diff options
Diffstat (limited to 'src/input/joystick.cpp')
-rw-r--r-- | src/input/joystick.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 01414b4dc..3a4a47fb1 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -357,6 +357,16 @@ KeysVector *Joystick::getActionVectorByKey(const int i) return nullptr; } +InputActionT Joystick::getActionId(const SDL_Event &event) +{ + const int i = getButtonFromEvent(event); + if (i < 0) + return InputAction::NO_VALUE; + if (mKeyToId.find(i) != mKeyToId.end()) + return mKeyToId[i]; + return InputAction::NO_VALUE; +} + int Joystick::getButtonFromEvent(const SDL_Event &event) const { if (event.type == SDL_JOYBUTTONDOWN) |