Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-03-08 20:20:32 +0000
committerStijn Buys <ingar@osirion.org>2011-03-08 20:20:32 +0000
commit49fb18f0d5ec9643794e0cbe156c27a9883e5dd7 (patch)
treef74427fbc2462c3ef2fef982991128d4b46d2923 /src/client/input.cc
parente897f60d10c3725638e90d0cde4a033a71215409 (diff)
Removed mouse control deadzone in the center of the screen.
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index b6199c6..50ef4da 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -71,8 +71,6 @@ float mouse_direction = 0;
float mouse_control_override_time = 0;
bool mouse_control_override = false;
bool mouse_control = false;
-// true if the mouse is in the deadzone
-bool mouse_deadzone = false;
// time the mouse was last moved
float mouse_lastmoved = 0;
@@ -850,7 +848,6 @@ void frame()
/* -- process mouse movement ----------------------*/
mouse_control = false;
- mouse_deadzone = false;
if (core::application()->connected() && core::localcontrol()) {
mouse_control = ui::console()->hidden() && !ui::root()->active() && ((input_mousecontrol->value() > 0) || (mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time())));
@@ -862,33 +859,13 @@ void frame()
}
if (mouse_control) {
- // the mouse will not react if it is in the deadzone
- int deadzone_size = 8;
- mouse_deadzone = true;
-
// direction
- int l = mouse_x - (render::State::width() >> 1);
-
- if (abs(l) < (deadzone_size >> 1)) {
- // dead zone
- mouse_direction = 0;
- } else {
- l = (mouse_x - deadzone_size) - ((render::State::width() - deadzone_size) >> 1);
- mouse_direction = float(-l) / (float)((render::State::width() - deadzone_size) >> 1);
- mouse_deadzone = false;
- }
+ int l = mouse_x - (render::State::width() / 2);
+ mouse_direction = float(-l) / (float)(render::State::width() / 2);
// pitch
- int h = mouse_y - (render::State::height() >> 1);
-
- if (abs(h) < (deadzone_size >> 1)) {
- // dead zone
- mouse_pitch = 0;
- } else {
- h = (mouse_y - deadzone_size) - ((render::State::height() - deadzone_size) >> 1);
- mouse_pitch = float(-h) / (float)((render::State::height() - deadzone_size) >> 1);
- mouse_deadzone = false;
- }
+ int h = mouse_y - (render::State::height() / 2);
+ mouse_pitch = float(-h) / (float)(render::State::height() / 2);
if ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit)) {