MouseSpeed Functions added to polledinput.bmx

BlitzMax Forums/BlitzMax Module Tweaks/MouseSpeed Functions added to polledinput.bmx

klepto2(Posted 2005) [#1]
Maybe this should make the way the official polledinput.bmx

I have added 3 new Function:
MouseXSpeed
MouseYSpeed
MouseZSpeed

These things have to be changed in polledinput.bmx:

First:

Change Line 27 from :
Global mouseStates[4],mouseHits[4],mouseLocation[4]

to :
Global mouseStates[4],mouseHits[4],mouseLocation[4],oldmouseLocation[4]


Then append the following at the end of polledinput.bmx :

Function MouseXSpeed()
	Local SpeedX = MouseLocation[0]-OldMouseLocation[0]
	OldMouseLocation[0] = MouseLocation[0]
	Return SpeedX
End Function

Function MouseYSpeed()
	Local SpeedY = MouseLocation[1]-OldMouseLocation[1]
	OldMouseLocation[1] = MouseLocation[1]
	Return SpeedY
End Function

Function MouseZSpeed()
	Local SpeedZ = MouseLocation[2]-OldMouseLocation[2]
	OldMouseLocation[2] = MouseLocation[2]
	Return SpeedZ
End Function


Rebuild the module (MinGW or similar needed) :
bmk makemods -r brl.polledinput
bmk makemods -d brl.polledinput