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 - curcolor() draw a horizontal bar without changing screen text http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 curcolor()          Draw a horizontal bar without changing screen text
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   proc curcolor extern
   param value int iRow, ;
         value int iCol, ;
         value int iColor, ;
         value int iLength

 Arguments
   iRow is the start row of the bar.

   iCol is the start column of the bar.

   iColor is the color of the bar.

   iLength is the length of the bar.

 Return
   None.

 Description
   This procedure paints a horizontal bar at iRow, iCol for iLength with a
   color attribute of iColor. It does not erase or change the text on the
   screen; in that area, it only changes the color attribute.

   Use this function to create a cursor bar for a menu system, or to quickly
   change the attribute of a string on the screen without having to repaint
   the string.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_curcolor
   vardef
      uint uKey
      char cMsg
   enddef
   /*
   Have a message "WAKE UP!!" flash on the screen in different colors if
   user does not press a key within 5 seconds
   */
   cMsg := "WAKE UP!!"
   @ 10, 35 ??  "Press a key"
   uKey := delay( 5 )
   if uKey == 0
      clear
      cursor( .f. )
      @ 12, 37 ?? cMsg                              // print message
      repeat
         curcolor( 12, 37, CYAN_RED, len( cMsg ) )  // change color
         waitms( 500 )
         curcolor( 12, 37, RED_CYAN, len( cMsg ) )  // change color
         waitms( 500 )
      until iskey() != 0
   endif
   endproc

   proc main
   Test_curcolor()
   endproc

See Also: curcolorvert()

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