Browse Source

Generate action for Game on mouse clicks

Thomas Buck 10 years ago
parent
commit
8434b52203
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      src/OpenRaider.cpp

+ 9
- 2
src/OpenRaider.cpp View File

@@ -425,9 +425,9 @@ int OpenRaider::bind(ActionEvents action, const char *key) {
425 425
         } else if (strcmp(tmp, "down") == 0) {
426 426
             keyBindings[action] = down;
427 427
         } else if (strcmp(tmp, "left") == 0) {
428
-            keyBindings[action] = KeyboardButton::left;
428
+            keyBindings[action] = left;
429 429
         } else if (strcmp(tmp, "right") == 0) {
430
-            keyBindings[action] = KeyboardButton::right;
430
+            keyBindings[action] = right;
431 431
         } else if (strcmp(tmp, "end") == 0) {
432 432
             keyBindings[action] = end;
433 433
         } else if (strcmp(tmp, "equals") == 0) {
@@ -679,6 +679,13 @@ void OpenRaider::handleText(char *text, bool notFinished) {
679 679
 void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
680 680
     if (mMenu->isVisible()) {
681 681
         mMenu->handleMouseClick(x, y, button, released);
682
+    } else if (!mConsole->isVisible()) {
683
+        for (int i = forwardAction; i < ActionEventCount; i++) {
684
+            if (keyBindings[i] == button) {
685
+                if (mGame)
686
+                    mGame->handleAction((ActionEvents)i, !released);
687
+            }
688
+        }
682 689
     }
683 690
 }
684 691
 

Loading…
Cancel
Save