From a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd Mon Sep 17 00:00:00 2001 From: ewewukek Date: Thu, 11 Jan 2024 12:53:19 +0300 Subject: Make D-Pad behave like regular buttons --- src/input/inputmanager.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'src/input/inputmanager.cpp') diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index a379e0e86..0a113bd76 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -416,8 +416,31 @@ std::string InputManager::getKeyStringLong(const InputActionT index) const } else if (key.type == InputType::JOYSTICK) { - // TRANSLATORS: long joystick button name. must be short. - str = strprintf(_("JButton%d"), key.value + 1); + if (key.value < Joystick::MAX_BUTTONS) + { + // TRANSLATORS: joystick button name. must be short. + str = strprintf(_("JButton%d"), key.value + 1); + } + else if (key.value == Joystick::KEY_UP) + { + // TRANSLATORS: joystick up button. must be short. + str = _("JUp"); + } + else if (key.value == Joystick::KEY_DOWN) + { + // TRANSLATORS: joystick down button. must be short. + str = _("JDown"); + } + else if (key.value == Joystick::KEY_LEFT) + { + // TRANSLATORS: joystick left button. must be short. + str = _("JLeft"); + } + else if (key.value == Joystick::KEY_RIGHT) + { + // TRANSLATORS: joystick right button. must be short. + str = _("JRight"); + } } if (!str.empty()) { @@ -459,8 +482,31 @@ void InputManager::updateKeyString(const InputFunction &ki, } else if (key.type == InputType::JOYSTICK) { - // TRANSLATORS: short joystick button name. muse be very short - str = strprintf(_("JB%d"), key.value + 1); + if (key.value < Joystick::MAX_BUTTONS) + { + // TRANSLATORS: joystick button name. must be very short + str = strprintf(_("JB%d"), key.value + 1); + } + else if (key.value == Joystick::KEY_UP) + { + // TRANSLATORS: joystick up button. must be very short + str = _("JUp"); + } + else if (key.value == Joystick::KEY_DOWN) + { + // TRANSLATORS: joystick down button. must be very short + str = _("JDn"); + } + else if (key.value == Joystick::KEY_LEFT) + { + // TRANSLATORS: joystick left button. must be very short + str = _("JLt"); + } + else if (key.value == Joystick::KEY_RIGHT) + { + // TRANSLATORS: joystick right button. must be very short + str = _("JRt"); + } } if (!str.empty()) { @@ -650,6 +696,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 break; } case SDL_JOYBUTTONDOWN: + case SDL_JOYHATMOTION: { updateConditionMask(true); // joystick.handleActicateButton(event); @@ -724,6 +771,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 // break; case SDL_JOYBUTTONDOWN: + case SDL_JOYHATMOTION: if ((joystick != nullptr) && joystick->validate()) { if (triggerAction(joystick->getActionVector(event))) -- cgit v1.2.3-70-g09d2 From 1dc559144c8809e2d9ab91a5f90a2047fc0595bc Mon Sep 17 00:00:00 2001 From: ewewukek Date: Thu, 11 Jan 2024 13:50:03 +0300 Subject: Gui support for joystick buttons --- src/gui/sdlinput.cpp | 14 ++++++++++++++ src/input/inputmanager.cpp | 12 ++++++++++-- src/input/joystick.cpp | 10 ++++++++++ src/input/joystick.h | 2 ++ 4 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src/input/inputmanager.cpp') 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); diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 0a113bd76..0bffbe231 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -738,7 +738,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 if (gui != nullptr) { const bool res = gui->handleInput(); - if (res && event.type == SDL_KEYDOWN) + if (res && (event.type == SDL_KEYDOWN || event.type == SDL_JOYBUTTONDOWN)) { BLOCK_END("InputManager::handleEvent") return true; @@ -1103,7 +1103,6 @@ InputActionT InputManager::getKeyIndex(const int value, InputActionT InputManager::getActionByKey(const SDL_Event &restrict event) const restrict2 { - // for now support only keyboard events if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) { const InputActionT idx = keyboard.getActionId(event); @@ -1113,6 +1112,15 @@ InputActionT InputManager::getActionByKey(const SDL_Event &restrict event) return idx; } } + if (joystick != nullptr && event.type == SDL_JOYBUTTONDOWN) + { + const InputActionT idx = joystick->getActionId(event); + if (CAST_S32(idx) >= 0 && + checkKey(&inputActionData[CAST_SIZE(idx)])) + { + return idx; + } + } return InputAction::NO_VALUE; } 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) diff --git a/src/input/joystick.h b/src/input/joystick.h index 805efa6ad..2a43d1a14 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -151,6 +151,8 @@ class Joystick final KeysVector *getActionVectorByKey(const int i) A_WARN_UNUSED; + InputActionT getActionId(const SDL_Event &event) A_WARN_UNUSED; + int getButtonFromEvent(const SDL_Event &event) const A_WARN_UNUSED; bool isActionActive(const InputActionT index) const A_WARN_UNUSED; -- cgit v1.2.3-70-g09d2 From 0ff6869e745b4a0174ab1ee116ba5d6ad08e4812 Mon Sep 17 00:00:00 2001 From: ewewukek Date: Thu, 11 Jan 2024 14:20:39 +0300 Subject: Extend gui support to joystick hat (d-pad) --- src/gui/sdlinput.cpp | 1 + src/input/inputmanager.cpp | 6 ++++-- src/input/joystick.cpp | 5 +++++ src/input/joystick.h | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/input/inputmanager.cpp') diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index f9ff0f618..bf6f0536c 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -172,6 +172,7 @@ void SDLInput::pushInput(const SDL_Event &event) } case SDL_JOYBUTTONDOWN: + case SDL_JOYHATMOTION: { const InputActionT actionId = inputManager.getActionByKey(event); if (actionId > InputAction::NO_VALUE) 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 && diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 3a4a47fb1..1e375cb0a 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -341,6 +341,11 @@ void Joystick::update() mKeyTimeMap, InputType::JOYSTICK); } +bool Joystick::isActionEvent(const SDL_Event &event) +{ + return getButtonFromEvent(event) >= 0; +} + KeysVector *Joystick::getActionVector(const SDL_Event &event) { const int i = getButtonFromEvent(event); diff --git a/src/input/joystick.h b/src/input/joystick.h index 2a43d1a14..293e75a22 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -147,6 +147,8 @@ class Joystick final void update(); + bool isActionEvent(const SDL_Event &event) A_WARN_UNUSED; + KeysVector *getActionVector(const SDL_Event &event) A_WARN_UNUSED; KeysVector *getActionVectorByKey(const int i) A_WARN_UNUSED; -- cgit v1.2.3-70-g09d2 From 842b7fd4db44d85308afbb401023429621d9c586 Mon Sep 17 00:00:00 2001 From: ewewukek Date: Thu, 11 Jan 2024 15:04:28 +0300 Subject: Make sticks/triggers behave like regular buttons --- src/gui/sdlinput.cpp | 1 + src/input/inputmanager.cpp | 33 ++++++++++++++++++++++++- src/input/joystick.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++--- src/input/joystick.h | 15 ++++++++++-- 4 files changed, 103 insertions(+), 7 deletions(-) (limited to 'src/input/inputmanager.cpp') diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index bf6f0536c..8f3ca8bff 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -173,6 +173,7 @@ void SDLInput::pushInput(const SDL_Event &event) case SDL_JOYBUTTONDOWN: case SDL_JOYHATMOTION: + case SDL_JOYAXISMOTION: { const InputActionT actionId = inputManager.getActionByKey(event); if (actionId > InputAction::NO_VALUE) diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index ac5325e3b..fc2815b5e 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -441,6 +441,20 @@ std::string InputManager::getKeyStringLong(const InputActionT index) const // TRANSLATORS: joystick right button. must be short. str = _("JRight"); } + else if (key.value >= Joystick::KEY_NEGATIVE_AXIS_FIRST + && key.value < Joystick::KEY_POSITIVE_AXIS_FIRST) + { + // TRANSLATORS: joystick negative axis. must be short. + str = strprintf(_("JAxis%dMinus"), + key.value - Joystick::KEY_NEGATIVE_AXIS_FIRST); + } + else if (key.value >= Joystick::KEY_POSITIVE_AXIS_FIRST + && key.value < Joystick::KEY_END) + { + // TRANSLATORS: joystick positive axis. must be short. + str = strprintf(_("JAxis%dPlus"), + key.value - Joystick::KEY_POSITIVE_AXIS_FIRST); + } } if (!str.empty()) { @@ -507,6 +521,20 @@ void InputManager::updateKeyString(const InputFunction &ki, // TRANSLATORS: joystick right button. must be very short str = _("JRt"); } + else if (key.value >= Joystick::KEY_NEGATIVE_AXIS_FIRST + && key.value < Joystick::KEY_POSITIVE_AXIS_FIRST) + { + // TRANSLATORS: joystick negative axis. must be very short. + str = strprintf(_("JA%d-"), + key.value - Joystick::KEY_NEGATIVE_AXIS_FIRST); + } + else if (key.value >= Joystick::KEY_POSITIVE_AXIS_FIRST + && key.value < Joystick::KEY_END) + { + // TRANSLATORS: joystick positive axis. must be very short. + str = strprintf(_("JA%d+"), + key.value - Joystick::KEY_POSITIVE_AXIS_FIRST); + } } if (!str.empty()) { @@ -697,10 +725,12 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 } case SDL_JOYBUTTONDOWN: case SDL_JOYHATMOTION: + case SDL_JOYAXISMOTION: { updateConditionMask(true); // joystick.handleActicateButton(event); - if (handleAssignKey(event, InputType::JOYSTICK)) + if (joystick != nullptr && joystick->isActionEvent(event) + && handleAssignKey(event, InputType::JOYSTICK)) { BLOCK_END("InputManager::handleEvent") return true; @@ -774,6 +804,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 case SDL_JOYBUTTONDOWN: case SDL_JOYHATMOTION: + case SDL_JOYAXISMOTION: if ((joystick != nullptr) && joystick->validate()) { if (triggerAction(joystick->getActionVector(event))) diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 1e375cb0a..21de2ad3d 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -51,6 +51,7 @@ Joystick::Joystick(const int no) : mJoystick(nullptr), mTolerance(0), mNumber(no >= joystickCount ? joystickCount : no), + mAxesNumber(MAX_AXES), mButtonsNumber(MAX_BUTTONS), mUseHatForMovement(true), mUseInactive(false), @@ -59,6 +60,8 @@ Joystick::Joystick(const int no) : mKeyToId(), mKeyTimeMap() { + for (int i = 0; i < MAX_AXES; i++) + mAxesPositions[i] = 0; for (int i = 0; i < MAX_BUTTONS; i++) mActiveButtons[i] = false; } @@ -127,7 +130,9 @@ bool Joystick::open() return false; } + mAxesNumber = SDL_JoystickNumAxes(mJoystick); mButtonsNumber = SDL_JoystickNumButtons(mJoystick); + logger->log("Joystick: %i ", mNumber); #ifdef USE_SDL2 logger->log("Name: %s", SDL_JoystickName(mJoystick)); @@ -186,13 +191,16 @@ bool Joystick::open() logger->log("Name: %s", SDL_JoystickName(mNumber)); #endif // USE_SDL2 - logger->log("Axes: %i ", SDL_JoystickNumAxes(mJoystick)); + logger->log("Axes: %i ", mAxesNumber); logger->log("Balls: %i", SDL_JoystickNumBalls(mJoystick)); logger->log("Hats: %i", SDL_JoystickNumHats(mJoystick)); logger->log("Buttons: %i", mButtonsNumber); mHaveHats = (SDL_JoystickNumHats(mJoystick) > 0); + if (mAxesNumber > MAX_AXES) + mAxesNumber = mAxesNumber; + if (mButtonsNumber > MAX_BUTTONS) mButtonsNumber = MAX_BUTTONS; @@ -244,15 +252,18 @@ void Joystick::logic() if (mUseInactive || settings.inputFocused != KeyboardFocus::Unfocused) { + for (int i = 0; i < mAxesNumber; i++) + mAxesPositions[i] = SDL_JoystickGetAxis(mJoystick, i); + // X-Axis - int position = SDL_JoystickGetAxis(mJoystick, 0); + int position = mAxesPositions[0]; if (position >= mTolerance * SDL_JOYSTICK_AXIS_MAX) mDirection |= RIGHT; else if (position <= mTolerance * SDL_JOYSTICK_AXIS_MIN) mDirection |= LEFT; // Y-Axis - position = SDL_JoystickGetAxis(mJoystick, 1); + position = mAxesPositions[1]; if (position <= mTolerance * SDL_JOYSTICK_AXIS_MIN) mDirection |= UP; else if (position >= mTolerance * SDL_JOYSTICK_AXIS_MAX) @@ -300,6 +311,8 @@ void Joystick::logic() else { mHatPosition = 0; + for (int i = 0; i < mAxesNumber; i++) + mAxesPositions[i] = 0; for (int i = 0; i < mButtonsNumber; i++) mActiveButtons[i] = false; } @@ -325,6 +338,20 @@ bool Joystick::buttonPressed(const int no) const if (no == KEY_RIGHT) return (mHatPosition & RIGHT) != 0; } + if (KEY_NEGATIVE_AXIS_FIRST <= no && no < KEY_POSITIVE_AXIS_FIRST) + { + const int axis = no - KEY_NEGATIVE_AXIS_FIRST; + if (axis < RESERVED_AXES || axis >= mAxesNumber) + return false; + return mAxesPositions[axis] < mTolerance * SDL_JOYSTICK_AXIS_MIN; + } + if (KEY_POSITIVE_AXIS_FIRST <= no && no < KEY_END) + { + const int axis = no - KEY_POSITIVE_AXIS_FIRST; + if (axis < RESERVED_AXES || axis >= mAxesNumber) + return false; + return mAxesPositions[axis] > mTolerance * SDL_JOYSTICK_AXIS_MAX; + } return false; } @@ -354,7 +381,7 @@ KeysVector *Joystick::getActionVector(const SDL_Event &event) KeysVector *Joystick::getActionVectorByKey(const int i) { - if (i < 0 || (i >= mButtonsNumber && i < MAX_BUTTONS) || i > KEY_LAST) + if (i < 0 || (i >= mButtonsNumber && i < MAX_BUTTONS) || i >= KEY_END) return nullptr; // logger->log("button triggerAction: %d", i); if (mKeyToAction.find(i) != mKeyToAction.end()) @@ -397,6 +424,20 @@ int Joystick::getButtonFromEvent(const SDL_Event &event) const if ((mHatPosition & RIGHT) == 0 && (value & SDL_HAT_RIGHT) != 0) return KEY_RIGHT; } + if (event.type == SDL_JOYAXISMOTION) + { + if (event.jaxis.which != mNumber) + return -1; + const int axis = event.jaxis.axis; + if (axis < RESERVED_AXES) + return -1; + if (event.jaxis.value < mTolerance * SDL_JOYSTICK_AXIS_MIN + && mAxesPositions[axis] > mTolerance * SDL_JOYSTICK_AXIS_MIN) + return KEY_NEGATIVE_AXIS_FIRST + axis; + if (event.jaxis.value > mTolerance * SDL_JOYSTICK_AXIS_MAX + && mAxesPositions[axis] < mTolerance * SDL_JOYSTICK_AXIS_MAX) + return KEY_POSITIVE_AXIS_FIRST + axis; + } return -1; } @@ -448,6 +489,18 @@ void Joystick::handleRepeat(const int time) if (key == KEY_RIGHT && (mHatPosition & RIGHT) != 0) repeat = true; } + if (KEY_NEGATIVE_AXIS_FIRST <= key && key < KEY_POSITIVE_AXIS_FIRST) + { + const int axis = key - KEY_NEGATIVE_AXIS_FIRST; + if (axis >= RESERVED_AXES && mAxesPositions[axis] < mTolerance * SDL_JOYSTICK_AXIS_MIN) + repeat = true; + } + if (KEY_POSITIVE_AXIS_FIRST <= key && key < KEY_END) + { + const int axis = key - KEY_POSITIVE_AXIS_FIRST; + if (axis >= RESERVED_AXES && mAxesPositions[axis] > mTolerance * SDL_JOYSTICK_AXIS_MAX) + repeat = true; + } if (repeat) { int &keyTime = (*it).second; diff --git a/src/input/joystick.h b/src/input/joystick.h index 293e75a22..2a7e0f638 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -51,8 +51,15 @@ class Joystick final MAX_BUTTONS = 64 }; + enum + { + RESERVED_AXES = 2, // reserved for movement + MAX_AXES = 8 // number of axes we can handle + }; + /** - * Additional "buttons" for hat 0 (d-pad). + * Additional "buttons" for hat 0 (d-pad), + * sticks and triggers. */ enum { @@ -60,7 +67,9 @@ class Joystick final KEY_DOWN, KEY_LEFT, KEY_RIGHT, - KEY_LAST = KEY_RIGHT + KEY_NEGATIVE_AXIS_FIRST, + KEY_POSITIVE_AXIS_FIRST = KEY_NEGATIVE_AXIS_FIRST + MAX_AXES, + KEY_END = KEY_POSITIVE_AXIS_FIRST + MAX_AXES }; /** @@ -169,12 +178,14 @@ class Joystick final unsigned char mDirection; unsigned char mHatPosition; + int mAxesPositions[MAX_AXES]; bool mActiveButtons[MAX_BUTTONS]; SDL_Joystick *mJoystick; float mTolerance; int mNumber; + int mAxesNumber; int mButtonsNumber; bool mUseHatForMovement; bool mUseInactive; -- cgit v1.2.3-70-g09d2 From 16fafb1516a346ee0553a329b0606c2bb55283d7 Mon Sep 17 00:00:00 2001 From: ewewukek Date: Tue, 2 Apr 2024 08:18:17 +0300 Subject: Consume input event in QuitDialog instead of relying on a hack --- src/gui/windows/quitdialog.cpp | 5 +++++ src/input/inputmanager.cpp | 22 +++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/input/inputmanager.cpp') diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index d1ceb1ad9..7ef2bc6e8 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -210,6 +210,7 @@ void QuitDialog::keyPressed(KeyEvent &event) { const InputActionT actionId = event.getActionId(); int dir = 0; + bool consume = true; PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") @@ -229,10 +230,14 @@ void QuitDialog::keyPressed(KeyEvent &event) dir = 1; break; default: + consume = false; break; } PRAGMA45(GCC diagnostic pop) + if (consume) + event.consume(); + if (dir != 0) { STD_VECTOR::const_iterator it = mOptions.begin(); diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index fc2815b5e..8cb10041e 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -691,21 +691,7 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 BLOCK_END("InputManager::handleEvent") return true; } - keyboard.handleActivateKey(event); - // send straight to gui for certain windows -#ifndef DYECMD - if ((quitDialog != nullptr) || TextDialog::isActive()) - { - if (guiInput != nullptr) - guiInput->pushInput(event); - if (gui != nullptr) - gui->handleInput(); - BLOCK_END("InputManager::handleEvent") - return true; - } -#endif // DYECMD - break; } case SDL_KEYUP: @@ -767,9 +753,15 @@ bool InputManager::handleEvent(const SDL_Event &restrict event) restrict2 guiInput->pushInput(event); if (gui != nullptr) { - const bool res = gui->handleInput(); + bool res = gui->handleInput(); +#ifndef DYECMD + // always treat keyboard input as handled if a text dialog is active + if (event.type == SDL_KEYDOWN && TextDialog::isActive()) + res = true; +#endif // DYECMD const bool joystickActionEvent = joystick != nullptr && joystick->isActionEvent(event); + // stop processing input if event is consumed by the gui if (res && (event.type == SDL_KEYDOWN || joystickActionEvent)) { BLOCK_END("InputManager::handleEvent") -- cgit v1.2.3-70-g09d2