[SDL] SDL event loop

Richard Schreyer rws_list at girr.org
Sun Jan 30 12:02:38 PST 2005


That depends on what you're doing.  If you are drawing an animation, and 
do an SDL_Flip() in that outer while loop, then it doesn't hurt to poll 
in this manner.

If your app is exclusively event driven (redrawing only on input), then 
you should use SDL_WaitEvent instead, which will block.

Richard Schreyer

Franki wrote:
> when we handle input like this:
> 
> SDL_Event event; 
> while (!done) {
>   while(SDL_PollEvent(&event)) {
>         .........
>   }
> }
> 
> do we keep polling for next event over and over? Isn't this a busy waiting if
> there are not frequent inputs? 






More information about the SDL mailing list