diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-10 21:12:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-10 21:12:29 +0300 |
commit | 3973b3175a1efdb0d47e93b93af6ae5f50cb62f8 (patch) | |
tree | 00e51ab584c108c6fd766a0f911a7c1e26ce8a1b /src/inputmanager.cpp | |
parent | 9df03a10b72b7e8c3b5bcf9cc7b595dc9fc17835 (diff) | |
download | manaverse-3973b3175a1efdb0d47e93b93af6ae5f50cb62f8.tar.gz manaverse-3973b3175a1efdb0d47e93b93af6ae5f50cb62f8.tar.bz2 manaverse-3973b3175a1efdb0d47e93b93af6ae5f50cb62f8.tar.xz manaverse-3973b3175a1efdb0d47e93b93af6ae5f50cb62f8.zip |
Move more code from keyboardconfig to inputmanager.
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r-- | src/inputmanager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 3f4904abe..181ba6490 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -605,3 +605,21 @@ bool InputManager::triggerAction(const KeysVector *ptrs) } return false; } + +int InputManager::getKeyIndex(int value, int grp, int type) const +{ + for (size_t i = 0; i < Input::KEY_TOTAL; i++) + { + const KeyFunction &key = mKey[i]; + for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + { + if (value == key.values[i2].value + && (grp & keyData[i].grp) != 0 + && key.values[i2].type == type) + { + return i; + } + } + } + return Input::KEY_NO_VALUE; +} |