SDL 3.0
SDL_KeyboardEvent Struct Reference

#include <SDL_events.h>

Data Fields

SDL_EventType type
 
Uint32 reserved
 
Uint64 timestamp
 
SDL_WindowID windowID
 
SDL_KeyboardID which
 
SDL_Scancode scancode
 
SDL_Keycode key
 
SDL_Keymod mod
 
Uint16 raw
 
bool down
 
bool repeat
 

Detailed Description

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.0.0.
See also
SDL_GetKeyFromScancode
SDL_HINT_KEYCODE_OPTIONS

Definition at line 319 of file SDL_events.h.

Field Documentation

◆ down

bool SDL_KeyboardEvent::down

true if the key is pressed

Definition at line 330 of file SDL_events.h.

◆ key

SDL_Keycode SDL_KeyboardEvent::key

SDL virtual key code

Definition at line 327 of file SDL_events.h.

◆ mod

SDL_Keymod SDL_KeyboardEvent::mod

current key modifiers

Definition at line 328 of file SDL_events.h.

◆ raw

Uint16 SDL_KeyboardEvent::raw

The platform dependent scancode for this event

Definition at line 329 of file SDL_events.h.

◆ repeat

bool SDL_KeyboardEvent::repeat

true if this is a key repeat

Definition at line 331 of file SDL_events.h.

◆ reserved

Uint32 SDL_KeyboardEvent::reserved

Definition at line 322 of file SDL_events.h.

◆ scancode

SDL_Scancode SDL_KeyboardEvent::scancode

SDL physical key code

Definition at line 326 of file SDL_events.h.

◆ timestamp

Uint64 SDL_KeyboardEvent::timestamp

In nanoseconds, populated using SDL_GetTicksNS()

Definition at line 323 of file SDL_events.h.

◆ type

SDL_EventType SDL_KeyboardEvent::type

SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP

Definition at line 321 of file SDL_events.h.

◆ which

SDL_KeyboardID SDL_KeyboardEvent::which

The keyboard instance id, or 0 if unknown or virtual

Definition at line 325 of file SDL_events.h.

◆ windowID

SDL_WindowID SDL_KeyboardEvent::windowID

The window with keyboard focus, if any

Definition at line 324 of file SDL_events.h.


The documentation for this struct was generated from the following file: