diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-31 17:33:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-31 17:33:44 +0300 |
commit | 021fa9fe787fe4dd1a6d97b77e94400fac179f23 (patch) | |
tree | 05eebf64884503a17766f1755344568087fec0b2 /src/inputmanager.cpp | |
parent | ea886eaeabe20e5a51e91ec58067e2ebc20d4f99 (diff) | |
download | plus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.gz plus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.bz2 plus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.xz plus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.zip |
Add support for changable actions for onscreen controls.
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 9cf456143..0bbbeda10 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -594,12 +594,24 @@ bool InputManager::invokeKey(const KeyData *const key, const int keyNum) if (checkKey(key)) { InputEvent evt(keyNum, mMask); - if ((*(keyData[keyNum].action))(evt)) + ActionFuncPtr func = *(keyData[keyNum].action); + if (func && func(evt)) return true; } return false; } +void InputManager::executeAction(const int keyNum) +{ + if (keyNum < 0 || keyNum >= Input::KEY_TOTAL) + return; + + InputEvent evt(keyNum, mMask); + ActionFuncPtr func = *(keyData[keyNum].action); + if (func) + func(evt); +} + void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, KeyToIdMap &idMap, KeyTimeMap &keyTimeMap, |