projects
/
dosdemo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4688bc5
)
changed gimbal motion from middle mouse button to modkeys + left
author
John Tsiombikas
<nuclear@member.fsf.org>
Thu, 26 Dec 2019 11:25:01 +0000
(13:25 +0200)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Thu, 26 Dec 2019 11:25:01 +0000
(13:25 +0200)
tools/ropesim/src/main.c
patch
|
blob
|
history
diff --git
a/tools/ropesim/src/main.c
b/tools/ropesim/src/main.c
index
e6221bc
..
90bccdf
100644
(file)
--- a/
tools/ropesim/src/main.c
+++ b/
tools/ropesim/src/main.c
@@
-19,6
+19,7
@@
void sball_button(int bn, int st);
float cam_theta, cam_phi, cam_dist = 10;
int prev_mx, prev_my;
int bnstate[8];
float cam_theta, cam_phi, cam_dist = 10;
int prev_mx, prev_my;
int bnstate[8];
+int modkeys;
long start_msec;
long start_msec;
@@
-222,6
+223,7
@@
void mouse(int bn, int st, int x, int y)
prev_mx = x;
prev_my = y;
bnstate[bn - GLUT_LEFT_BUTTON] = st == GLUT_DOWN;
prev_mx = x;
prev_my = y;
bnstate[bn - GLUT_LEFT_BUTTON] = st == GLUT_DOWN;
+ modkeys = glutGetModifiers();
}
void motion(int x, int y)
}
void motion(int x, int y)
@@
-233,21
+235,23
@@
void motion(int x, int y)
if(!(dx | dy)) return;
if(!(dx | dy)) return;
- if(bnstate[0]) {
- cam_theta += dx * 0.5;
- cam_phi += dy * 0.5;
- if(cam_phi < -90) cam_phi = -90;
- if(cam_phi > 90) cam_phi = 90;
- }
-
- if(bnstate[1]) {
- grot_theta += dx * 0.5;
- grot_phi += dy * 0.5;
- }
+ if(modkeys) {
+ if(bnstate[0]) {
+ grot_theta += dx * 0.5;
+ grot_phi += dy * 0.5;
+ }
+ } else {
+ if(bnstate[0]) {
+ cam_theta += dx * 0.5;
+ cam_phi += dy * 0.5;
+ if(cam_phi < -90) cam_phi = -90;
+ if(cam_phi > 90) cam_phi = 90;
+ }
- if(bnstate[2]) {
- cam_dist += dy * 0.1;
- if(cam_dist < 0.0f) cam_dist = 0.0f;
+ if(bnstate[2]) {
+ cam_dist += dy * 0.1;
+ if(cam_dist < 0.0f) cam_dist = 0.0f;
+ }
}
}
}
}