adding a kbhit() function

This commit is contained in:
phyto
2019-05-13 17:48:58 +02:00
parent cce90eb60e
commit 06b5603b8b
3 changed files with 36 additions and 2 deletions

View File

@@ -11,6 +11,30 @@
extern int verbosity;
/* ---------------------------------------------------------------- */
int kbhit(void)
{
int r, ch;
nodelay(stdscr, TRUE);
noecho();
// check for input
ch = getch();
if( ch == ERR) { // no input
r = FALSE;
}
else { // input
r = TRUE;
ungetch(ch);
}
// restore block and echo
echo();
nodelay(stdscr, FALSE);
return r;
}
/* ---------------------------------------------------------------- */
int message(char *txt)
{

View File

@@ -2,6 +2,8 @@
* interface ncurses pour dd2 monitoring
*/
int kbhit(void);
int fond_ecran(char *titre);
int message(char *);