La sección del programa se controla ahora mediante un puntero a una variable
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
const Uint8 SELF = 0;
|
||||
|
||||
// Constructor
|
||||
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options)
|
||||
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
@@ -13,6 +13,7 @@ HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset,
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->lang = lang;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -30,7 +31,7 @@ HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset,
|
||||
}
|
||||
|
||||
// Inicializa variables
|
||||
section.name = SELF;
|
||||
section->name = SELF;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
manualQuit = false;
|
||||
@@ -68,8 +69,8 @@ void HiScoreTable::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
|
||||
@@ -78,8 +79,8 @@ void HiScoreTable::update()
|
||||
|
||||
if (manualQuit)
|
||||
{
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = SUBSECTION_TITLE_3;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +181,7 @@ void HiScoreTable::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +192,7 @@ void HiScoreTable::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))
|
||||
@@ -214,8 +215,8 @@ void HiScoreTable::checkInput()
|
||||
if (mode == mhst_auto)
|
||||
{
|
||||
JA_StopMusic();
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = SUBSECTION_TITLE_1;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,17 +229,15 @@ void HiScoreTable::checkInput()
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
section_t HiScoreTable::run(mode_hiScoreTable_e mode)
|
||||
void HiScoreTable::run(mode_hiScoreTable_e mode)
|
||||
{
|
||||
this->mode = mode;
|
||||
|
||||
while (section.name == SELF)
|
||||
while (section->name == SELF)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Transforma un valor numérico en una cadena de 6 cifras
|
||||
|
||||
Reference in New Issue
Block a user