diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-09 00:29:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-09 00:29:58 +0300 |
commit | eef58035c1848a8cffbcb17373b6afbe43be1440 (patch) | |
tree | ec8ff687c1c15c6b3f8448e596f51de066a5717b /src/input | |
parent | 1f0070646425aeb23f01d769f5b1cf071d1d3d15 (diff) | |
download | manaplus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.gz manaplus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.bz2 manaplus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.xz manaplus-eef58035c1848a8cffbcb17373b6afbe43be1440.zip |
Add chat command for send any gui key.
New chat command: guikey.
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 12 | ||||
-rw-r--r-- | src/input/inputmanager.h | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index a717c7e5e..f4d8f5739 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5612,6 +5612,12 @@ static const InputActionData inputActionData "translate|trans|tran", UseArgs_false, Protected_true}, + {"keyCommandSendGuiKey", + defaultAction(&Actions::sendGuiKey), + InputCondition::ENABLED, + "guikey|sendguikey", + UseArgs_false, + Protected_true}, }; #undef defaultAction diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index eda8ba7b1..40397e91f 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -1019,6 +1019,18 @@ InputActionT InputManager::getActionByKey(const SDL_Event &restrict event) return InputAction::NO_VALUE; } +InputActionT InputManager::getActionByConfigField(const std::string &field) + const restrict2 +{ + for (int i = 0; i < CAST_S32(InputAction::TOTAL); i ++) + { + const std::string cf = inputActionData[i].configField; + if (field == cf) + return static_cast<InputActionT>(i); + } + return InputAction::NO_VALUE; +} + void InputManager::addChatCommands(std::list<std::string> &restrict arr) restrict { diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h index 94e85b7d2..8455ef9b0 100644 --- a/src/input/inputmanager.h +++ b/src/input/inputmanager.h @@ -139,6 +139,9 @@ class InputManager final InputActionT getActionByKey(const SDL_Event &restrict event) const restrict2 A_WARN_UNUSED; + InputActionT getActionByConfigField(const std::string &field) + const restrict2 A_WARN_UNUSED; + void executeAction(const InputActionT keyNum) restrict2; bool executeChatCommand(const std::string &restrict cmd, |