diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-17 21:55:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-17 21:55:47 +0300 |
commit | 5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5 (patch) | |
tree | 7c55d024ca0c1e4219efaad5f6f17792771d037c /src | |
parent | c11527a8c7ba7dbea4028cd2011d43aab2718a81 (diff) | |
download | plus-5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5.tar.gz plus-5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5.tar.bz2 plus-5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5.tar.xz plus-5c9a571bcfe1a1a3e007fc53cca9c4ebd0be68a5.zip |
Rename KeyItem into InputItem.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/input/inputitem.h (renamed from src/input/keyitem.h) | 13 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 38 | ||||
-rw-r--r-- | src/input/joystick.cpp | 2 | ||||
-rw-r--r-- | src/input/keyboardconfig.cpp | 2 | ||||
-rw-r--r-- | src/input/keyfunction.h | 4 |
7 files changed, 31 insertions, 32 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8d98c9405..4fa18708f 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/inputitem.h input/inputmanager.cpp input/inputmanager.h input/inputtype.h @@ -818,7 +819,6 @@ SET(SRCS input/keyboardconfig.h input/keyfunction.h input/keyinput.h - input/keyitem.h input/keysortfunctor.h input/multitouchmanager.cpp input/multitouchmanager.h diff --git a/src/Makefile.am b/src/Makefile.am index 01b9438c5..0d7b967a0 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/inputitem.h \ input/inputmanager.cpp \ input/inputmanager.h \ input/inputtype.h \ @@ -939,7 +940,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ input/keyboardconfig.h \ input/keyfunction.h \ input/keyinput.h \ - input/keyitem.h \ input/keysortfunctor.h \ input/multitouchmanager.cpp \ input/multitouchmanager.h \ diff --git a/src/input/keyitem.h b/src/input/inputitem.h index 96ee70d0a..ce1f7973f 100644 --- a/src/input/keyitem.h +++ b/src/input/inputitem.h @@ -18,25 +18,24 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INPUT_KEYITEM_H -#define INPUT_KEYITEM_H +#ifndef INPUT_INPUTITEM_H +#define INPUT_INPUTITEM_H #include "localconsts.h" -struct KeyItem final +struct InputItem final { - KeyItem() : + InputItem() : type(-1), value(-1) { } - KeyItem(const int type0, const int value0) : + InputItem(const int type0, const int value0) : type(type0), value(value0) { } int type; - int value; }; -#endif // INPUT_KEYITEM_H +#endif // INPUT_INPUTITEM_H diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index e61372c21..f62b76c64 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -82,7 +82,7 @@ void InputManager::init() KeyFunction &kf = mKey[i]; for (unsigned int f = 0; f < KeyFunctionSize; f ++) { - KeyItem &ki = kf.values[f]; + InputItem &ki = kf.values[f]; ki.type = InputType::UNKNOWN; ki.value = -1; } @@ -149,7 +149,7 @@ void InputManager::retrieve() const int key = atoi(keyStr2.c_str()); if (key >= -255 && key < SDLK_LAST) { - kf.values[i2] = KeyItem(type, key); + kf.values[i2] = InputItem(type, key); i2 ++; } } @@ -173,7 +173,7 @@ void InputManager::store() const for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &key = kf.values[i2]; + const InputItem &key = kf.values[i2]; if (key.type != InputType::UNKNOWN) { std::string tmp("k"); @@ -215,14 +215,14 @@ void InputManager::resetKey(const int i) KeyFunction &key = mKey[i]; for (size_t i2 = 1; i2 < KeyFunctionSize; i2 ++) { - KeyItem &ki2 = key.values[i2]; + InputItem &ki2 = key.values[i2]; ki2.type = InputType::UNKNOWN; ki2.value = -1; } const InputActionData &kd = inputActionData[i]; - KeyItem &val0 = key.values[0]; + InputItem &val0 = key.values[0]; val0.type = kd.defaultType1; - KeyItem &val1 = key.values[1]; + InputItem &val1 = key.values[1]; val1.type = kd.defaultType2; #ifdef USE_SDL2 if (kd.defaultType1 == InputType::KEYBOARD) @@ -269,7 +269,7 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const const KeyFunction &ki = mKey[i]; for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &vali2 = ki.values[i2]; + const InputItem &vali2 = ki.values[i2]; if (vali2.value == InputAction::NO_VALUE) continue; @@ -281,7 +281,7 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const for (size_t j2 = 0; j2 < KeyFunctionSize; j2 ++) { - const KeyItem &valj2 = mKey[j].values[j2]; + const InputItem &valj2 = mKey[j].values[j2]; // Allow for item shortcut and emote keys to overlap // as well as emote and ignore keys, but no other keys if (valj2.type != InputType::UNKNOWN @@ -340,7 +340,7 @@ std::string InputManager::getKeyStringLong(const int index) const for (size_t i = 0; i < KeyFunctionSize; i ++) { - const KeyItem &key = ki.values[i]; + const InputItem &key = ki.values[i]; std::string str; if (key.type == InputType::KEYBOARD) { @@ -383,7 +383,7 @@ std::string InputManager::getKeyValueString(const int index) const for (size_t i = 0; i < KeyFunctionSize; i ++) { - const KeyItem &key = ki.values[i]; + const InputItem &key = ki.values[i]; std::string str; if (key.type == InputType::KEYBOARD) { @@ -440,7 +440,7 @@ void InputManager::addActionKey(const int action, const int type, KeyFunction &key = mKey[action]; for (size_t i = 0; i < KeyFunctionSize; i ++) { - const KeyItem &val2 = key.values[i]; + const InputItem &val2 = key.values[i]; if (val2.type == InputType::UNKNOWN || (val2.type == type && val2.value == val)) { @@ -452,15 +452,15 @@ void InputManager::addActionKey(const int action, const int type, { for (size_t i = 1; i < KeyFunctionSize; i ++) { - KeyItem &val1 = key.values[i - 1]; - KeyItem &val2 = key.values[i]; + InputItem &val1 = key.values[i - 1]; + InputItem &val2 = key.values[i]; val1.type = val2.type; val1.value = val2.value; } idx = KeyFunctionSize - 1; } - key.values[idx] = KeyItem(type, val); + key.values[idx] = InputItem(type, val); } void InputManager::setNewKey(const SDL_Event &event, const int type) @@ -483,7 +483,7 @@ void InputManager::unassignKey() KeyFunction &key = mKey[mNewKeyIndex]; for (size_t i = 0; i < KeyFunctionSize; i ++) { - KeyItem &val = key.values[i]; + InputItem &val = key.values[i]; val.type = InputType::UNKNOWN; val.value = -1; } @@ -735,7 +735,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, { for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &ki = key.values[i2]; + const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) actionMap[ki.value].push_back(static_cast<int>(i)); } @@ -744,7 +744,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, { for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &ki = key.values[i2]; + const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) idMap[ki.value] = static_cast<int>(i); } @@ -753,7 +753,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, { for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &ki = key.values[i2]; + const InputItem &ki = key.values[i2]; if (ki.type == type && ki.value != -1) keyTimeMap[ki.value] = 0; } @@ -797,7 +797,7 @@ int InputManager::getKeyIndex(const int value, const int grp, const InputActionData &kd = inputActionData[i]; for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { - const KeyItem &vali2 = key.values[i2]; + const InputItem &vali2 = key.values[i2]; if (value == vali2.value && (grp & kd.grp) != 0 && vali2.type == type) { diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index b7d34e6ec..674633833 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -328,7 +328,7 @@ bool Joystick::isActionActive(const int index) const const KeyFunction &key = inputManager.getKey(index); for (size_t i = 0; i < KeyFunctionSize; i ++) { - const KeyItem &val = key.values[i]; + const InputItem &val = key.values[i]; if (val.type != InputType::JOYSTICK) continue; const int value = val.value; diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index 7642e260c..a8949e84a 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -193,7 +193,7 @@ bool KeyboardConfig::isActionActive(const int index) const const KeyFunction &key = inputManager.getKey(index); for (size_t i = 0; i < KeyFunctionSize; i ++) { - const KeyItem &val = key.values[i]; + const InputItem &val = key.values[i]; if (val.type != InputType::KEYBOARD) continue; diff --git a/src/input/keyfunction.h b/src/input/keyfunction.h index 2376e4da5..22d8e358f 100644 --- a/src/input/keyfunction.h +++ b/src/input/keyfunction.h @@ -21,7 +21,7 @@ #ifndef INPUT_KEYFUNCTION_H #define INPUT_KEYFUNCTION_H -#include "input/keyitem.h" +#include "input/inputitem.h" #include "localconsts.h" @@ -29,7 +29,7 @@ const unsigned int KeyFunctionSize = 3; struct KeyFunction final { - KeyItem values[KeyFunctionSize]; + InputItem values[KeyFunctionSize]; }; #endif // INPUT_KEYFUNCTION_H |