Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index a72999e..1e018f5 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -486,8 +486,19 @@ void key_pressed(Key *key)
render::Camera::set_pitch(0.0f);
client()->console()->toggle();
+ return;
+ }
+
+ if (ui::root()->active()) {
+ local_direction = 0.0f;
+ local_pitch = 0.0f;
+ local_roll = 0.0f;
- } else if (ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers)) {
+ render::Camera::set_direction(0.0f);
+ render::Camera::set_pitch(0.0f);
+ }
+
+ if (ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers)) {
return;
} else if (core::application()->connected() && core::localcontrol()) {
@@ -609,8 +620,8 @@ void reset()
}
mouse_pitch = 0.0f;
mouse_direction = 0.0f;
- mouse_x = video::width / 2;
- mouse_y = video::height / 2;
+ mouse_x = render::Camera::width() / 2;
+ mouse_y = render::Camera::height() / 2;
render::Camera::reset();
render::Dust::reset();
mouse_control_override = false;
@@ -631,7 +642,7 @@ void reset()
joystick_lastmoved = 0;
}
-void frame(float seconds)
+void frame()
{
/* -- detect localcontrol() changes --------------- */
if (core::localcontrol() && (last_control != core::localcontrol()->id())) {
@@ -662,6 +673,9 @@ void frame(float seconds)
key = 0;
switch (event.type) {
+ case SDL_VIDEORESIZE:
+ video::resize((float) event.resize.w, (float) event.resize.h);
+ break;
case SDL_MOUSEMOTION:
mouse_x = event.motion.x;
@@ -774,26 +788,26 @@ void frame(float seconds)
mouse_deadzone = true;
// direction
- int l = mouse_x - (video::width >> 1);
+ int l = mouse_x - (render::Camera::width() >> 1);
if (abs(l) < ( deadzone_size >> 1 )) {
// dead zone
mouse_direction = 0;
} else {
- l = (mouse_x - deadzone_size) - ((video::width - deadzone_size) >> 1);
- mouse_direction = float (-l) / (float) ((video::width - deadzone_size) >> 1);
+ l = (mouse_x - deadzone_size) - ((render::Camera::width() - deadzone_size) >> 1);
+ mouse_direction = float (-l) / (float) ((render::Camera::width() - deadzone_size) >> 1);
mouse_deadzone = false;
}
// pitch
- int h = mouse_y - (video::height >> 1);
+ int h = mouse_y - (render::Camera::height() >> 1);
if (abs(h) < ( deadzone_size >> 1 )) {
// dead zone
mouse_pitch = 0;
} else {
- h = (mouse_y - deadzone_size) - ((video::height - deadzone_size) >> 1);
- mouse_pitch = float (-h) / (float) ((video::height - deadzone_size) >> 1);
+ h = (mouse_y - deadzone_size) - ((render::Camera::height() - deadzone_size) >> 1);
+ mouse_pitch = float (-h) / (float) ((render::Camera::height() - deadzone_size) >> 1);
mouse_deadzone = false;
}