Difference between revisions of "SCREEN (statement)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
m (Text replacement - "{{Parameters}}" to "{{PageParameters}}")
 
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The {{KW|SCREEN (statement)|SCREEN}} statement sets the screen mode of a program. No statement defaults the program to {{KW|SCREEN (statement)|SCREEN}} 0 text mode.
+
{| align="Right"
 +
  | __TOC__
 +
  |}
 +
The [[SCREEN]] statement sets the video display mode and size of the program window's workspace.  
  
  
 +
{{PageSyntax}}
  
:''Qbasic & QB64 Syntax: {{KW|SCREEN (statement)|SCREEN}} mode% [, , active_page, visual_page]  
+
::: '''SCREEN''' {''mode%''|''imagehandle&''} [, , active_page, visual_page]  
  
  
* The SCREEN mode values available today are 0 to 2 and 7 to 13 listed below.  
+
{{PageParameters}}
* The empty comma disables color when any value is used. '''DO NOT USE!''' Include the comma ONLY when using page flipping.
+
* The SCREEN ''mode'' [[INTEGER]] values available are 0 to 2 and 7 to 13, as listed below.
* If the SCREEN mode supports pages, the Active page is the page to be worked on while visualpage is the one displayed.
+
* '''QB64''' can use a [[LONG]] [[_NEWIMAGE]] page or [[_LOADIMAGE]] file ''image handle'' value instead.
* A {{KW|SCREEN (statement)|SCREEN}} statement that changes screen modes also clears the screen like {{KW|CLS}}. Nothing on the screen is retained.
+
* The empty comma disables color when any value is used. Include the comma only when using page flipping.
* Some screen mode text sizes are adjustable with [[WIDTH]] and some support [[PCOPY]] and page flipping.  
+
* If the SCREEN mode supports pages, the ''active page'' is the page to be worked on while ''visual page'' is the one displayed.
  
{{WhiteStart}}                   '''LEGACY SCREEN MODES AT A GLANCE'''
+
 
                          TEXT           GRAPHICS
+
''Usage:''
              Screen   Rows  Columns  Width  Height   Colors
+
* No SCREEN statement in a program defaults to [[SCREEN]] 0 text ONLY mode.
                0  25/43/50 80/40       --------      16/16 DAC 
+
* A SCREEN statement that changes screen modes also clears the screen like [[CLS]]. Nothing on the screen is retained.
                1      25      40       320   200       4   BG  
+
* Some screen mode text sizes are adjustable with [[WIDTH]] and all '''QB54''' screens support [[PCOPY]] and page flipping.
                2      25      80       640   200       2  
+
 
              ...............................................  
+
{{WhiteStart}}                       '''LEGACY SCREEN MODES AT A GLANCE'''
                7      25      40       320   200       16   DAC
+
 
                8      25      80       640   200       16  
+
'''Screen      Text           Graphics          Colors      Video    Text      Default'''
                9      25      80       640   350     16/64 DAC  
+
  '''Mode   Rows  Columns  Width   Height Attrib.  BPP   Pages    Block    QB64 Font'''
                10      25      80       640   350       4  
+
 
                11    30/60    80       640   480       2  
+
  0  25/43/50 80/40   No graphics    16/16 DAC  4    0-7    -----   _FONT 16
                12    30/60    80       640    480      16  
+
  1      25      40     320     200     16/4 BG   4    none    8 X 8    _FONT 8
                13      25      40       320   200     256 '' ''
+
  2      25      80     640     200     2/mono    1    none    8 X 8    _FONT 8
 +
  .................................................................................  
 +
  7      25      40     320     200     16/16 DAC 4    0-7    8 X 8    _FONT 8
 +
  8      25      80     640     200     16/16     4    0-3    8 X 8    _FONT 8
 +
  9      25      80     640     350     16/64 DAC 4    0-1    8 X 14  _FONT 14
 +
  10      25      80     640     350     4/2 GScale 2    none    8 X 14  _FONT 14
 +
  11    30/60    80     640     480     2/mono    1    none    8 X 16  _FONT 16
 +
  12    30/60    80     640     480    16/262K   4    none    8 X 16  _FONT 16
 +
  13      25      40     320     200     256/65K    8    none    8 X 8    _FONT 8
 +
 
 +
              '''QB64 allows video paging and [[PCOPY]] in all screen modes.''' '' ''
 
