A function which returns information about the mouse, if present. The information returned depends upon the argument passed to ADVAL.
ADVAL positive argument
If the argument is positive, ADVAL returns a value related to the distance that the mouse has been moved.
- ADVAL(1) returns the distance travelled in the X-direction.
- ADVAL(2) returns the distance travelled in the Y-direction.
- ADVAL(3) returns the amount that the scroll-wheel has been rotated.
The value returned corresponds to the total distance travelled in a particular axis since the last time that axis was checked using ADVAL.
The X value increases as the mouse is moved right on a surface; the Y value increases as the mouse is moved up on a surface.
You should poll the mouse using a routine like the following:
mouseX%= 0 mouseY%= 0 REPEAT mouseX%= mouseX% + ADVAL(1) mouseY%= mouseY% + ADVAL(2) UNTIL FALSE
ADVAL zero argument
ADVAL(0) returns a value in the range 0 to 7 corresponding to the state of the three mouse buttons. You can check the state of individual buttons using the AND operator.
buttons%= ADVAL(0) leftPressed%= buttons% AND 1 rightPressed%= buttons% AND 2 middlePressed%= buttons% AND 4