PROGRAM ColoredText

? This Program prints text to the window in different colors
? using the ROM Kernel's Text Function. Remember that
? the drawing mode set in F-Basic (JAM1,JAM2,COMPLEMENT,etc.)
? affects the rendering results. See the discussion on
? F-Basic's COLOR_PATTERN statement for more information
? on changing the drawing mode.

INTEGER I,J,GfxsBase,WindPtr,ScreenPtr,CurrentRastPort
TEXT*80 String
DATA (String," ")

&SYSLIB 1
GfxsBase=OPENLIB("graphics.library",0)
IF NOT GfxsBase THEN
   PRINT "Unable to open graphics library"
   STOP
ENDIF
ScreenPtr=SCREEN #1 (0,200,4,2,0)
WindPtr=WINDOW #1 (0,0,640,200,0,0,0,0,-1,-1,30,@"This Is Fun",1)
CurrentRastPort=WINDOW_INFO(3)
IF NOT ScreenPtr OR NOT WindPtr OR NOT CurrentRastPort THEN
   PRINT "Unable to open screen, window, or find window's rastport"
   STOP
ENDIF
String="Colored Strings Are Interesting"
String=String(1:LENGTH(String))&CHAR(0)
COLOR_DEFINE #9 (15,8,0) ; ? orange
COLOR_DEFINE #7 (0,13,11) ; ? aqua
COLOR_PENS(9,7)
COLOR_POINT #9 (30,30)    ; ? move the drawing pen to text start location
I=Text(GfxsBase,CurrentRastPort,@String,LENGTH(String)-1)
COLOR_PENS(7,0)  ; ? change colors
COLOR_POINT #7 (70,70)  ; ? move to next text start location
I=Text(GfxsBase,CurrentRastPort,@String,LENGTH(String)-1)
COLOR_PENS(9,0)  ; ? change colors
COLOR_POINT #7 (110,110)  ; ? move to next text start location
I=Text(GfxsBase,CurrentRastPort,@String,LENGTH(String)-1)
COLOR_PENS(5,0)  ; ? change colors
COLOR_POINT #5 (140,140)  ; ? move to next text start location
I=Text(GfxsBase,CurrentRastPort,@String,LENGTH(String)-1)
DELAY(50)


END

