summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-11 13:50:03 +0300
committerFedja Beader <fedja@protonmail.ch>2024-05-15 00:11:38 +0200
commit1dc559144c8809e2d9ab91a5f90a2047fc0595bc (patch)
tree47fbac5776f2277df4a625cc5a8547c99d28589f /src/gui/sdlinput.cpp
parent046ac8fceda89092f01325abbc8d2b5b8602719c (diff)
downloadmanaverse-1dc559144c8809e2d9ab91a5f90a2047fc0595bc.tar.gz
manaverse-1dc559144c8809e2d9ab91a5f90a2047fc0595bc.tar.bz2
manaverse-1dc559144c8809e2d9ab91a5f90a2047fc0595bc.tar.xz
manaverse-1dc559144c8809e2d9ab91a5f90a2047fc0595bc.zip
Gui support for joystick buttons
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r--src/gui/sdlinput.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 9b8b1ec6a..f9ff0f618 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -171,6 +171,20 @@ void SDLInput::pushInput(const SDL_Event &event)
break;
}
+ case SDL_JOYBUTTONDOWN:
+ {
+ const InputActionT actionId = inputManager.getActionByKey(event);
+ if (actionId > InputAction::NO_VALUE)
+ {
+ keyInput.setActionId(actionId);
+ keyInput.setType(KeyEventType::PRESSED);
+ mKeyInputQueue.push(keyInput);
+ keyInput.setType(KeyEventType::RELEASED);
+ mKeyInputQueue.push(keyInput);
+ }
+ break;
+ }
+
#ifdef USE_SDL2
case SDL_TEXTINPUT:
keyInput.setType(KeyEventType::PRESSED);