Mouse Object

The mouse object of Brutus2D is an object that contains useful functions for manipulating and reading the mouse.

Initialization

Visibility

Current State

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 tags: input mouse object
page_revision: 1, last_edited: 1214403429|%e %b %Y, %H:%M %Z (%O ago)