Mouse Cursor Guide
Mouse Cursor in Game Programming
The mouse cursor is the pointer with which you point. The mouse cursor has two components. The mouse cursor image itself and the position of the mouse cursor on the screen.
Mouse Cursor Image
Mouse Cursor Position
Check Mouse Cursor Position
SetFPS 60 Do Cls 0 Print "MouseX() : " Print MouseX() Print "" Print "MouseY() : " Print MouseY() Sync Loop
Check if Mouse Cursor is In Area
The code below checks to see if the mouse cursor is located in a rectangular area.
SetFPS 60 Do Cls 0 If MouseX() >= 200 and MouseX() <= 300 If MouseY() >= 200 and MouseY() <= 300 Print "Mouse in Rectangle" EndIf Endif Box 200,200,300,300, True Sync Loop
The code below checks to see if the mouse cursor is located in a circular area.
SetFPS 60 Do Cls 0 If GetDistance2D(MouseX(),MouseY(),200,200) <= 30 Print "Mouse in Circle" EndIf Circle 200,200,30,True Sync Loop