SDL_WaitEvent(3)
π€ SDL_WaitEvent(3) π€
okay bestie, we're in the SDL3 FUNCTIONS section of the manual and this one is literally just "chill until something happens" β¨
β¨ NAME β¨
SDL_WaitEvent β wait indefinitely for the next available event. like, no timer, no vibes check, just vibes. you sit there. you wait. π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_events.h>
bool SDL_WaitEvent(SDL_Event *event);
β¨ DESCRIPTION β¨
okay so here's the tea β β if event is not NULL, the next event gets removed from the queue and stored in the SDL_Event structure pointed to by event. it's giving "gimme the next one, I'll hold it" π
β οΈ important bestie!! because this function may implicitly call SDL_PumpEvents(), you can only call this function in the thread that initialized the video subsystem. do not try to be cute and call it from some random thread. that's not the move. π«π§΅
β¨ FUNCTION PARAMETERS β¨
eventβ theSDL_Eventstructure to be filled in with the next event from the queue, orNULL. that's it. that's the whole parameter. simple queen behaviour π
β¨ RETURN VALUE β¨
- returns
trueon success π - returns
falseif there was an error while waiting for events π
if you get false, call SDL_GetError() for more information β she will tell you what went wrong, fr fr.
β¨ THREAD SAFETY β¨
this function should only be called on the main thread. periodt. π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. so if you're on anything older, no she's not there yet, sorry babe π
β¨ SEE ALSO β¨
SDL_PollEvent(3)β for when you simply cannot commit to waitingSDL_PushEvent(3)β for when you're the one making events happenSDL_WaitEventTimeout(3)β waiting but with a deadline, main character with boundaries energy β°
and that's the whole page bestie!! this one came to you from Simple Directmedia Layer, running SDL 3.4.18 β go forth and wait for events responsibly, mwah ππ¦πΈ
π¦ 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