Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - restcolors() restore saved color settings http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 restcolors()        Restore saved color settings
------------------------------------------------------------------------------
 Declaration
   color.hdr

 Syntax
   proc restcolors extern

 Arguments
   None.

 Return
   None.

 Description
   This procedure restores the color settings which were last saved by the
   savecolors() procedure. If savecolors() was never called before,
   restcolors() leaves the color attributes unchanged.

   The save/restcolors() pair of routines saves/restores all 32 elements of
   the __syscolor[] system array. This pair of routines is handy if you
   need to save, and later restore color attributes.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_restcolors
   vardef
      byte bColorStd, bColorEnhcd
   enddef
   ? "Original color"
   
   // The conventional way to save/restore colors
   bColorStd   := __syscolor[ CLR_STD ] // save the current color attributes
   bColorEnhcd := __syscolor[ CLR_ENHCD ]
   __syscolor[ CLR_STD ] := RED_LIGHT_CYAN
   ? "Colors changed"
   __syscolor[ CLR_STD ]   := bColorStd // restore the old cursor position
   __syscolor[ CLR_ENHCD ] := bColorEnhcd
   ? "Colors restored"
   
   // The shorter way to save/restore colors
   savecolors()                         // save the current colors
   __syscolor[ CLR_STD ] := RED_LIGHT_CYAN
   ? "Colors changed"
   restcolors()                         // restore the old colors
   ? "Colors restored"
   endproc

   proc main
   Test_restcolors()
   endproc

See Also: savecolors()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson