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.
This commit is contained in:
Glenn Smith 2019-01-10 04:15:22 -05:00 committed by GitHub
parent 1acd8eb7c3
commit c256ebdb5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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];
}
}