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
Instructions::Instructions(Screen *screen, Asset *asset, Input *input, section_t *section, JA_Music_t *music)
Instructions::Instructions(Screen *screen, Asset *asset, Input *input, JA_Music_t *music)
{
// Copia los punteros
this->screen = screen;
this->asset = asset;
this->input = input;
this->section = section;
this->music = music;
renderer = screen->getRenderer();
@@ -29,7 +28,7 @@ Instructions::Instructions(Screen *screen, Asset *asset, Input *input, section_t
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
// Inicializa variables
section->name = SECTION_PROG_INSTRUCTIONS;
section::name = section::NAME_INSTRUCTIONS;
ticks = 0;
ticksSpeed = 15;
counter = 0;
@@ -252,8 +251,8 @@ void Instructions::update()
// Comprueba si el contador ha llegado al final
if (counter == counterEnd)
{
section->name = SECTION_PROG_TITLE;
section->options = SECTION_OPTIONS_TITLE_1;
section::name = section::NAME_TITLE;
section::options = section::OPTIONS_TITLE_1;
}
}
}
@@ -305,7 +304,7 @@ void Instructions::checkEvents()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section->name = SECTION_PROG_QUIT;
section::name = section::NAME_QUIT;
break;
}
@@ -326,7 +325,7 @@ void Instructions::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;
}
@@ -334,8 +333,8 @@ void Instructions::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;
}
@@ -344,14 +343,14 @@ void Instructions::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_LOGO;
section::name = section::NAME_LOGO;
screen->showNotification("Reset");
return;
}
@@ -374,7 +373,7 @@ void Instructions::checkInput()
// Bucle para la pantalla de instrucciones
void Instructions::run()
{
while (section->name == SECTION_PROG_INSTRUCTIONS)
while (section::name == section::NAME_INSTRUCTIONS)
{
checkInput();
update();
@@ -384,12 +383,12 @@ void Instructions::run()
}
// Termina
void Instructions::quit(int code)
void Instructions::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
{