SDL_UserEvent(3type)
π SDL_UserEvent β a datatype from the SDL3 crew π
okay bestie, pull up a chair, because today we're talking about SDL_UserEvent β the little struct that's literally yours to fill, aka the event.user.* of your dreams. π
β¨ NAME β¨
SDL_UserEvent β a user-defined event type, the one and only event.user.* π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_events.h>
typedef struct SDL_UserEvent
{
Uint32 type; /**< SDL_EVENT_USER through SDL_EVENT_LAST, Uint32 because these are not in the SDL_EventType enumeration */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
void *data2; /**< User defined data pointer */
} SDL_UserEvent;
she's structured, she's typed, she's got void *s so you can put whatever you want in there. main character energy fr. π
β¨ DESCRIPTION β¨
okay so here's the tea: this event is unique. SDL never makes it. not once. it's never created by SDL β only by you, the application. it's giving bespoke. it's giving handmade. β¨
you push it onto the event queue with SDL_PushEvent(), and then it's out there living its best life.
and the contents of the struct members? completely up to the programmer. go wild. put a pointer to your cat's medical records in there, idk, it's your world. π
the only requirement β and bestie I need you to hear me on this one β is thattypehas to be a value you got fromSDL_RegisterEvents(). that's it. that's the vibe check. don't skip it. π
β¨ AVAILABILITY β¨
this struct has been around since SDL 3.2.0. she's not new new, but she's not ancient either. iconic behavior. π¦
and that's the whole page, bestie!! π written by the Simple Directmedia Layer girlies, straight outta SDL 3.4.18, and yeah β it's still called SDL_UserEvent(3type) if you wanna look her up again. periodt. π
β¨πΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms