API Docs for:
Show:

gs.MouseInput Class

This class gives access to mouse or touch input. Mouse-buttons or mouse-position is automatically mapped to touch-input on touch-devices like smartphones. For example: A single tap counts as a left mouse-click and a double-tap counts as a right mouse-click.

Constructor

gs.MouseInput

() final static

Item Index

Methods

Properties

Methods

clear

() static

Clears the state of the mouse-buttons.

initialize

() static

Initializes the mouse/touch system. Needs to be called before any mouse/touch input can be received.

press

(
  • button
)
Boolean static

Checks if the specified mouse button is pressed.

Parameters:

  • button Number
    • The button to check.

Returns:

Boolean:

If true the button is pressed. Otherwise false

update

() static

Updates the mouse/touch input-system. Needs to be called once per frame.

Properties

buttonDown

Boolean static

Indicates if a mouse-button is currently down.

buttons

Uint8Array static

Stores the state of the mouse buttons.

buttonUp

Boolean static

Indicates if a mouse-button was held down before and is now up.

initialized

Boolean static

Indicates if the mouse-input system is initialized.

mouseMoveOnTouchDevices

Boolean static

Indicates if mouse-move should be supported for touch-devices.

Default: false

moved

Boolean static

Indicates if the mouse/touch pointer moved.

touchButtonsEnabled

Boolean static

Indicates if the invisible virtual touch-buttons are enabled. For more info about virtual buttons, see help-file.

Default: false

wheel

Number static

The current state of the mouse-wheel. Its the wheel-delta.

wheelChanged

Boolean static

Indicates if the mouse-wheel state has changed.

x

Number static

The x-coordinate of the mouse/touch pointer position.

y

Number static

The y-coordinate of the mouse/touch pointer position.