[SDL] SDL mouse events.

Bob Pendleton bob at pendleton.com
Fri Mar 7 13:19:58 PST 2008


On 3/7/08, Lucas <lucas_pet at live.co.uk> wrote:
>
> I use 'while(SDL_PollEvent...' to manage my mouse events and the following
> questions came to mind:


Yes, there can be many events of every type on the queue.

Can there be multiple event per type on the queue?
> If so, how many mouse events would there be on the queue if my program
> runs
> once every second and my mouse gets polled by windows at 500Hz(and moves
> randomly)? 500?


No, not quite 500, the queue is only 128 items long. Once the queue is full
SDL just discards any new events. That means you never have to process more
than 128 events at a time, but if you only check for events every second and
you can have 500 events pile up during a second, you will lose 372 events.
The best idea is to use SDL_WaitEvents() to process events as they come in.

      Bob Pendleton


Thanks.
>
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>



-- 

+ Bob Pendleton: writer and programmer
+ email: Bob at Pendleton.com
+ web: www.GameProgrammer.com
+ www.Wise2Food.com

+--------------------------------------+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080307/0a791d94/attachment.htm 


More information about the SDL mailing list