diff --git a/source/sections/hiscore_table.cpp b/source/sections/hiscore_table.cpp index 0ccd528..29c17e7 100644 --- a/source/sections/hiscore_table.cpp +++ b/source/sections/hiscore_table.cpp @@ -368,17 +368,14 @@ void HiScoreTable::glowEntryNames() { // Gestiona el contador void HiScoreTable::updateCounter() { - static bool background_changed = false; - static bool fade_activated = false; - - if (elapsed_time_ >= BACKGROUND_CHANGE_S && !background_changed) { + if (elapsed_time_ >= BACKGROUND_CHANGE_S && !hiscore_flags_.background_changed) { background_->setColor(background_fade_color_.DARKEN()); background_->setAlpha(96); - background_changed = true; + hiscore_flags_.background_changed = true; } - if (elapsed_time_ >= COUNTER_END_S && !fade_activated) { + if (elapsed_time_ >= COUNTER_END_S && !hiscore_flags_.fade_activated) { fade_->activate(); - fade_activated = true; + hiscore_flags_.fade_activated = true; } } \ No newline at end of file diff --git a/source/sections/hiscore_table.h b/source/sections/hiscore_table.h index 3624fef..b9f21e0 100644 --- a/source/sections/hiscore_table.h +++ b/source/sections/hiscore_table.h @@ -56,6 +56,17 @@ class HiScoreTable { Color background_fade_color_; // Color de atenuación del fondo std::vector entry_colors_; // Colores para destacar las entradas en la tabla + // --- Flags para eventos basados en tiempo --- + struct HiScoreFlags { + bool background_changed = false; + bool fade_activated = false; + + void reset() { + background_changed = false; + fade_activated = false; + } + } hiscore_flags_; + // --- Métodos internos --- void update(float delta_time); // Actualiza las variables void render(); // Pinta en pantalla