SDL_KeyboardDeviceEvent(3type)

πŸ’– SDL_KeyboardDeviceEvent πŸ’–

okay bestie, welcome to the SDL3 DATATYPES corner of the group chat 🫢 this one is SDL_KeyboardDeviceEvent β€” the keyboard device event structure, aka the event.kdevice.* situation ✨


🌸 NAME 🌸

SDL_KeyboardDeviceEvent β€” Keyboard device event structure (event.kdevice.*) βŒ¨οΈπŸ’…


✨ SYNOPSIS ✨

like, first you gotta pull in the header, no cap:

#include <SDL3/SDL_events.h>

then here's the whole struct, character for character, because we do not mess with the facts:

typedef struct SDL_KeyboardDeviceEvent
{
    SDL_EventType type; /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_KeyboardID which;   /**< The keyboard instance id */
} SDL_KeyboardDeviceEvent;

the way that type is literally SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED?? iconic πŸŽ€

and timestamp is in nanoseconds, populated using SDL_GetTicksNS() β€” slay ⏱️

and which is the keyboard instance id, iykyk πŸ”‘


πŸ¦‹ AVAILABILITY πŸ¦‹

this struct is available since SDL 3.2.0 β€” so if you're on anything older, bestie, it's giving not found 😭


lowkey a whole vibe, highkey just a struct. but it's our struct now πŸ’œ

Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_KeyboardDeviceEvent(3type) β€” mwah, that's the whole page, periodt πŸ’…βœ¨ go forth and handle those keyboard device events, queen πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from