diff options
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r-- | src/inputmanager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 4b5988a57..3b99c3498 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -66,7 +66,8 @@ static class KeyFunctor final InputManager::InputManager() : mSetupInput(nullptr), mNewKeyIndex(Input::KEY_NO_VALUE), - mMask(1) + mMask(1), + mNameMap() { } @@ -104,6 +105,7 @@ void InputManager::retrieve() const char *const cf = keyData[i].configField; if (*cf) { + mNameMap[cf] = i; KeyFunction &kf = mKey[i]; const std::string keyStr = config.getValue(cf, ""); if (keyStr.empty()) @@ -392,6 +394,16 @@ std::string InputManager::getKeyValueString(const int index) const return keyStr; } +std::string InputManager::getKeyValueByName(const std::string &keyName) +{ + const std::map<std::string, int>::const_iterator + it = mNameMap.find(keyName); + + if (it == mNameMap.end()) + return std::string(); + return getKeyValueString((*it).second); +} + void InputManager::addActionKey(const int action, const int type, const int val) { |