Browse Source

Generate action for Game on mouse clicks

Thomas Buck 11 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
         } else if (strcmp(tmp, "down") == 0) {
425
         } else if (strcmp(tmp, "down") == 0) {
426
             keyBindings[action] = down;
426
             keyBindings[action] = down;
427
         } else if (strcmp(tmp, "left") == 0) {
427
         } else if (strcmp(tmp, "left") == 0) {
428
-            keyBindings[action] = KeyboardButton::left;
428
+            keyBindings[action] = left;
429
         } else if (strcmp(tmp, "right") == 0) {
429
         } else if (strcmp(tmp, "right") == 0) {
430
-            keyBindings[action] = KeyboardButton::right;
430
+            keyBindings[action] = right;
431
         } else if (strcmp(tmp, "end") == 0) {
431
         } else if (strcmp(tmp, "end") == 0) {
432
             keyBindings[action] = end;
432
             keyBindings[action] = end;
433
         } else if (strcmp(tmp, "equals") == 0) {
433
         } else if (strcmp(tmp, "equals") == 0) {
679
 void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
679
 void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
680
     if (mMenu->isVisible()) {
680
     if (mMenu->isVisible()) {
681
         mMenu->handleMouseClick(x, y, button, released);
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