Code archives/Miscellaneous/MouseXSpeed() / MouseYSpeed()
This code has been declared by its author to be Public Domain code.
Download source code
| I miss simple pleasures like MouseXSpeed so I knocked this up. I'll be doing a few more things like this to make my life easier in BMax. EDIT: Just realized it's all integers so I took out all the Floats. |
'MouseSpeed Setup Global MouseXSpeed:Int 'MouseXSpeed() Component Global MouseYSpeed:Int 'MouseYSpeed() Component Global CenterX:Int = GraphicsWidth() / 2 'Find CenterX Global CenterY:Int = GraphicsHeight() / 2 'Find CenterY MoveMouse CenterX,CenterY 'Move Mouse to Center of Screen Function MouseSpeed() Local XM:Int = MouseX() Local YM:Int = MouseY() MouseXSpeed = XM - CenterX MouseYSpeed = YM - CenterY MoveMouse CenterX,CenterY End Function |