SDL_PushEvent(3)
π SDL_PushEvent(3) π
okay bestie, so this is a page from the SDL3 FUNCTIONS set β like, the official Unix manual vibes but make it cute. We're talking SDL_PushEvent, and no cap, it's exactly what it sounds like: you get to yeet your own event onto the queue. π¦
β¨ NAME β¨
SDL_PushEvent β Add an event to the event queue. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_events.h>
bool SDL_PushEvent(SDL_Event *event);
β¨ DESCRIPTION β¨
Okay so here's the tea, and it's actually kind of iconic: the event queue is a two-way communication channel. Not only can you read events off of it, but you, the user, can also push your own events onto it. Main character energy fr fr. π
event is a pointer to the event structure you wish to push onto the queue. The event gets copied into the queue, so once SDL_PushEvent() returns you can go ahead and dispose of the memory that event pointed to β it's not your problem anymore, she's independent now. π
Note: Pushing device input events onto the queue doesn't modify the state of the device within SDL. Like, you're just dropping a copy into the queue, you're not actually touching the device itself. No cap.
Note: Events pushed onto the queue withSDL_PushEvent()get passed through the event filter, but events added withSDL_PeepEvents()do NOT. Yes this is a real difference, yes it matters, remember it. π
For pushing application-specific events, please use SDL_RegisterEvents() to get an event type that doesn't conflict with other code that also wants its own custom event types. Sharing is caring but event type collisions are not the vibe. π«Ά
β¨ FUNCTION PARAMETERS β¨
eventβ theSDL_Eventto be added to the queue. π
β¨ RETURN VALUE β¨
Returns true on success, and false if the event was filtered or on failure. When it's giving failure, call SDL_GetError() for more info. A common reason for error is the event queue being full β she's at capacity, bestie, no room at the inn. π
β¨ THREAD SAFETY β¨
It is safe to call this function from any thread. Go off, multithreaded queen. π
β¨ AVAILABILITY β¨
This function is available since SDL 3.2.0. β
β¨ SEE ALSO β¨
and that's the whole page, babe πΈ this was brought to you by Simple Directmedia Layer, running SDL 3.4.18, and it's SDL_PushEvent(3) forever and ever, 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