home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
C-ASM_VI.ARJ
/
PROGC.ZIP
/
PROGC010.C
< prev
next >
Wrap
Text File
|
1988-04-10
|
1KB
|
36 lines
/************************************************************************/
/* Scroll in a loop by one pixel at a time */
/* Scroll using arrow keys and quit if Escape is pressed */
/************************************************************************/
smooth_horizontal()
{
#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 x = 0, i, key;
set_more_columns(100); /* Select 100 text column mode */
for (i = 0; i < 25;i++) /* Fill newly organized text buffer */
printf("\nThis is text line %2d in the new text buffer",i);
while((key = get_key()) != KEY_ENTER)
switch (key)
{
case KEY_RIGHT:
x = (++x) > 799 ? 799 : x;
horizontal_scroll(x); /* Scroll right */
break;
case KEY_LEFT:
x = (--x) < 0 ? 0 : x;
horizontal_scroll(x); /* Scroll left */
break;
default:
break;
}
horizontal_scroll(0);
}