display_mouse_get_x

Returns the x coordinate of the mouse relative to the display.

Syntax:

GML Code Example

display_mouse_get_x();


Returns: Real


Description

This function will return the mouse x position within the screen. It should be noted that this function only works properly when used on the Windows target. It can be used for HTML5 too, but will only return a value relative to the 0,0 of the canvas itself, and will not return any value while the mouse is outside of the canvas. For other devices it will return 0, and you should use the device_mouse_raw_x and device_mouse_raw_y functions instead.


Example:

GML Code Example

my_x = display_mouse_get_x();

This would set my_x to the x coordinate of the mouse relative to the display.





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