SDL_KeyboardEvent.3type - Man Page
Keyboard button event structure (event.key.*)
Header File
Defined in SDL3/SDL_events.h
Synopsis
#include "SDL3/SDL.h" typedef struct SDL_KeyboardEvent { SDL_EventType type; /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */ Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with keyboard focus, if any */ SDL_KeyboardID which; /**< The keyboard instance id, or 0 if unknown or virtual */ SDL_Scancode scancode; /**< SDL physical key code */ SDL_Keycode key; /**< SDL virtual key code */ SDL_Keymod mod; /**< current key modifiers */ Uint16 raw; /**< The platform dependent scancode for this event */ bool down; /**< true if the key is pressed */ bool repeat; /**< true if this is a key repeat */ } SDL_KeyboardEvent;
Description
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 ().
Availability
This struct is available since SDL 3.2.0.
See Also
·(3), SDL_GetKeyFromScancode(3), ·(3), SDL_HINT_KEYCODE_OPTIONS(3)
Info
SDL 3.2.2 Simple Directmedia Layer SDL3 DATATYPES