From d19a484de0e76acf2cbe62bcd0aaaf0021f3964f Mon Sep 17 00:00:00 2001 From: cpasjuste Date: Mon, 27 Apr 2020 12:03:02 +0200 Subject: inputmanager: fix joystick key 0 not assignable from inputactionmap (SDL_SCANCODE_UNKNOWN check on joystick button 0 is always true) --- src/input/inputmanager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2