Table of Contents

MOUSEX

X16

Defined in X16.BAS.

Returns the X position of the mouse pointer.

Function header

FUNCTION MOUSEX AS WORD () SHARED STATIC

Example

INCLUDE "x16.bas"
DIM btn AS BYTE
CALL MOUSEON()
PRINT "click left or middle button to get position"
PRINT "or right button to exit"
DO
  btn = MOUSEBTN()
  ' No button
  IF btn = 0 THEN CONTINUE DO
  ' Right button
  IF btn AND 2 THEN CALL MOUSEOFF() : END 
  ' Any other button(s)
  PRINT "x: "; MOUSEX(), "y: "; MOUSEY()
  ' Now wait until the button is released
  DO : LOOP UNTIL MOUSEBTN() = 0
LOOP WHILE 1

See also