|
Removed
Link Here
|
| 1 |
From 61833c9c26da5520f2eaa02f2458971ba07f2aad Mon Sep 17 00:00:00 2001 |
| 2 |
From: Benau <Benau@users.noreply.github.com> |
| 3 |
Date: Sun, 29 Nov 2020 12:42:11 +0800 |
| 4 |
Subject: [PATCH] Fix compilation with latest SDL |
| 5 |
|
| 6 |
--- |
| 7 |
src/input/gamepad_config.cpp | 55 ++++++++++++++++++------------------ |
| 8 |
1 file changed, 27 insertions(+), 28 deletions(-) |
| 9 |
|
| 10 |
diff --git a/src/input/gamepad_config.cpp b/src/input/gamepad_config.cpp |
| 11 |
index 7c6f632099..c060e7a5a7 100644 |
| 12 |
--- src/input/gamepad_config.cpp |
| 13 |
+++ src/input/gamepad_config.cpp |
| 14 |
@@ -32,8 +32,7 @@ |
| 15 |
#include "input/sdl_controller.hpp" |
| 16 |
#include <array> |
| 17 |
|
| 18 |
-static_assert(SDL_CONTROLLER_BUTTON_MAX - 1 == SDL_CONTROLLER_BUTTON_DPAD_RIGHT, "non continous name"); |
| 19 |
-enum AxisWithDirection |
| 20 |
+enum AxisWithDirection : unsigned |
| 21 |
{ |
| 22 |
SDL_CONTROLLER_AXIS_LEFTX_RIGHT = SDL_CONTROLLER_BUTTON_MAX, |
| 23 |
SDL_CONTROLLER_AXIS_LEFTX_LEFT, |
| 24 |
@@ -140,56 +139,56 @@ void GamepadConfig::setDefaultBinds () |
| 25 |
core::stringw GamepadConfig::getBindingAsString(const PlayerAction action) const |
| 26 |
{ |
| 27 |
#ifndef SERVER_ONLY |
| 28 |
- std::array<core::stringw, SDL_CONTROLLER_AXIS_WITH_DIRECTION_AND_BUTTON_MAX> readable = |
| 29 |
+ std::map<unsigned, core::stringw> readable = |
| 30 |
{{ |
| 31 |
- "A", // SDL_CONTROLLER_BUTTON_A |
| 32 |
- "B", // SDL_CONTROLLER_BUTTON_B |
| 33 |
- "X", // SDL_CONTROLLER_BUTTON_X |
| 34 |
- "Y", // SDL_CONTROLLER_BUTTON_Y |
| 35 |
+ { SDL_CONTROLLER_BUTTON_A, "A" }, |
| 36 |
+ { SDL_CONTROLLER_BUTTON_B, "B" }, |
| 37 |
+ { SDL_CONTROLLER_BUTTON_X, "X" }, |
| 38 |
+ { SDL_CONTROLLER_BUTTON_Y, "Y" }, |
| 39 |
// I18N: name of buttons on gamepads |
| 40 |
- _("Back"), // SDL_CONTROLLER_BUTTON_BACK |
| 41 |
+ { SDL_CONTROLLER_BUTTON_BACK, _("Back") }, |
| 42 |
// I18N: name of buttons on gamepads |
| 43 |
- _("Guide"), // SDL_CONTROLLER_BUTTON_GUIDE |
| 44 |
+ { SDL_CONTROLLER_BUTTON_GUIDE, _("Guide") }, |
| 45 |
// I18N: name of buttons on gamepads |
| 46 |
- _("Start"), // SDL_CONTROLLER_BUTTON_START |
| 47 |
+ { SDL_CONTROLLER_BUTTON_START, _("Start") }, |
| 48 |
// I18N: name of buttons on gamepads |
| 49 |
- _("Left thumbstick press"), // SDL_CONTROLLER_BUTTON_LEFTSTICK |
| 50 |
+ { SDL_CONTROLLER_BUTTON_LEFTSTICK, _("Left thumbstick press") }, |
| 51 |
// I18N: name of buttons on gamepads |
| 52 |
- _("Right thumbstick press"), // SDL_CONTROLLER_BUTTON_RIGHTSTICK |
| 53 |
+ { SDL_CONTROLLER_BUTTON_RIGHTSTICK, _("Right thumbstick press") }, |
| 54 |
// I18N: name of buttons on gamepads |
| 55 |
- _("Left shoulder"), // SDL_CONTROLLER_BUTTON_LEFTSHOULDER |
| 56 |
+ { SDL_CONTROLLER_BUTTON_LEFTSHOULDER, _("Left shoulder") }, |
| 57 |
// I18N: name of buttons on gamepads |
| 58 |
- _("Right shoulder"), // SDL_CONTROLLER_BUTTON_RIGHTSHOULDER |
| 59 |
+ { SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, _("Right shoulder") }, |
| 60 |
// I18N: name of buttons on gamepads |
| 61 |
- _("DPad up"), // SDL_CONTROLLER_BUTTON_DPAD_UP |
| 62 |
+ { SDL_CONTROLLER_BUTTON_DPAD_UP, _("DPad up") }, |
| 63 |
// I18N: name of buttons on gamepads |
| 64 |
- _("DPad down"), // SDL_CONTROLLER_BUTTON_DPAD_DOWN |
| 65 |
+ { SDL_CONTROLLER_BUTTON_DPAD_DOWN, _("DPad down") }, |
| 66 |
// I18N: name of buttons on gamepads |
| 67 |
- _("DPad left"), // SDL_CONTROLLER_BUTTON_DPAD_LEFT |
| 68 |
+ { SDL_CONTROLLER_BUTTON_DPAD_LEFT, _("DPad left") }, |
| 69 |
// I18N: name of buttons on gamepads |
| 70 |
- _("DPad right"), // SDL_CONTROLLER_BUTTON_DPAD_RIGHT |
| 71 |
+ { SDL_CONTROLLER_BUTTON_DPAD_RIGHT, _("DPad right") }, |
| 72 |
|
| 73 |
// Below are extensions after SDL2 header SDL_CONTROLLER_BUTTON_MAX |
| 74 |
// I18N: name of buttons on gamepads |
| 75 |
- _("Left thumbstick right"), // SDL_CONTROLLER_AXIS_LEFTX_RIGHT |
| 76 |
+ { SDL_CONTROLLER_AXIS_LEFTX_RIGHT, _("Left thumbstick right") }, |
| 77 |
// I18N: name of buttons on gamepads |
| 78 |
- _("Left thumbstick left"), // SDL_CONTROLLER_AXIS_LEFTX_LEFT |
| 79 |
+ { SDL_CONTROLLER_AXIS_LEFTX_LEFT, _("Left thumbstick left") }, |
| 80 |
// I18N: name of buttons on gamepads |
| 81 |
- _("Left thumbstick down"), // SDL_CONTROLLER_AXIS_LEFTY_DOWN |
| 82 |
+ { SDL_CONTROLLER_AXIS_LEFTY_DOWN, _("Left thumbstick down") }, |
| 83 |
// I18N: name of buttons on gamepads |
| 84 |
- _("Left thumbstick up"), // SDL_CONTROLLER_AXIS_LEFTY_UP |
| 85 |
+ { SDL_CONTROLLER_AXIS_LEFTY_UP, _("Left thumbstick up") }, |
| 86 |
// I18N: name of buttons on gamepads |
| 87 |
- _("Right thumbstick right"), // SDL_CONTROLLER_AXIS_RIGHTX_RIGHT |
| 88 |
+ { SDL_CONTROLLER_AXIS_RIGHTX_RIGHT, _("Right thumbstick right") }, |
| 89 |
// I18N: name of buttons on gamepads |
| 90 |
- _("Right thumbstick left"), // SDL_CONTROLLER_AXIS_RIGHTX_LEFT |
| 91 |
+ { SDL_CONTROLLER_AXIS_RIGHTX_LEFT, _("Right thumbstick left") }, |
| 92 |
// I18N: name of buttons on gamepads |
| 93 |
- _("Right thumbstick down"), // SDL_CONTROLLER_AXIS_RIGHTY_DOWN |
| 94 |
+ { SDL_CONTROLLER_AXIS_RIGHTY_DOWN, _("Right thumbstick down") }, |
| 95 |
// I18N: name of buttons on gamepads |
| 96 |
- _("Right thumbstick up"), // SDL_CONTROLLER_AXIS_RIGHTY_UP |
| 97 |
+ { SDL_CONTROLLER_AXIS_RIGHTY_UP, _("Right thumbstick up") }, |
| 98 |
// I18N: name of buttons on gamepads |
| 99 |
- _("Left trigger"), // SDL_CONTROLLER_AXIS_TRIGGERLEFT_UP |
| 100 |
+ { SDL_CONTROLLER_AXIS_TRIGGERLEFT_UP, _("Left trigger") }, |
| 101 |
// I18N: name of buttons on gamepads |
| 102 |
- _("Right trigger") // SDL_CONTROLLER_AXIS_TRIGGERRIGHT_UP |
| 103 |
+ { SDL_CONTROLLER_AXIS_TRIGGERRIGHT_UP, _("Right trigger") } |
| 104 |
}}; |
| 105 |
|
| 106 |
const Binding &b = getBinding(action); |