Function SDL_GetScancodeFromKey

pub unsafe extern "C" fn SDL_GetScancodeFromKey(
    key: u32,
    modstate: *mut u16,
) -> SDL_Scancode
Available on crate feature dep_sdl3 only.
Expand description

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.

§Parameters

  • key: the desired SDL_Keycode to query.
  • modstate: a pointer to the modifier state that would be used when the scancode generates this key, may be NULL.

§Return value

Returns the SDL_Scancode that corresponds to the given SDL_Keycode.

§Thread safety

This function is not thread safe.

§Availability

This function is available since SDL 3.2.0.

§See also