projects
/
libopano.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4640589
)
Implemented keyboard controls and basic mouse handling.
author
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sat, 18 Aug 2007 01:36:57 +0000
(
03:36
+0200)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Sat, 18 Aug 2007 01:36:57 +0000
(
03:36
+0200)
src/viewer.c
patch
|
blob
|
history
diff --git
a/src/viewer.c
b/src/viewer.c
index
d7445e2
..
8773a00
100644
(file)
--- a/
src/viewer.c
+++ b/
src/viewer.c
@@
-190,7
+190,6
@@
int main( int argc, char** argv )
static Atom proto_atom= None, delete_atom= None;
long event_mask;
static Atom proto_atom= None, delete_atom= None;
long event_mask;
- unsigned int button_state = 0;
double fov = 70.0;
double yaw = 0.0;
double fov = 70.0;
double yaw = 0.0;
@@
-304,7
+303,10
@@
int main( int argc, char** argv )
XConfigureEvent *cev = (XConfigureEvent *) &event;
printf ("XConfigureEvent received: width = %i; height = %i;\n",
cev->width, cev->height);
XConfigureEvent *cev = (XConfigureEvent *) &event;
printf ("XConfigureEvent received: width = %i; height = %i;\n",
cev->width, cev->height);
- /* TODO, FIXME: re-create `view' and `ximage' with cev->width, cev->height */
+
+ ui_destroy (view);
+ view = ui_create (cev->width, cev->height);
+ isChanged = 1;
}
break;
}
break;
@@
-326,6
+328,34
@@
int main( int argc, char** argv )
zoom_out (&fov);
isChanged = 1;
break;
zoom_out (&fov);
isChanged = 1;
break;
+
+ case XK_Up:
+ pitch += 5.0;
+ if (pitch > 90.0)
+ pitch = 90.0;
+ isChanged = 1;
+ break;
+
+ case XK_Down:
+ pitch -= 5.0;
+ if (pitch < -90.0)
+ pitch = -90.0;
+ isChanged = 1;
+ break;
+
+ case XK_Right:
+ yaw += 5.0;
+ if (yaw > 180.0)
+ yaw -= 360.0;
+ isChanged = 1;
+ break;
+
+ case XK_Left:
+ yaw -= 5.0;
+ if (yaw <= -180.0)
+ yaw += 360.0;
+ isChanged = 1;
+ break;
}
}
break;
}
}
break;
@@
-338,7
+368,8
@@
int main( int argc, char** argv )
case ButtonRelease:
{
XButtonEvent *bev = (XButtonEvent *) &event;
case ButtonRelease:
{
XButtonEvent *bev = (XButtonEvent *) &event;
- button_state = bev->state;
+ pos_x_old = pos_x_new = bev->x;
+ pos_y_old = pos_y_new = bev->y;
}
break;
}
break;
@@
-348,10
+379,18
@@
int main( int argc, char** argv )
pos_x_old = pos_x_new;
pos_y_old = pos_y_new;
pos_x_old = pos_x_new;
pos_y_old = pos_y_new;
- pos_x_new = mev->x;
- pos_y_new = mev->y;
- if (button_state & Button1Mask)
+ do
+ {
+ pos_x_new = mev->x;
+ pos_y_new = mev->y;
+ }
+ while (XCheckTypedEvent (disp_g, MotionNotify, &event));
+
+ printf ("XMotionEvent received: [%u,%u] -> [%u,%u]\n",
+ pos_x_old, pos_y_old, pos_x_new, pos_y_new);
+
+ if (mev->state & Button1Mask)
{
double yaw_diff = (pos_x_new - pos_x_old) / 24.0;
if (yaw_diff > 90.0)
{
double yaw_diff = (pos_x_new - pos_x_old) / 24.0;
if (yaw_diff > 90.0)