[SDL] SDL mouse events.

Lucas lucas_pet at live.co.uk
Mon Mar 17 09:39:17 PDT 2008


As I see it now its like this on WinXP
Mouse motion events are put on the queue at a maximum rate of the rate you 
call  SDL_PumpEvents().
I expect relative mouse events to be relative to the last mouse event on the 
queue (and not relative to the last 'hardware' sample)
but I haven't tested this yet.
So calling SLD_PumpEvents() at the rate of your framerate or disabling mouse 
events and calling SDL_GetMouseState should keep the queue from filling up.

Did I understand this correctly?

I don't know why key events can exceed the max rate.


"Sam Lantinga" <slouken at devolution.com> wrote in message 
news:E1JbHi4-0000dP-2j at seras.devolution.com...
>> Hmmm. Does this mean that in 1.3 the mouse input is still gathered using
>> a thread? This is one of my biggest gripes with 1.2. The problem is that
>> if your input gathering rate differs from your game's framerate (which
>> it almost always will), you get beats in the mouse input.
>
> SDL doesn't have an event thred by default.  I think what you're seeing
> is Windows collapsing mouse motion events in the event queue if you don't
> process them fast enough.
>
> SDL 1.2 uses the non-DirectX code by default, for the best compatibility,
> but you're welcome to try out the DirectX driver 
> (putenv("SDL_VIDEODRIVER=directx")),
> which uses DirectInput, and see if that improves things.
>
> See ya!
> -Sam Lantinga, Lead Software Engineer, Blizzard Entertainment 





More information about the SDL mailing list