diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 00:50:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:17 +0300 |
commit | fe8eaac0bddd1d6416bf16abdb9206290fcced2f (patch) | |
tree | 7356ee830cbcecf418c63f1222c741d0b0b1bb7e | |
parent | 076e2f4655c43e7dc79a01d576551942c7c3c057 (diff) | |
download | manaplus-fe8eaac0bddd1d6416bf16abdb9206290fcced2f.tar.gz manaplus-fe8eaac0bddd1d6416bf16abdb9206290fcced2f.tar.bz2 manaplus-fe8eaac0bddd1d6416bf16abdb9206290fcced2f.tar.xz manaplus-fe8eaac0bddd1d6416bf16abdb9206290fcced2f.zip |
In SDL2 key configuration options add prefix "sdl2".
This allow separate SDL1.2 and SDL2 keys in same config.
-rw-r--r-- | src/inputmanager.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 6e421498e..03aba6ecf 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -102,8 +102,12 @@ void InputManager::retrieve() { for (int i = 0; i < Input::KEY_TOTAL; i++) { - const char *const cf = keyData[i].configField; - if (*cf) +#ifdef USE_SDL2 + const std::string cf = std::string("sdl2") + keyData[i].configField; +#else + const std::string cf = keyData[i].configField; +#endif + if (!cf.empty()) { mNameMap[cf] = i; KeyFunction &kf = mKey[i]; @@ -153,8 +157,12 @@ void InputManager::store() const { for (int i = 0; i < Input::KEY_TOTAL; i++) { - const char *const cf = keyData[i].configField; - if (*cf) +#ifdef USE_SDL2 + const std::string cf = std::string("sdl2") + keyData[i].configField; +#else + const std::string cf = keyData[i].configField; +#endif + if (!cf.empty()) { std::string keyStr; const KeyFunction &kf = mKey[i]; |