La sección del programa se controla ahora mediante un puntero a una variable
This commit is contained in:
@@ -4,13 +4,14 @@
|
||||
#define END_LOGO 200
|
||||
|
||||
// Constructor
|
||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
|
||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -19,8 +20,8 @@ Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
|
||||
|
||||
// Inicializa variables
|
||||
counter = 0;
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_PROG_LOGO;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
}
|
||||
@@ -40,8 +41,8 @@ void Logo::checkLogoEnd()
|
||||
{
|
||||
if (counter >= END_LOGO + 20)
|
||||
{
|
||||
section.name = SECTION_PROG_INTRO;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_PROG_INTRO;
|
||||
section->subsection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ void Logo::checkEvents()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +66,7 @@ void Logo::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))
|
||||
@@ -85,8 +86,8 @@ void Logo::checkInput()
|
||||
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_fire_left, REPEAT_FALSE) || input->checkInput(input_fire_center, REPEAT_FALSE) || input->checkInput(input_fire_right, REPEAT_FALSE))
|
||||
{
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = SUBSECTION_TITLE_1;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,16 +145,14 @@ void Logo::render()
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
section_t Logo::run()
|
||||
void Logo::run()
|
||||
{
|
||||
JA_StopMusic();
|
||||
|
||||
while (section.name == SECTION_PROG_LOGO)
|
||||
while (section->name == SECTION_PROG_LOGO)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user