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 - getdoscolor() return the dos screen color attribute http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getdoscolor()       Return the DOS screen color attribute
------------------------------------------------------------------------------
 Declaration
   color.hdr

 Syntax
   func uint getdoscolor extern

 Arguments
   None.

 Return
   A color attribute value.

 Description
   getdoscolor() outputs a blank character via the DOS standard output, and
   then determines the color attribute of this character.

   Call this function at the begin of an application before clearing the
   screen, or setting any color attributes, and save the return value. Before
   finally clearing the screen at the end of the application, set
   __syscolor[ CLR_STD ] to the saved value.

   This makes sure that the user finds his/her DOS screen in the same colors
   as it was before starting the application.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_getdoscolor
   vardef
      byte bDOSColor
   enddef
   bDOSColor := getdoscolor()             // save original color
   __syscolor[ CLR_STD ] := RED_WHITE     // change screen attributes
   clear
   wait
   __syscolor[ CLR_STD ] := bDOSColor     // restore original color
   clear
   endproc

   proc main
   Test_getdoscolor()
   endproc

See Also: __doscolor __syscolor

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