emscripten: fix reset quan fas exit. Eliminades les opcions d'eixida
This commit is contained in:
@@ -150,8 +150,8 @@ void Director::initInput() {
|
|||||||
input->bindGameControllerButton(input_fire_right, SDL_GAMEPAD_BUTTON_EAST);
|
input->bindGameControllerButton(input_fire_right, SDL_GAMEPAD_BUTTON_EAST);
|
||||||
|
|
||||||
// Mando - Otros
|
// Mando - Otros
|
||||||
|
// SOUTH queda sin asignar para evitar salidas accidentales: pausa/cancel se hace con START/BACK.
|
||||||
input->bindGameControllerButton(input_accept, SDL_GAMEPAD_BUTTON_EAST);
|
input->bindGameControllerButton(input_accept, SDL_GAMEPAD_BUTTON_EAST);
|
||||||
input->bindGameControllerButton(input_cancel, SDL_GAMEPAD_BUTTON_SOUTH);
|
|
||||||
#ifdef GAME_CONSOLE
|
#ifdef GAME_CONSOLE
|
||||||
input->bindGameControllerButton(input_pause, SDL_GAMEPAD_BUTTON_BACK);
|
input->bindGameControllerButton(input_pause, SDL_GAMEPAD_BUTTON_BACK);
|
||||||
input->bindGameControllerButton(input_exit, SDL_GAMEPAD_BUTTON_START);
|
input->bindGameControllerButton(input_exit, SDL_GAMEPAD_BUTTON_START);
|
||||||
|
|||||||
@@ -2825,7 +2825,7 @@ void Game::checkGameInput() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el input de pausa
|
// Comprueba el input de pausa
|
||||||
if (input->checkInput(input_cancel, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id)) {
|
if (input->checkInput(input_pause, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id)) {
|
||||||
section->subsection = SUBSECTION_GAME_PAUSE;
|
section->subsection = SUBSECTION_GAME_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,12 +157,13 @@ bool Input::checkAnyInput(int device, int index) {
|
|||||||
|
|
||||||
// Construye el nombre visible de un mando
|
// Construye el nombre visible de un mando
|
||||||
std::string Input::buildControllerName(SDL_Gamepad *pad, int padIndex) {
|
std::string Input::buildControllerName(SDL_Gamepad *pad, int padIndex) {
|
||||||
|
(void)padIndex;
|
||||||
const char *padName = SDL_GetGamepadName(pad);
|
const char *padName = SDL_GetGamepadName(pad);
|
||||||
std::string name = padName ? padName : "Unknown";
|
std::string name = padName ? padName : "Unknown";
|
||||||
if (name.size() > 25) {
|
if (name.size() > 25) {
|
||||||
name.resize(25);
|
name.resize(25);
|
||||||
}
|
}
|
||||||
return name + " #" + std::to_string(padIndex);
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Busca si hay un mando conectado. Cierra y limpia el estado previo para
|
// Busca si hay un mando conectado. Cierra y limpia el estado previo para
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ void Instructions::render() {
|
|||||||
|
|
||||||
// Comprueba los eventos
|
// Comprueba los eventos
|
||||||
void Instructions::checkEvents() {
|
void Instructions::checkEvents() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
// Comprueba los eventos que hay en la cola
|
// Comprueba los eventos que hay en la cola
|
||||||
while (SDL_PollEvent(eventHandler) != 0) {
|
while (SDL_PollEvent(eventHandler) != 0) {
|
||||||
// Evento de salida de la aplicación
|
// Evento de salida de la aplicación
|
||||||
@@ -217,16 +218,18 @@ void Instructions::checkEvents() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Instructions::checkInput() {
|
void Instructions::checkInput() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
||||||
quitRequested = true;
|
quitRequested = true;
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
} else
|
||||||
|
#endif
|
||||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
||||||
screen->switchVideoMode();
|
screen->switchVideoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ bool Intro::loadMedia() {
|
|||||||
|
|
||||||
// Comprueba los eventos
|
// Comprueba los eventos
|
||||||
void Intro::checkEvents() {
|
void Intro::checkEvents() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
// Comprueba los eventos que hay en la cola
|
// Comprueba los eventos que hay en la cola
|
||||||
while (SDL_PollEvent(eventHandler) != 0) {
|
while (SDL_PollEvent(eventHandler) != 0) {
|
||||||
// Evento de salida de la aplicación
|
// Evento de salida de la aplicación
|
||||||
@@ -193,15 +194,17 @@ void Intro::checkEvents() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Intro::checkInput() {
|
void Intro::checkInput() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
}
|
} else
|
||||||
|
#endif
|
||||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
||||||
screen->switchVideoMode();
|
screen->switchVideoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void Logo::checkLogoEnd() {
|
|||||||
|
|
||||||
// Comprueba los eventos
|
// Comprueba los eventos
|
||||||
void Logo::checkEvents() {
|
void Logo::checkEvents() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
// Comprueba los eventos que hay en la cola
|
// Comprueba los eventos que hay en la cola
|
||||||
while (SDL_PollEvent(eventHandler) != 0) {
|
while (SDL_PollEvent(eventHandler) != 0) {
|
||||||
// Evento de salida de la aplicación
|
// Evento de salida de la aplicación
|
||||||
@@ -69,15 +70,17 @@ void Logo::checkEvents() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Logo::checkInput() {
|
void Logo::checkInput() {
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
}
|
} else
|
||||||
|
#endif
|
||||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
if (input->checkInput(input_window_fullscreen, REPEAT_FALSE)) {
|
||||||
screen->switchVideoMode();
|
screen->switchVideoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
#endif
|
#endif
|
||||||
menu.playerSelect = new Menu(renderer, asset, input, asset->get("player_select.men"));
|
menu.playerSelect = new Menu(renderer, asset, input, asset->get("player_select.men"));
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
// En la versión web no se puede cerrar el programa: ocultamos la opción QUIT del menú de título
|
||||||
|
menu.title->setVisible(3, false);
|
||||||
|
menu.title->setSelectable(3, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Sonidos
|
// Sonidos
|
||||||
crashSound = JA_LoadSound(asset->get("title.wav").c_str());
|
crashSound = JA_LoadSound(asset->get("title.wav").c_str());
|
||||||
|
|
||||||
@@ -314,8 +320,10 @@ void Title::update() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // QUIT
|
case 2: // QUIT
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // TIME OUT
|
case 3: // TIME OUT
|
||||||
|
|||||||
Reference in New Issue
Block a user