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
 
Uint8 state
 
Uint8 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 334 of file SDL_events.h.

Field Documentation

◆ key

SDL_Keycode SDL_KeyboardEvent::key

SDL virtual key code

Definition at line 342 of file SDL_events.h.

◆ mod

SDL_Keymod SDL_KeyboardEvent::mod

current key modifiers

Definition at line 343 of file SDL_events.h.

◆ raw

Uint16 SDL_KeyboardEvent::raw

The platform dependent scancode for this event

Definition at line 344 of file SDL_events.h.

◆ repeat

Uint8 SDL_KeyboardEvent::repeat

Non-zero if this is a key repeat

Definition at line 346 of file SDL_events.h.

◆ reserved

Uint32 SDL_KeyboardEvent::reserved

Definition at line 337 of file SDL_events.h.

◆ scancode

SDL_Scancode SDL_KeyboardEvent::scancode

SDL physical key code

Definition at line 341 of file SDL_events.h.

◆ state

Uint8 SDL_KeyboardEvent::state

SDL_PRESSED or SDL_RELEASED

Definition at line 345 of file SDL_events.h.

◆ timestamp

Uint64 SDL_KeyboardEvent::timestamp

In nanoseconds, populated using SDL_GetTicksNS()

Definition at line 338 of file SDL_events.h.

◆ type

SDL_EventType SDL_KeyboardEvent::type

SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP

Definition at line 336 of file SDL_events.h.

◆ which

SDL_KeyboardID SDL_KeyboardEvent::which

The keyboard instance id, or 0 if unknown or virtual

Definition at line 340 of file SDL_events.h.

◆ windowID

SDL_WindowID SDL_KeyboardEvent::windowID

The window with keyboard focus, if any

Definition at line 339 of file SDL_events.h.


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