From 04050c1685855a0640c7c0d5147299fadbd2ebe8 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Jul 2008 17:16:55 +0000 Subject: select-on-release --- src/client/input.cc | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src/client/input.cc') diff --git a/src/client/input.cc b/src/client/input.cc index 2f09d5b..751b3ca 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -63,6 +63,14 @@ bool mouse_control = false; const float thruster_offset = 0.05f; +int mouse_position_x() { + return mouse_x; +} + +int mouse_position_y() { + return mouse_y; +} + //--- engine functions -------------------------------------------- void func_screenshot(std::string const & args) @@ -456,12 +464,6 @@ void key_pressed(Key *key) } else if (core::application()->connected() && core::localcontrol()) { - if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover()) { - // hovering target selected - targets::select_target(targets::hover()); - - } else { - char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0]; if (c == '+') { // action bind @@ -471,7 +473,6 @@ void key_pressed(Key *key) // normal bind core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n"; } - } } else if (core::application()->connected()) { @@ -487,17 +488,37 @@ void key_pressed(Key *key) void key_released(Key *key) { if (core::application()->connected() && core::localcontrol() && !console()->visible() && !chat::visible()) { + if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover()) { - // FIXME modifiers - char c = key->bind(Key::None).c_str()[0]; + // hovering target selected + targets::select_target(targets::hover()); + } + + // the release event still must be processed as usual + char c = 0; + c = key->bind(Key::None).c_str()[0]; if (c == '+') { // action bind action_release(key->bind(Key::None)); } + c = key->bind(Key::Shift).c_str()[0]; + if (c == '+') { + // action bind + action_release(key->bind(Key::Shift)); + } + c = key->bind(Key::Ctrl).c_str()[0]; + if (c == '+') { + // action bind + action_release(key->bind(Key::Ctrl)); + } + c = key->bind(Key::Alt).c_str()[0]; + if (c == '+') { + // action bind + action_release(key->bind(Key::Alt)); + } } } - void reset() { local_direction = 0.0f; -- cgit v1.2.3