此函数会返回鼠标是否已 锁定 (true) 或未锁定 (false)。
window_mouse_get_locked();
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);
上面的代码在按住鼠标左键的同时将鼠标位置的 更改 添加到实例的位置。
在全局左按下和全局左释放事件中,使用 window_mouse_set_locked 将鼠标分别设置为锁定和解锁。
在 Step 事件中,使用 window_mouse_get_locked 检查鼠标的锁定状态。如果它被锁定,则增量 x( window_mouse_get_delta_x ) 和 y( window_mouse_get_delta_y ) 将添加到实例的 x 和 y 中。