SDL_PollEvent VS SDL_WaitEvent

This quesiton may sound silly :
what is the difference between SDL_PollEvent and SDL_WaitEvent?
When do I use SDL_PollEvent and when do I use SDL_WaitEvent?
Is there an efficiency issue here?

Thanks!

This quesiton may sound silly :
what is the difference between SDL_PollEvent and SDL_WaitEvent?
When do I use SDL_PollEvent and when do I use SDL_WaitEvent?
Is there an efficiency issue here?

SDL_PollEvent ? Polls for currently pending events.
SDL_WaitEvent ? Waits indefinitely for the next available event.

SDL_PollEvent is non-blocking, so you usually put that in your main loop
to handle user input, if there’s a possibility that there is none. You
would use this in a single-threaded program. (“Press any key to stop
this cool animation.”)

SDL_WaitEvent blocks; it doesn’t return until there is an event. So a
call to it will cause your program to wait if the user hasn’t pressed
any keys or moved the mouse or anything. (“Press any key to continue.”)

Will Childman wrote:> This quesiton may sound silly :

what is the difference between SDL_PollEvent and SDL_WaitEvent?
When do I use SDL_PollEvent and when do I use SDL_WaitEvent?
Is there an efficiency issue here?

Thanks!


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl