Afegida confirmació per eixir del joc
This commit is contained in:
@@ -504,4 +504,10 @@ void Screen::displayInfo()
|
|||||||
// Resolution
|
// Resolution
|
||||||
dbg_print(0, 0, infoResolution.c_str(), 255, 255, 0);
|
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;
|
// Muestra una notificación de texto por pantalla;
|
||||||
void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1);
|
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
|
// Obtiene el puntero al renderizador
|
||||||
SDL_Renderer *getRenderer();
|
SDL_Renderer *getRenderer();
|
||||||
};
|
};
|
||||||
@@ -2040,13 +2040,19 @@ void Game::checkInput()
|
|||||||
// Comprueba si se sale con el teclado
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
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
|
// Comprueba si se va a resetear el juego
|
||||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
@@ -2809,4 +2815,18 @@ int Game::getController(int playerId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
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
|
// Obtiene un controlador a partir del "id" del jugador
|
||||||
int getController(int playerId);
|
int getController(int playerId);
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// 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);
|
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
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +212,13 @@ void HiScoreTable::checkInput()
|
|||||||
|
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
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
|
// Comprueba si se va a resetear el juego
|
||||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
@@ -329,4 +335,18 @@ std::string HiScoreTable::format(int number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
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
|
// Gestiona el fade
|
||||||
void updateFade();
|
void updateFade();
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
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
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,6 +342,13 @@ void Instructions::checkInput()
|
|||||||
|
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
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
|
// Comprueba si se va a resetear el juego
|
||||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
@@ -377,3 +383,17 @@ void Instructions::run()
|
|||||||
render();
|
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
|
// Recarga todas las texturas
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
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
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,9 +208,16 @@ void Intro::checkInput()
|
|||||||
section->options = SECTION_OPTIONS_TITLE_1;
|
section->options = SECTION_OPTIONS_TITLE_1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
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
|
// Comprueba si se va a resetear el juego
|
||||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
@@ -455,3 +461,17 @@ void Intro::run()
|
|||||||
render();
|
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
|
// Recarga todas las texturas
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
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
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,8 +125,7 @@ void Logo::checkInput()
|
|||||||
// Comprueba si se sale con el mando
|
// Comprueba si se sale con el mando
|
||||||
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
|
||||||
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,4 +333,18 @@ void Logo::run()
|
|||||||
checkEvents(); // Tiene que ir antes del render
|
checkEvents(); // Tiene que ir antes del render
|
||||||
render();
|
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
|
// Recarga todas las texturas
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo(Screen *screen, Asset *asset, Input *input, options_t *options, param_t *param, section_t *section);
|
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
|
// Comprueba si se sale con el teclado
|
||||||
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_QUIT;
|
quit(SECTION_OPTIONS_QUIT_NORMAL);
|
||||||
section->options = SECTION_OPTIONS_QUIT_NORMAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +272,14 @@ void Title::checkInput()
|
|||||||
|
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
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
|
// Comprueba si se va a resetear el juego
|
||||||
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
@@ -389,4 +396,18 @@ void Title::swapControllers()
|
|||||||
screen->showNotification(text[0], text[1]);
|
screen->showNotification(text[0], text[1]);
|
||||||
|
|
||||||
resetCounter();
|
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
|
// Intercambia la asignación de mandos a los jugadores
|
||||||
void swapControllers();
|
void swapControllers();
|
||||||
|
|
||||||
|
// Termina
|
||||||
|
void quit(int code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, param_t *param, section_t *section, JA_Music_t *music);
|
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