WINDOW
From QB64 Wiki
The WINDOW graphics statement defines the coordinate dimensions of the current graphics viewport.
- WINDOW [[SCREEN] (x1, y1)-(x2,y2)]
Description:
- The statement allows a program to create a custom graphic coordinate system independent of the SCREEN mode used.
- The coordinate values are defined as SINGLE precision values.
- If the SCREEN option is used, row values increase from top to bottom. Negative coordinates can be used to the screen center.
- If the SCREEN option is not used, row coordinates use the Cartesian system with highest row at top to lowest row at bottom.
- A VIEW statement can change the viewport area.
- All subsequent graphics statements will use the new coordinate system.
- If no statement parameters are used, the viewport area is disabled.
- Use CLS or CLS 1 to clear the active WINDOW view port area.
- RUN or a SCREEN statement will also disable the window viewport.
- Note: QB64 can create a custom sized window using _NEWIMAGE.
Example: Using a WINDOW to amplify circle sizes. PMAP finds the corresponding WINDOW co-ordinates.
SCREEN 12 WINDOW (0, 0)-(10, 10) 'uses Cartesian row co-ordinates PRINT "Click mouse to place a circle. Hit enter for next color." FOR clr = 1 TO 15 DO DO IF _MOUSEBUTTON(1) THEN x! = PMAP(_MOUSEX, 2) ' Convert mouse screen co-ordinates to window co-ordinates. y! = PMAP(_MOUSEY, 3) CIRCLE (x!, y!), .2, clr PAINT STEP(0, 0), clr END IF LOOP WHILE _MOUSEINPUT LOOP UNTIL INKEY$ = CHR$(13) NEXT
See also:
- PMAP
- VIEW (graphics view port)
- VIEW PRINT (text view port)
- _NEWIMAGE, _LOADIMAGE