Code archives/User Input/MouseXSpeed(), MouseYSpeed()
This code has been declared by its author to be Public Domain code.
Download source code
| tMouse class for Blitzmax. Adds MouseXSpeed() and MouseYSpeed() functionality.|
You'll need to create a tMouse object at the start of your program. Then once per cycle, when you're done checking mouse stuff, called mouse.Update(). If you don't do this, further calls to mouse.MouseXSpeed() or mouse.MouseYSpeed() may give erratic results.
Graphics 640,480 Global mouse:tMouse = New tMouse While Not KeyDown(key_escape) Cls DrawText "Xspeed: "+ mouse.mouseXSpeed(),10,10 DrawText "Yspeed: " + mouse.mouseYSpeed(),10,25 mouse.update() Flip Wend Type tMouse Field lastX:Int Field lastY:Int Method mouseXSpeed:Int() Return MouseX() - lastX End Method Method mouseYSpeed:Int() Return MouseY() - lastY End Method Method update() lastx = MouseX() lasty = MouseY() End Method End Type
| Very usefull many thanks ! |
Code Archives Forum