SDL_HasEvents(3)
π SDL_HasEvents β a page from the SDL3 FUNCTIONS manual π
okay bestie, sit down, hydrate, and let's talk about SDL_HasEvents π«Ά this is a whole function from the SDL3 FUNCTIONS section of the manual and it's lowkey one of the most useful little vibe checks in the whole event system. let's get into it β¨
πΈ NAME πΈ
SDL_HasEvents β check for the existence of certain event types in the event queue. like, is anybody home in there?? π
π SYNOPSIS π
#include <SDL3/SDL_events.h>
bool SDL_HasEvents(Uint32 minType, Uint32 maxType);
that's it. that's the whole thing. two Uint32 args, one bool out. iconic π
π¦ DESCRIPTION π¦
so basically you're asking the event queue: "hey, do you have any events whose type falls between these two numbers?" and it tells you yes or no. no popping them off, no consuming them, just a peek. a little gossip session with the queue π
and listen β if you only need to check for a single event type, don't do the whole range thing, just use SDL_HasEvent() instead. it's giving "use the right tool" energy fr fr π
β FUNCTION PARAMETERS β
minTypeβ the low end of event type to be queried, inclusive. meaning if an event's type equalsminTypeexactly, it totally counts. seeSDL_EventTypefor the details πmaxTypeβ the high end of event type to be queried, inclusive. same deal, the boundary itself is included. again, seeSDL_EventTypefor details π
so like, the range is minType <= type <= maxType, both ends invited to the party π
π₯ RETURN VALUE π₯
returns true if events with type >= minType and <= maxType are present. returns false if not. that's the whole story, no cap π―
π§ THREAD SAFETY π§
it is safe to call this function from any thread. yes, ANY. go wild, bestie, no locks required, no anxiety, no "wait should I be doing this here" spiral πβ¨
π AVAILABILITY π
this function is available since SDL 3.2.0. if you're on something older than that, sorry babe, she's not there yet π
π SEE ALSO π
β οΈ real talk: this only checks. it does not remove, consume, or drain anything from the queue. peeking is not popping, and the events will still be sitting there waiting for you. handle them, don't just stare at them π
and that's the page!! Simple Directmedia Layer, SDL 3.4.18, dated SDL_HasEvents(3) β love her, know her, use her responsibly ππ bye bestie, go check those events π¦
π¦ 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