diff --git a/build/game.o b/build/game.o index c6e2a79..509a49f 100644 Binary files a/build/game.o and b/build/game.o differ diff --git a/build/gui.o b/build/gui.o index 82e6037..73d8be3 100644 Binary files a/build/gui.o and b/build/gui.o differ diff --git a/build/input.o b/build/input.o index 146eea8..f7c24c8 100644 Binary files a/build/input.o and b/build/input.o differ diff --git a/build/main.o b/build/main.o index 9b66896..e5ebed6 100644 Binary files a/build/main.o and b/build/main.o differ diff --git a/build/shooter b/build/shooter index d10c07d..d5218ac 100755 Binary files a/build/shooter and b/build/shooter differ diff --git a/include/gui.h b/include/gui.h index f98e139..0ce3e28 100644 --- a/include/gui.h +++ b/include/gui.h @@ -20,10 +20,13 @@ enum { #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) //extern char* choices[]; +#define START_MODE 0 +#define GMOVR_MODE 1 +#define PAUSE_MODE 2 /* initialization and screens */ void init_colors(void); -int print_menu(WINDOW* win); +int print_menu(WINDOW* win, int mode); void print_gameover(WINDOW* win); void print_win_screen(WINDOW* win); diff --git a/src/game.c b/src/game.c index 6a6187e..7aa86e9 100644 --- a/src/game.c +++ b/src/game.c @@ -16,7 +16,7 @@ int game_run(void) { WINDOW *game_window = NULL; int height, width, win_startx, win_starty; - char *pause_msg = "PAUSA: premi q per uscire dal gioco..."; + char *pause_msg = "PAUSE..."; int pause = 0; int auto_shoot = 0; diff --git a/src/gui.c b/src/gui.c index 5cd3814..6bc98a0 100644 --- a/src/gui.c +++ b/src/gui.c @@ -3,12 +3,6 @@ /************** FUNZIONI GUI ***************/ -static char *choices[] = { - "Start Game", - "Exit", - NULL, -}; - char* title[] = { "###########################################################################################################", @@ -52,8 +46,19 @@ void init_colors() { init_pair(WINSC_PAIR, COLOR_YELLOW, COLOR_BLACK); } +static char *choices[] = { + "", + "Exit", + NULL, +}; // FUNCTION THAT PRINTS THE MENU -int print_menu(WINDOW* win) { +int print_menu(WINDOW* win, int mode) { + switch(mode) { + case START_MODE : choices[0] = "Start Game"; break; + case PAUSE_MODE: choices[0] = "Continue"; break; + case GMOVR_MODE: choices[0] = ""; break; + defualt: choices[0] = "Start Game"; break; + } int height; int width; int ch; diff --git a/src/input.c b/src/input.c index 6032560..39e3bfa 100644 --- a/src/input.c +++ b/src/input.c @@ -1,4 +1,5 @@ #include "../include/input.h" +#include "../include/gui.h" #include /* Returns 1 to continue, 0 if quit requested (player inactive). */ @@ -22,9 +23,18 @@ int process_input(int input, } } else if (input == 'p') { *pause = !(*pause); - } else if (input == 'q') { - /* signal to caller to quit by marking player inactive */ - return 0; + + int choice = print_menu(stdscr, PAUSE_MODE); + + switch(choice) { + case 0: { + werase(stdscr); + mvprintw(LINES-1, 1, "p per pausa"); + *pause = !(*pause); + break; + } + case 1: return 0; break; + } } else if (input == 'g') { *auto_shoot = !(*auto_shoot); } diff --git a/src/main.c b/src/main.c index 5caff27..1ab541e 100644 --- a/src/main.c +++ b/src/main.c @@ -15,12 +15,12 @@ int main(void) { init_colors(); /* show menu */ - int choice = print_menu(stdscr); + int choice = print_menu(stdscr, START_MODE); switch(choice) { case 0: { werase(stdscr); - mvprintw(1, 1, "p per pausa, q per uscire"); + mvprintw(LINES-1, 1, "p per pausa"); refresh(); game_run(); break;