Doc: MouseX( )

MouseX - get the horizontal mouse cursor position on the game screen.

Syntax

xPos = MouseX( )

  • xPos : horizontal position of the mouse cursor on the game screen.

Explanation

MouseX() gets the horizontal mouse cursor position on the game screen.

If your game is running in windowed mode and the mouse goes horizontally out of the window, MouseX() will return the horizontal position of the mouse just before it left the game window.

Examples

Get the Mouse Cursor Position

The example code below gets and displays the mouse cursor position.

SetFPS 60

Do
    Cls 0
        Print "MouseX : " + Str$( MouseX() )
        Print "MouseY : " + Str$( MouseY() )
    Sync
Loop

Related Pages

Functions

Categories: Functions : Input : Mouse