diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-17 22:11:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-17 22:11:37 +0300 |
commit | a01c8632961792ba92a5c0bda8308d1260444b41 (patch) | |
tree | ec31890d3ff8c9f0b9ef94b3e96216b5bd07728f /src | |
parent | 5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5 (diff) | |
download | manaverse-a01c8632961792ba92a5c0bda8308d1260444b41.tar.gz manaverse-a01c8632961792ba92a5c0bda8308d1260444b41.tar.bz2 manaverse-a01c8632961792ba92a5c0bda8308d1260444b41.tar.xz manaverse-a01c8632961792ba92a5c0bda8308d1260444b41.zip |
Rename KeyFunction into InputFunction.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/input/inputfunction.h (renamed from src/input/keyfunction.h) | 12 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 56 | ||||
-rw-r--r-- | src/input/inputmanager.h | 6 | ||||
-rw-r--r-- | src/input/joystick.cpp | 4 | ||||
-rw-r--r-- | src/input/keyboardconfig.cpp | 4 |
7 files changed, 43 insertions, 43 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4fa18708f..f960eb857 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -808,6 +808,7 @@ SET(SRCS input/inputactiondata.h input/inputactionmap.h input/inputcondition.h + input/inputfunction.h input/inputitem.h input/inputmanager.cpp input/inputmanager.h @@ -817,7 +818,6 @@ SET(SRCS input/joystick.h input/keyboardconfig.cpp input/keyboardconfig.h - input/keyfunction.h input/keyinput.h input/keysortfunctor.h input/multitouchmanager.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 0d7b967a0..fe7df4c46 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -930,6 +930,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ input/inputactiondata.h \ input/inputactionmap.h \ input/inputcondition.h \ + input/inputfunction.h \ input/inputitem.h \ input/inputmanager.cpp \ input/inputmanager.h \ @@ -938,7 +939,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ input/joystick.h \ input/keyboardconfig.cpp \ input/keyboardconfig.h \ - input/keyfunction.h \ input/keyinput.h \ input/keysortfunctor.h \ input/multitouchmanager.cpp \ diff --git a/src/input/keyfunction.h b/src/input/inputfunction.h index 22d8e358f..6345e875d 100644 --- a/src/input/keyfunction.h +++ b/src/input/inputfunction.h @@ -18,18 +18,18 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INPUT_KEYFUNCTION_H -#define INPUT_KEYFUNCTION_H +#ifndef INPUT_INPUTFUNCTION_H +#define INPUT_INPUTFUNCTION_H #include "input/inputitem.h" #include "localconsts.h" -const unsigned int KeyFunctionSize = 3; +const unsigned int inputFunctionSize = 3; -struct KeyFunction final +struct InputFunction final { - InputItem values[KeyFunctionSize]; + InputItem values[inputFunctionSize]; }; -#endif // INPUT_KEYFUNCTION_H +#endif // INPUT_INPUTFUNCTION_H diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index f62b76c64..429297cfd 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -79,8 +79,8 @@ void InputManager::init() { for (unsigned int i = 0; i < InputAction::TOTAL; i++) { - KeyFunction &kf = mKey[i]; - for (unsigned int f = 0; f < KeyFunctionSize; f ++) + InputFunction &kf = mKey[i]; + for (unsigned int f = 0; f < inputFunctionSize; f ++) { InputItem &ki = kf.values[f]; ki.type = InputType::UNKNOWN; @@ -114,7 +114,7 @@ void InputManager::retrieve() if (!cf.empty()) { mNameMap[cf] = i; - KeyFunction &kf = mKey[i]; + InputFunction &kf = mKey[i]; const std::string keyStr = config.getValue(cf, ""); const size_t keyStrSize = keyStr.size(); if (keyStr.empty()) @@ -124,7 +124,7 @@ void InputManager::retrieve() splitToStringVector(keys, keyStr, ','); unsigned int i2 = 0; for (StringVectCIter it = keys.begin(), it_end = keys.end(); - it != it_end && i2 < KeyFunctionSize; ++ it) + it != it_end && i2 < inputFunctionSize; ++ it) { std::string keyStr2 = *it; if (keyStrSize < 2) @@ -169,9 +169,9 @@ void InputManager::store() const if (!cf.empty()) { std::string keyStr; - const KeyFunction &kf = mKey[i]; + const InputFunction &kf = mKey[i]; - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &key = kf.values[i2]; if (key.type != InputType::UNKNOWN) @@ -212,8 +212,8 @@ void InputManager::store() const void InputManager::resetKey(const int i) { - KeyFunction &key = mKey[i]; - for (size_t i2 = 1; i2 < KeyFunctionSize; i2 ++) + InputFunction &key = mKey[i]; + for (size_t i2 = 1; i2 < inputFunctionSize; i2 ++) { InputItem &ki2 = key.values[i2]; ki2.type = InputType::UNKNOWN; @@ -266,8 +266,8 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const if (!*kdi.configField) continue; - const KeyFunction &ki = mKey[i]; - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + const InputFunction &ki = mKey[i]; + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &vali2 = ki.values[i2]; if (vali2.value == InputAction::NO_VALUE) @@ -279,7 +279,7 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const if ((kdi.grp & inputActionData[j].grp) == 0 || !*kdi.configField) continue; - for (size_t j2 = 0; j2 < KeyFunctionSize; j2 ++) + for (size_t j2 = 0; j2 < inputFunctionSize; j2 ++) { const InputItem &valj2 = mKey[j].values[j2]; // Allow for item shortcut and emote keys to overlap @@ -326,7 +326,7 @@ bool InputManager::isActionActive0(const int index) return touchManager.isActionActive(index); } -KeyFunction &InputManager::getKey(int index) +InputFunction &InputManager::getKey(int index) { if (index < 0 || index >= InputAction::TOTAL) index = 0; @@ -336,9 +336,9 @@ KeyFunction &InputManager::getKey(int index) std::string InputManager::getKeyStringLong(const int index) const { std::string keyStr; - const KeyFunction &ki = mKey[index]; + const InputFunction &ki = mKey[index]; - for (size_t i = 0; i < KeyFunctionSize; i ++) + for (size_t i = 0; i < inputFunctionSize; i ++) { const InputItem &key = ki.values[i]; std::string str; @@ -379,9 +379,9 @@ std::string InputManager::getKeyStringLong(const int index) const std::string InputManager::getKeyValueString(const int index) const { std::string keyStr; - const KeyFunction &ki = mKey[index]; + const InputFunction &ki = mKey[index]; - for (size_t i = 0; i < KeyFunctionSize; i ++) + for (size_t i = 0; i < inputFunctionSize; i ++) { const InputItem &key = ki.values[i]; std::string str; @@ -437,8 +437,8 @@ void InputManager::addActionKey(const int action, const int type, return; int idx = -1; - KeyFunction &key = mKey[action]; - for (size_t i = 0; i < KeyFunctionSize; i ++) + InputFunction &key = mKey[action]; + for (size_t i = 0; i < inputFunctionSize; i ++) { const InputItem &val2 = key.values[i]; if (val2.type == InputType::UNKNOWN || (val2.type == type @@ -450,14 +450,14 @@ void InputManager::addActionKey(const int action, const int type, } if (idx == -1) { - for (size_t i = 1; i < KeyFunctionSize; i ++) + for (size_t i = 1; i < inputFunctionSize; i ++) { InputItem &val1 = key.values[i - 1]; InputItem &val2 = key.values[i]; val1.type = val2.type; val1.value = val2.value; } - idx = KeyFunctionSize - 1; + idx = inputFunctionSize - 1; } key.values[idx] = InputItem(type, val); @@ -480,8 +480,8 @@ void InputManager::setNewKey(const SDL_Event &event, const int type) void InputManager::unassignKey() { - KeyFunction &key = mKey[mNewKeyIndex]; - for (size_t i = 0; i < KeyFunctionSize; i ++) + InputFunction &key = mKey[mNewKeyIndex]; + for (size_t i = 0; i < inputFunctionSize; i ++) { InputItem &val = key.values[i]; val.type = InputType::UNKNOWN; @@ -729,11 +729,11 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, for (size_t i = 0; i < InputAction::TOTAL; i ++) { - const KeyFunction &key = mKey[i]; + const InputFunction &key = mKey[i]; const InputActionData &kd = inputActionData[i]; if (kd.action) { - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) @@ -742,7 +742,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, } if (kd.configField && (kd.grp & Input::GRP_GUICHAN)) { - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) @@ -751,7 +751,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, } if (kd.configField && (kd.grp & Input::GRP_REPEAT)) { - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) @@ -793,9 +793,9 @@ int InputManager::getKeyIndex(const int value, const int grp, { for (size_t i = 0; i < InputAction::TOTAL; i++) { - const KeyFunction &key = mKey[i]; + const InputFunction &key = mKey[i]; const InputActionData &kd = inputActionData[i]; - for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) + for (size_t i2 = 0; i2 < inputFunctionSize; i2 ++) { const InputItem &vali2 = key.values[i2]; if (value == vali2.value && (grp & kd.grp) != 0 diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h index 11db43402..02bc0315b 100644 --- a/src/input/inputmanager.h +++ b/src/input/inputmanager.h @@ -22,7 +22,7 @@ #define INPUT_INPUTMANAGER_H #include "input/inputaction.h" -#include "input/keyfunction.h" +#include "input/inputfunction.h" #include "events/inputevent.h" @@ -61,7 +61,7 @@ class InputManager final void callbackNewKey(); - KeyFunction &getKey(int index) A_WARN_UNUSED; + InputFunction &getKey(int index) A_WARN_UNUSED; std::string getKeyValueString(const int index) const A_WARN_UNUSED; @@ -131,7 +131,7 @@ class InputManager final std::map<std::string, int> mNameMap; - KeyFunction mKey[InputAction::TOTAL]; + InputFunction mKey[InputAction::TOTAL]; }; extern InputManager inputManager; diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 674633833..2170bdc48 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -325,8 +325,8 @@ bool Joystick::isActionActive(const int index) const if (!validate()) return false; - const KeyFunction &key = inputManager.getKey(index); - for (size_t i = 0; i < KeyFunctionSize; i ++) + const InputFunction &key = inputManager.getKey(index); + for (size_t i = 0; i < inputFunctionSize; i ++) { const InputItem &val = key.values[i]; if (val.type != InputType::JOYSTICK) diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index a8949e84a..b989b2d30 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -190,8 +190,8 @@ bool KeyboardConfig::isActionActive(const int index) const if (!mActiveKeys) return false; - const KeyFunction &key = inputManager.getKey(index); - for (size_t i = 0; i < KeyFunctionSize; i ++) + const InputFunction &key = inputManager.getKey(index); + for (size_t i = 0; i < inputFunctionSize; i ++) { const InputItem &val = key.values[i]; if (val.type != InputType::KEYBOARD) |