Mouse Object
The mouse object of Brutus2D is an object that contains useful functions for manipulating and reading the mouse.
Initialization
- mouse.Initialize - start the mouse object
- mouse.Terminate - kill the mouse object
Visibility
- mouse.Hide - hide the mouse cursor
- mouse.Show - show the mouse cursor
Current State
- mouse.X - x position of mouse within graphics window
- mouse.Y - y position of mouse within graphics window
- mouse.LeftButton - returns true if left mouse button is pressed
- mouse.MiddleButton - returns true if middle mouse button is pressed
- mouse.RightButton - returns true if right mouse button is pressed
- mouse.AnyButton - returns true if any mouse button is pressed
- mouse.SetPosXY - sets the position of the mouse
Movement
- mouse.Dx - change in mouse x value since last reading
- mouse.Dy - change in mouse y value since last reading
- mouse.Dz - change in mouse z value (the mouse wheel) since last reading
Miscellaneous
- mouse.Wait - halts program until a mouse button is pressed
- mouse.Update - update the values in the mouse object
Notes
- The mouse.Update method should be called repeatedly to update the mouse values. Place inside the main game loop.
- Coordinates used and returned by mouse.X, mouse.Y and mouse.SetPosXY do not correspond to your screen's coordinates when in windowed mode. This is because these coordinates are scaled relative to your window border. This issue can be resolved by using this mouse fix. There should be no such problems in full-screen mode.
- Contrary to many other programming languages Brutus2D keeps updating both mouse position and buttons even though the mouse cursor is out side your window (in windowed mode). This is also true even if your window does not have focus. This sometimes causes problems as mouse-clicks that are intended for other programs are also received in your program. See mouse fix for a work-around.
page_revision: 1, last_edited: 1214403429|%e %b %Y, %H:%M %Z (%O ago)