[SDL] Erratic mouse movements

Lilith Calbridge lilith at dcccd.edu
Mon Dec 11 13:36:08 PST 2006


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.

Lilith

>>> On 12/11/2006 at 3:15 PM, in message
<1165871727.15152.7.camel at localhost.localdomain>, Ochal Christophe
<ochal at kefren.be> wrote:
> Hi,
> 
> On Mon, 2006-12-11 at 15:04 -0600, Lilith Calbridge wrote:
>> Just a possibility here but can you scale the return values on the
mouse
>> movements to bring them within a viable range?
> 
> I have no idea whatsoever how to do that, is there a function for
that?
> Did i quick search in the sdl api reference guide on "mouse" & the
> functions it returned don't seem to allow to specify this.
> 
>> Lilith
>> 
>> >>> On 12/11/2006 at 2:47 PM, in message
>> <1165870029.15152.3.camel at localhost.localdomain>, Ochal Christophe
>> <ochal at kefren.be> wrote:
>> > Hi,
>> > 
>> > I'm currently working with the mouse in a full screen setup, and
it
>> > seems the mouse is just about impossible to use, it seems the
>> > sensitivity of the thing is just way to high.
>> > 
>> > Is there a way to specify the sensitivity, or could i be facing a
bug
>> in
>> > my setup somewhere? (I'm running Win2k in Vmware-player, incase
>> that's a
>> > known problem area)
>> > 
>> > Cheers
>> > 
>> > 
>> > _______________________________________________
>> > SDL mailing list
>> > SDL at libsdl.org 
>> > http://www.libsdl.org/mailman/listinfo/sdl 
>> 
>> _______________________________________________
>> SDL mailing list
>> SDL at libsdl.org 
>> http://www.libsdl.org/mailman/listinfo/sdl 
>> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org 
> http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list