home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY1 / EXAMP1.ZIP / UMEX230.BAS < prev    next >
BASIC Source File  |  1990-03-29  |  1KB  |  44 lines

  1. 'User's Manual Reference, Page 230.
  2.  
  3. 'CGADEMO--demo of cga color and palette range
  4. 'Cycles through possible colors for background and palette.
  5. DEFINT a-z
  6. %CX = 60                       'x location of circle
  7. %CY = 30                       'y location of circle
  8. %RADIUS = 30
  9. %NCIRCLE = 3
  10. backgrd = 1
  11. palet = 0
  12. SCREEN 1,0
  13. COLOR backgrd,palet            'change colors and palette
  14. CLS
  15. CALL drawcircles(backgrd, palet)
  16. Letter$ = INPUT$(1)
  17. WHILE Letter$ <> " "
  18.   SELECT CASE UCASE$(Letter$)
  19.   CASE "P"
  20.     palet = (palet + 1) MOD 2
  21.   CASE "B"
  22.     backgrd = backgrd + 1
  23.     IF backgrd > 31 THEN backgrd = 0
  24.   END SELECT
  25.   CALL drawcircles(backgrd, palet)
  26.   Letter$ = INPUT$(1)
  27. WEND
  28. SCREEN 0,0 : COLOR 15,0        'reset
  29. END
  30.  
  31. SUB drawcircles(backgrd, palet)
  32.   COLOR backgrd, palet
  33.   FOR i = 1 to %NCIRCLE
  34.     CIRCLE ((i + 1) * %CX, (i + 1) * %CY), %RADIUS, i
  35.     PAINT  ((i + 1) * %CX, (i + 1) * %CY), i, i
  36.   NEXT i
  37.   LOCATE 22,1
  38.   PRINT "Color";backgrd;",";palet
  39.   LOCATE 23,1 : PRINT "B/ackground, P/alette, or <Spacebar>"
  40. END SUB
  41.  
  42.  
  43.  
  44.