Просмотр исходного кода

input: rename "action_x" button handles to "face_x"

rdb 7 лет назад
Родитель
Сommit
8d8c5a546d

+ 12 - 12
panda/src/device/evdevInputDevice.cxx

@@ -906,10 +906,10 @@ map_button(int code, DeviceClass device_class) {
     if (device_class == DC_gamepad) {
       // Based on "Jess Tech Colour Rumble Pad"
       static const ButtonHandle mapping[] = {
-        GamepadButton::action_x(),
-        GamepadButton::action_y(),
-        GamepadButton::action_a(),
-        GamepadButton::action_b(),
+        GamepadButton::face_x(),
+        GamepadButton::face_y(),
+        GamepadButton::face_a(),
+        GamepadButton::face_b(),
         GamepadButton::lshoulder(),
         GamepadButton::ltrigger(),
         GamepadButton::rshoulder(),
@@ -929,22 +929,22 @@ map_button(int code, DeviceClass device_class) {
 
   switch (code) {
   case BTN_A:
-    return GamepadButton::action_a();
+    return GamepadButton::face_a();
 
   case BTN_B:
-    return GamepadButton::action_b();
+    return GamepadButton::face_b();
 
   case BTN_C:
-    return GamepadButton::action_c();
+    return GamepadButton::face_c();
 
   case BTN_X:
-    return GamepadButton::action_x();
+    return GamepadButton::face_x();
 
   case BTN_Y:
-    return GamepadButton::action_y();
+    return GamepadButton::face_y();
 
   case BTN_Z:
-    return GamepadButton::action_z();
+    return GamepadButton::face_z();
 
   case BTN_TL:
     return GamepadButton::lshoulder();
@@ -959,10 +959,10 @@ map_button(int code, DeviceClass device_class) {
     return GamepadButton::rtrigger();
 
   case BTN_1:
-    return GamepadButton::action_1();
+    return GamepadButton::face_1();
 
   case BTN_2:
-    return GamepadButton::action_2();
+    return GamepadButton::face_2();
 
   case BTN_SELECT:
   case KEY_PREVIOUS:

+ 8 - 8
panda/src/device/ioKitInputDevice.cxx

@@ -632,10 +632,10 @@ parse_element(IOHIDElementRef element) {
           // SNES-style USB gamepad
           static const ButtonHandle gamepad_buttons[] = {
             ButtonHandle::none(),
-            GamepadButton::action_x(),
-            GamepadButton::action_a(),
-            GamepadButton::action_b(),
-            GamepadButton::action_y(),
+            GamepadButton::face_x(),
+            GamepadButton::face_a(),
+            GamepadButton::face_b(),
+            GamepadButton::face_y(),
             GamepadButton::lshoulder(),
             GamepadButton::rshoulder(),
             ButtonHandle::none(),
@@ -651,10 +651,10 @@ parse_element(IOHIDElementRef element) {
           // driver.  I don't know if other drivers do the same thing at all.
           static const ButtonHandle gamepad_buttons[] = {
             ButtonHandle::none(),
-            GamepadButton::action_a(),
-            GamepadButton::action_b(),
-            GamepadButton::action_x(),
-            GamepadButton::action_y(),
+            GamepadButton::face_a(),
+            GamepadButton::face_b(),
+            GamepadButton::face_x(),
+            GamepadButton::face_y(),
             GamepadButton::lshoulder(),
             GamepadButton::rshoulder(),
             GamepadButton::lstick(),

+ 1 - 1
panda/src/device/linuxJoystickDevice.cxx

@@ -134,7 +134,7 @@ open_device() {
           device_cat.debug() << "Unmapped /dev/input/js" << _index
             << " button " << (int)i << ": 0x" << std::hex << btnmap[i] << "\n";
         }
-      } else if (handle == GamepadButton::action_a()) {
+      } else if (handle == GamepadButton::face_a()) {
         _device_class = DC_gamepad;
       } else if (handle == GamepadButton::trigger()) {
         _device_class = DC_flight_stick;

+ 8 - 8
panda/src/device/winRawInputDevice.cxx

@@ -332,10 +332,10 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
   // Do we have a button mapping?
   static const ButtonHandle gamepad_buttons_common[] = {
     ButtonHandle::none(),
-    GamepadButton::action_a(),
-    GamepadButton::action_b(),
-    GamepadButton::action_x(),
-    GamepadButton::action_y(),
+    GamepadButton::face_a(),
+    GamepadButton::face_b(),
+    GamepadButton::face_x(),
+    GamepadButton::face_y(),
     GamepadButton::lshoulder(),
     GamepadButton::rshoulder(),
     GamepadButton::start(),
@@ -348,10 +348,10 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
     // SNES-style USB gamepad
     static const ButtonHandle gamepad_buttons_snes[] = {
       ButtonHandle::none(),
-      GamepadButton::action_x(),
-      GamepadButton::action_a(),
-      GamepadButton::action_b(),
-      GamepadButton::action_y(),
+      GamepadButton::face_x(),
+      GamepadButton::face_a(),
+      GamepadButton::face_b(),
+      GamepadButton::face_y(),
       GamepadButton::lshoulder(),
       GamepadButton::rshoulder(),
       ButtonHandle::none(),

+ 4 - 5
panda/src/device/xInputDevice.cxx

@@ -386,11 +386,10 @@ init_device(const XINPUT_CAPABILITIES_EX &caps, const XINPUT_STATE &state) {
   set_button_map(8, GamepadButton::lshoulder());
   set_button_map(9, GamepadButton::rshoulder());
   set_button_map(10, GamepadButton::guide());
-  set_button_map(11, GamepadButton::action_a());
-  set_button_map(12, GamepadButton::action_b());
-  set_button_map(13, GamepadButton::action_x());
-  set_button_map(14, GamepadButton::action_y());
-
+  set_button_map(11, GamepadButton::face_a());
+  set_button_map(12, GamepadButton::face_b());
+  set_button_map(13, GamepadButton::face_x());
+  set_button_map(14, GamepadButton::face_y());
 
   if (caps.Vibration.wLeftMotorSpeed != 0 ||
       caps.Vibration.wRightMotorSpeed != 0) {

+ 16 - 16
panda/src/putil/gamepadButton.cxx

@@ -37,15 +37,15 @@ DEFINE_GAMEPAD_BUTTON_HANDLE(start)
 DEFINE_GAMEPAD_BUTTON_HANDLE(next)
 DEFINE_GAMEPAD_BUTTON_HANDLE(previous)
 
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_a)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_b)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_c)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_x)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_y)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_z)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_a)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_b)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_c)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_x)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_y)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_z)
 
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_1)
-DEFINE_GAMEPAD_BUTTON_HANDLE(action_2)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_1)
+DEFINE_GAMEPAD_BUTTON_HANDLE(face_2)
 
 DEFINE_GAMEPAD_BUTTON_HANDLE(trigger)
 DEFINE_GAMEPAD_BUTTON_HANDLE(hat_up)
