home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / clipper / screen / fxdemo.prg < prev    next >
Text File  |  1992-04-15  |  39KB  |  905 lines

  1. /*
  2.  
  3. FXDEMO.PRG
  4.  
  5. Written by:    Jim Fowler  - 04/16/92
  6.  
  7. Compile with:  CLIPPER FXDEMO /M /N /W
  8. Link with:     RTLINK FILE FXDEMO,FXCOLOR
  9.  
  10. */
  11.  
  12.  
  13. ******************************************************************************
  14.  
  15.  
  16. #INCLUDE  "BOX.CH"
  17. #INCLUDE  "INKEY.CH"
  18. #INCLUDE  "SETCURS.CH"
  19.  
  20. STATIC    cEntryScreen
  21.  
  22.  
  23. ******************************************************************************
  24.  
  25.  
  26. FUNCTION FxDemo()
  27.     
  28.    LOCAL lResult, nValue, nLoop, cGreen, cBrown, cPink
  29.  
  30.     cEntryScreen := SAVESCREEN( 0, 0, MAXROW(), MAXCOL() )
  31.     SETCURSOR( SC_NONE )
  32.    SETCOLOR( "b/bg,b/bg,rb,rb,b/bg" )
  33.     CLS
  34.    IF !( fx_IsVGA() )
  35.         
  36.         // No VGA, so display message and quit.
  37.         
  38.       SETCOLOR( "w+/r" )
  39.       @ 10, 16, 13, 63 BOX ( B_SINGLE + " " )
  40.       @ 11, 18 SAY "Sorry, a VGA system must be installed to run"
  41.       @ 12, 18 SAY "this demo program.  Press any key to exit.  "
  42.       INKEY( 0 )
  43.       ExitDemo()
  44.     
  45.     ENDIF
  46.     
  47.    @  1, 57 SAY "<ESC> to quit demo." COLOR "r/bg"
  48.    SETCOLOR( "w/n" )
  49.    @  3, 54, 21, 78 BOX ( B_SINGLE + " " )
  50.    @  4, 56 SAY "  Background = Black " COLOR "w/n"
  51.    @  5, 56 SAY " Black          (n  )" COLOR "n/n"
  52.    @  6, 56 SAY " Blue           (b  )" COLOR "b/n"
  53.    @  7, 56 SAY " Green          (g  )" COLOR "g/n"
  54.    @  8, 56 SAY " Cyan           (bg )" COLOR "bg/n"
  55.    @  9, 56 SAY " Red            (r  )" COLOR "r/n"
  56.    @ 10, 56 SAY " Magenta        (rb )" COLOR "rb/n"
  57.    @ 11, 56 SAY " Brown          (gr )" COLOR "gr/n"
  58.    @ 12, 56 SAY " White          (w  )" COLOR "w/n"
  59.    @ 13, 56 SAY " Grey           (n+ )" COLOR "n+/n"
  60.    @ 14, 56 SAY " Bright Blue    (b+ )" COLOR "b+/n"
  61.    @ 15, 56 SAY " Bright Green   (g+ )" COLOR "g+/n"
  62.    @ 16, 56 SAY " Bright Cyan    (bg+)" COLOR "bg+/n"
  63.    @ 17, 56 SAY " Bright Red     (r+ )" COLOR "r+/n"
  64.    @ 18, 56 SAY " Bright Magenta (rb+)" COLOR "rb+/n"
  65.    @ 19, 56 SAY " Yellow         (gr+)" COLOR "gr+/n"
  66.    @ 20, 56 SAY " Bright White   (w+ )" COLOR "w+/n"
  67.    SETCOLOR( "b/bg" )
  68.    
  69.    *-------------------------------------------------------------------------*
  70.  
  71.    @  0, 1 SAY "This demo program is designed to help you become"
  72.    @  1, 1 SAY "familiar with the special effects color commands and"
  73.    @  2, 1 SAY "some simplified uses by presenting them in a"
  74.    @  3, 1 SAY "tutorial manner."
  75.    @  5, 1 SAY "Armed with these commands, you can almost create any"
  76.    @  6, 1 SAY "color effect you can imagine.  You can also create"
  77.    @  7, 1 SAY "any color from the 262,144 possible colors allowed"
  78.    @  8, 1 SAY "by a VGA system."
  79.    @ 10, 1 SAY "The effects shown in this demo are fairly simple to"
  80.    @ 11, 1 SAY "implement.  For more advanced effects, you can study"
  81.    @ 12, 1 SAY "the document VGA.DOC and the ASM source code file"
  82.    @ 13, 1 SAY "FXCOLOR.ASM and get many more ideas."
  83.    @ 15, 1 SAY "If you're ready, lets start!"
  84.    @ 17, 1 SAY "Press <ENTER> to begin..." COLOR "r/bg"
  85.    GetKey()
  86.  
  87.    *-------------------------------------------------------------------------*
  88.  
  89.    BlankText()
  90.    @  0, 1 SAY "To redefine colors and use special effects, we must"
  91.    @  1, 1 SAY "first enable the special effects.  This is done"
  92.    @  2, 1 SAY "using the command:"
  93.    @  4, 1 SAY "     fx_Enable()" COLOR "n/bg"
  94.    @  6, 1 SAY "Notice the colors now displayed in the table are the"
  95.    @  7, 1 SAY "default colors used by your computer at bootup for"
  96.    @  8, 1 SAY "text mode.  When we enable the special effects, some"
  97.    @  9, 1 SAY "will change slightly, particularly the high-"
  98.    @ 10, 1 SAY "intensity colors (which will be slightly darker)."
  99.    @ 12, 1 SAY "This occurs because the special effects system uses"
  100.    @ 13, 1 SAY "its own pre-defined colors.  The high-intensity"
  101.    @ 14, 1 SAY "colors are purposely made slightly darker to allow"
  102.    @ 15, 1 SAY "for effects such as pulsating colors.  If the high-"
  103.    @ 16, 1 SAY "intensity colors are at their maximums, these"
  104.    @ 17, 1 SAY "effects would not be possible."
  105.    @ 19, 1 SAY "You can change the pre-defined colors by modifying"
  106.    @ 20, 1 SAY "the values for the variable _NewBase in the ASM"
  107.    @ 21, 1 SAY "source file and re-assembling."
  108.    @ 23, 1 SAY "Press <ENTER> to enable the color system..." COLOR "r/bg"
  109.    GetKey()
  110.  
  111.    fx_Enable()
  112.  
  113.    *-------------------------------------------------------------------------*
  114.  
  115.    BlankText()
  116.    @  0, 1 SAY "Special effects enabled!  Nothing is happening yet"
  117.    @  1, 1 SAY "because we've only enabled the special effects, not"
  118.    @  2, 1 SAY "created them."
  119.    @  4, 1 SAY "A fading effect can be created with the command:"
  120.    @  6, 1 SAY "     fx_Fade( cBaseAttrib, cSecondAttrib )" COLOR "n/bg"
  121.    @  8, 1 SAY "Let's fade red to blue, magenta to yellow, bright"
  122.    @  9, 1 SAY "cyan to black (background), and bright white to"
  123.    @ 10, 1 SAY "black (background) using the following commands:"
  124.    @ 12, 1 SAY '     fx_Fade( "r",   "b"   )' COLOR "n/bg"
  125.    @ 13, 1 SAY '     fx_Fade( "rb",  "gr+" )' COLOR "n/bg"
  126.    @ 14, 1 SAY '     fx_Fade( "bg+", "n"   )' COLOR "n/bg"
  127.    @ 15, 1 SAY '     fx_Fade( "w+",  "n"   )' COLOR "n/bg"
  128.    @ 17, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  129.    GetKey()
  130.  
  131.    // Lets flag our colors first.
  132.    @  9,56 SAY CHR( 26 ) COLOR "w/n"
  133.    @ 10,56 SAY CHR( 26 ) COLOR "w/n"
  134.    @ 16,56 SAY CHR( 26 ) COLOR "w/n"
  135.    @ 20,56 SAY CHR( 26 ) COLOR "w/n"
  136.  
  137.    fx_Fade( "rb",  "gr+" )
  138.    fx_Fade( "w+",  "n"   )
  139.    fx_Fade( "r",   "b"   )
  140.    fx_Fade( "bg+", "n"   )
  141.  
  142.    *-------------------------------------------------------------------------*
  143.  
  144.    BlankText()
  145.    @  0, 1 SAY "fx_Fade() is particularly effective when fading a"
  146.    @  1, 1 SAY "foreground color into a background color (such as"
  147.    @  2, 1 SAY "bright white to black as shown in the table)."
  148.    @  4, 1 SAY "Just to show it works on background colors too,"
  149.    @  5, 1 SAY "let's fade the color of our main screen (cyan) with"
  150.    @  6, 1 SAY "the command:"
  151.    @  8, 1 SAY '     fx_Fade( "bg", "n" )' COLOR "n/bg"
  152.    @ 10, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  153.    GetKey()
  154.  
  155.    fx_Fade( "bg", "n" )
  156.  
  157.    *-------------------------------------------------------------------------*
  158.  
  159.    BlankText()
  160.    @  0, 1 SAY "We can restore cyan back to normal with the command:"
  161.    @  2, 1 SAY '     fx_Restore( cBaseAttrib )' COLOR "n/bg"
  162.    @  4, 1 SAY 'Cyan is the base attribute we want to restore, so we'
  163.    @  5, 1 SAY "will execute the following:"
  164.    @  7, 1 SAY '     fx_Restore( "bg" )' COLOR "n/bg"
  165.    @  9, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  166.    GetKey()
  167.  
  168.    fx_Restore( "bg" )
  169.  
  170.    *-------------------------------------------------------------------------*
  171.  
  172.    BlankText()
  173.    @  0, 1 SAY "We can speed up or slow down the rate using:"
  174.    @  2, 1 SAY "     fx_PalRate( [nPaletteIncrement] )" COLOR "n/bg"
  175.    @  3, 1 SAY "     fx_IntRate( [nInterval] )" COLOR "n/bg"
  176.    @  5, 1 SAY "The fading (and other effects) are implemented"
  177.    @  6, 1 SAY "internally by hooking the timer interrupt 1Ch"
  178.    @  7, 1 SAY "(which occurs 18.2 times per second) and rotating"
  179.    @  8, 1 SAY "through the color palettes."
  180.    @ 10, 1 SAY "The fx_PalRate() command lets you set the number of"
  181.    @ 11, 1 SAY "palettes to increment (skip) each timer interval."
  182.    @ 12, 1 SAY "Normally, this is 1.  The HIGHER the number, the"
  183.    @ 13, 1 SAY "FASTER the increment and the effect."
  184.    @ 15, 1 SAY "The fx_IntRate() command lets you set the number of"
  185.    @ 16, 1 SAY "timer tick intervals before rotating any palettes."
  186.    @ 17, 1 SAY "Therefore, the HIGHER the number, the SLOWER the"
  187.    @ 18, 1 SAY "rotation occurs and the slower the effect."
  188.    @ 20, 1 SAY "Let's increase the speed with:"
  189.    @ 22, 1 SAY "     fx_PalRate( 2 )" COLOR "n/bg"
  190.    @ 24, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  191.    GetKey()
  192.  
  193.    fx_PalRate( 2 )
  194.  
  195.    *-------------------------------------------------------------------------*
  196.  
  197.    BlankText()
  198.    @  0, 1 SAY "Not fast enough?  Oh well, let's try this:"
  199.    @  2, 1 SAY "     fx_PalRate( 15 )" COLOR "n/bg"
  200.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  201.    GetKey()
  202.  
  203.    fx_PalRate( 15 )
  204.  
  205.    *-------------------------------------------------------------------------*
  206.  
  207.    BlankText()
  208.    @  0, 1 SAY "Fast enough now?"
  209.    @  2, 1 SAY "Also, we want to see what slowing it down does, so"
  210.    @  3, 1 SAY "we will start by resetting the speed back to normal."
  211.    @  5, 1 SAY "     fx_PalRate( 1 )" COLOR "n/bg"
  212.    @  7, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  213.    GetKey()
  214.  
  215.    fx_PalRate( 1 )
  216.  
  217.    *-------------------------------------------------------------------------*
  218.  
  219.    BlankText()
  220.    @  0, 1 SAY "To slow it, we'll use:"
  221.    @  2, 1 SAY "     fx_IntRate( 2 )" COLOR "n/bg"
  222.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  223.    GetKey()
  224.  
  225.    fx_IntRate( 2 )
  226.  
  227.    *-------------------------------------------------------------------------*
  228.  
  229.    BlankText()
  230.    @  0, 1 SAY "A little slower, but we can make it even slower with"
  231.    @  2, 1 SAY "     fx_IntRate( 18 )" COLOR "n/bg"
  232.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  233.    GetKey()
  234.  
  235.    fx_IntRate( 18 )
  236.  
  237.    *-------------------------------------------------------------------------*
  238.  
  239.    BlankText()
  240.    @  0, 1 SAY "It's only doing about one palette change per second"
  241.    @  1, 1 SAY "so it will take about 32 seconds to make a full"
  242.    @  2, 1 SAY "cycle because it rotates from palette 0 to palette"
  243.    @  3, 1 SAY "15, then reverses direction and rotates back to"
  244.    @  4, 1 SAY "palette 0 and so forth.  Therefore, it must go 32"
  245.    @  5, 1 SAY "palette changes to complete a full cycle (assuming"
  246.    @  6, 1 SAY "fx_PalRate() is set to 1)."
  247.    @  8, 1 SAY "Of course this is fascinating to watch, but we want"
  248.    @  9, 1 SAY "to look at other commands too.  We can restore"
  249.    @ 10, 1 SAY "EVERYTHING back to normal using the command:"
  250.    @ 12, 1 SAY "     fx_RestAll()" COLOR "n/bg"
  251.    @ 14, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  252.    GetKey()
  253.  
  254.    fx_RestAll()
  255.  
  256.    // Lets unflag our colors.
  257.    @  9,56 SAY " " COLOR "w/n"
  258.    @ 10,56 SAY " " COLOR "w/n"
  259.    @ 16,56 SAY " " COLOR "w/n"
  260.    @ 20,56 SAY " " COLOR "w/n"
  261.  
  262.    *-------------------------------------------------------------------------*
  263.  
  264.    BlankText()
  265.    @  0, 1 SAY "Another special effect is pulsating colors.  The"
  266.    @  1, 1 SAY "syntax for the command is:"
  267.    @  3, 1 SAY "     fx_Pulse( cBaseAttrib )" COLOR "n/bg"
  268.    @  5, 1 SAY "Let's try the following commands and see what result"
  269.    @  6, 1 SAY "we obtain:"
  270.    @  8, 1 SAY '     fx_Pulse( "b"   )' COLOR "n/bg"
  271.    @  9, 1 SAY '     fx_Pulse( "r"   )' COLOR "n/bg"
  272.    @ 10, 1 SAY '     fx_Pulse( "gr"  )' COLOR "n/bg"
  273.    @ 11, 1 SAY '     fx_Pulse( "gr+" )' COLOR "n/bg"
  274.    @ 13, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  275.    GetKey()
  276.  
  277.    // Lets flag our colors first.
  278.    @  6,56 SAY CHR( 26 ) COLOR "w/n"
  279.    @  9,56 SAY CHR( 26 ) COLOR "w/n"
  280.    @ 11,56 SAY CHR( 26 ) COLOR "w/n"
  281.    @ 19,56 SAY CHR( 26 ) COLOR "w/n"
  282.  
  283.    fx_Pulse( "b"   )
  284.    fx_Pulse( "r"   )
  285.    fx_Pulse( "gr"  )
  286.    fx_Pulse( "gr+" )
  287.  
  288.    *-------------------------------------------------------------------------*
  289.  
  290.    BlankText()
  291.    @  0, 1 SAY "Uh-Oh!  We've managed to pulse our text color.  As"
  292.    @  1, 1 SAY "you can see, fx_Pulse() causes a color to go from"
  293.    @  2, 1 SAY "normal to brighter (up to 75% brighter).  You may"
  294.    @  3, 1 SAY "notice that yellow does not seem to change much."
  295.    @  4, 1 SAY "This is because yellow is a high-intensity color and"
  296.    @  5, 1 SAY "cannot be brightened much more.  Remember, it was"
  297.    @  6, 1 SAY "explained earlier that the high-intensity colors are"
  298.    @  7, 1 SAY "slightly darker on purpose in order to generate this"
  299.    @  8, 1 SAY "effect."
  300.    @ 10, 1 SAY "Let's increase the speed with:"
  301.    @ 12, 1 SAY '     fx_PalRate( 2 )' COLOR "n/bg"
  302.    @ 14, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  303.    GetKey()
  304.  
  305.    fx_PalRate( 2 )
  306.  
  307.    *-------------------------------------------------------------------------*
  308.  
  309.    BlankText()
  310.    @  0, 1 SAY "Now we will slow it with:"
  311.    @  2, 1 SAY "     fx_IntRate( 2 )" COLOR "n/bg"
  312.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  313.    GetKey()
  314.  
  315.    fx_IntRate( 2 )
  316.  
  317.    *-------------------------------------------------------------------------*
  318.  
  319.    BlankText()
  320.    @  0, 1 SAY "Well, it slowed, but appears to be at normal speed"
  321.    @  1, 1 SAY "rather than slower.  Our command was fx_IntRate(2)."
  322.    @  2, 1 SAY "Usually this should slow it to about one-half the"
  323.    @  3, 1 SAY "normal rate.  So what happened?"
  324.    @  5, 1 SAY "Earlier we sped it up with fx_PalRate( 2 )."
  325.    @  6, 1 SAY "Therefore, every timer tick interval we are rotating"
  326.    @  7, 1 SAY "the displayed palette by a factor of 2 (i.e.,"
  327.    @  8, 1 SAY "skipping every other palette).  The fx_IntRate( 2 )"
  328.    @  9, 1 SAY "command causes the rotation to occur every 2 timer"
  329.    @ 10, 1 SAY "tick intervals (i.e., every other timer tick)."
  330.    @ 11, 1 SAY "The resulting 2 palette increments every 2 timer"
  331.    @ 12, 1 SAY "tick intervals is almost equivalent to the normal"
  332.    @ 13, 1 SAY "speed of 1 palette increment every 1 timer tick."
  333.    @ 14, 1 SAY "They are not exactly equivalent because we are"
  334.    @ 15, 1 SAY "skipping a palette so the display is not quite as"
  335.    @ 16, 1 SAY '"smooth" as normal speed would be.'
  336.    @ 18, 1 SAY "To actually slow it, we need to reset the palette"
  337.    @ 19, 1 SAY "increment rate back to normal with the command:"
  338.    @ 21, 1 SAY "     fx_PalRate( 1 )" COLOR "n/bg"
  339.    @ 23, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  340.    GetKey()
  341.  
  342.    fx_PalRate( 1 )
  343.  
  344.    *-------------------------------------------------------------------------*
  345.  
  346.    BlankText()
  347.    @  0, 1 SAY "Now we're at a slower speed."
  348.    @  2, 1 SAY "Pulsating colors have their uses, but trying to"
  349.    @  3, 1 SAY "read pulsating text can give you a pulsating"
  350.    @  4, 1 SAY "headache <g>.  Let's restore everything back to"
  351.    @  5, 1 SAY "normal again and move on to blinking."
  352.    @  7, 1 SAY "     fx_RestAll()" COLOR "n/bg"
  353.    @  9, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  354.    GetKey()
  355.  
  356.    fx_RestAll()
  357.  
  358.    // Lets unflag our colors.
  359.    @  6,56 SAY " " COLOR "w/n"
  360.    @  9,56 SAY " " COLOR "w/n"
  361.    @ 11,56 SAY " " COLOR "w/n"
  362.    @ 19,56 SAY " " COLOR "w/n"
  363.  
  364.    *-------------------------------------------------------------------------*
  365.  
  366.    BlankText()
  367.    @  0, 1 SAY "The syntax for the blinking command is:"
  368.    @  2, 1 SAY "     fx_Blink( cBaseAttrib,      ;" COLOR "n/bg"
  369.    @  3, 1 SAY "               cSecondAttrib,    ;" COLOR "n/bg"
  370.    @  4, 1 SAY "               [lSoftBlink]   )" COLOR "n/bg"
  371.    @  6, 1 SAY "cBaseAttrib is the color attribute you want to"
  372.    @  7, 1 SAY "blink (usually a foreground color) and cSecondAttrib"
  373.    @  8, 1 SAY "is the color to blink to (usually a background"
  374.    @  9, 1 SAY "color).  The optional lSoftBlink, when logical .T.,"
  375.    @ 10, 1 SAY 'produces a "softened" blink (i.e. slight fading).'
  376.    @ 12, 1 SAY "The color attributes specified do not have to be"
  377.    @ 13, 1 SAY "foreground and background as you will see.  We'll"
  378.    @ 14, 1 SAY "do the following commands:"
  379.    @ 16, 1 SAY '     fx_Blink( "r",  "gr+" )' COLOR "n/bg"
  380.    @ 17, 1 SAY '     fx_Blink( "gr", "bg"  )' COLOR "n/bg"
  381.    @ 18, 1 SAY '     fx_Blink( "w+", "g", .T. )' COLOR "n/bg"
  382.    @ 20, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  383.    GetKey()
  384.  
  385.    // Lets flag our colors first.
  386.    @  9,56 SAY CHR( 26 ) COLOR "w/n"
  387.    @ 11,56 SAY CHR( 26 ) COLOR "w/n"
  388.    @ 20,56 SAY CHR( 26 ) COLOR "w/n"
  389.  
  390.    fx_Blink( "r",  "gr+" )
  391.    fx_Blink( "gr", "bg"  )
  392.    fx_Blink( "w+", "g",  .T. )
  393.  
  394.    *-------------------------------------------------------------------------*
  395.  
  396.    // In coloring the suceeding text examples, the "*" is used in the
  397.    // color string to allow for high-intensity background colors in Clipper.
  398.    // (I.E., "b*" is equivalent to a background color of "b+".)
  399.    // It does NOT create the blinking effect because the hardware blink bit
  400.    // is set OFF by fx_Enable().
  401.  
  402.    BlankText()
  403.    @  0, 7 SAY 'Command:  fx_Blink( "r",  "gr+" )'
  404.    @  1, 7 SAY " FG = red->yellow, BG = yellow         " COLOR "r/gr*"
  405.    @  2, 7 SAY " FG = red->yellow, BG = bright magenta " COLOR "r/rb*"
  406.    @  3, 7 SAY " FG = yellow, BG = red->yellow         " COLOR "gr+/r"
  407.    @  4, 7 SAY " FG = bright cyan, BG = red->yellow    " COLOR "bg+/r"
  408.    @  6, 7 SAY 'Command:  fx_Blink( "gr", "bg" )'
  409.    @  7, 7 SAY " FG = brown->cyan, BG = cyan           " COLOR "gr/bg"
  410.    @  8, 7 SAY " FG = brown->cyan, BG = grey           " COLOR "gr/n*"
  411.    @  9, 7 SAY " FG = cyan, BG = brown->cyan           " COLOR "bg/gr"
  412.    @ 10, 7 SAY " FG = bright blue, BG = brown->cyan    " COLOR "b+/gr"
  413.    @ 12, 7 SAY 'Command:  fx_Blink( "w+", "g", .T. )'
  414.    @ 13, 7 SAY " FG = bright white->green, BG = green  " COLOR "w+/g"
  415.    @ 14, 7 SAY " FG = bright white->green, BG = blue   " COLOR "w+/b"
  416.    @ 15, 7 SAY " FG = green, BG = bright white->green  " COLOR "g/w*"
  417.    @ 16, 7 SAY " FG = black, BG = bright white->green  " COLOR "n/w*"
  418.    @ 18, 1 SAY "Notice that you can have blinking colors AND high-"
  419.    @ 19, 1 SAY "intensity backgrounds and that the background can"
  420.    @ 20, 1 SAY "blink while the foreground remains stable.  Can you"
  421.    @ 21, 1 SAY 'see the difference caused by "softened" blinking?'
  422.    @ 23, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  423.    GetKey()
  424.  
  425.    *-------------------------------------------------------------------------*
  426.  
  427.    BlankText()
  428.    @  0, 7 SAY 'Command:  fx_Blink( "r",  "gr+" )'
  429.    @  1, 7 SAY " FG = red->yellow, BG = yellow         " COLOR "r/gr*"
  430.    @  2, 7 SAY " FG = red->yellow, BG = bright magenta " COLOR "r/rb*"
  431.    @  3, 7 SAY " FG = yellow, BG = red->yellow         " COLOR "gr+/r"
  432.    @  4, 7 SAY " FG = bright cyan, BG = red->yellow    " COLOR "bg+/r"
  433.    @  6, 7 SAY 'Command:  fx_Blink( "gr", "bg" )'
  434.    @  7, 7 SAY " FG = brown->cyan, BG = cyan           " COLOR "gr/bg"
  435.    @  8, 7 SAY " FG = brown->cyan, BG = grey           " COLOR "gr/n*"
  436.    @  9, 7 SAY " FG = cyan, BG = brown->cyan           " COLOR "bg/gr"
  437.    @ 10, 7 SAY " FG = bright blue, BG = brown->cyan    " COLOR "b+/gr"
  438.    @ 12, 7 SAY 'Command:  fx_Blink( "w+", "g", .T. )'
  439.    @ 13, 7 SAY " FG = bright white->green, BG = green  " COLOR "w+/g"
  440.    @ 14, 7 SAY " FG = bright white->green, BG = blue   " COLOR "w+/b"
  441.    @ 15, 7 SAY " FG = green, BG = bright white->green  " COLOR "g/w*"
  442.    @ 16, 7 SAY " FG = black, BG = bright white->green  " COLOR "n/w*"
  443.    @ 18, 1 SAY "We will now increase the speed with:"
  444.    @ 20, 1 SAY "     fx_PalRate( 2 )" COLOR "n/bg"
  445.    @ 22, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  446.    GetKey()
  447.  
  448.    fx_PalRate( 2 )
  449.  
  450.    *-------------------------------------------------------------------------*
  451.  
  452.    BlankText()
  453.    @  0, 7 SAY 'Command:  fx_Blink( "r",  "gr+" )'
  454.    @  1, 7 SAY " FG = red->yellow, BG = yellow         " COLOR "r/gr*"
  455.    @  2, 7 SAY " FG = red->yellow, BG = bright magenta " COLOR "r/rb*"
  456.    @  3, 7 SAY " FG = yellow, BG = red->yellow         " COLOR "gr+/r"
  457.    @  4, 7 SAY " FG = bright cyan, BG = red->yellow    " COLOR "bg+/r"
  458.    @  6, 7 SAY 'Command:  fx_Blink( "gr", "bg" )'
  459.    @  7, 7 SAY " FG = brown->cyan, BG = cyan           " COLOR "gr/bg"
  460.    @  8, 7 SAY " FG = brown->cyan, BG = grey           " COLOR "gr/n*"
  461.    @  9, 7 SAY " FG = cyan, BG = brown->cyan           " COLOR "bg/gr"
  462.    @ 10, 7 SAY " FG = bright blue, BG = brown->cyan    " COLOR "b+/gr"
  463.    @ 12, 7 SAY 'Command:  fx_Blink( "w+", "g", .T. )'
  464.    @ 13, 7 SAY " FG = bright white->green, BG = green  " COLOR "w+/g"
  465.    @ 14, 7 SAY " FG = bright white->green, BG = blue   " COLOR "w+/b"
  466.    @ 15, 7 SAY " FG = green, BG = bright white->green  " COLOR "g/w*"
  467.    @ 16, 7 SAY " FG = black, BG = bright white->green  " COLOR "n/w*"
  468.    @ 18, 1 SAY "And slow the speed with:"
  469.    @ 20, 1 SAY "     fx_PalRate( 1 )" COLOR "n/bg"
  470.    @ 21, 1 SAY "     fx_IntRate( 2 )" COLOR "n/bg"
  471.    @ 23, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  472.    GetKey()
  473.  
  474.    fx_PalRate( 1 )
  475.    fx_IntRate( 2 )
  476.  
  477.    *-------------------------------------------------------------------------*
  478.  
  479.    BlankText()
  480.    @  0, 7 SAY 'Command:  fx_Blink( "r",  "gr+" )'
  481.    @  1, 7 SAY " FG = red->yellow, BG = yellow         " COLOR "r/gr*"
  482.    @  2, 7 SAY " FG = red->yellow, BG = bright magenta " COLOR "r/rb*"
  483.    @  3, 7 SAY " FG = yellow, BG = red->yellow         " COLOR "gr+/r"
  484.    @  4, 7 SAY " FG = bright cyan, BG = red->yellow    " COLOR "bg+/r"
  485.    @  6, 7 SAY 'Command:  fx_Blink( "gr", "bg" )'
  486.    @  7, 7 SAY " FG = brown->cyan, BG = cyan           " COLOR "gr/bg"
  487.    @  8, 7 SAY " FG = brown->cyan, BG = grey           " COLOR "gr/n*"
  488.    @  9, 7 SAY " FG = cyan, BG = brown->cyan           " COLOR "bg/gr"
  489.    @ 10, 7 SAY " FG = bright blue, BG = brown->cyan    " COLOR "b+/gr"
  490.    @ 12, 7 SAY 'Command:  fx_Blink( "w+", "g", .T. )'
  491.    @ 13, 7 SAY " FG = bright white->green, BG = green  " COLOR "w+/g"
  492.    @ 14, 7 SAY " FG = bright white->green, BG = blue   " COLOR "w+/b"
  493.    @ 15, 7 SAY " FG = green, BG = bright white->green  " COLOR "g/w*"
  494.    @ 16, 7 SAY " FG = black, BG = bright white->green  " COLOR "n/w*"
  495.    @ 18, 1 SAY "Restore EVERYTHING to normal with:"
  496.    @ 20, 1 SAY "     fx_RestAll()" COLOR "n/bg"
  497.    @ 22, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  498.    GetKey()
  499.  
  500.    fx_RestAll()
  501.  
  502.    // Lets unflag our colors.
  503.    @  9,56 SAY " " COLOR "w/n"
  504.    @ 11,56 SAY " " COLOR "w/n"
  505.    @ 20,56 SAY " " COLOR "w/n"
  506.  
  507.    *-------------------------------------------------------------------------*
  508.  
  509.    // Do these in advance of the next screen page.
  510.    fx_Fade( "g", "r" )
  511.    fx_Pulse( "rb" )
  512.    fx_Blink( "w", "n" )
  513.  
  514.    BlankText()
  515.    @  0, 1 SAY "Surprise!  Everything was restored to normal but I"
  516.    @  1, 1 SAY "thought you might want to see the special effects"
  517.    @  2, 1 SAY "together on one screen for comparisons."
  518.    @  7,27 SAY 'fx_Fade( "g", "r" )   --->' COLOR "n/bg"
  519.    @ 10,27 SAY 'fx_Pulse( "rb" )      --->' COLOR "n/bg"
  520.    @ 12,27 SAY 'fx_Blink( "w", "n" )  --->' COLOR "n/bg"
  521.    @ 22, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  522.    GetKey()
  523.  
  524.    fx_RestAll()
  525.  
  526.    *-------------------------------------------------------------------------*
  527.  
  528.    BlankText()
  529.    @  0, 1 SAY "All of the preceding special effects (and others)"
  530.    @  1, 1 SAY "can be created using the attribute/palette set/get"
  531.    @  2, 1 SAY "commands that will follow.  But first we need to"
  532.    @  3, 1 SAY "discuss two other commands."
  533.    @  5, 1 SAY "If you recall, the special effects are accomplished"
  534.    @  6, 1 SAY "by rotating palettes N increments every N timer tick"
  535.    @  7, 1 SAY "intervals.  But suppose you wanted palette 2 to be"
  536.    @  8, 1 SAY "a color scheme of shades of red, and palette 11 to"
  537.    @  9, 1 SAY 'represent a set of "tropical" colors you have'
  538.    @ 10, 1 SAY "defined.  If the palettes are constantly rotated,"
  539.    @ 11, 1 SAY "you will get an interesting side effect with each"
  540.    @ 12, 1 SAY "color attribute (i.e., they'll appear as blips)."
  541.    @ 14, 1 SAY "The command"
  542.    @ 16, 1 SAY "     fx_SetFix( [lSetting] )" COLOR "n/bg"
  543.    @ 18, 1 SAY "solves this.  When lSetting = .T., it suspends the"
  544.    @ 19, 1 SAY 'rotations and "fixes" a palette in place.  Of course'
  545.    @ 20, 1 SAY "you no longer have fading, pulsing, and blinking"
  546.    @ 21, 1 SAY "effects (this can be overcome though if you are"
  547.    @ 22, 1 SAY "ingenious enough to figure it out)."
  548.    @ 24, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  549.    GetKey()
  550.  
  551.    *-------------------------------------------------------------------------*
  552.  
  553.    BlankText()
  554.    @  0, 1 SAY "     fx_SetFix( [lSetting] )" COLOR "n/bg"
  555.    @  2, 1 SAY 'In other words, when "fixed" palette mode is ON,'
  556.    @  3, 1 SAY "the following command's DISPLAYS are suspended:"
  557.    @  5, 1 SAY "     fx_Fade()" COLOR "n/bg"
  558.    @  6, 1 SAY "     fx_Pulse()" COLOR "n/bg"
  559.    @  7, 1 SAY "     fx_Blink()" COLOR "n/bg"
  560.    @  8, 1 SAY "     fx_PalRate()" COLOR "n/bg"
  561.    @  9, 1 SAY "     fx_IntRate()" COLOR "n/bg"
  562.    @ 11, 1 SAY 'When lSetting = .F., "fixed" palette mode is'
  563.    @ 12, 1 SAY "turned OFF and the above commands are re-enabled."
  564.    @ 14, 1 SAY "Keep in mind that when the RED/GREEN/BLUE (RGB)"
  565.    @ 15, 1 SAY "values of any attribute in any palette are changed,"
  566.    @ 16, 1 SAY "whether by the special effects commands above or by"
  567.    @ 17, 1 SAY "attribute manipulation commands that follow, those"
  568.    @ 18, 1 SAY "values are STILL IN EFFECT, even when you switch"
  569.    @ 19, 1 SAY 'from "fixed" palette mode to rotation, and'
  570.    @ 20, 1 SAY "vice-versa.  Remembering this rule can prevent some"
  571.    @ 21, 1 SAY "unpredictable results."
  572.    @ 23, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  573.    GetKey()
  574.  
  575.    *-------------------------------------------------------------------------*
  576.  
  577.    BlankText()
  578.    @  0, 1 SAY "Once you have used fx_SetFix( .T. ) to place your"
  579.    @  1, 1 SAY 'application in a "fixed" palette mode, you need to'
  580.    @  2, 1 SAY "be able to change from one palette to another.  This"
  581.    @  3, 1 SAY "is accomplished with the command:"
  582.    @  5, 1 SAY "     fx_SetPal( [nPalette] )" COLOR "n/bg"
  583.    @  7, 1 SAY "fx_SetPal() allows you to set the displayable"
  584.    @  8, 1 SAY "palette.  There are 16 palettes (numbered 0-15),"
  585.    @  9, 1 SAY "each containing 16 color attributes.  Although there"
  586.    @ 10, 1 SAY "are 262,144 color combinations available, you may"
  587.    @ 11, 1 SAY "define only 256 at any time and only 16 of those may"
  588.    @ 12, 1 SAY "be displayed at any time in text mode.  (This is a"
  589.    @ 13, 1 SAY "limitation imposed by DOS.)  The 16 colors that can"
  590.    @ 14, 1 SAY "be displayed are the 16 color attributes in the"
  591.    @ 15, 1 SAY "currently selected palette."
  592.    @ 17, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  593.    GetKey()
  594.  
  595.    *-------------------------------------------------------------------------*
  596.  
  597.    BlankText()
  598.    @  0, 1 SAY "Commands used to get/set palettes/attributes are:"
  599.    @  2, 1 SAY "     fx_Palette( nPalette, [cPal48BtyeString] )" COLOR "n/bg"
  600.    @  3, 1 SAY "     fx_PalAll( [cPal768ByteString] )" COLOR "n/bg"
  601.    @  4, 1 SAY "     fx_Attr( cBaseAttrib, [cAttr48ByteString] )" COLOR "n/bg"
  602.    @  5, 1 SAY "     fx_AttrAll( [cAttr768ByteString] )" COLOR "n/bg"
  603.    @  7, 1 SAY "These commands do not actually manipulate the RGB"
  604.    @  8, 1 SAY "values of the attributes, you must write your own"
  605.    @  9, 1 SAY "routines for that.  They do, however, allow you to"
  606.    @ 10, 1 SAY "get/set the RGB values.  The commands are similiar"
  607.    @ 11, 1 SAY "in use - the difference is the format of the string"
  608.    @ 12, 1 SAY "variable used by the command to get/set the values."
  609.    @ 14, 1 SAY "fx_Palette() is used to get/set a SINGLE PALETTE"
  610.    @ 15, 1 SAY "with 16 attributes.  fx_Attr() is used to get/set a"
  611.    @ 16, 1 SAY "SINGLE ATTRIBUTE across 16 palettes.  fx_PalAll() is"
  612.    @ 17, 1 SAY "used to get/set ALL PALETTES (in PALETTE order) with"
  613.    @ 18, 1 SAY "16 attributes each.  fx_AttrAll() is used to get/set"
  614.    @ 19, 1 SAY "ALL ATTRIBUTES (in ATTRIBUTE order) across 16"
  615.    @ 20, 1 SAY "palettes each.  Please read the docs for more"
  616.    @ 21, 1 SAY "information on these commands."
  617.    @ 23, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  618.    GetKey()
  619.  
  620.    *-------------------------------------------------------------------------*
  621.  
  622.    BlankText()
  623.    @  0, 1 SAY "Now let's display various shades of green.  First,"
  624.    @  1, 1 SAY "we'll create a 48 byte string (16 attributes times 3"
  625.    @  2, 1 SAY "RGB values each) and let this represent one palette."
  626.    @  3, 1 SAY "We need to increment the RGB green value so it will"
  627.    @  4, 1 SAY "range from a low RGB value for green to the maximum"
  628.    @  5, 1 SAY "value (63) over a range of 16 attributes."
  629.    @  7, 1 SAY '     cGreen := ""      // Values range 3,7,...,63'     ;
  630.                COLOR "n/bg"
  631.    @  8, 1 SAY "     nValue := 3       // Starting green value" COLOR "n/bg"
  632.    @  9, 1 SAY "     FOR nLoop = 1 TO 16" COLOR "n/bg"
  633.    @ 10, 1 SAY "        //        -Red-       -Green-      -Blue-"     ;
  634.                COLOR "n/bg"
  635.    @ 11, 1 SAY "        cGreen += CHR(0) + CHR( nValue ) + CHR(0)"     ;
  636.                COLOR "n/bg"
  637.    @ 12, 1 SAY "        nValue += 4    // Increment value by 4" COLOR "n/bg"
  638.    @ 13, 1 SAY "     NEXT" COLOR "n/bg"
  639.    @ 15, 1 SAY "Now we can implement our greens with the commands:"
  640.    @ 17, 1 SAY "     fx_SetFix( .T. )  // If not issued before" COLOR "n/bg"
  641.    @ 18, 1 SAY "     fx_Palette( 14, cGreen )  // We'll use pal # 14"  ;
  642.                COLOR "n/bg"
  643.    @ 19, 1 SAY "     fx_SetPal( 14 )           //    but any will do"  ;
  644.                COLOR "n/bg"
  645.    @ 21, 1 SAY "Of course, EVERYTHING will be a shade of green."
  646.    @ 23, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  647.    GetKey()
  648.  
  649.    cGreen := ""       // Values range 3,7,...,63
  650.    nValue := 3        // Starting green value
  651.    FOR nLoop = 1 TO 16
  652.        //        -Red-       -Green-      -Blue-
  653.        cGreen += CHR(0) + CHR( nValue ) + CHR(0)
  654.        nValue += 4    // Increment value by 4
  655.    NEXT
  656.  
  657.    fx_SetFix( .T. )   // If not issued before
  658.    fx_Palette( 14, cGreen )  // We'll use pal # 14
  659.    fx_SetPal( 14 )           //    but any will do
  660.  
  661.    *-------------------------------------------------------------------------*
  662.  
  663.    BlankText()
  664.    @  0, 1 SAY "As you can see, everything is a shade of green.  Can"
  665.    @  1, 1 SAY 'you tell which shade of green is the "normal" green?'
  666.    @  2, 1 SAY "(Hint:  It's not _wrong_ green!)"
  667.    @  4, 3 SAY "   " COLOR "n/n"
  668.    @  4, 6 SAY "   " COLOR "n/b"
  669.    @  4, 9 SAY "   " COLOR "n/g"
  670.    @  4,12 SAY "   " COLOR "n/bg"
  671.    @  4,15 SAY "   " COLOR "n/r"
  672.    @  4,18 SAY "   " COLOR "n/rb"
  673.    @  4,21 SAY "   " COLOR "n/gr"
  674.    @  4,24 SAY "   " COLOR "n/w"
  675.    @  4,27 SAY "   " COLOR "n/n*"
  676.    @  4,30 SAY "   " COLOR "n/b*"
  677.    @  4,33 SAY "   " COLOR "n/g*"
  678.    @  4,36 SAY "   " COLOR "n/bg*"
  679.    @  4,39 SAY "   " COLOR "n/r*"
  680.    @  4,42 SAY "   " COLOR "n/rb*"
  681.    @  4,45 SAY "   " COLOR "n/gr*"
  682.    @  4,48 SAY "   " COLOR "n/w*"
  683.    @  6, 1 SAY "You'll notice the color to the extreme left above"
  684.    @  7, 1 SAY "appears to be almost black, not green.  It does"
  685.    @  8, 1 SAY "actually have some green in it - recall our initial"
  686.    @  9, 1 SAY "RGB green value was 3 (out of possible 63).  The"
  687.    @ 10, 1 SAY "value is very low and the color is very faint.  But"
  688.    @ 11, 1 SAY "it is there!"
  689.    @ 13, 1 SAY "We'll now go back to palette 0 and return to normal"
  690.    @ 14, 1 SAY "colors because palette 0 was not changed.  We can"
  691.    @ 15, 1 SAY "use the command:"
  692.    @ 17, 1 SAY "     fx_SetPal( 0 )" COLOR "n/bg"
  693.    @ 19, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  694.    GetKey()
  695.  
  696.    fx_SetPal( 0 )
  697.  
  698.    *-------------------------------------------------------------------------*
  699.  
  700.    BlankText()
  701.    @  0, 1 SAY "Green (and most of the default colors) are easy to"
  702.    @  1, 1 SAY "shade from dark to light because the increment for"
  703.    @  2, 1 SAY "each applicable RGB value would be the same (i.e.,"
  704.    @  3, 1 SAY "cyan's RGB values are 0/42/42, magenta is 42/42/0)."
  705.    @  4, 1 SAY "For unequal values (such as brown - 42/21/0), you"
  706.    @  5, 1 SAY "need to maintain the proper color ratio mix to"
  707.    @  6, 1 SAY 'produce "true" color shadings.  For example:'
  708.    @  8, 1 SAY '     cBrown := ""' COLOR "n/bg"
  709.    @  9, 1 SAY "     nValue := 3" COLOR "n/bg"
  710.    @ 10, 1 SAY "     FOR nLoop = 1 TO 16" COLOR "n/bg"
  711.    @ 11, 1 SAY "        // Set RGB's - Green is 50% of Red value" COLOR "n/bg"
  712.    @ 12, 1 SAY "        cBrown += CHR( nValue )               ;" COLOR "n/bg"
  713.    @ 13, 1 SAY "                  + CHR( INT( nValue / 2 ) )  ;" COLOR "n/bg"
  714.    @ 14, 1 SAY "                  + CHR(0)" COLOR "n/bg"
  715.    @ 15, 1 SAY "        nValue += 4" COLOR "n/bg"
  716.    @ 16, 1 SAY "     NEXT" COLOR "n/bg"
  717.    @ 17, 1 SAY "     fx_Palette( 8, cBrown )   // We'll use pal # 8"  ;
  718.                COLOR "n/bg"
  719.    @ 18, 1 SAY "     fx_SetPal( 8 )" COLOR "n/bg"
  720.    @ 20, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  721.    GetKey()
  722.  
  723.    cBrown := ""
  724.    nValue := 3
  725.    FOR nLoop = 1 TO 16
  726.       // Set RGB's - Green is 50% of Red value
  727.       cBrown += CHR( nValue )               ;
  728.                 + CHR( INT( nValue / 2 ) )  ;
  729.                 + CHR(0)
  730.       nValue += 4
  731.    NEXT
  732.    fx_Palette( 8, cBrown )   // We'll use pal # 8
  733.    fx_SetPal( 8 )
  734.  
  735.    *-------------------------------------------------------------------------*
  736.  
  737.    BlankText()
  738.    @  0, 1 SAY "Let's go back to palette 0 before continuing."
  739.    @  2, 1 SAY "     fx_SetPal( 0 )" COLOR "n/bg"
  740.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  741.    GetKey()
  742.  
  743.    fx_SetPal( 0 )
  744.  
  745.    *-------------------------------------------------------------------------*
  746.  
  747.    BlankText()
  748.    @  0, 1 SAY "The command fx_Attr() lets us get/set an attribute"
  749.    @  1, 1 SAY "across all palettes.  Black is such a drab color"
  750.    @  2, 1 SAY "(actually it's no color).  Why don't we change it to"
  751.    @  3, 1 SAY "pink!"
  752.    @  5, 1 SAY "The RGB values for a high-intensity pink are"
  753.    @  6, 1 SAY "63/0/47.  The following will create a 48-byte string"
  754.    @  7, 1 SAY "with pink repeated for all 16 palettes."
  755.    @  9, 1 SAY '     cPink := ""' COLOR "n/bg"
  756.    @ 10, 1 SAY "     FOR nLoop = 1 TO 16" COLOR "n/bg"
  757.    @ 11, 1 SAY "        cPink += CHR( 63 ) + CHR( 0 ) + CHR( 47 )"  ;
  758.                COLOR "n/bg"
  759.    @ 12, 1 SAY "     NEXT" COLOR "n/bg"
  760.    @ 13, 1 SAY '     fx_Attr( "n", cPink )' COLOR "n/bg"
  761.    @ 15, 1 SAY "Need proof it's stored in all the palettes?  We will"
  762.    @ 16, 1 SAY 'de-activate our "fixed" palette mode and return to'
  763.    @ 17, 1 SAY "rotating palettes with the command:"
  764.    @ 19, 1 SAY "     fx_SetFix( .F. )" COLOR "n/bg"
  765.    @ 21, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  766.    GetKey()
  767.  
  768.    cPink := ""
  769.    FOR nLoop = 1 TO 16
  770.        cPink += CHR( 63 ) + CHR( 0 ) + CHR( 47 )
  771.    NEXT
  772.    fx_Attr( "n", cPink )
  773.    fx_SetFix( .F. )
  774.  
  775.    *-------------------------------------------------------------------------*
  776.  
  777.    BlankText()
  778.    @  0, 1 SAY "Now that the palettes are rotating again, we can"
  779.    @  1, 1 SAY "see that pink remains constant because it's in"
  780.    @  2, 1 SAY "every palette."
  781.    @  4, 1 SAY "But what's all this flickering?  Let's slow down"
  782.    @  5, 1 SAY "and take a look."
  783.    @  7, 1 SAY "     fx_IntRate( 12 )" COLOR "n/bg"
  784.    @  9, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  785.    GetKey()
  786.  
  787.    fx_IntRate( 12 )
  788.  
  789.    *-------------------------------------------------------------------------*
  790.  
  791.    BlankText()
  792.    @  0, 1 SAY "With the palettes rotating slower we'll be able to"
  793.    @  1, 1 SAY "diagnose our problem.  Have you figured it out yet?"
  794.    @  3, 1 SAY "Palette 8 was set for shading brown and palette 14"
  795.    @  4, 1 SAY "was set for shading green.  We forgot to restore"
  796.    @  5, 1 SAY "those palettes before starting our palette rotation!"
  797.    @  7, 1 SAY "Notice that pink, however, remains constant since we"
  798.    @  8, 1 SAY "defined it for ALL palettes (including 8 and 14)."
  799.    @ 10, 1 SAY "When we set palettes 8 and 14, we should have saved"
  800.    @ 11, 1 SAY "the original definitions to a variable, as in"
  801.    @ 13, 1 SAY "     cSavePal := fx_Palette( nPalette, cRGBString )"  ;
  802.            COLOR "n/bg"
  803.    @ 15, 1 SAY "We could then restore them easily with:"
  804.    @ 17, 1 SAY "     fx_Palette( nPalette, cSavePal )" COLOR "n/bg"
  805.    @ 19, 1 SAY "Of course, they should have been restored BEFORE we"
  806.    @ 20, 1 SAY "defined pink across all palettes, otherwise, we"
  807.    @ 21, 1 SAY "would have over-written pink in palettes 8 and 14."
  808.    @ 23, 1 SAY "Press <ENTER> to continue..." COLOR "r/bg"
  809.    GetKey()
  810.  
  811.    *-------------------------------------------------------------------------*
  812.  
  813.    BlankText()
  814.    @  0, 1 SAY "Lets return everything to normal with:"
  815.    @  2, 1 SAY "     fx_RestAll()" COLOR "n/bg"
  816.    @  4, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  817.    GetKey()
  818.  
  819.    fx_RestAll()
  820.  
  821.    *-------------------------------------------------------------------------*
  822.  
  823.    BlankText()
  824.    @  0, 1 SAY "By redefining the RGB values of an attribute or"
  825.    @  1, 1 SAY 'palette and "fixing" palettes or rotating palettes'
  826.    @  2, 1 SAY "at various speeds, you have complete control to"
  827.    @  3, 1 SAY "create almost any color effect you can imagine. You"
  828.    @  4, 1 SAY "can study the FXDEMO.PRG source to learn more about"
  829.    @  5, 1 SAY "how to create some sophisticated effects."
  830.    @  7, 1 SAY "Before your application terminates and returns to"
  831.    @  8, 1 SAY "DOS, or at any time it may be necessary, you must"
  832.    @  9, 1 SAY "disable the special effects colors and the timer"
  833.    @ 10, 1 SAY "intercept.  This is done with the following command:"
  834.    @ 12, 1 SAY "     fx_Disable()" COLOR "n/bg"
  835.    @ 14, 1 SAY "Press <ENTER> to execute..." COLOR "r/bg"
  836.    GetKey()
  837.  
  838.    fx_Disable()
  839.  
  840.    *-------------------------------------------------------------------------*
  841.  
  842.    BlankText()
  843.    @  0, 1 SAY "Two other commands we have not discussed can be"
  844.    @  1, 1 SAY "used even when the special effects are disabled."
  845.    @  3, 1 SAY "     fx_IsFxOn()" COLOR "n/bg"
  846.    @  4, 1 SAY "     fx_IsVGA()" COLOR "n/bg"
  847.    @  6, 1 SAY "fx_IsFxOn() returns a logical .T./.F. indicating"
  848.    @  7, 1 SAY "whether or not the special effects are enabled."
  849.    @  9, 1 SAY "fx_IsVGA() returns a logical .T./.F. indicating"
  850.    @ 10, 1 SAY "whether or not a VGA system is installed.  (A VGA"
  851.    @ 11, 1 SAY "is required for the special effects commands.)"
  852.    @ 13, 1 SAY "This concludes our demo program.  Please review"
  853.    @ 14, 1 SAY "the documentation and syntax for each command and"
  854.    @ 15, 1 SAY "also read the VGA.DOC file and study the FXCOLOR.ASM"
  855.    @ 16, 1 SAY "source file for more information and tips on using"
  856.    @ 17, 1 SAY "these and other special effects."
  857.    @ 19, 1 SAY "Press <ENTER> to exit..." COLOR "r/bg"
  858.    GetKey()
  859.  
  860.    ExitDemo()
  861.  
  862. RETURN ( NIL )
  863.  
  864.  
  865. ******************************************************************************
  866.  
  867.  
  868. FUNCTION GetKey()
  869.     
  870.    IF INKEY( 0 ) == K_ESC
  871.       fx_Disable()
  872.       ExitDemo()
  873.    ENDIF
  874.  
  875. RETURN ( NIL )
  876.  
  877.  
  878. *******************************************************************************
  879.  
  880.  
  881. FUNCTION BlankText()
  882.     
  883.    @ 0, 0 CLEAR TO 24, 53
  884.    
  885. RETURN ( NIL )
  886.  
  887.  
  888. *******************************************************************************
  889.  
  890.  
  891. FUNCTION ExitDemo()
  892.     
  893.    SETCOLOR( "n/w,n/w,n,n,n/w" )
  894.     RESTSCREEN( 0, 0, MAXROW(), MAXCOL(), cEntryScreen )
  895.     SETCURSOR( SC_NORMAL )
  896.     QUIT
  897.     
  898. RETURN ( NIL )
  899.  
  900.  
  901. *******************************************************************************
  902.  
  903.  
  904. /* EOF: fxdemo.prg */
  905.