SCREEN 8, COLOR behavior

Windows specific questions.
Post Reply
DamageX
Posts: 130
Joined: Nov 21, 2009 8:42

SCREEN 8, COLOR behavior

Post by DamageX »

Under SCREEN 12 or higher (or SCREEN 0), one can use COLOR to set the foreground and background colors for text that is subsequently PRINTed. However under SCREEN 8 the last value specified for the background color affects the entire screen instead. Is there a way to get the same functionality in SCREEN 8 that we have in SCREEN 12?
Lothar Schirm
Posts: 437
Joined: Sep 28, 2013 15:08
Location: Germany

Re: SCREEN 8, COLOR behavior

Post by Lothar Schirm »

The Screen modes are used mainly for compatibility with QBasic. It is more flexible to use ScreenRes instead, because you can select everything yourselve: size of the graphics window (width and height), color depth, number of pages etc.
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN 8, COLOR behavior

Post by fxm »

You can never get the same fonts between "Screen 8" and "Screenres ...", but the closest is this following I think:

Code: Select all

Sub test()
  Dim As String s = "FreeBASIC"
  Locate 1, 1
  Color 11, 2
  Print s;
  Locate 25, 80 - Len(s)+1
  Color 14, 4
  Print s;
End Sub

Screen 8
test()
Sleep

Screenres 640, 400, 4
Width , Int(400/16)
test()
Sleep
Lothar Schirm
Posts: 437
Joined: Sep 28, 2013 15:08
Location: Germany

Re: SCREEN 8, COLOR behavior

Post by Lothar Schirm »

If you omit "Width , Int(400/16)", you will have even the same font size (8x8, which is the default font size for ScreenRes).
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN 8, COLOR behavior

Post by fxm »

Yes, but not a similar aspect on display.
By using "Screen 8", all horizontal lines are duplicated on the display under Windows (640x200 becomes 640x400 and 8x8 becomes 8x16, apparently).
DamageX
Posts: 130
Joined: Nov 21, 2009 8:42

Re: SCREEN 8, COLOR behavior

Post by DamageX »

I hadn't thought to try SCREENRES for such 'legacy' modes... but it does work. Great news for EGA fans (they exist right?) thanks.
Post Reply