Mouse sensitivity?

BlitzMax Forums/BlitzMax Beginners Area/Mouse sensitivity?

Eric Vaughn(Posted 2006) [#1]
Hi there,

I was wondering if there is a way to set the sensitivity of the mouse in a blitzmax app. Right now, I think it is based on Windows' sensitivity/speed, and I want to be able to set it with my program.

Any ideas?


Brendane(Posted 2006) [#2]
You can change the windows system parameters... like so..

SuperStrict

Import pub.win32

Extern "win32"
 Function SystemParametersInfo:Int( uiAction:Int, uiParam:Int, pvParam:Int, fWinIni:Int ) = "SystemParametersInfoA@16"
End Extern


Graphics 800,600

Const SPI_GETMOUSESPEED:Int = $70
Const SPI_SETMOUSESPEED:Int = $71
Global currentMouseSpeed:Int

' Store the current mouse speed so we can reset it before closing
SystemParametersInfo( SPI_GETMOUSESPEED, 0, Int Varptr currentMouseSpeed, 0 )

' Change the mouse speed (ranges between 1 and 20)
SystemParametersInfo( SPI_SETMOUSESPEED, 0, 1, 0 )


While Not KeyHit( KEY_ESCAPE )
	Cls
	DrawText "Sloooooooow mouse. Escape to reset it and end.", 10, 30
	Flip
Wend

' Reset the original mouse speed
SystemParametersInfo( SPI_SETMOUSESPEED, 0, currentMouseSpeed, 0 )


Not very nice for the user though.

Your ideal thing to do is to get the current speed of the mouse and then use a multiplier in your own code to force a fixed (and controllable) rate.


tonyg(Posted 2006) [#3]
Changing Mouse Sensitivity