{{WhiteEnd}}
 
{{WhiteEnd}}
  
 
:::::::::'''QB64 Custom Screen Modes'''
 
:::::::::'''QB64 Custom Screen Modes'''
:'''''QB64 only''' Syntax:''   {{KW|SCREEN (statement)|SCREEN}} ''imagehandle&'' [, , ''active_page'', ''visual_page'']
+
:'''QB64''' {{PageSyntax}}  
  
::::::{{KW|SCREEN (statement)|SCREEN}} [[_LOADIMAGE]](''file$''[, {''mode''|''256''|''32''}]) [, , ''active_page'', ''visual_page'']
+
::::::[[SCREEN]] ''imagehandle&'' [, , ''active_page'', ''visual_page'']
 +
 
 +
::::::[[SCREEN]] [[_NEWIMAGE]](''wide&'', ''high&''[, {''mode''|''256''|''32''}]) [, , ''active_page'', ''visual_page'']
 +
 
 +
::::::[[SCREEN]] [[_LOADIMAGE]](''file$''[, {''mode''|''256''|''32''}]) [, , ''active_page'', ''visual_page'']
  
::::::{{KW|SCREEN (statement)|SCREEN}} [[_NEWIMAGE]](''wide&'', ''high&''[, {''mode''|''256''|''32'']) [, , ''active_page'', ''visual_page'']
 
  
 
* Custom screen modes can be created using a [[_NEWIMAGE]] or [[_LOADIMAGE]] function ''imagehandle'' return value.  
 
* Custom screen modes can be created using a [[_NEWIMAGE]] or [[_LOADIMAGE]] function ''imagehandle'' return value.  
* [[_NEWIMAGE]] screens can be any set size. A screen mode can be imitated or 256 or 32 bit colors can be designated.
+
* '''QB64''' screen modes 0 to 2 and 7 to 13 can be emulated with the same color depth and text block size and different dimensions.
 +
* [[_NEWIMAGE]] screens can be any set size. A screen mode can be emulated or 256 or 32 bit colors can be designated.
 
* The [[_LOADIMAGE]] screen size will be the size of the image loaded. Can designate a ''mode'' or 256 or 32 bit colors.
 
* The [[_LOADIMAGE]] screen size will be the size of the image loaded. Can designate a ''mode'' or 256 or 32 bit colors.
* '''QB64''' allows page flipping or a [[PCOPY]] in ANY SCREEN mode.
+
* '''QB64''' allows page flipping or a [[PCOPY]] in ANY SCREEN mode. [[_DISPLAY]] can also be used to reduce flickering in animations.
 +
* All SCREEN modes are Windows in QB64. Use [[_FULLSCREEN]] to set the window area to full screen.
 +
* [[_SCREENMOVE]] can position a window or the _MIDDLE option can center it on the desktop.
 +
 
 +
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
 +
 
 +
==Legacy Screen Modes==
 +
 
 +
* '''[[SCREEN]] 0''' (default mode) is a '''text only''' screen mode. 64 (VGA) colors with hi-intensity (blinking) colors 16 to 31. ([[DAC]] attrib 6, 8 to 15). 8 Background colors intensities only(0 - 7). To enable high-intensity backgrounds, check [[_BLINK]]. No graphics are possible. Normally runs in a window. ALT-Enter switches from a window to fullscreen. Can use {{KW|PCOPY}} with video pages 0 to 7. Text is 25, 43 or 50 rows by 40 or 80 columns. Default is 25 by 80. See {{KW|WIDTH}}.
 +
 
 +
: '''Note:''' Use [[OUT]] or [[_PALETTECOLOR]] to create higher intensity color backgrounds than [[COLOR]] , 7.  See also [[_BLINK]]
 +
 
 +
:::'''All other available [[SCREEN]] modes can use text and graphics.'''
 +
 
 +
* '''[[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.          NO [[COLOR]] keyword allowed.
 +
 
 +
* '''[[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. Video  pages 0 to 7 for flipping or {{KW|PCOPY}}.
  
 +
* '''[[SCREEN]] 8''' has 16 color attributes with background. Text is 25 by 80. Graphics is 640 by 200. Video pages 0 to 3.
  
::::::::'''Qbasic and QB64 Legacy SCREEN Modes'''
+
* '''[[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. Video pages 0 and 1 for flipping or {{KW|PCOPY}}.
  
* '''{{KW|SCREEN (statement)|SCREEN}} 0''' (default mode) 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 {{KW|SCREEN (statement)|SCREEN}} 0.  Can use {{KW|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 {{KW|WIDTH}}.
+
* '''[[SCREEN]] 10''' has 4 gray scale 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.
  
:::* All other available {{KW|SCREEN (statement)|SCREEN}} modes can use text and graphics and are fullscreen in Qbasic ONLY.  
+
* '''[[SCREEN]] 11''' is '''monochrome''' with black background and white foreground. Text is 30 or 60 by 80 columns(see {{KW|WIDTH}}). White graphics is 640 by 480. NO [[COLOR]] keyword allowed.
  
* '''{{KW|SCREEN (statement)|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]] 12''' has 16 color attributes, black background. 256K possible color hues. Text is 30 or 60 by 80 columns(see {{KW|WIDTH}}). Graphics 640 by 480.  
  
* '''{{KW|SCREEN (statement)|SCREEN}} 2''' is '''monochrome''' with black background and white foreground. Text is 25 by 80. White graphics 640 by 200.
+
* '''[[SCREEN]] 13''' has 256 color attributes, black background. 256K possible color hues. Text is 25 by 40. Graphics is 320 by 200.  
 
* {{KW|SCREEN (statement)|SCREEN}}s 3 to 6 are '''no longer supported''' on most computers! Using them will cause an [[ERROR Codes|error]]!
 
  
* '''{{KW|SCREEN (statement)|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 {{KW|PCOPY}}.
 
  
* '''{{KW|SCREEN (statement)|SCREEN}} 8''' has 16 color attributes with background. Text is 25 by 80. Graphics is 640 by 200.
+
==Modern Syntax==
  
* '''{{KW|SCREEN (statement)|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 {{KW|PCOPY}}.  
+
* '''[[SCREEN]] [[_NEWIMAGE]]'''(wide&, deep&, mode%) can imitate any size screen mode or use 32 bit or 256 color modes in '''QB64'''.
  
* '''{{KW|SCREEN (statement)|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]] [[_LOADIMAGE]]'''(imagehandle&, colors) can load a program screen of an image file handle in '''QB64''' using 32-bit colors.  
  
* '''{{KW|SCREEN (statement)|SCREEN}} 11''' is '''monochrome''' with black background and white foreground. Text is 30 or 60 by 80. White graphics is 640 by 480. See {{KW|WIDTH}}.
 
  
* '''{{KW|SCREEN (statement)|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 {{KW|WIDTH}}.
+
<center>'''QB64 can use page flipping with any number of pages in any screen mode. Also, see [[_DISPLAY]]'''</center>
  
* '''{{KW|SCREEN (statement)|SCREEN}} 13''' has 256 color attributes, black background. 256K possible color hues. Text is 25 by 40. Graphics is 320 by 200.
+
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
 +
 
 +
==Text and Graphics==
  
  
 
:::::::::'''Text Coordinates:'''  
 
:::::::::'''Text Coordinates:'''  
  
* Are a minimum of 1 and the values given above are the maximums.
+
* [[LOCATE]] 1, 1 places the cursor at the top left [[SCREEN]] text position.
* Text characters occupy a certain sized pixel box adjusted by {{KW|WIDTH}} in some screen modes.
+
* Text characters occupy a certain sized pixel box adjusted by [[WIDTH]] in some screen modes.
* Text {{KW|PRINT}} cursor positions can be read by {{KW|CSRLIN}} and {{KW|POS|POS(0)}} to {{KW|LOCATE}} text {{KW|PRINT}}S.
+
* Text [[PRINT]] cursor positions can be read by {{KW|CSRLIN}} and {{KW|POS|POS(0)}} to [[LOCATE]] text [[PRINT]]s.
 +
* The [[SCREEN (function)]] can be used to read the [[ASCII]] character code or color of text in SCREEN 0 only.
 +
* [[VIEW PRINT]] can be used to designate a text view port area.
 +
* In '''QB64''' the [[_WIDTH (function)|_WIDTH]] and [[_HEIGHT]] functions will return the text block dimensions in SCREEN 0 only.
  
  
 
:::::::::'''Graphic Coordinates:'''
 
:::::::::'''Graphic Coordinates:'''
  
* The minimum on screen graphics pixel coordinates are 0 for columns and rows in the top left corner.
+
* Coordinate (0, 0) indicates the first top left corner pixel.
 
* Maximum pixel coordinates are one less than the maximum dimensions above because the pixel count starts at 0.
 
* Maximum pixel coordinates are one less than the maximum dimensions above because the pixel count starts at 0.
* Graphic objects such as {{KW|LINE}}, {{KW|CIRCLE}} and {{KW|DRAW}} can be placed partially off of the screen.
+
* Graphic objects such as [[PSET]], [[PRESET]], [[LINE]], [[CIRCLE]] and [[DRAW]] can be placed partially off screen.
* {{KW|GET (graphics statement)|GET}} and {{KW|PUT (graphics statement)|PUT}} screen image operations MUST be located completely on the screen in Qbasic!
+
* [[GET (graphics statement)|GET]] and [[PUT (graphics statement)|PUT]] screen image operations must be located completely on the screen, unless the '''_CLIP''' parameter is passed.
 +
* [[VIEW]] can be used to designate a graphic view port area of the screen.
 +
* [[WINDOW]] can be used to set the graphics SCREEN coordinates to almost any size needed. Use the SCREEN option for normal row coordinate values. Row coordinates are Cartesian (decrease in value going down the screen) otherwise.
 +
* In '''QB64''' the [[_WIDTH (function)|_WIDTH]] and [[_HEIGHT]] functions will return the graphic pixel dimensions in SCREENs other than 0.
  
  
 
:::::::'''QB64 Screen Statements and Functions:'''
 
:::::::'''QB64 Screen Statements and Functions:'''
  
* For file image screens that adopt the image dimensions and image color settings use: {{KW|_LOADIMAGE}}
+
* For file image screens that adopt the image dimensions and image color settings use: [[_LOADIMAGE]]
* To create custom sized screen modes or pages and 256 or 32 bit colors use: {{KW|_NEWIMAGE}}
+
* To create custom sized screen modes or pages and 256 or 32 bit colors use: [[_NEWIMAGE]]
 
* [[_PUTIMAGE]] can stretch or reduce the size of images to fit the SCREEN size.
 
* [[_PUTIMAGE]] can stretch or reduce the size of images to fit the SCREEN size.
* {{KW|PUT (graphics statement)|PUT}} can use {{KW|_CLIP}} to set objects partially or fully off screen. {{KW|GET (graphics statement)|GET}} can read objects off screen in QB64 ONLY.
+
* [[PUT (graphics statement)|PUT]] can use [[_CLIP]] to set objects partially off screen. [[GET (graphics statement)|GET]] can read objects off screen as a color in QB64 ONLY.
* A [[_DISPLAY]] statement can be used to display an image that changes instead of using page flipping or [[PCOPY]].
+
* A [[_DISPLAY]] statement can be used to only display an image after changes instead of using page flipping or [[PCOPY]].
 +
* The current desktop screen resolution can be found using the [[_SCREENIMAGE]] handle value with [[_WIDTH (function)|_WIDTH]] and [[_HEIGHT]].
 +
* '''NOTE: Default 32-bit backgrounds are transparent black or [[_RGB32]](0, 0). Use [[CLS]] to make the black opaque.'''
 +
*  '''Images are not deallocated when the [[SUB]] or [[FUNCTION]] they are created in ends. Free them with [[_FREEIMAGE]].'''
  
  
:''Example:'' Shows an example of each screenmode.
+
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
 +
 
 +
==Examples==
 +
 
 +
:''Example 1:'' Shows an example of each legacy screen mode available to QBasic and QB64.
 
{{CodeStart}} '' ''
 
{{CodeStart}} '' ''
{{Cl|SCREEN (statement)|SCREEN}} 0
+
{{Cl|SCREEN}} 0
{{Cl|PRINT}} "This is {{Cl|SCREEN (statement)|SCREEN}} 0 - only text is allowed!"
+
{{Cl|PRINT}} "This is {{Cl|SCREEN}} 0 - only text is allowed!"
 
{{Cl|FOR}} S = 1 {{Cl|TO}} 13
 
{{Cl|FOR}} S = 1 {{Cl|TO}} 13
 
   {{Cl|IF}} S < 3 {{Cl|OR}} S > 6 {{Cl|THEN}}  
 
   {{Cl|IF}} S < 3 {{Cl|OR}} S > 6 {{Cl|THEN}}  
 
     {{Cl|DO}}: {{Cl|SLEEP}}: {{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> ""
 
     {{Cl|DO}}: {{Cl|SLEEP}}: {{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> ""
     {{Cl|SCREEN (statement)|SCREEN}} S
+
     {{Cl|SCREEN}} S
     {{Cl|PRINT}} "This is {{Cl|SCREEN (statement)|SCREEN}}"; S; " - can use text and graphics!"
+
     {{Cl|PRINT}} "This is {{Cl|SCREEN}}"; S; " - can use text and graphics!"
 
       {{Cl|IF}} S = 2 {{Cl|OR}} S = 11 {{Cl|THEN}} {{Cl|PRINT}} "Monochrome - no {{Cl|COLOR}} statements!"
 
       {{Cl|IF}} S = 2 {{Cl|OR}} S = 11 {{Cl|THEN}} {{Cl|PRINT}} "Monochrome - no {{Cl|COLOR}} statements!"
 
       {{Cl|IF}} S = 10 {{Cl|THEN}}  
 
       {{Cl|IF}} S = 10 {{Cl|THEN}}  
         {{Cl|COLOR}} 2: {{Cl|PRINT}} "This {{Cl|SCREEN (statement)|SCREEN}} has only 4 colors. Black and 3 white: 2 blinks.
+
         {{Cl|COLOR}} 2: {{Cl|PRINT}} "This {{Cl|SCREEN}} has only 4 colors. Black and 3 white: 2 blinks.
 
         {{Cl|CIRCLE}} (100,100), 50, 2
 
         {{Cl|CIRCLE}} (100,100), 50, 2
 
       {{Cl|ELSE}} : {{Cl|CIRCLE}} (100,100), 100, S
 
       {{Cl|ELSE}} : {{Cl|CIRCLE}} (100,100), 100, S
Line 115: Line 163:
 
This is SCREEN 0 - only text is allowed!
 
This is SCREEN 0 - only text is allowed!
 
{{OutputEnd}}
 
{{OutputEnd}}
:Displays each {{KW|SCREEN (statement)|SCREEN}} mode one at a time with a {{KW|CIRCLE}} (except for {{KW|SCREEN (statement)|SCREEN}} 0))
+
:Displays each {{KW|SCREEN (statement)|SCREEN}} mode one at a time with a {{KW|CIRCLE}} (except for {{KW|SCREEN (statement)|SCREEN}} 0)
  
 +
 +
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
 +
 +
==References==
  
 
''See Examples:''
 
''See Examples:''
  
*{{KW|SAVEIMAGE}} (QB64 Image to Bitmap SUB by Galleon)
+
* [[SAVEIMAGE]] {{text|(QB64 Image to Bitmap SUB by Galleon)}}
  
*{{KW|Program ScreenShots}} (Member program for legacy screen modes)
+
* [[Program ScreenShots]] {{text|(Member program for legacy screen modes)}}
  
*{{KW|ThirtyTwoBit SUB}} (QB64 Image area to bitmap)  
+
* [[ThirtyTwoBit SUB]] {{text|(QB64 Image area to bitmap)}}
 
 
*{{KW|SelectScreen}} (Member Screen mode function)
 
  
 +
* [[SelectScreen]] {{text|(Member Screen mode function)}}
  
  
 
{{PageSeeAlso}}
 
{{PageSeeAlso}}
 
+
* [[COLOR]], [[CLS]], [[WIDTH]]
*{{KW|COLOR}}, {{KW|CLS}}, {{KW|WIDTH}}
+
* [[_NEWIMAGE]], [[_LOADIMAGE]], [[_SCREENIMAGE]]
*{{KW|_NEWIMAGE}}, {{KW|_LOADIMAGE}}
+
* [[_LOADFONT]], [[_FONT]]
*{{KW|_DISPLAY}}, {{KW|_COPYIMAGE}}
+
* [[_DISPLAY]], [[_COPYIMAGE]], [[_SCREENMOVE]]
*{{KW|PALETTE}}, {{KW|OUT}}, {{KW|PCOPY}}
+
* [[PALETTE]], [[OUT]], [[PCOPY]],
*{{KW|GET (graphics statement)|GET}}, {{KW|PUT (graphics statement)|PUT}} (graphics)
+
* [[GET (graphics statement)|GET]], [[PUT (graphics statement)|PUT]] {{text|(graphics)}}
*{{KW|SCREEN (function)}}
+
* [[VIEW]], [[WINDOW]] {{text|(graphic viewport)}}, [[VIEW PRINT]] {{text|(text view port)}}
*{{KW|Screen Memory}}
+
* [[SCREEN (function)]] {{text|(text only)}}, [[POINT]] {{text|(graphic pixel colors)}}
*{{KW|Screen Saver Programs}}
+
* [[Screen Memory]], [[Screen Saver Programs]]
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Latest revision as of 12:40, 17 February 2021

The SCREEN statement sets the video display mode and size of the program window's workspace.


Syntax

SCREEN {mode%|imagehandle&} [, , active_page, visual_page]


Parameters

  • The SCREEN mode INTEGER values available are 0 to 2 and 7 to 13, as listed below.
  • QB64 can use a LONG _NEWIMAGE page or _LOADIMAGE file image handle value instead.
  • The empty comma disables color when any value is used. 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 visual page is the one displayed.


Usage:

  • No SCREEN statement in a program defaults to SCREEN 0 text ONLY mode.
  • A SCREEN statement that changes screen modes also clears the screen like CLS. Nothing on the screen is retained.
  • Some screen mode text sizes are adjustable with WIDTH and all QB54 screens support PCOPY and page flipping.

LEGACY SCREEN MODES AT A GLANCE Screen Text Graphics Colors Video Text Default Mode Rows Columns Width Height Attrib. BPP Pages Block QB64 Font 0 25/43/50 80/40 No graphics 16/16 DAC 4 0-7 ----- _FONT 16 1 25 40 320 200 16/4 BG 4 none 8 X 8 _FONT 8 2 25 80 640 200 2/mono 1 none 8 X 8 _FONT 8 ................................................................................. 7 25 40 320 200 16/16 DAC 4 0-7 8 X 8 _FONT 8 8 25 80 640 200 16/16 4 0-3 8 X 8 _FONT 8 9 25 80 640 350 16/64 DAC 4 0-1 8 X 14 _FONT 14 10 25 80 640 350 4/2 GScale 2 none 8 X 14 _FONT 14 11 30/60 80 640 480 2/mono 1 none 8 X 16 _FONT 16 12 30/60 80 640 480 16/262K 4 none 8 X 16 _FONT 16 13 25 40 320 200 256/65K 8 none 8 X 8 _FONT 8 QB64 allows video paging and PCOPY in all screen modes.

QB64 Custom Screen Modes
QB64 == Syntax ==  
SCREEN imagehandle& [, , active_page, visual_page]
SCREEN _NEWIMAGE(wide&, high&[, {mode|256|32}]) [, , active_page, visual_page]
SCREEN _LOADIMAGE(file$[, {mode|256|32}]) [, , active_page, visual_page]


  • Custom screen modes can be created using a _NEWIMAGE or _LOADIMAGE function imagehandle return value.
  • QB64 screen modes 0 to 2 and 7 to 13 can be emulated with the same color depth and text block size and different dimensions.
  • _NEWIMAGE screens can be any set size. A screen mode can be emulated or 256 or 32 bit colors can be designated.
  • The _LOADIMAGE screen size will be the size of the image loaded. Can designate a mode or 256 or 32 bit colors.
  • QB64 allows page flipping or a PCOPY in ANY SCREEN mode. _DISPLAY can also be used to reduce flickering in animations.
  • All SCREEN modes are Windows in QB64. Use _FULLSCREEN to set the window area to full screen.
  • _SCREENMOVE can position a window or the _MIDDLE option can center it on the desktop.

(Return to Table of Contents)

Legacy Screen Modes

  • SCREEN 0 (default mode) is a text only screen mode. 64 (VGA) colors with hi-intensity (blinking) colors 16 to 31. (DAC attrib 6, 8 to 15). 8 Background colors intensities only(0 - 7). To enable high-intensity backgrounds, check _BLINK. No graphics are possible. Normally runs in a window. ALT-Enter switches from a window to fullscreen. Can use PCOPY with video pages 0 to 7. Text is 25, 43 or 50 rows by 40 or 80 columns. Default is 25 by 80. See WIDTH.
Note: Use OUT or _PALETTECOLOR to create higher intensity color backgrounds than COLOR , 7. See also _BLINK
All other available SCREEN modes can use text and graphics.
  • 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.          NO COLOR keyword allowed.
  • 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. Video pages 0 to 7 for flipping or PCOPY.
  • SCREEN 8 has 16 color attributes with background. Text is 25 by 80. Graphics is 640 by 200. Video pages 0 to 3.
  • 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. Video pages 0 and 1 for flipping or PCOPY.
  • SCREEN 10 has 4 gray scale 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 columns(see WIDTH). White graphics is 640 by 480. NO COLOR keyword allowed.
  • SCREEN 12 has 16 color attributes, black background. 256K possible color hues. Text is 30 or 60 by 80 columns(see WIDTH). Graphics 640 by 480.
  • SCREEN 13 has 256 color attributes, black background. 256K possible color hues. Text is 25 by 40. Graphics is 320 by 200.


Modern Syntax

  • SCREEN _NEWIMAGE(wide&, deep&, mode%) can imitate any size screen mode or use 32 bit or 256 color modes in QB64.
  • SCREEN _LOADIMAGE(imagehandle&, colors) can load a program screen of an image file handle in QB64 using 32-bit colors.


QB64 can use page flipping with any number of pages in any screen mode. Also, see _DISPLAY

(Return to Table of Contents)

Text and Graphics

Text Coordinates:
  • LOCATE 1, 1 places the cursor at the top left SCREEN text position.
  • 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.
  • The SCREEN (function) can be used to read the ASCII character code or color of text in SCREEN 0 only.
  • VIEW PRINT can be used to designate a text view port area.
  • In QB64 the _WIDTH and _HEIGHT functions will return the text block dimensions in SCREEN 0 only.


Graphic Coordinates:
  • Coordinate (0, 0) indicates the first top left corner pixel.
  • Maximum pixel coordinates are one less than the maximum dimensions above because the pixel count starts at 0.
  • Graphic objects such as PSET, PRESET, LINE, CIRCLE and DRAW can be placed partially off screen.
  • GET and PUT screen image operations must be located completely on the screen, unless the _CLIP parameter is passed.
  • VIEW can be used to designate a graphic view port area of the screen.
  • WINDOW can be used to set the graphics SCREEN coordinates to almost any size needed. Use the SCREEN option for normal row coordinate values. Row coordinates are Cartesian (decrease in value going down the screen) otherwise.
  • In QB64 the _WIDTH and _HEIGHT functions will return the graphic pixel dimensions in SCREENs other than 0.


QB64 Screen Statements and Functions:
  • For file image screens that adopt the image dimensions and image color settings use: _LOADIMAGE
  • To create custom sized screen modes or pages and 256 or 32 bit colors use: _NEWIMAGE
  • _PUTIMAGE can stretch or reduce the size of images to fit the SCREEN size.
  • PUT can use _CLIP to set objects partially off screen. GET can read objects off screen as a color in QB64 ONLY.
  • A _DISPLAY statement can be used to only display an image after changes instead of using page flipping or PCOPY.
  • The current desktop screen resolution can be found using the _SCREENIMAGE handle value with _WIDTH and _HEIGHT.
  • NOTE: Default 32-bit backgrounds are transparent black or _RGB32(0, 0). Use CLS to make the black opaque.
  • Images are not deallocated when the SUB or FUNCTION they are created in ends. Free them with _FREEIMAGE.


(Return to Table of Contents)

Examples

Example 1: Shows an example of each legacy screen mode available to QBasic and QB64.

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)


(Return to Table of Contents)

References

See Examples:

  • SAVEIMAGE (QB64 Image to Bitmap SUB by Galleon)


See also



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