summaryrefslogtreecommitdiff
path: root/src/input/inputmanager.cpp
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-11 14:20:39 +0300
committerFedja Beader <fedja@protonmail.ch>2024-05-15 00:11:38 +0200
commit0ff6869e745b4a0174ab1ee116ba5d6ad08e4812 (patch)
tree20411f52ba209bdffee2c9b6dc7b30ed36a584cf /src/input/inputmanager.cpp
parent1dc559144c8809e2d9ab91a5f90a2047fc0595bc (diff)
downloadmanaverse-0ff6869e745b4a0174ab1ee116ba5d6ad08e4812.tar.gz
manaverse-0ff6869e745b4a0174ab1ee116ba5d6ad08e4812.tar.bz2
manaverse-0ff6869e745b4a0174ab1ee116ba5d6ad08e4812.tar.xz
manaverse-0ff6869e745b4a0174ab1ee116ba5d6ad08e4812.zip
Extend gui support to joystick hat (d-pad)
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r--src/input/inputmanager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index 0bffbe231..ac5325e3b 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -738,7 +738,9 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2
if (gui != nullptr)
{
const bool res = gui->handleInput();
- if (res && (event.type == SDL_KEYDOWN || event.type == SDL_JOYBUTTONDOWN))
+ const bool joystickActionEvent =
+ joystick != nullptr && joystick->isActionEvent(event);
+ if (res && (event.type == SDL_KEYDOWN || joystickActionEvent))
{
BLOCK_END("InputManager::handleEvent")
return true;
@@ -1112,7 +1114,7 @@ InputActionT InputManager::getActionByKey(const SDL_Event &restrict event)
return idx;
}
}
- if (joystick != nullptr && event.type == SDL_JOYBUTTONDOWN)
+ if (joystick != nullptr && joystick->isActionEvent(event))
{
const InputActionT idx = joystick->getActionId(event);
if (CAST_S32(idx) >= 0 &&