@@ -100,15 +100,15 @@ init_gamepad_buttons() {
   ButtonRegistry::ptr()->register_button(_next, "next");
   ButtonRegistry::ptr()->register_button(_previous, "previous");
 
-  ButtonRegistry::ptr()->register_button(_action_a, "action_a");
-  ButtonRegistry::ptr()->register_button(_action_b, "action_b");
-  ButtonRegistry::ptr()->register_button(_action_c, "action_c");
-  ButtonRegistry::ptr()->register_button(_action_x, "action_x");
-  ButtonRegistry::ptr()->register_button(_action_y, "action_y");
-  ButtonRegistry::ptr()->register_button(_action_z, "action_z");
+  ButtonRegistry::ptr()->register_button(_face_a, "face_a");
+  ButtonRegistry::ptr()->register_button(_face_b, "face_b");
+  ButtonRegistry::ptr()->register_button(_face_c, "face_c");
+  ButtonRegistry::ptr()->register_button(_face_x, "face_x");
+  ButtonRegistry::ptr()->register_button(_face_y, "face_y");
+  ButtonRegistry::ptr()->register_button(_face_z, "face_z");
 
-  ButtonRegistry::ptr()->register_button(_action_1, "action_1");
-  ButtonRegistry::ptr()->register_button(_action_2, "action_2");
+  ButtonRegistry::ptr()->register_button(_face_1, "face_1");
+  ButtonRegistry::ptr()->register_button(_face_2, "face_2");
 
   ButtonRegistry::ptr()->register_button(_trigger, "trigger");
   ButtonRegistry::ptr()->register_button(_hat_up, "hat_up");

+ 8 - 8
panda/src/putil/gamepadButton.h

@@ -43,15 +43,15 @@ PUBLISHED:
   static ButtonHandle next();
   static ButtonHandle previous();
 
-  static ButtonHandle action_a();
-  static ButtonHandle action_b();
-  static ButtonHandle action_c();
-  static ButtonHandle action_x();
-  static ButtonHandle action_y();
-  static ButtonHandle action_z();
+  static ButtonHandle face_a();
+  static ButtonHandle face_b();
+  static ButtonHandle face_c();
+  static ButtonHandle face_x();
+  static ButtonHandle face_y();
+  static ButtonHandle face_z();
 
-  static ButtonHandle action_1();
-  static ButtonHandle action_2();
+  static ButtonHandle face_1();
+  static ButtonHandle face_2();
 
   // Flight stick buttons, takes zero-based index.  First is always trigger.
   static ButtonHandle trigger();