summaryrefslogtreecommitdiff
path: root/src/input/inputmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r--src/input/inputmanager.cpp56
1 files changed, 52 insertions, 4 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index a379e0e86..7c07d1351 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -416,8 +416,31 @@ std::string InputManager::getKeyStringLong(const InputActionT index) const
}
else if (key.type == InputType::JOYSTICK)
{
- // TRANSLATORS: long joystick button name. must be short.
- str = strprintf(_("JButton%d"), key.value + 1);
+ if (key.value < Joystick::MAX_BUTTONS)
+ {
+ // TRANSLATORS: joystick button name. must be short.
+ str = strprintf(_("JButton%d"), key.value + 1);
+ }
+ else if (key.value == Joystick::KEY_UP)
+ {
+ // TRANSLATORS: joystick up button. must be short.
+ str = _("JUp");
+ }
+ else if (key.value == Joystick::KEY_DOWN)
+ {
+ // TRANSLATORS: joystick down button. must be short.
+ str = _("JDown");
+ }
+ else if (key.value == Joystick::KEY_LEFT)
+ {
+ // TRANSLATORS: joystick left button. must be short.
+ str = _("JLeft");
+ }
+ else if (key.value == Joystick::KEY_RIGHT)
+ {
+ // TRANSLATORS: joystick right button. must be short.
+ str = _("JRight");
+ }
}
if (!str.empty())
{
@@ -459,8 +482,31 @@ void InputManager::updateKeyString(const InputFunction &ki,
}
else if (key.type == InputType::JOYSTICK)
{
- // TRANSLATORS: short joystick button name. muse be very short
- str = strprintf(_("JB%d"), key.value + 1);
+ if (key.value < Joystick::MAX_BUTTONS)
+ {
+ // TRANSLATORS: joystick button name. muse be very short
+ str = strprintf(_("JB%d"), key.value + 1);
+ }
+ else if (key.value == Joystick::KEY_UP)
+ {
+ // TRANSLATORS: joystick up button. muse be very short
+ str = _("JUp");
+ }
+ else if (key.value == Joystick::KEY_DOWN)
+ {
+ // TRANSLATORS: joystick down button. muse be very short
+ str = _("JDn");
+ }
+ else if (key.value == Joystick::KEY_LEFT)
+ {
+ // TRANSLATORS: joystick left button. muse be very short
+ str = _("JLt");
+ }
+ else if (key.value == Joystick::KEY_RIGHT)
+ {
+ // TRANSLATORS: joystick right button. muse be very short
+ str = _("JRt");
+ }
}
if (!str.empty())
{
@@ -650,6 +696,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2
break;
}
case SDL_JOYBUTTONDOWN:
+ case SDL_JOYHATMOTION:
{
updateConditionMask(true);
// joystick.handleActicateButton(event);
@@ -724,6 +771,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2
// break;
case SDL_JOYBUTTONDOWN:
+ case SDL_JOYHATMOTION:
if ((joystick != nullptr) && joystick->validate())
{
if (triggerAction(joystick->getActionVector(event)))