al acabar la partida i vore els records, torna al titol

This commit is contained in:
2025-03-15 19:53:57 +01:00
parent a6d115342c
commit c2c55707c3
4 changed files with 9 additions and 5 deletions

View File

@@ -22,7 +22,6 @@ Fade::Fade()
Fade::~Fade()
{
SDL_DestroyTexture(backbuffer_);
backbuffer_ = nullptr;
}
// Inicializa las variables
@@ -141,11 +140,11 @@ void Fade::update()
SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_);
// Dibuja el cuadrado correspondiente
const int index = std::min(counter_ / fade_random_squares_delay_, (num_squares_width_ * num_squares_height_) - 1);
const int INDEX = std::min(counter_ / fade_random_squares_delay_, (num_squares_width_ * num_squares_height_) - 1);
for (int i = 0; i < fade_random_squares_mult_; ++i)
{
const int index2 = std::min(index * fade_random_squares_mult_ + i, (int)square_.size() - 1);
SDL_RenderFillRect(renderer_, &square_[index2]);
const int INDEX2 = std::min(INDEX * fade_random_squares_mult_ + i, (int)square_.size() - 1);
SDL_RenderFillRect(renderer_, &square_[INDEX2]);
}
// Deja el renderizador como estaba

View File

@@ -346,6 +346,7 @@ void Game::updateGameStateGameOver()
{
// La partida ha terminado con la derrota de los jugadores
section::name = section::Name::HI_SCORE_TABLE;
section::options = section::Options::HI_SCORE_AFTER_GAME_OVER;
}
if (options.audio.enabled)
{

View File

@@ -176,7 +176,10 @@ void HiScoreTable::updateFade()
if (fade_->hasEnded() && fade_mode_ == FadeMode::OUT)
{
section::name = section::Name::INSTRUCTIONS;
section::name = (section::options == section::Options::HI_SCORE_AFTER_GAME_OVER)
? section::Name::TITLE
: section::Name::INSTRUCTIONS;
section::options = section::Options::NONE;
}
}

View File

@@ -29,6 +29,7 @@ namespace section
QUIT_WITH_CONTROLLER,
QUIT_FROM_EVENT,
RELOAD,
HI_SCORE_AFTER_GAME_OVER,
NONE,
};