QBasic 1.1: POINT Function
Explanation
POINT Function
Returns the current graphics cursor coordinates or the color attribute of a specified pixel.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
Description / Parameter(s)
(n%) |
Indicates the type of coordinate to return: |
|
n% | Returns |
0 | The current viewport x coordinate |
1 | The current viewport y coordinate |
2 | The current window x coordinate |
3 | The current window y coordinate |
|
(x%,y%) |
The coordinates of the pixel that POINT checks for color. If the coordinates are outside the current viewport, POINT returns -1. |
Example
'This example requires a color graphics adapter.
SCREEN 1
LINE (0, 0)-(100, 100), 2
LOCATE 14, 1
FOR y% = 1 TO 10
FOR x% = 1 TO 10
PRINT POINT(x%, y%);
NEXT x%
PRINT
NEXT y%