Scroll to navigation

SDL_KeyboardEvent(3type) SDL3 DATATYPES SDL_KeyboardEvent(3type)

NAME

SDL_KeyboardEvent - 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.1.3.

SEE ALSO

(3), SDL_GetKeyFromScancode(3), (3), SDL_HINT_KEYCODE_OPTIONS(3)

SDL 3.1.6 Simple Directmedia Layer