window_mouse_set

Sets the position of the mouse in the window to the indicated values.

Syntax:

GML Code Example

window_mouse_set(x, y);


Argument Description
x The x coordinate in the window.
y The y coordinate in the window.


Returns:N/A


Description

With this function you can change or set the position of the mouse within the game window which can be useful for FPS games, for example. The function will only work while the game is in focus and using alt + tab will unlock the mouse.


Example:

GML Code Example

window_mouse_set(window_get_width() / 2, window_get_height() / 2);

The above code would center the mouse in the game window.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here