dxMouseX%()

Parameters

None

Description

This command returns the X location of the mouse on the screen. This position is always from the range 0 to dxGraphicsWidth( ) - 1. You can use this command in combination with DrawImage to make a custom mouse pointer, or to control something on the screen directly with the mouse.

See also: dxMouseY, dxMouseZ.

Example

Graphics 640,480

dxSetBuffer dxBackBuffer()

Repeat
dxCls

dxText 320,0,"Click to reset mouse",True

dxText 0,0,"Mouse X:"+dxMouseX()
dxText 0,10,"Mouse Y:"+dxMouseY()

If dxMouseDown(1) Or dxMouseDown(2) Then dxMoveMouse 320,240

dxText dxMouseX(),dxMouseY(),"X",True,True

dxFlip

Until dxKeyHit(1)

End

Index