Mouse Input

Mouse input is accepted on all platforms (on mobile devices it is accepted as a single screen touch - if you need to use multi-touch, you should be using the device-specific functions) and has a few constants that are used to specify the buttons being pressed. These constants are shown in the following table:

Mouse Button Constant
Constant Description
mb_left The left mouse button
mb_middle The middle mouse button (this may not be valid for all target platforms)
mb_right The right mouse button
mb_side1* Mouse side button 1
mb_side2* Mouse side button 2
mb_any Any of the mouse buttons
mb_none No mouse button

* NOTE The mb_side1 and mb_side2 buttons are only for use on Windows, macOS, Ubuntu and HTML5.

The following functions exist for the standard mouse button controls:

 

There are also a set of window functions related to using the mouse on desktop targets:

Mouse Coordinates

You can get the coordinates of the mouse within the room using mouse_x and mouse_y. There are also functions for getting the raw or GUI mouse coordinates, please see Device Input.

Mouse coordinates are updated every frame, however some platforms (such as macOS) use an event handler for capturing mouse position.

This means there may be frames where the mouse moved, but its position remained unchanged -- which would mean that there was no mouse event between the current and previous frame.

Due to this, you may encounter frames where the mouse coordinates are the same as the previous frame, depending on the platform.