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
parente897f60d10c3725638e90d0cde4a033a71215409 (diff)
Removed mouse control deadzone in the center of the screen.
-rw-r--r--src/client/input.cc31
-rw-r--r--src/client/input.h1
-rw-r--r--src/client/video.cc4
3 files changed, 4 insertions, 32 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)) {
diff --git a/src/client/input.h b/src/client/input.h
index 2565189..ad837a9 100644
--- a/src/client/input.h
+++ b/src/client/input.h
@@ -52,7 +52,6 @@ float joystick_lastmoved_time();
/// current modifier
Key::Modifier modifier();
-extern bool mouse_deadzone;
extern bool mouse_control;
extern bool joystick_control;
diff --git a/src/client/video.cc b/src/client/video.cc
index 2949ae7..a610b86 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -319,10 +319,6 @@ void set_cursor()
ui::root()->set_pointer("control", ui::Palette::Pointer);
- if (input::mouse_deadzone) {
- ui::root()->input_mouse(render::State::width() / 2, render::State::height() / 2);
- }
-
} else if ((input::joystick_lastmoved_time() > input::mouse_lastmoved_time()) &&
(render::Camera::mode() == render::Camera::Cockpit || render::Camera::mode() == render::Camera::Track)) {