From 354848ce7ae4bb5d0a6a808eb409bdad83abc209 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 23 Dec 2012 17:21:50 +0000 Subject: Mouse control sensitivity is now independent of resolution. --- src/client/input.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client/input.cc') diff --git a/src/client/input.cc b/src/client/input.cc index 5c5a71d..fcf33f8 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -875,13 +875,17 @@ void frame() } if (mouse_control) { + const float aim_square_size = 256.0f; + // direction int l = mouse_x - (render::State::width() / 2); - mouse_direction = float(-l) / (float)(render::State::width() / 2); + mouse_direction = float(-l) / math::min( 0.5f *(float)(render::State::width()), aim_square_size); + math::clamp(mouse_direction, -1.0f, 1.0f); // pitch int h = mouse_y - (render::State::height() / 2); - mouse_pitch = float(-h) / (float)(render::State::height() / 2); + mouse_pitch = float(-h) / math::min (0.5f * (float)(render::State::height()), aim_square_size); + math::clamp(mouse_pitch, -1.0f, 1.0f); if ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit)) { -- cgit v1.2.3