From: John Tsiombikas Date: Thu, 26 Dec 2019 11:25:01 +0000 (+0200) Subject: changed gimbal motion from middle mouse button to modkeys + left X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=91571f90a9120404bc40a868a66d91ce4ce29580;ds=sidebyside changed gimbal motion from middle mouse button to modkeys + left --- diff --git a/tools/ropesim/src/main.c b/tools/ropesim/src/main.c index e6221bc..90bccdf 100644 --- 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]; +int modkeys; 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; + modkeys = glutGetModifiers(); } void motion(int x, int y) @@ -233,21 +235,23 @@ void motion(int x, int y) 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; + } } }