13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

lVINDOW statementFunctionSyntaxRemarksWINDOW defines the graphics coordinate system.WINDOW [[SCREEN] (xl,yl) - (x2,y2)](xl,yl) and (x2,y2) are two single-precision coordinate pairs. (xl,yl)represent the lower left-hand portion of the screen, while· (x2,y2)represent the upper right-hand portion of the screen.If you don't like <strong>Turbo</strong> <strong>Basic</strong>'s standard 0 to 319 (or 0 to 639), 0 to199, origin-at-top-Ieft method of addressing the graphics screen, theWINDOW statement allows you to do it your way.The WINDOW statement translates arbitrary "world" coordinates(which may be a more. natural way for your program toexpress locations) into "physical" coordinates (the addresses of thedisplay's pixels).One application for WINDOW is to remap the display to correspondto the screen coordinates used by a different computersystem. For example, the Apple II graphic display consists of 280pixels horizontally by 192 pixels vertically. This WINDOW statementWINDOW SCREEN (0,0) - (279,191)causes the PC's display to use the same· addressing scheme. Afterexecuting this statement, a program migrated from an Apple II thatattempts to plot the lower right-most pixel on the Apple II screen itwas written for. For example, PSET(279,191) turns on physical pixel319,199 (the PC's lower right-hand corner).As another example, suppose you are working with an applicationin which it is convenient to describe lines and other objects interms of coordinates much larger than the 0 to 199 and. 0 to 639allowed by standard screen addressing. In this sample application,suppose it would also be useful to have the origin in the center ofthe display, and to have positive y values become larger as youmove up from the origin, as they do in analytical geometry.The WINDOW statement allows you to treat the medium orhigh resolution graphics screen as though it were really arrangedthis way. WINDOW allows you to map the full range of singleprecisionnumbers to the display; for example:WINDOW(-1E6,1E6) - (1E6,-1E6)378<strong>Turbo</strong> <strong>Basic</strong> Owner's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!