[SDL] Erratic mouse movements

Ochal Christophe ochal at kefren.be
Tue Dec 12 12:32:20 PST 2006


Hi,

On Mon, 2006-12-11 at 15:36 -0600, Lilith Calbridge wrote:
> Well, I'm looking at SDL_GetRelativeMouseState as the only mouse event
> of import here.  The x and y values returned are relative to the last
> time that the function was called.  So if you move the mouse in the x
> direction you get a delta-x value returned.  For the sake of simplicity
> we'll say it returns 100 but that's twice as much as you think it should
> be.  So you set 
> 
> delta-x /= 2;
> 
> to set delta-x to half of what it was.  You could divide by other
> numbers and perhaps floating point if you want a bit more control.  Same
> thing for the delta-y value.  
> 
> So, instead of using the value 100 you'd be using half that or 50.  You
> sometimes have to do some post processing with the values the SDL
> functions provide.

If i understand your explication correctly, that should only apply if i
were actively polling the mouse, right? At the moment i'm not polling
any events other then MOUSEBUTTONDOWN & MOUSEBUTTONUP, and the same code
in window mode seems to have no problems.

At the moment it's not that important tho, i'll look into this later-on.

Thx for the help tho ;)

Cheers





More information about the SDL mailing list