MouseUtils - TerraUI/TerraUI GitHub Wiki

MouseUtils

The MouseUtils static class is a utility class used to access the current state of the mouse.

Properties

State

  • Type: MouseState

A read-only value that retrieves the current mouse state (assigned by the last UIUtils.UpdateInput() call).

LastState

  • Type: MouseState

A read-only value that retrieves the last mouse state (assigned by the last UIUtils.UpdateInput() call).

Rectangle

  • Type: Rectangle

A read-only value that retrieves a Rectangle representing the current mouse position.

Position

  • Type: Vector2

A read-only value that retrieves a Vector2 representing the current mouse position.

Functions

UpdateState

Updates State and LastState. Call during some PreUpdate() function.

JustPressed

Calls UIUtils.GetButtonState to determine whether the given mouse button was just pressed.

JustReleased

Calls UIUtils.GetButtonState to determine whether the given mouse button was just released.

HeldDown

Calls UIUtils.GetButtonState to determine whether the given mouse button has been held down for more than one update cycle.

AnyButtonPressed

  • Return value: bool
  • Parameters: (optional) out MouseButtons

Checks if any mouse button has been pressed. If a parameter is given, it will be assigned to the first pressed button in the MouseButtons enumeration.

AnyButtonReleased

  • Return value: bool
  • Parameters: (optional) out MouseButtons

Checks if any mouse button has been released. If a parameter is given, it will be assigned to the first released button in the MouseButtons enumeration.

AnyButtonHeld

  • Return value: bool
  • Parameters: (optional) out MouseButtons

Checks if any mouse button has been held down. If a parameter is given, it will be assigned to the first held down button in the MouseButtons enumeration.