SDL_FlushEvent(3)
β¨ SDL_FlushEvent β¨
okay bestie, welcome to the SDL_FlushEvent(3) page from the SDL3 functions manual π this one's a lil baddie that clears out events of one specific type from the event queue. she's simple, she's iconic, let's get into it π«Ά
πΈ NAME πΈ
SDL_FlushEvent β Clear events of a specific type from the event queue. β¨
π SYNOPSIS π
#include <SDL3/SDL_events.h>
void SDL_FlushEvent(Uint32 type);
π¦ DESCRIPTION π¦
So like, this function will unconditionally remove any events from the queue that match type. No questions asked, no vibe check, they're just gone π
If you need to remove a range of event types instead of just one, use SDL_FlushEvents() instead β she's the group version, this one's the solo act π
ngl it's also totally normal to just ignore events you don't care about in your event loop without calling this function at all. like, you don't have to yeet them, sometimes you just look away π
important thing tho: this function only affects currently queued events. If you want to make sure that all pending OS events are flushed too, you can call SDL_PumpEvents() on the main thread immediately before the flush call β¨ like, pump first, then flush. order matters bestie π
and one more thing that's lowkey crucial: if you have user events with custom data that needs to be freed, you should use SDL_PeepEvents() to remove and clean up those events before calling this function. otherwise you're just leaking memory and that's not the vibe π clean up your room before you throw stuff out, periodt π
π FUNCTION PARAMETERS π
typeβ the type of event to be cleared; seeSDL_EventTypefor details. π
π THREAD SAFETY π
It is safe to call this function from any thread. yes bestie, any thread, she's flexible like that π β¨
β 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 π
and that's the whole page bestie!! π this came to you from the Simple Directmedia Layer girlies, rocking SDL 3.4.18, and it's literally called SDL_FlushEvent(3) in case you forgot already π mwah, go clear those events, ily πβ¨πΈ
π¦ 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