SDL_FlushEvents(3)

✨ SDL_FlushEvents ✨

okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_FlushEvents(3) πŸ’…


🌸 NAME 🌸

SDL_FlushEvents β€” clear events of a range of types from the event queue 🧹✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_events.h>

void SDL_FlushEvents(Uint32 minType, Uint32 maxType);

πŸ¦‹ DESCRIPTION πŸ¦‹

This will unconditionally remove any events from the queue that are in the range of minType to maxType, inclusive. no vibe check, no "hmm should i", it just yeets them. πŸ—‘οΈ

If you need to remove a single event type, use SDL_FlushEvent() instead β€” that's the solo version, this one is the group chat. πŸ’¬

ngl it's also completely normal to just ignore events you don't care about in your event loop without calling this function at all. like, living your life and simply not responding? valid. πŸ™ˆ

This function only affects currently queued events. So if you want to make sure that all pending OS events are flushed, you can call SDL_PumpEvents() on the main thread immediately before the flush call. pump first, then flush. that's the order, fr fr. πŸ”₯


πŸ’– FUNCTION PARAMETERS πŸ’–

  • minType β€” the low end of event type to be cleared, inclusive; see SDL_EventType for details. the bottom of the range, she's the floor 🫢
  • maxType β€” the high end of event type to be cleared, inclusive; see SDL_EventType for details. the top of the range, she's the ceiling πŸ‘‘

🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. literally any of them. go off, all your threads can do this πŸ’œ


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. if you're on something older... babe, we need to talk 😭


πŸ‘‘ SEE ALSO πŸ‘‘


Simple Directmedia Layer made this, and this lil doc is sitting on SDL 3.4.18 🌸 so yeah β€” mwah, kisses from the SDL 3.4.18 era, thanks for reading bestie, you ate this page fr fr πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from