sdlGetScancodeFromKey function

int sdlGetScancodeFromKey(
  1. int key,
  2. Pointer<Uint16> modstate
)

Get the scancode corresponding to the given key code according to the current keyboard layout.

Note that there may be multiple scancode+modifier states that can generate this keycode, this will just return the first one found.

\param key the desired SDL_Keycode to query. \param modstate a pointer to the modifier state that would be used when the scancode generates this key, may be NULL. \returns the SDL_Scancode that corresponds to the given SDL_Keycode.

\threadsafety This function is not thread safe.

\since This function is available since SDL 3.1.3.

\sa SDL_GetKeyFromScancode \sa SDL_GetScancodeName

extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate)

Implementation

int sdlGetScancodeFromKey(int key, Pointer<Uint16> modstate) {
  final sdlGetScancodeFromKeyLookupFunction = libSdl3.lookupFunction<
      Int32 Function(Uint32 key, Pointer<Uint16> modstate),
      int Function(
          int key, Pointer<Uint16> modstate)>('SDL_GetScancodeFromKey');
  return sdlGetScancodeFromKeyLookupFunction(key, modstate);
}