WINDOW - QB64 Wiki

WINDOW

From QB64 Wiki

Revision as of 19:12, 25 October 2011 by Clippy (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The WINDOW graphics statement defines the coordinate dimensions of the current graphics viewport.


Syntax:

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:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page