Afegida confirmació per eixir del joc
This commit is contained in:
@@ -505,3 +505,9 @@ void Screen::displayInfo()
|
||||
dbg_print(0, 0, infoResolution.c_str(), 255, 255, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Indica si hay alguna notificación activa en pantalla
|
||||
bool Screen::notificationsAreActive()
|
||||
{
|
||||
return notify->active();
|
||||
}
|
||||
@@ -134,6 +134,9 @@ public:
|
||||
// Muestra una notificación de texto por pantalla;
|
||||
void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1);
|
||||
|
||||
// Indica si hay alguna notificación activa en pantalla
|
||||
bool notificationsAreActive();
|
||||
|
||||
// Obtiene el puntero al renderizador
|
||||
SDL_Renderer *getRenderer();
|
||||
};
|
||||
@@ -2040,13 +2040,19 @@ void Game::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
@@ -2810,3 +2816,17 @@ int Game::getController(int playerId)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Termina
|
||||
void Game::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -446,6 +446,9 @@ private:
|
||||
// Obtiene un controlador a partir del "id" del jugador
|
||||
int getController(int playerId);
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(int playerID, int currentStage, bool demo, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
||||
|
||||
@@ -197,8 +197,7 @@ void HiScoreTable::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -213,6 +212,13 @@ void HiScoreTable::checkInput()
|
||||
|
||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
@@ -330,3 +336,17 @@ std::string HiScoreTable::format(int number)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Termina
|
||||
void HiScoreTable::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,9 @@ private:
|
||||
// Gestiona el fade
|
||||
void updateFade();
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
||||
|
||||
@@ -327,8 +327,7 @@ void Instructions::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,6 +342,13 @@ void Instructions::checkInput()
|
||||
|
||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
@@ -377,3 +383,17 @@ void Instructions::run()
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Termina
|
||||
void Instructions::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,9 @@ private:
|
||||
// Recarga todas las texturas
|
||||
void reloadTextures();
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
||||
|
||||
@@ -196,8 +196,7 @@ void Intro::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,6 +211,13 @@ void Intro::checkInput()
|
||||
|
||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
@@ -455,3 +461,17 @@ void Intro::run()
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Termina
|
||||
void Intro::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,9 @@ private:
|
||||
// Recarga todas las texturas
|
||||
void reloadTextures();
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
||||
|
||||
@@ -107,8 +107,7 @@ void Logo::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,8 +125,7 @@ void Logo::checkInput()
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -336,3 +334,17 @@ void Logo::run()
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Termina
|
||||
void Logo::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,9 @@ private:
|
||||
// Recarga todas las texturas
|
||||
void reloadTextures();
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Logo(Screen *screen, Asset *asset, Input *input, options_t *options, param_t *param, section_t *section);
|
||||
|
||||
@@ -252,8 +252,7 @@ void Title::checkInput()
|
||||
// Comprueba si se sale con el teclado
|
||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
||||
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -273,6 +272,14 @@ void Title::checkInput()
|
||||
|
||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||
{
|
||||
|
||||
// Comprueba si se sale con el mando
|
||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
@@ -390,3 +397,17 @@ void Title::swapControllers()
|
||||
|
||||
resetCounter();
|
||||
}
|
||||
|
||||
// Termina
|
||||
void Title::quit(int code)
|
||||
{
|
||||
if (screen->notificationsAreActive())
|
||||
{
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
section->options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->showNotification("Torna a polsar per eixir");
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,9 @@ private:
|
||||
// Intercambia la asignación de mandos a los jugadores
|
||||
void swapControllers();
|
||||
|
||||
// Termina
|
||||
void quit(int code);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Title(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
||||
|
||||
Reference in New Issue
Block a user