Commit c2525247 authored by deuce's avatar deuce
Browse files

Added kbwait() to replace kbhit() in inkey() function.

parent 79f2e1af
......@@ -7,13 +7,6 @@
static int lastattr=0;
static long mode;
int inkey(int mode)
{
if(mode)
return(kbhit());
return(getch());
}
short curses_color(short color)
{
switch(color)
......@@ -335,12 +328,12 @@ void textattr(unsigned char attr)
bkgdset(colour);
}
int _kbhit(void)
int kbhit(void)
{
struct timeval timeout;
fd_set rfds;
timeout.tv_sec=1;
timeout.tv_sec=0;
timeout.tv_usec=0;
FD_ZERO(&rfds);
FD_SET(fileno(stdin),&rfds);
......@@ -623,7 +616,7 @@ void _setcursortype(int type) {
default: /* Normal cursor */
curs_set(1);
break;
}
refresh();
}
......@@ -3,7 +3,6 @@
#define MONO 1
#define BW80 MONO
#define COLOR_MODE 2
#define kbhit() _kbhit()
#ifndef BOOL
#define BOOL int
......@@ -28,12 +27,11 @@ struct text_info {
unsigned char screenwidth;
};
int inkey(int mode);
short curses_color(short color);
int puttext(int sx, int sy, int ex, int ey, unsigned char *fill);
int gettext(int sx, int sy, int ex, int ey, unsigned char *fill);
void textattr(unsigned char attr);
int _kbhit(void);
int kbhit(void);
#ifndef __QNX__
void delay(long msec);
#endif
......
......@@ -66,7 +66,7 @@ enum {
,BLUE
,GREEN
,CYAN
,RED
,RED
,MAGENTA
,BROWN
,LIGHTGRAY
......@@ -131,19 +131,28 @@ static void reset_dynamic(void) {
/* Returns 0 on success. */
/****************************************************************************/
#ifdef _WIN32 /* ToDo Merge with __unix__ */
int kbwait() {
int timeout=0;
while(timeout++<500) {
if(kbhit)
return(TRUE);
}
return(FALSE);
}
int inkey(int mode)
{
int c;
if(mode)
return(kbhit());
c=getch();
if(!c)
c=(getch()<<8);
return(c);
}
if(mode)
return(kbwait());
c=getch();
#ifdef _WIN32
if(!c)
c=(getch()<<8);
#endif
return(c);
}
int uifcini32(uifcapi_t* uifcapi)
{
......@@ -1571,33 +1580,32 @@ void upop(char *str)
char buf[26*3*2];
int i,j,k;
reset_dynamic();
if(!str) {
puttext(28,12,53,14,sav);
return;
return;
}
gettext(28,12,53,14,sav);
memset(buf,SP,25*3*2);
for(i=1;i<26*3*2;i+=2)
buf[i]=(hclr|(bclr<<4));
buf[0]='';
buf[0]='';
for(i=2;i<25*2;i+=2)
buf[i]='';
buf[i]=''; i+=2;
buf[i]=''; i+=2;
buf[i]='';
buf[i]=''; i+=2;
buf[i]=''; i+=2;
i+=2;
k=strlen(str);
i+=(((23-k)/2)*2);
for(j=0;j<k;j++,i+=2) {
buf[i]=str[j];
buf[i+1]|=BLINK;
buf[i+1]|=BLINK;
}
i=((25*2)+1)*2;
buf[i]=''; i+=2;
buf[i]=''; i+=2;
buf[i]=''; i+=2;
buf[i]=''; i+=2;
for(;i<((26*3)-1)*2;i+=2)
buf[i]='';
buf[i]='';
buf[i]='';
buf[i]='';
puttext(28,12,53,14,buf);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment