Difference between revisions of "SCREEN (statement)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 150: Line 150:
 
*{{KW|SCREEN (function)}}   
 
*{{KW|SCREEN (function)}}   
 
*{{KW|Screen Memory}}
 
*{{KW|Screen Memory}}
 
+
*{{KW|Screen Saver Programs}}
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Revision as of 21:08, 12 December 2010

The SCREEN statement sets the screen mode in a program. No SCREEN statement defaults program to SCREEN 0.


Qbasic & QB64 Syntax:
SCREEN mode% [, [CS]][, [active_page]][, [visual_page]]
QB64 only Syntax:
SCREEN imagehandle& [, , [active_page][, visual_page]]
SCREEN _LOADIMAGE(file$[, mode]) [, , [active_page][,visual_page]]
SCREEN _NEWIMAGE(wide&, high&[, 32]) [, , [active_page][,visual_page]]


Description

  • The mode values available today are 0 to 2 and 7 to 13 listed below.
  • Custom screen modes can be created using _NEWIMAGE or _LOADIMAGE in QB64.
  • CS value disables color when a value. DO NOT USE! Include the comma ONLY when using page flipping.
  • If the SCREEN mode supports pages, the Active page is the page to be worked on while visualpage is the one displayed.
  • A _DISPLAY statement can be used in QB64 to display an image that changes instead of page flipping or PCOPY.
  • A SCREEN statement that changes screen modes also clears the screen like CLS. Nothing on the screen is retained.
  • QB64 allows page flipping in ANY SCREEN mode listed.


SCREEN MODES AT A GLANCE

TEXT GRAPHICS Screen Rows Columns Width Height Colors 0 25/43/50 80/40 -------- 16/16 DAC 1 25 40 320 200 4 BG 2 25 80 640 200 2 ............................................... 7 25 40 320 200 16 DAC 8 25 80 640 200 16 9 25 80 640 350 16/64 DAC 10 25 80 640 350 4 11 30/60 80 640 480 2 12 30/60 80 640 480 16 13 25 40 320 200 256

SCREEN MODES
Screen mode 0 creates program Windows
  • SCREEN 0 (default) is a text only screen mode. 64 (VGA) colors with hi-intensity(blinking) colors 16 to 31. (DAC attrib 6, 8 to 15). 16 Background colors. No graphics are possible! Normally runs in a window. ALT-Enter switches from a window to fullscreen. To automatically run in fullscreen, use another Screen mode before using SCREEN 0. Can use PCOPY with up to 8 pages(0 to 7). Text is 25, 43 or 50 rows by 40 or 80 columns. Default is 25 by 80. See WIDTH.
  • All other available SCREEN modes can be text and graphics and are fullscreen only.
  • SCREEN 1 has 4 background color attributes. 0 = black, 1 = blue, 2 = green, 3 = grey. White foreground only. Text is 25 by 40. White graphics is 320 by 200.
  • SCREEN 2 is monochrome with black background and white foreground. Text is 25 by 80. White graphics 640 by 200.
  • SCREENs 3 to 6 are no longer supported on most computers! Using them will cause an error!
  • SCREEN 7 has 16 color attributes (DAC attrib. 8 to 15) with background colors. Text 25 rows by 40 columns. Graphics 320 columns by 200 rows. Can use 8 (0 to 7) pages for flipping or PCOPY.
  • SCREEN 8 has 16 color attributes with background. Text is 25 by 80. Graphics is 640 by 200.
  • SCREEN 9 has 64 DAC color hues for (DAC attrib. 6, 8 to 15) with background colors. Text is 25 by 80. Graphics is 640 by 350. Can use 2 (0 and 1) pages for flipping or PCOPY.
  • SCREEN 10 has 4 color attributes with black background. 1 = normal white, 2 = blinking white and 3 = bright white. Text is 25 by 80. Graphics is 640 by 350.
  • SCREEN 11 is monochrome with black background and white foreground. Text is 30 or 60 by 80. White graphics is 640 by 480. See WIDTH.
  • SCREEN 12 has 16 color attributes, black background. 256K possible color hues. Text is 30 or 60 by 80 columns. Graphics 640 by 480. See WIDTH.
  • SCREEN 13 has 256 color attributes, black background. 256K possible color hues. Text is 25 by 40. Graphics is 320 by 200.


Text Coordinates:
  • Are a minimum of 1 and the values given above are the maximums.
  • Text characters occupy a certain sized pixel box adjusted by WIDTH in some screen modes.
  • Text PRINT cursor positions can be read by CSRLIN and POS(0) to LOCATE text PRINTS.


Graphic Coordinates:
  • The minimum on screen graphics pixel coordinates are 0 for columns and rows in the top left corner.
  • Maximum pixel coordinates are one less than the maximum dimensions above because the pixel count starts at 0.
  • Graphic objects such as LINE, CIRCLE and DRAW can be placed partially off of the screen.
  • GET and PUT screen image operations MUST be located completely on the screen in Qbasic!


QB64 image handles:
  • SCREEN can also be used to display an image in it's own resolution using an image handle in QB64 only.
  • For file image screens that adopt image color settings use: _LOADIMAGE
  • To create custom screen modes or pages use: _NEWIMAGE
  • PUT can use _CLIP to set objects partially or fully off screen. GET can read objects off screen in QB64.


Examples

Example: Shows an example of each screenmode.

SCREEN 0 PRINT "This is SCREEN 0 - only text is allowed!" FOR S = 1 TO 13 IF S < 3 OR S > 6 THEN DO: SLEEP: LOOP UNTIL INKEY$ <> "" SCREEN S PRINT "This is SCREEN"; S; " - can use text and graphics!" IF S = 2 OR S = 11 THEN PRINT "Monochrome - no COLOR statements!" IF S = 10 THEN COLOR 2: PRINT "This SCREEN has only 4 colors. Black and 3 white: 2 blinks. CIRCLE (100,100), 50, 2 ELSE : CIRCLE (100,100), 100, S END IF END IF NEXT SLEEP SYSTEM

This is SCREEN 0 - only text is allowed!

Displays each SCREEN mode one at a time with a CIRCLE (except for SCREEN 0))


See Examples:

  • SAVEIMAGE (QB64 Image to Bitmap SUB by Galleon)


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page