mouse speed
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 15 Nov 2016 05:20:04 +0000 (07:20 +0200)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 15 Nov 2016 05:20:04 +0000 (07:20 +0200)
src/app.cc
src/main.cc

index 096bf4e..9245f06 100644 (file)
@@ -32,6 +32,7 @@ static float floor_y; // last floor height
 static float user_eye_height = 165;
 
 static float walk_speed = 300.0f;
+static float mouse_speed = 1.0f;
 static bool show_walk_mesh, noclip = false;
 
 static bool have_headtracking, should_swap;
@@ -375,6 +376,16 @@ void app_keyboard(int key, bool pressed)
                        walk_speed *= 0.75;
                        show_message("walk speed: %g", walk_speed);
                        break;
+
+               case ']':
+                       mouse_speed *= 1.2;
+                       show_message("mouse speed: %g", mouse_speed);
+                       break;
+
+               case '[':
+                       mouse_speed *= 0.8;
+                       show_message("mouse speed: %g", mouse_speed);
+                       break;
                }
        }
 
@@ -426,8 +437,8 @@ void app_mouse_motion(int x, int y)
 void app_mouse_delta(int dx, int dy)
 {
        if(bnstate[2]) {
-               mouse_zoom(dx, dy);
+               mouse_zoom(dx * mouse_speed, dy * mouse_speed);
        } else {
-               mouse_look(dx, dy);
+               mouse_look(dx * mouse_speed, dy * mouse_speed);
        }
 }
index fb8a2e2..4efca60 100644 (file)
@@ -172,7 +172,7 @@ static void process_event(SDL_Event *ev)
        case SDL_MOUSEMOTION:
                if(mouse_grabbed) {
                        // XXX xrel/yrel seems faster by default
-                       app_mouse_delta(ev->motion.xrel * 0.5, ev->motion.yrel * 0.5);
+                       app_mouse_delta(ev->motion.xrel * 0.75, ev->motion.yrel * 0.75);
                } else {
                        app_mouse_motion(ev->motion.x * scale_factor, ev->motion.y * scale_factor);
                }