diff options
author | Stijn Buys <ingar@osirion.org> | 2012-12-23 17:21:50 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-12-23 17:21:50 +0000 |
commit | 354848ce7ae4bb5d0a6a808eb409bdad83abc209 (patch) | |
tree | 363f1b66c912d93dd22a4cb20abc66bf519f62e5 /src/client | |
parent | d2e9d7532f58f07c0ede3fad2dbf39a92130670c (diff) |
Mouse control sensitivity is now independent of resolution.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/input.cc | 8 |
1 files changed, 6 insertions, 2 deletions
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)) { |