summaryrefslogtreecommitdiff
path: root/src/inputmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-31 17:33:44 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-31 17:33:44 +0300
commit021fa9fe787fe4dd1a6d97b77e94400fac179f23 (patch)
tree05eebf64884503a17766f1755344568087fec0b2 /src/inputmanager.cpp
parentea886eaeabe20e5a51e91ec58067e2ebc20d4f99 (diff)
downloadmanaplus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.gz
manaplus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.bz2
manaplus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.tar.xz
manaplus-021fa9fe787fe4dd1a6d97b77e94400fac179f23.zip
Add support for changable actions for onscreen controls.
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r--src/inputmanager.cpp14
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,