SDL_PumpEvents(3)
โจ SDL_PumpEvents โจ
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about SDL_PumpEvents โ the little function that keeps the event loop hydrated ๐ง
๐ NAME ๐
SDL_PumpEvents โ pump the event loop, gathering events from the input devices ๐ฎโจ๏ธ๐ฑ๏ธ
๐ธ SYNOPSIS ๐ธ
#include <SDL3/SDL_events.h>
void SDL_PumpEvents(void);
likeโฆ that's it. that's the whole thing. no args, no return value, just vibes โจ
๐ฆ DESCRIPTION ๐ฆ
so what does it actually do? this function updates the event queue and the internal input device state. two for one, slay ๐
SDL_PumpEvents() goes around gathering all the pending input info from your devices and drops it into the event queue. and here's the thing โ without calls to SDL_PumpEvents(), no events would ever get placed on the queue. literally none. the queue would just sit there empty, rotting, unbothered ๐ญ
now, most of the time you don't even have to think about it, because the need for calling SDL_PumpEvents() is hidden from you โ SDL_PollEvent() and SDL_WaitEvent() implicitly call SDL_PumpEvents() for you. they're the ones doing the heavy lifting behind the scenes, main character energy fr fr ๐
but โ and this is the part that matters โ if you are not polling or waiting for events (e.g. you are filtering them), then you must call SDL_PumpEvents() yourself to force an event queue update. no shortcuts, no autopilot, you gotta do it manually bestie ๐ซถ
๐ฅ THREAD SAFETY ๐ฅ
this function should only be called on the main thread. do not try it anywhere else, it's not giving multitasking, it's giving chaos ๐
โญ AVAILABILITY โญ
this function is available since SDL 3.2.0 ๐ so if you're on anything olderโฆ yeah no, upgrade babes.
๐ SEE ALSO ๐
and that's the whole page, bestie!! brought to you by Simple Directmedia Layer โ SDL 3.4.18 edition, the SDL_PumpEvents(3) era ๐ go forth and pump those events, ily, 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