La sección del programa se controla ahora mediante un puntero a una variable

This commit is contained in:
2023-09-23 00:02:49 +02:00
parent 337e6ed6cc
commit 9513a6c57e
16 changed files with 179 additions and 201 deletions

View File

@@ -45,7 +45,7 @@ Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset,
}
// Inicializa variables
section.name = SELF;
section->name = SELF;
ticks = 0;
ticksSpeed = 15;
manualQuit = false;
@@ -88,8 +88,8 @@ void Instructions::update()
if (counter == counterEnd)
{
section.name = SECTION_PROG_TITLE;
section.subsection = SUBSECTION_TITLE_1;
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_1;
}
}
else
@@ -98,8 +98,8 @@ void Instructions::update()
if (manualQuit)
{
section.name = SECTION_PROG_TITLE;
section.subsection = SUBSECTION_TITLE_3;
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_3;
}
}
}
@@ -214,7 +214,7 @@ void Instructions::checkEvents()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section.name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_QUIT;
break;
}
}
@@ -225,7 +225,7 @@ void Instructions::checkInput()
{
if (input->checkInput(input_exit, REPEAT_FALSE))
{
section.name = SECTION_PROG_QUIT;
section->name = SECTION_PROG_QUIT;
}
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
@@ -248,8 +248,8 @@ void Instructions::checkInput()
if (mode == m_auto)
{
JA_StopMusic();
section.name = SECTION_PROG_TITLE;
section.subsection = SUBSECTION_TITLE_1;
section->name = SECTION_PROG_TITLE;
section->subsection = SUBSECTION_TITLE_1;
}
else
{
@@ -262,16 +262,14 @@ void Instructions::checkInput()
}
// Bucle para la pantalla de instrucciones
section_t Instructions::run(mode_e mode)
void Instructions::run(mode_e mode)
{
this->mode = mode;
while (section.name == SELF)
while (section->name == SELF)
{
update();
checkEvents();
render();
}
return section;
}