This commit is contained in:
2026-04-17 22:20:37 +02:00
parent 513eacf356
commit 20b9a95619
38 changed files with 310 additions and 622 deletions

View File

@@ -145,8 +145,8 @@ Intro::Intro(SDL_Renderer *renderer, section_t *section) {
texts[8]->setCaption(Lang::get()->getText(35));
texts[8]->setSpeed(16);
for (auto text : texts) {
text->center(GAMECANVAS_CENTER_X);
for (auto *t : texts) {
t->center(GAMECANVAS_CENTER_X);
}
JA_PlayMusic(music, 0);
@@ -166,25 +166,6 @@ Intro::~Intro() {
}
}
// Carga los recursos (ya no carga nada, se mantiene por si hay callers)
bool Intro::loadMedia() {
return true;
}
// Comprueba los eventos
void Intro::checkEvents() {
#ifndef __EMSCRIPTEN__
// Comprueba los eventos que hay en la cola
while (SDL_PollEvent(eventHandler) != 0) {
// Evento de salida de la aplicación
if (eventHandler->type == SDL_EVENT_QUIT) {
section->name = SECTION_PROG_QUIT;
break;
}
}
#endif
}
// Comprueba las entradas
void Intro::checkInput() {
#ifndef __EMSCRIPTEN__
@@ -352,8 +333,8 @@ void Intro::update() {
bitmap->update();
}
for (auto text : texts) {
text->update();
for (auto *t : texts) {
t->update();
}
// Actualiza las escenas de la intro
@@ -374,8 +355,8 @@ void Intro::render() {
bitmap->render();
}
for (auto text : texts) {
text->render();
for (auto *t : texts) {
t->render();
}
// Vuelca el contenido del renderizador en pantalla
@@ -398,6 +379,6 @@ void Intro::iterate() {
}
// Procesa un evento individual
void Intro::handleEvent(SDL_Event *event) {
void Intro::handleEvent(const SDL_Event *event) {
// SDL_EVENT_QUIT ya lo maneja Director
}

View File

@@ -34,12 +34,6 @@ class Intro {
// Dibuja el objeto en pantalla
void render();
// Carga los recursos
bool loadMedia();
// Comprueba los eventos
void checkEvents();
// Comprueba las entradas
void checkInput();
@@ -60,5 +54,5 @@ class Intro {
void iterate();
// Procesa un evento
void handleEvent(SDL_Event *event);
void handleEvent(const SDL_Event *event);
};

View File

@@ -56,20 +56,6 @@ void Logo::checkLogoEnd() {
}
}
// Comprueba los eventos
void Logo::checkEvents() {
#ifndef __EMSCRIPTEN__
// Comprueba los eventos que hay en la cola
while (SDL_PollEvent(eventHandler) != 0) {
// Evento de salida de la aplicación
if (eventHandler->type == SDL_EVENT_QUIT) {
section->name = SECTION_PROG_QUIT;
break;
}
}
#endif
}
// Comprueba las entradas
void Logo::checkInput() {
#ifndef __EMSCRIPTEN__
@@ -148,6 +134,6 @@ void Logo::iterate() {
}
// Procesa un evento individual
void Logo::handleEvent(SDL_Event *event) {
void Logo::handleEvent(const SDL_Event *event) {
// SDL_EVENT_QUIT ya lo maneja Director
}

View File

@@ -29,9 +29,6 @@ class Logo {
// Comprueba si ha terminado el logo
void checkLogoEnd();
// Comprueba los eventos
void checkEvents();
// Comprueba las entradas
void checkInput();
@@ -52,5 +49,5 @@ class Logo {
void iterate();
// Procesa un evento
void handleEvent(SDL_Event *event);
void handleEvent(const SDL_Event *event);
};

View File

@@ -112,16 +112,16 @@ void Title::init() {
// Pone valores por defecto a las opciones de control
Options::inputs.clear();
input_t i;
i.id = 0;
i.name = "KEYBOARD";
i.deviceType = INPUT_USE_KEYBOARD;
Options::inputs.push_back(i);
input_t inp;
inp.id = 0;
inp.name = "KEYBOARD";
inp.deviceType = INPUT_USE_KEYBOARD;
Options::inputs.push_back(inp);
i.id = 0;
i.name = "GAME CONTROLLER";
i.deviceType = INPUT_USE_GAMECONTROLLER;
Options::inputs.push_back(i);
inp.id = 0;
inp.name = "GAME CONTROLLER";
inp.deviceType = INPUT_USE_GAMECONTROLLER;
Options::inputs.push_back(inp);
// Comprueba si hay mandos conectados
checkInputDevices();
@@ -609,32 +609,6 @@ void Title::render() {
}
}
// Comprueba los eventos
void Title::checkEvents() {
// Comprueba los eventos que hay en la cola
while (SDL_PollEvent(eventHandler) != 0) {
// Evento de salida de la aplicación
if (eventHandler->type == SDL_EVENT_QUIT) {
section->name = SECTION_PROG_QUIT;
break;
}
else if (eventHandler->type == SDL_EVENT_RENDER_DEVICE_RESET || eventHandler->type == SDL_EVENT_RENDER_TARGETS_RESET) {
reLoadTextures();
}
if (section->subsection == SUBSECTION_TITLE_3) { // Si se pulsa alguna tecla durante la tercera sección del titulo
if ((eventHandler->type == SDL_EVENT_KEY_UP) || (eventHandler->type == SDL_EVENT_JOYSTICK_BUTTON_UP)) {
// Muestra el menu
menuVisible = true;
// Reinicia el contador
counter = TITLE_COUNTER;
}
}
}
}
// Comprueba las entradas
void Title::checkInput() {
#ifndef __EMSCRIPTEN__
@@ -915,7 +889,7 @@ void Title::iterate() {
}
// Procesa un evento individual
void Title::handleEvent(SDL_Event *event) {
void Title::handleEvent(const SDL_Event *event) {
// Si hay un sub-estado activo, delega el evento
if (instructionsActive && instructions) {
// SDL_EVENT_QUIT ya lo maneja Director

View File

@@ -107,9 +107,6 @@ class Title {
// Dibuja el objeto en pantalla
void render();
// Comprueba los eventos
void checkEvents();
// Comprueba las entradas
void checkInput();
@@ -157,5 +154,5 @@ class Title {
void iterate();
// Procesa un evento
void handleEvent(SDL_Event *event);
void handleEvent(const SDL_Event *event);
};