Eliminat el punter a "section"

This commit is contained in:
2024-09-28 09:28:22 +02:00
parent 0a8d0479a0
commit 8d263931b2
19 changed files with 191 additions and 172 deletions

View File

@@ -4,13 +4,12 @@
#include <iostream>
// Constructor
Logo::Logo(Screen *screen, Asset *asset, Input *input, section_t *section)
Logo::Logo(Screen *screen, Asset *asset, Input *input)
{
// Copia la dirección de los objetos
this->screen = screen;
this->asset = asset;
this->input = input;
this->section = section;
SDL_Renderer *renderer = screen->getRenderer();
// Reserva memoria para los punteros
@@ -21,7 +20,7 @@ Logo::Logo(Screen *screen, Asset *asset, Input *input, section_t *section)
// Inicializa variables
counter = 0;
section->name = SECTION_PROG_LOGO;
section::name = section::NAME_LOGO;
ticks = 0;
ticksSpeed = 15;
showSinceSprite_cm = 70;
@@ -86,7 +85,7 @@ void Logo::checkEvents()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section->name = SECTION_PROG_QUIT;
section::name = section::NAME_QUIT;
break;
}
@@ -107,14 +106,14 @@ void Logo::checkInput()
// Comprueba si se sale con el teclado
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
quit(SECTION_OPTIONS_QUIT_NORMAL);
quit(section::OPTIONS_QUIT_NORMAL);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
section->name = SECTION_PROG_INIT;
section::name = section::NAME_INIT;
screen->showNotification("Reset");
return;
}
@@ -123,8 +122,8 @@ void Logo::checkInput()
if (input->checkAnyButtonPressed())
{
JA_StopMusic();
section->name = SECTION_PROG_TITLE;
section->options = SECTION_OPTIONS_TITLE_1;
section::name = section::NAME_TITLE;
section::options = section::OPTIONS_TITLE_1;
return;
}
@@ -133,14 +132,14 @@ 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))
{
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
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))
{
section->name = SECTION_PROG_INIT;
section::name = section::NAME_INIT;
screen->showNotification("Reset");
return;
}
@@ -305,7 +304,7 @@ void Logo::update()
// Comprueba si ha terminado el logo
if (counter == endLogo_cm + postLogoDuration)
{
section->name = SECTION_PROG_INTRO;
section::name = section::NAME_INTRO;
}
// Comprueba si se ha de mostrar el sprite
@@ -342,7 +341,7 @@ void Logo::run()
// Detiene la música
JA_StopMusic();
while (section->name == SECTION_PROG_LOGO)
while (section::name == section::NAME_LOGO)
{
checkInput();
update();
@@ -352,12 +351,12 @@ void Logo::run()
}
// Termina
void Logo::quit(int code)
void Logo::quit(section::options_e code)
{
if (screen->notificationsAreActive())
{
section->name = SECTION_PROG_QUIT;
section->options = code;
section::name = section::NAME_QUIT;
section::options = code;
}
else
{