Add support for 4th and 5th mouse button
authorWuzzy <Wuzzy2@mail.ru>
Sat, 27 Apr 2019 15:13:33 +0200
changeset 14845 6c51f74d80a8
parent 14844 9e8c201eae9d
child 14846 75b515a64202
Add support for 4th and 5th mouse button
ChangeLog.txt
QTfrontend/sdlkeys.cpp
hedgewars/uInputHandler.pas
--- a/ChangeLog.txt	Sat Apr 27 13:51:02 2019 +0200
+++ b/ChangeLog.txt	Sat Apr 27 15:13:33 2019 +0200
@@ -49,6 +49,7 @@
 
 Controls:
  + Add control to unselect current weapon (no key chosen by default)
+ + Add support for 4th and 5th mouse buttons
  + Allow to leave a control unused
  + Reset zoom resets zoom to zoom level set in options
  + Add control to display mines time and health crate health (default: O)
--- a/QTfrontend/sdlkeys.cpp	Sat Apr 27 13:51:02 2019 +0200
+++ b/QTfrontend/sdlkeys.cpp	Sat Apr 27 15:13:33 2019 +0200
@@ -25,6 +25,8 @@
     {"mousel", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Left button")},
     {"mousem", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Middle button")},
     {"mouser", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Right button")},
+    {"mousex1", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X1 button ")},
+    {"mousex2", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X2 button")},
     {"wheelup", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel up")},
     {"wheeldown", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel down")},
     {"backspace", QT_TRANSLATE_NOOP("binds (keys)", "Backspace")},
--- a/hedgewars/uInputHandler.pas	Sat Apr 27 13:51:02 2019 +0200
+++ b/hedgewars/uInputHandler.pas	Sat Apr 27 15:13:33 2019 +0200
@@ -289,6 +289,10 @@
             ProcessKey(KeyNameToCode('mousem'), ButtonDown);
         SDL_BUTTON_RIGHT:
             ProcessKey(KeyNameToCode('mouser'), ButtonDown);
+        SDL_BUTTON_X1:
+            ProcessKey(KeyNameToCode('mousex1'), ButtonDown);
+        SDL_BUTTON_X2:
+            ProcessKey(KeyNameToCode('mousex2'), ButtonDown);
         end;
 end;
 
@@ -452,9 +456,11 @@
     KeyNames[cKeyMaxIndex    ]:= 'mousel';
     KeyNames[cKeyMaxIndex - 1]:= 'mousem';
     KeyNames[cKeyMaxIndex - 2]:= 'mouser';
-    mwheelupCode:= cKeyMaxIndex - 3;
+    KeyNames[cKeyMaxIndex - 3]:= 'mousex1';
+    KeyNames[cKeyMaxIndex - 4]:= 'mousex2';
+    mwheelupCode:= cKeyMaxIndex - 5;
     KeyNames[mwheelupCode]:= 'wheelup';
-    mwheeldownCode:= cKeyMaxIndex - 4;
+    mwheeldownCode:= cKeyMaxIndex - 6;
     KeyNames[mwheeldownCode]:= 'wheeldown';
 
     // Keyboard keys