sdlGetKeyFromScancode function
Get the key code corresponding to the given scancode according to the current keyboard layout.
If you want to get the keycode as it would be delivered in key events,
including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
pass key_event
as true. Otherwise this function simply translates the
scancode based on the given modifier state.
\param scancode the desired SDL_Scancode to query. \param modstate the modifier state to use when translating the scancode to a keycode. \param key_event true if the keycode will be used in key events. \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
\threadsafety This function is not thread safe.
\since This function is available since SDL 3.1.3.
\sa SDL_GetKeyName \sa SDL_GetScancodeFromKey
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event)
Implementation
int sdlGetKeyFromScancode(int scancode, int modstate, bool keyEvent) {
final sdlGetKeyFromScancodeLookupFunction = libSdl3.lookupFunction<
Uint32 Function(Int32 scancode, Uint16 modstate, Uint8 keyEvent),
int Function(
int scancode, int modstate, int keyEvent)>('SDL_GetKeyFromScancode');
return sdlGetKeyFromScancodeLookupFunction(
scancode, modstate, keyEvent ? 1 : 0);
}