Browse Source

Fix Input::getKeyCode on software keyboard layouts

Input::getAscii goes Torque keyCode -> SDL Scancode -> SDL Keycode -> SDL ascii key name
Input::getKeycode used to be SDL ascii key name -> SDL Scancode -> Torque keyCode

This mismatch made software keyboard layouts behave incorrectly in different places. For example, you would bind a key to an ActionMap and it would activate with a different button than specified.
Glenn Smith 6 years ago
parent
commit
a78235dd06
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Engine/source/platformSDL/sdlInput.cpp

+ 2 - 2
Engine/source/platformSDL/sdlInput.cpp

@@ -118,7 +118,7 @@ U16 Input::getKeyCode( U16 asciiCode )
     char c[2];
     c[0]= asciiCode;
     c[1] = NULL;
-    return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromName( c ) );
+    return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromKey( SDL_GetKeyFromName(c) ) );
 }
 
 //------------------------------------------------------------------------------
@@ -435,4 +435,4 @@ U32 KeyMapSDL::getSDLScanCodeFromTorque(U32 torque)
       buildScanCodeArray();
 
    return T3D_SDL[torque];
-}
+}