Change key event 'q'
pressing 'q' while playing current game will be closed and leaderboard would be shown
This commit is contained in:
parent
274c9354b0
commit
1eb795f959
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "config.h"
|
||||
|
||||
#define MAX_PRINTED_SCORES 10
|
||||
#define MAX_PRINTED_SCORES 13
|
||||
|
||||
extern int recordsInFile;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user