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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - scroll.c
  3.  *
  4.  * function(s)
  5.  *        zapline  - deletes a line
  6.  *        __scroll - scrolls the current window in text mode
  7.  *
  8.  *-----------------------------------------------------------------------*/
  9.  
  10. /*
  11.  *      C/C++ Run Time Library - Version 5.0
  12.  *
  13.  *      Copyright (c) 1987, 1992 by Borland International
  14.  *      All Rights Reserved.
  15.  *
  16.  */
  17.  
  18.  
  19. #include <conio.h>
  20. #include <_video.h>
  21.  
  22. /*---------------------------------------------------------------------*
  23.  
  24. Name            zapline - deletes a line
  25.  
  26. Usage           static void near pascal zapline(unsigned int *linebuffer,
  27.                                                 int x1, int x2);
  28.  
  29. Return value    None
  30.  
  31. *---------------------------------------------------------------------*/
  32. static void near pascal zapline(unsigned int *linebuffer, int x1, int x2)
  33. {
  34.         _CH = _video.attribute;
  35.         _CL = 0x20;
  36.         for (; x1 <= x2; x1++)
  37.                 *linebuffer++ = _CX;
  38. }
  39.  
  40.  
  41. /*---------------------------------------------------------------------*
  42.  
  43. Name            __scroll - scrolls the current window in text mode
  44.  
  45. Usage           static pascal __scroll(uchar dir, uchar x1, uchar y1,
  46.                                        uchar x2, uchar y2, uchar lines);
  47.  
  48. Return value    None
  49.  
  50. *---------------------------------------------------------------------*/
  51. void pascal near __scroll(uchar dir, uchar x1, uchar y1, uchar x2, uchar y2, uchar lines)
  52. {
  53.         unsigned linebuffer[80];
  54.  
  55.         if (!_video.graphicsmode && directvideo && lines == 1)
  56.         {
  57.                 x1++;
  58.                 y1++;
  59.                 x2++;
  60.                 y2++;
  61.                 if (dir == UP)
  62.                 {
  63.                         movetext(x1,y1+1,x2,y2,x1,y1);
  64.                         gettext(x1,y2,x1,y2,linebuffer);
  65.                         zapline(linebuffer,x1,x2);
  66.                         puttext(x1,y2,x2,y2,linebuffer);
  67.                 }
  68.                 else
  69.                 {
  70.                         movetext(x1,y1,x2,y2-1,x1,y1+1);
  71.                         gettext(x1,y1,x1,y1,linebuffer);
  72.                         zapline(linebuffer,x1,x2);
  73.                         puttext(x1,y1,x2,y1,linebuffer);
  74.                 }
  75.         }
  76.         else
  77.         {
  78.                 _BH = _video.attribute;
  79.                 _AH = dir;
  80.                 _AL = lines;
  81.                 _CH = y1;
  82.                 _CL = x1;
  83.                 _DH = y2;
  84.                 _DL = x2;
  85.                 _VideoInt();
  86.         }
  87. }
  88.