home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-ASM_VI.ARJ / PROGC.ZIP / PROGC009.C < prev    next >
Text File  |  1988-04-10  |  1KB  |  32 lines

  1.  
  2. /************************************************************************/
  3. /* Scroll using arrow keys and quit if Escape is pressed                */
  4. /************************************************************************/
  5.  
  6. smooth_vertical()
  7.         {
  8.         #define KEY_ESC         0x011B
  9.         #define KEY_UP          0x4800
  10.         #define KEY_DOWN        0x5000
  11.         #define KEY_LEFT        0x4B00
  12.         #define KEY_RIGHT       0x4D00
  13.         #define KEY_ENTER       0x1C0D
  14.  
  15.         int     y = 0, key;
  16.         while((key = get_key()) != KEY_ENTER)
  17.                 switch (key)
  18.                     {
  19.                     case KEY_UP:
  20.                         y = (--y) < 0 ? 0 : y;
  21.                         vertical_scroll(y);             /* Scroll up    */
  22.                         break;
  23.                     case KEY_DOWN:
  24.                         vertical_scroll(++y);           /* Scroll down  */
  25.                         break;
  26.                     default:
  27.                         break;
  28.                     }
  29.  
  30.         vertical_scroll(0);
  31.         }
  32.