Re: SDL_PumpEvents without SDL_PollEvent

"Ryan C. Gordon" <[email protected]>
Newsgroups gmane.comp.lib.sdl
Organization icculus.org
Message-ID <[email protected]>
On 8/4/16 3:46 AM, mediata wrote:
> 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.

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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.