ignore arrow keys
This commit is contained in:
parent
30b7116fbd
commit
03332baf2e
@ -71,6 +71,7 @@ int main_game_loop(int argc, char *argv[]) {
|
|||||||
/* Initialize ncurses */
|
/* Initialize ncurses */
|
||||||
stdscr = initscr();
|
stdscr = initscr();
|
||||||
curs_set(0); /* Hide cursor */
|
curs_set(0); /* Hide cursor */
|
||||||
|
keypad(stdscr, TRUE); /* Enable special key detection */
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
/* Initialize colors */
|
/* Initialize colors */
|
||||||
@ -168,6 +169,9 @@ int main_game_loop(int argc, char *argv[]) {
|
|||||||
if (key == 27) {
|
if (key == 27) {
|
||||||
/* ESC */
|
/* ESC */
|
||||||
break;
|
break;
|
||||||
|
} else if (key == KEY_UP || key == KEY_DOWN || key == KEY_LEFT || key == KEY_RIGHT) {
|
||||||
|
/* Ignore arrow keys to prevent crashes */
|
||||||
|
continue;
|
||||||
} else if (key == '\n' || key == '\r' || key == KEY_ENTER) {
|
} else if (key == '\n' || key == '\r' || key == KEY_ENTER) {
|
||||||
if (game.current_guess_length == WORD_LENGTH) {
|
if (game.current_guess_length == WORD_LENGTH) {
|
||||||
strcpy(temp_guess, game.current_guess);
|
strcpy(temp_guess, game.current_guess);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user