summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-11 13:50:03 +0300
committerewewukek <ewewukek@gmail.com>2024-03-27 13:18:30 +0300
commit5fcfc0ae8222de65e83857947e23eb6b449f3f03 (patch)
tree127e1ee6e0e8b880779ab6f1f1b47a5076a032a7 /src/gui/sdlinput.cpp
parent9728279062a74c4e80c7ed1c714571ae6fda2016 (diff)
downloadmanaverse-5fcfc0ae8222de65e83857947e23eb6b449f3f03.tar.gz
manaverse-5fcfc0ae8222de65e83857947e23eb6b449f3f03.tar.bz2
manaverse-5fcfc0ae8222de65e83857947e23eb6b449f3f03.tar.xz
manaverse-5fcfc0ae8222de65e83857947e23eb6b449f3f03.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);