I’m asking this because I saw someone say on another forum that it wasn’t good but I personally don’t see how to handle window closing with ‘SDL_PumpEvents’.
My execution loop roughly looks like this:
running = event.type != SDL_QUIT;
SDL_PumpEvents() so there’s no need to do it yourself.
I don’t know the context of that post in the other forum, but if it said that using
SDL_PollEvent() is bad, that’s nonsense.
SDL_PollEvent() to handle events (including SDL_QUIT, but also keyboard, mouse or joystick input and window events like size changed) is the standard way to handle input in SDL.
forgive my absence I had some problems, I may have expressed myself badly, what was said in this other forum is that the use of SDL_PollEvent + SDL_PumpEvents (the two together) was “bad” but I understand why thanks to @sjr’s answer.
In another thread, he set up event handlers.
After calling it, you do, for example:
if (Quit) do something …