home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 1 / FishNMoreVol1.bin / more / code_examples / librar / box.c < prev    next >
Text File  |  1989-02-08  |  2KB  |  99 lines

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*             BOX(X,X,X,X,X)        */
  4. /*                    */
  5. /* Functionality:            */
  6. /*    Draws a box in text mode.    */
  7. /* Arguments:                */
  8. /*    0: Type of box.  0 is a single    */
  9. /*       line border, and 1 is double */
  10. /*       lined.  Any other number    */
  11. /*       erases a box already drawn.    */
  12. /*     1: Horizontal coordinate of    */
  13. /*       upper left-hand corner.    */
  14. /*    2: Vertical coordinate of upper */
  15. /*       left-hand corner.        */
  16. /*     3: Horizontal coordinate of    */
  17. /*       upper right-hand corner.    */
  18. /*    4: Vertical coordinate of upper */
  19. /*       right-hand corner.        */
  20. /* Functions used:            */
  21. /*      CURS_OUT(),OUT(),SCR_CURS()    */
  22. /* Returns: Nothing            */
  23. /* Author: John Callicotte        */
  24. /* Date created/modified: 09/01/88    */
  25. /*                    */
  26. /*--------------------------------------*/
  27.  
  28. void box(type,x1,y1,x2,y2)
  29. int type,x1,x2,y1,y2;
  30. {
  31.     int d,j;
  32.     scr_curs(x1,y1);        /* Set the cursor on the upper */
  33.                     /* left-hand corner.            */
  34.  
  35.     if (!type){            /* Display the appropriate corner */
  36.             out(218,1);
  37.             d=196;
  38.     }
  39.     else{
  40.             if (type==1){
  41.                 out(201,1);
  42.                 d=205;
  43.             }
  44.             else{
  45.                 out(32,1);
  46.                 d=32;
  47.             }
  48.     }
  49.     out(d,y2-y1);            /* Display the top of the box */
  50.     if (!type)
  51.             d=191;
  52.     else{
  53.             if (type==1)
  54.                 d=187;
  55.             else
  56.                 d=32;
  57.     }
  58.     out(d,1);            /* Display the upper right-hand */
  59.                     /* corner.            */
  60.     if (!type)
  61.             d=179;
  62.     else{
  63.             if (type==1)
  64.                 d=186;
  65.             else
  66.                 d=32;
  67.     }
  68.     for (j=x1+1;j<x2;j++){        /* Display both vertical sides */
  69.              curs_out(j,y1,d,1);
  70.              curs_out(j,y2+1,d,1);
  71.     }
  72.     if (!type)
  73.             d=192;
  74.     else{
  75.             if (type==1)
  76.                 d=200;
  77.             else
  78.                 d=32;
  79.     }
  80.     curs_out(x2,y1,d,1);         /* Display lower left-hand corner */
  81.     if (!type)
  82.             d=196;
  83.     else{
  84.             if (type==1)
  85.                 d=205;
  86.             else
  87.                 d=32;
  88.     }
  89.     out(d,y2-y1);            /* Display bottom of box */
  90.     if (!type)
  91.             d=217;
  92.     else{
  93.             if (type==1)
  94.                 d=188;
  95.             else
  96.                 d=32;
  97.     }
  98.     out(d,1);            /* Display lower right-hand corner */
  99. }