home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / SCROLL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  2.4 KB  |  89 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. /*|                                                              |*/
  12. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  13. /*|                                                              |*/
  14. /*|                                                              |*/
  15. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  16. /*|     All Rights Reserved.                                     |*/
  17. /*|                                                              |*/
  18. /*[]------------------------------------------------------------[]*/
  19.  
  20. #include <conio.h>
  21. #include <_video.h>
  22.  
  23. /*---------------------------------------------------------------------*
  24.  
  25. Name        zapline - deletes a line
  26.  
  27. Usage        static void near pascal zapline(unsigned int *linebuffer,
  28.                         int x1, int x2);
  29.  
  30. Return value    None
  31.  
  32. *---------------------------------------------------------------------*/
  33. static void near pascal zapline(unsigned int *linebuffer, int x1, int x2)
  34. {
  35.     _CX = *linebuffer;
  36.     _CL = 0x20;
  37.     for (; x1 <= x2; x1++)
  38.         *linebuffer++ = _CX;
  39. }
  40.  
  41.  
  42. /*---------------------------------------------------------------------*
  43.  
  44. Name            __scroll - scrolls the current window in text mode
  45.  
  46. Usage        static pascal __scroll(uchar dir, uchar x1, uchar y1,
  47.                        uchar x2, uchar y2, uchar lines);
  48.  
  49. Return value    None
  50.  
  51. *---------------------------------------------------------------------*/
  52. void pascal near __scroll(uchar dir, uchar x1, uchar y1, uchar x2, uchar y2, uchar lines)
  53. {
  54.     unsigned linebuffer[80];
  55.  
  56.     if (!_video.graphicsmode && directvideo && lines == 1)
  57.     {
  58.         x1++;
  59.         y1++;
  60.         x2++;
  61.         y2++;
  62.         if (dir == UP)
  63.         {
  64.             movetext(x1,y1+1,x2,y2,x1,y1);
  65.             gettext(x1,y2,x1,y2,linebuffer);
  66.             zapline(linebuffer,x1,x2);
  67.             puttext(x1,y2,x2,y2,linebuffer);
  68.         }
  69.         else
  70.         {
  71.             movetext(x1,y1,x2,y2-1,x1,y1+1);
  72.             gettext(x1,y1,x1,y1,linebuffer);
  73.             zapline(linebuffer,x1,x2);
  74.             puttext(x1,y1,x2,y1,linebuffer);
  75.         }
  76.     }
  77.     else
  78.     {
  79.         _BH = _video.attribute;
  80.         _AH = dir;
  81.         _AL = lines;
  82.         _CH = y1;
  83.         _CL = x1;
  84.         _DH = y2;
  85.         _DL = x2;
  86.         _VideoInt();
  87.     }
  88. }
  89.