Changing mouse sensitivity

BlitzMax Forums/BlitzMax Programming/Changing mouse sensitivity

I'm wanting to change the sensitivity of the mouse in a game. In other words, lowering the sensitivity will require bigger mouse movement to move the pointer the same amount and raising the sensitivity will require less mouse movement to move the pointer. I have come up with a program posted here.
Strict

Const Width:Int = 800
Const Height:Int = 600
Const CenterX:Int = Width / 2
Const CenterY:Int = Height / 2

Graphics Width,Height,32
InitMouse()
Repeat
 Cls
 DrawText "UP/DOWN arrows to change sensitivity.", 10,10
 DrawText GetMouseSensitivity(),10,30
 DrawOval GetMouseX()-8,GetMouseY()-8,16,16
 If KeyHit(KEY_UP) SetMouseSensitivity(GetMouseSensitivity() + .1)
 If KeyHit(KEY_DOWN) SetMouseSensitivity(GetMouseSensitivity() - .1)
 Flip 1
Until KeyHit(KEY_ESCAPE)

 

Global MousePosX:Int
Global MousePosY:Int
Global MouseSensitivity:Float


Function InitMouse()
 MousePosX = CenterX
 MousePosY = CenterY
 HideMouse()
 MoveMouse(CenterX,CenterY)
 MouseSensitivity = 1.0
End Function

Function SetMouseSensitivity(Sensitivity:Float)
 MouseSensitivity = Sensitivity
End Function

Function GetMouseSensitivity:Float()
 Return MouseSensitivity
End Function

Function UpdateMouse()
 MousePosX :+ (MouseX() - CenterX) * MouseSensitivity
 MousePosY :+ (MouseY() - CenterY) * MouseSensitivity
 If MousePosX < 0 Then MousePosX = 0
 If MousePosX > Width - 1 Then MousePosX = Width - 1
 If MousePosY < 0 Then MousePosY = 0
 If MousePosY > Height - 1 Then MousePosY = Height - 1
 MoveMouse(CenterX,CenterY)
End Function

Function GetMouseX:Int()
 UpdateMouse()
 Return MousePosX
End Function

Function GetMouseY:Int()
 UpdateMouse()
 Return MousePosY
End Function
 

This will work. It'll even reverse the mouse movement if you set the sensitivity to a negative value. Is this a good way to do it or is there a better way?