From fe8eaac0bddd1d6416bf16abdb9206290fcced2f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Aug 2013 00:50:03 +0300 Subject: In SDL2 key configuration options add prefix "sdl2". This allow separate SDL1.2 and SDL2 keys in same config. --- src/inputmanager.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') 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]; -- cgit v1.2.3-70-g09d2