SDL_PumpEvents without SDL_PollEvent |
mediata
|
Hello,
I am reading documentation about SDL_PumpEvents. And it is unclear if I only call SDL_PumpEvents without SDL_PollEvent is there a chance that Event query will be full or SDL save only last event happen for exact device. The documentation is uncleared when i want only to PumpEvents not to handle it because some system events are handled in Events System of SDL. https://wiki.libsdl.org/SDL_PumpEvents - this is document i read. Best Regards. |
|||||||||||
|
Re: SDL_PumpEvents without SDL_PollEvent |
mediata
|
And program crash for full queue. |
|||||||||||||
|
SDL_PumpEvents without SDL_PollEvent |
Ryan C. Gordon
Guest
|
On 8/4/16 3:46 AM, mediata wrote:
You'll need to call SDL_PollEvent eventually to drain the queue; with a few exceptions, we don't discard old events in the queue when new ones arrive. If you need to check events in multiple places and are concerned that one place will cause the other to lose events, pick one place to do SDL_PollEvent() and the other can use SDL_AddEventWatch() to see events as they enter the queue. If you don't care about the events _at all_ and just want the queue to not overflow, just put this in some place that runs once per frame: SDL_Event e; while (SDL_PollEvent(&e)) { /* do nothing, empty the queue. */ } The queue will hold up to 65535 events, but this goes quickly when you aren't emptying it every frame. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|