| 102 |
moveto(0, 0); |
moveto(0, 0); |
| 103 |
} |
} |
| 104 |
|
|
| 105 |
int press_any_key() |
inline int press_any_key() |
| 106 |
{ |
{ |
| 107 |
|
return press_any_key_ex(" \033[1;33m按任意键继续...\033[m"); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
int press_any_key_ex(const char *msg) |
| 111 |
|
{ |
| 112 |
|
int ch = 0; |
| 113 |
|
int wait_seconds = 60; |
| 114 |
|
int duration = 0; |
| 115 |
|
time_t t_begin = time(NULL); |
| 116 |
|
|
| 117 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 118 |
clrtoeol(); |
clrtoeol(); |
| 119 |
|
|
| 120 |
prints(" \033[1;33m按任意键继续...\033[0;37m"); |
prints(msg); |
| 121 |
iflush(); |
iflush(); |
| 122 |
|
|
| 123 |
return igetch_t(MIN(MAX_DELAY_TIME, 60)); |
do |
| 124 |
|
{ |
| 125 |
|
ch = igetch_t(wait_seconds - duration); |
| 126 |
|
duration = (int)(time(NULL) - t_begin); |
| 127 |
|
} while (!SYS_server_exit && ch == 0 && duration < 60); |
| 128 |
|
|
| 129 |
|
return ch; |
| 130 |
} |
} |
| 131 |
|
|
| 132 |
void set_input_echo(int echo) |
void set_input_echo(int echo) |