forked from jaildesigner-jailgames/jaildoctors_dilemma
Añadida pantalla de game over funcional
This commit is contained in:
@@ -12,6 +12,7 @@ GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, A
|
||||
|
||||
// Reserva memoria para los punteros a objetos
|
||||
eventHandler = new SDL_Event();
|
||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
||||
|
||||
// Inicializa variables
|
||||
counter = 0;
|
||||
@@ -26,6 +27,7 @@ GameOver::~GameOver()
|
||||
{
|
||||
// Libera la memoria de los objetos
|
||||
delete eventHandler;
|
||||
delete text;
|
||||
}
|
||||
|
||||
// Actualiza el objeto
|
||||
@@ -39,6 +41,13 @@ void GameOver::update()
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
|
||||
counter++;
|
||||
|
||||
if (counter == 400)
|
||||
{
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +60,8 @@ void GameOver::render()
|
||||
// Limpia la pantalla
|
||||
screen->clean();
|
||||
|
||||
text->writeCentered(GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y, "G A M E O V E R");
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
@@ -65,6 +76,7 @@ void GameOver::checkEventHandler()
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section.subsection = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -112,8 +124,8 @@ void GameOver::checkEventHandler()
|
||||
break;
|
||||
|
||||
default:
|
||||
// section.name = SECTION_PROG_TITLE;
|
||||
// section.subsection = 0;
|
||||
//section.name = SECTION_PROG_TITLE;
|
||||
//section.subsection = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user