events: Add a helper function to get the default keycode for a scancode
Add a helper function to get the keycode for a scancode from the default lookup table. Unlike SDL_GetKeyFromScancode(), this is not affected by the set keymap.
This commit is contained in:
parent
0e446c54bd
commit
d1858eb124
2 changed files with 14 additions and 0 deletions
|
@ -1137,6 +1137,17 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
|||
return keyboard->keymap[scancode];
|
||||
}
|
||||
|
||||
SDL_Keycode
|
||||
SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
|
||||
{
|
||||
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SDL_default_keymap[scancode];
|
||||
}
|
||||
|
||||
SDL_Scancode
|
||||
SDL_GetScancodeFromKey(SDL_Keycode key)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue