From: John Tsiombikas Date: Tue, 15 Nov 2016 05:20:04 +0000 (+0200) Subject: mouse speed X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;ds=sidebyside;h=31e1ffedb543e048673b7ba969607fbb8214ac9a;hp=3aacec4aee795e703e8eb9d6852ca47a3be065ee;p=laserbrain_demo mouse speed --- diff --git a/src/app.cc b/src/app.cc index 096bf4e..9245f06 100644 --- a/src/app.cc +++ b/src/app.cc @@ -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); } } diff --git a/src/main.cc b/src/main.cc index fb8a2e2..4efca60 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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); }