home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / thewall.prg < prev    next >
Text File  |  1993-10-14  |  2KB  |  75 lines

  1. /*
  2.  * File......: THEWALL.PRG
  3.  * Author....: Dave Pearson
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Dave Pearson
  7.  * Date......: $Date$
  8.  * Revision..: $Revision$
  9.  * Log file..: $Logfile$
  10.  *
  11.  * This is an original work by Dave Pearson and is placed in the public
  12.  * domain.
  13.  *
  14.  * Modification history:
  15.  * ---------------------
  16.  *
  17.  * $Log$
  18.  *
  19.  */
  20.  
  21. #include "gt_lib.ch"
  22.  
  23. #define TW_ODD_BRICK  "┬──┴──"
  24. #define TW_EVEN_BRICK "┴──┬──"
  25.  
  26. /*  $DOC$
  27.  *  $FUNCNAME$
  28.  *      GT_THEWALL()
  29.  *  $CATEGORY$
  30.  *      Video
  31.  *  $ONELINER$
  32.  *      Draws a wall on screen. For Floyd fans only! <g>
  33.  *  $SYNTAX$
  34.  *      GT_TheWall([<nTop>],[<nLeft>],[<nBottom>],[<nRight>],;
  35.  *                 [<cColour>]) --> NIL
  36.  *  $ARGUMENTS$
  37.  *      <nTop>, <nLeft>, <nBottom> and <nRight> are the screen co-ordinates
  38.  *      at which to draw the wall. The defaults are 0, 0, maxrow(), maxcol().
  39.  *
  40.  *      <cColour> is an optional string parameter that is the colour if the
  41.  *      wall. If not supplied this defaults to the current colour.
  42.  *  $RETURNS$
  43.  *      Nothing.
  44.  *  $DESCRIPTION$
  45.  *      GT_TheWall() draws a wall on your screen. It could be nice as a
  46.  *      background for your applications.
  47.  *  $EXAMPLES$
  48.  *      // Draw a wall on the screen fitting inside a border.
  49.  *
  50.  *      dispbox(0,0,maxrow(),maxcol(),"w+/b")
  51.  *      GT_TheWall(1,1,maxrow()-1,maxcol()-1,"w/r")
  52.  *  $END$
  53.  */
  54.  
  55. function GT_TheWall(nTop,nLeft,nBottom,nRight,cColour)
  56. local nLineCount := 0,;
  57.       cOldColour := setcolor()
  58. default nTop    to 0
  59. default nLeft   to 0
  60. default nBottom to maxrow()
  61. default nRight  to maxcol()
  62. default cColour to setcolor()
  63. dispbegin()
  64. setcolor(cColour)
  65. for nLineCount := nTop to nBottom
  66.    devpos(nLineCount,nLeft)
  67.    if nRight-nLeft > len(TW_ODD_BRICK)
  68.       devout(replic(if((nLineCount % 2) != 0,TW_ODD_BRICK,TW_EVEN_BRICK),int((nRight-nLeft)/len(TW_ODD_BRICK))))
  69.    endif
  70.    devout(substr(if((nLineCount % 2) != 0,TW_ODD_BRICK,TW_EVEN_BRICK),1,(nRight-col())+1))
  71. next
  72. setcolor(cOldColour)
  73. dispend()
  74. return(NIL)
  75.