home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 5.ddi / CLIBSRC2.ZIP / WINDOW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.2 KB  |  72 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - window.c
  3.  *
  4.  * function(s)
  5.  *        window - defines a rectangular area of the screen as a window
  6.  *                 and puts the cursor inside the window
  7.  *-----------------------------------------------------------------------*/
  8.  
  9. /*
  10.  *      C/C++ Run Time Library - Version 5.0
  11.  *
  12.  *      Copyright (c) 1987, 1992 by Borland International
  13.  *      All Rights Reserved.
  14.  *
  15.  */
  16.  
  17.  
  18. #include <_video.h>
  19. #include <conio.h>
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name            window - defines a rectangular area of the screen as a
  24.                          window and puts the cursor inside the window
  25.  
  26. Usage           void window(int left, int top, int right, int bottom);
  27.  
  28. Prototype in    conio.h
  29.  
  30. Description     window defines a text window on the screen.  If the
  31.                 coordinates are in any way invalid, the call to window()
  32.                 is ignored.
  33.  
  34.                 left and top are the screen coordinates of the upper left
  35.                 corner of the window.
  36.  
  37.                 right and bottom are the screen coordinates of the lower
  38.                 right corner.
  39.  
  40.                 The minimum size of the text window is 1 column by 1
  41.                 line. The default window is full screen, with these
  42.                 coordinates:
  43.  
  44.                         80-column mode: 1, 1, 80, 25
  45.                         40-column mode: 1, 1, 40, 25
  46.  
  47. Return value    None
  48.  
  49. *---------------------------------------------------------------------*/
  50. void window(int left, int top, int right, int bottom)
  51. {
  52.         left    -= 1;
  53.         right   -= 1;
  54.         top     -= 1;
  55.         bottom  -= 1;
  56.         /* consistency checking */
  57.         if (left < 0  || right >= _video.screenwidth   ||
  58.                 top  < 0  || bottom >= _video.screenheight ||
  59.                 (right - left < 0) || (bottom - top < 0)) return;
  60.  
  61.         _video.windowx1 = left;
  62.         _video.windowx2 = right;
  63.         _video.windowy1 = top;
  64.         _video.windowy2 = bottom;
  65.  
  66.         _DL = left;             /* position to window 1,1 */
  67.         _DH = top;
  68.         _AH = V_SET_CURSOR_POS;
  69.         _BH = 0;
  70.         _VideoInt();
  71. }
  72.