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 >
Wrap
Text File
|
1988-04-10
|
1KB
|
32 lines
/************************************************************************/
/* Scroll using arrow keys and quit if Escape is pressed */
/************************************************************************/
smooth_vertical()
{
#define KEY_ESC 0x011B
#define KEY_UP 0x4800
#define KEY_DOWN 0x5000
#define KEY_LEFT 0x4B00
#define KEY_RIGHT 0x4D00
#define KEY_ENTER 0x1C0D
int y = 0, key;
while((key = get_key()) != KEY_ENTER)
switch (key)
{
case KEY_UP:
y = (--y) < 0 ? 0 : y;
vertical_scroll(y); /* Scroll up */
break;
case KEY_DOWN:
vertical_scroll(++y); /* Scroll down */
break;
default:
break;
}
vertical_scroll(0);
}