diff --git a/source/core/rendering/surface.cpp b/source/core/rendering/surface.cpp index 32c12cb5..e3b82779 100644 --- a/source/core/rendering/surface.cpp +++ b/source/core/rendering/surface.cpp @@ -673,3 +673,6 @@ auto Surface::fadeSubPalette(Uint32 delay) -> bool { // Devolver si el índice 15 coincide con el índice 0 return sub_palette_[15] == sub_palette_[0]; } + +// Restaura la sub paleta a su estado original +void Surface::resetSubPalette() { initializeSubPalette(sub_palette_); } diff --git a/source/core/rendering/surface.hpp b/source/core/rendering/surface.hpp index d7c4e91a..0d7634dc 100644 --- a/source/core/rendering/surface.hpp +++ b/source/core/rendering/surface.hpp @@ -104,6 +104,9 @@ class Surface { auto fadePalette() -> bool; auto fadeSubPalette(Uint32 delay = 0) -> bool; + // Restaura la sub paleta a su estado original + void resetSubPalette(); + // Vuelca los píxeles como ARGB8888 a un buffer externo (sin SDL_Texture) void toARGBBuffer(Uint32* buffer) const; diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index ffbf5086..7eb79b09 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -48,6 +48,12 @@ Title::Title() Audio::get()->playMusic("title.ogg"); // Inicia la musica } +// Destructor +Title::~Title() { + loading_screen_surface_->resetSubPalette(); + title_surface_->resetSubPalette(); +} + // Inicializa la marquesina void Title::initMarquee() { letters_.clear(); diff --git a/source/game/scenes/title.hpp b/source/game/scenes/title.hpp index a458b282..e48edcec 100644 --- a/source/game/scenes/title.hpp +++ b/source/game/scenes/title.hpp @@ -17,7 +17,7 @@ class Title { public: // --- Constructor y Destructor --- Title(); - ~Title() = default; + ~Title(); // --- Bucle principal --- void run();