diff --git a/include/files.h b/include/files.h index 987a834..4e0012c 100644 --- a/include/files.h +++ b/include/files.h @@ -1,7 +1,7 @@ #pragma once #include "config.h" -#define MAX_PRINTED_SCORES 10 +#define MAX_PRINTED_SCORES 13 extern int recordsInFile; diff --git a/src/input.c b/src/input.c index 9479969..0315c0c 100644 --- a/src/input.c +++ b/src/input.c @@ -7,6 +7,7 @@ #include "menu.h" #include "snake.h" #include "map.h" +#include "files.h" @@ -22,7 +23,12 @@ void handleInput_runningState(SDL_Event event) switch (event.key.keysym.sym) { case SDLK_q: // q: quit - game.gameState = EXIT; + //game.gameState = EXIT; + game.gameState = MENU; + activeMenu = LEADERBOARD; + savePlayerScore(config.leaderboardFilename); + readTopScores(config.leaderboardFilename); + //showLeaderboard(); break; case SDLK_p: // p: pause diff --git a/src/menu.c b/src/menu.c index 19e71d8..2cbe865 100644 --- a/src/menu.c +++ b/src/menu.c @@ -150,7 +150,7 @@ void menuHandleInput(SDL_Event event){ switch (event.key.keysym.sym) { case SDLK_q: // q: quit - game.gameState = EXIT; + // game.gameState = EXIT; break; case SDLK_RETURN: // Enter key @@ -272,7 +272,7 @@ void menuHandleInput(SDL_Event event){ switch(event.key.keysym.sym) { case SDLK_q: // q: quit - game.gameState = EXIT; + // game.gameState = EXIT; break; case SDLK_RETURN: // go return to settings @@ -290,7 +290,7 @@ void menuHandleInput(SDL_Event event){ switch(event.key.keysym.sym) { case SDLK_q: // q: quit - game.gameState = EXIT; + // game.gameState = EXIT; break; case SDLK_RETURN: // go to first page