window_mouse_get_locked

This function returns if the mouse is locked (true) or not (false).

 

Syntax:

window_mouse_get_locked();

 

Returns:

Boolean

 

Example:

 Step Event

if (window_mouse_get_locked())
{
    x += window_mouse_get_delta_x();
    y += window_mouse_get_delta_y();
}

Global Left Pressed Event

window_mouse_set_locked(true);

Global Left Released Event

window_mouse_set_locked(false);

The above code adds the change in mouse position to the instance's position while the left mouse button is held down.

In the Global Left Pressed and Global Left Released events, the mouse is set to locked and unlocked respectively, using window_mouse_set_locked.

In the Step event, the locked state of the mouse is checked using window_mouse_get_locked. If it is locked, the delta x (window_mouse_get_delta_x) and y (window_mouse_get_delta_y) are added to the instance's x and y.