SDL_KeyboardEvent

Keyboard button event structure (event.key.*)

The key is the base SDL_Keycode generated by pressing the scancode using the current keyboard layout, applying any options specified in SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the event scancode and modifiers directly from the keyboard layout, bypassing SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode().

\since This struct is available since SDL 3.2.0.

\sa SDL_GetKeyFromScancode \sa SDL_HINT_KEYCODE_OPTIONS

Members

Variables

down
bool down;

< true if the key is pressed

key
SDL_Keycode key;

< SDL virtual key code

mod
SDL_Keymod mod;

< current key modifiers

raw
Uint16 raw;

< The platform dependent scancode for this event

repeat
bool repeat;

< true if this is a key repeat

reserved
Uint32 reserved;
Undocumented in source.
scancode
SDL_Scancode scancode;

< SDL physical key code

timestamp
Uint64 timestamp;

< In nanoseconds, populated using SDL_GetTicksNS()

type
SDL_EventType type;

< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP

which
SDL_KeyboardID which;

< The keyboard instance id, or 0 if unknown or virtual

windowID
SDL_WindowID windowID;

< The window with keyboard focus, if any

Meta