home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
FGIN131.ZIP
/
SOURCE.ZIP
/
KEYDELAY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-21
|
771b
|
35 lines
#include "\keys\keys.h"
#include <time.h>
/****************************************************************************\
\****************************************************************************/
/****************************************************************************\
int key_delay(int seconds)
This function will wait a specified number of seconds or until
a key is pressed. It returns the key pressed, -1 if time expired.
\****************************************************************************/
int delay_key(int seconds)
{
clock_t start_time=clock();
int key;
clear_key();
do {
if ((key=check_key())>=0) //if key pressed
break;
}while(clock()<start_time+(seconds*18));
return(key);
}