diff options
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r-- | src/gui/sdlinput.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 9b8b1ec6a..0f176258f 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,6 +90,8 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_timer.h> PRAGMA48(GCC diagnostic pop) +#include "utils/performance.h" + #include "debug.h" #ifdef __SWITCH__ @@ -171,6 +173,22 @@ void SDLInput::pushInput(const SDL_Event &event) break; } + case SDL_JOYBUTTONDOWN: + case SDL_JOYHATMOTION: + case SDL_JOYAXISMOTION: + { + 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); |