SDL_KeyboardEvent - Keyboard button event structure (event.key.*)
Contents
Availability
This struct is available since SDL 3.2.0.
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 ().
Header File
Defined in SDL3/SDL_events.h
Name
SDL_KeyboardEvent - Keyboard button event structure (event.key.*)
See Also
•(3), SDL_GetKeyFromScancode(3), •(3), SDL_HINT_KEYCODE_OPTIONS(3) Simple Directmedia Layer SDL 3.2.10 SDL_KeyboardEvent(3type)
Synopsis
#include"SDL3/SDL.h"typedefstructSDL_KeyboardEvent{SDL_EventTypetype;/**<SDL_EVENT_KEY_DOWNorSDL_EVENT_KEY_UP*/Uint32reserved;Uint64timestamp;/**<Innanoseconds,populatedusingSDL_GetTicksNS()*/SDL_WindowIDwindowID;/**<Thewindowwithkeyboardfocus,ifany*/SDL_KeyboardIDwhich;/**<Thekeyboardinstanceid,or0ifunknownorvirtual*/SDL_Scancodescancode;/**<SDLphysicalkeycode*/SDL_Keycodekey;/**<SDLvirtualkeycode*/SDL_Keymodmod;/**<currentkeymodifiers*/Uint16raw;/**<Theplatformdependentscancodeforthisevent*/booldown;/**<trueifthekeyispressed*/boolrepeat;/**<trueifthisisakeyrepeat*/}SDL_KeyboardEvent;