summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-27 12:03:02 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-27 12:03:02 +0200
commitd19a484de0e76acf2cbe62bcd0aaaf0021f3964f (patch)
treec984a16dfd212318dbf8f791187e188f3f611624
parent6e9bf7b88a055247c01d4c25bfe172748aace9a6 (diff)
downloadmv-d19a484de0e76acf2cbe62bcd0aaaf0021f3964f.tar.gz
mv-d19a484de0e76acf2cbe62bcd0aaaf0021f3964f.tar.bz2
mv-d19a484de0e76acf2cbe62bcd0aaaf0021f3964f.tar.xz
mv-d19a484de0e76acf2cbe62bcd0aaaf0021f3964f.zip
inputmanager: fix joystick key 0 not assignable from inputactionmap (SDL_SCANCODE_UNKNOWN check on joystick button 0 is always true)
-rw-r--r--src/input/inputmanager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index f6e24f904..4d167589e 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -266,17 +266,21 @@ void InputManager::resetKey(const InputActionT i) restrict2
val1.type = kd.defaultType2;
#ifdef USE_SDL2
if (kd.defaultType1 == InputType::KEYBOARD)
+ {
val0.value = SDL_GetScancodeFromKey(kd.defaultValue1);
+ if (val0.value == SDL_SCANCODE_UNKNOWN)
+ val0.value = -1;
+ }
else
val0.value = kd.defaultValue1;
if (kd.defaultType2 == InputType::KEYBOARD)
+ {
val1.value = SDL_GetScancodeFromKey(kd.defaultValue2);
+ if (val1.value == SDL_SCANCODE_UNKNOWN)
+ val1.value = -1;
+ }
else
val1.value = kd.defaultValue2;
- if (val0.value == SDL_SCANCODE_UNKNOWN)
- val0.value = -1;
- if (val1.value == SDL_SCANCODE_UNKNOWN)
- val1.value = -1;
#else // USE_SDL2
val0.value = kd.defaultValue1;