table of contents
SDL_KeyboardEvent(3type) | SDL3 DATATYPES | SDL_KeyboardEvent(3type) |
NAME¶
SDL_KeyboardEvent - Keyboard button event structure (event.key.*)
SYNOPSIS¶
#include <SDL3/SDL_events.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¶
SDL 3.2.14 | Simple Directmedia Layer |