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>2008-07-30 17:16:55 +0000
committerStijn Buys <ingar@osirion.org>2008-07-30 17:16:55 +0000
commit04050c1685855a0640c7c0d5147299fadbd2ebe8 (patch)
treeb0789947f5cc363950472c5f5a8b55048ca72d18 /src/client/input.cc
parentd09a1be33a647aedc12ce5ddcb7ea4ee23a75c8c (diff)
select-on-release
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc41
1 files changed, 31 insertions, 10 deletions
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;