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
HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, section_t *section, JA_Music_t *music)
HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, JA_Music_t *music)
{
// Copia punteros
this->screen = screen;
this->asset = asset;
this->input = input;
this->section = section;
this->music = music;
renderer = screen->getRenderer();
@@ -25,7 +24,7 @@ HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, section_t
SDL_SetTextureBlendMode(backbuffer, SDL_BLENDMODE_BLEND);
// Inicializa variables
section->name = SECTION_PROG_HI_SCORE_TABLE;
section::name = section::NAME_HI_SCORE_TABLE;
ticks = 0;
ticksSpeed = 15;
counter = 0;
@@ -175,7 +174,7 @@ void HiScoreTable::checkEvents()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section->name = SECTION_PROG_QUIT;
section::name = section::NAME_QUIT;
break;
}
@@ -196,7 +195,7 @@ void HiScoreTable::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;
}
@@ -204,8 +203,8 @@ void HiScoreTable::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;
}
@@ -214,14 +213,14 @@ void HiScoreTable::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;
}
@@ -244,7 +243,7 @@ void HiScoreTable::checkInput()
// Bucle para la pantalla de instrucciones
void HiScoreTable::run()
{
while (section->name == SECTION_PROG_HI_SCORE_TABLE)
while (section::name == section::NAME_HI_SCORE_TABLE)
{
checkInput();
update();
@@ -308,7 +307,7 @@ void HiScoreTable::updateFade()
if (fade->hasEnded() && fadeMode == FADE_OUT)
{
section->name = SECTION_PROG_INSTRUCTIONS;
section::name = section::NAME_INSTRUCTIONS;
}
}
@@ -337,12 +336,12 @@ std::string HiScoreTable::format(int number)
}
// Termina
void HiScoreTable::quit(int code)
void HiScoreTable::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
{