MouseSpeed

BlitzMax Forums/BlitzMax Beginners Area/MouseSpeed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Graphics 640,480,0
SetBlend ALPHABLEND
Repeat 
cls
	xsp:Int = mousespeed_x()
	ysp:Int = mousespeed_y()

	SetColor 0,0,200
	DrawRect 100,98,xsp*2,16
	DrawRect 100,128,ysp*2,16
	SetColor 255,255,0
	DrawText "Xspeed: "+xsp,100,100
	DrawText "Yspeed: "+ysp,100,130
	
Flip
Until MouseDown(1)

Function mousespeed_x()
	Global oldx#
		newx# = MouseX()
		speed# = oldx#-newX#
		oldx# = newx#
	Return Abs(speed)
End Function 

Function mousespeed_y()
	Global oldy#
		newy# = Mousey()
		speed# = oldy#-newy#
		oldy# = newy#
	Return Abs(speed)
End Function