fix: Fade Type::FULLSCREEN no iniciava correctament i el primer frame de un fade_in mostrava el contingut

This commit is contained in:
2025-10-22 15:40:17 +02:00
parent 5a0fc9330d
commit 52a387463d
2 changed files with 15 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ Director::Director(int argc, std::span<char*> argv) {
Section::name = Section::Name::GAME; Section::name = Section::Name::GAME;
Section::options = Section::Options::GAME_PLAY_1P; Section::options = Section::Options::GAME_PLAY_1P;
#elif _DEBUG #elif _DEBUG
Section::name = Section::Name::GAME; Section::name = Section::Name::HI_SCORE_TABLE;
Section::options = Section::Options::GAME_PLAY_1P; Section::options = Section::Options::GAME_PLAY_1P;
#else // NORMAL GAME #else // NORMAL GAME
Section::name = Section::Name::LOGO; Section::name = Section::Name::LOGO;

View File

@@ -439,10 +439,23 @@ void Fade::activate() {
// Preparación inicial de cada tipo // Preparación inicial de cada tipo
switch (type_) { switch (type_) {
case Type::FULLSCREEN: /*case Type::FULLSCREEN:
cleanBackbuffer(r_, g_, b_, (mode_ == Mode::OUT) ? 0 : 255); cleanBackbuffer(r_, g_, b_, (mode_ == Mode::OUT) ? 0 : 255);
SDL_SetTextureAlphaMod(backbuffer_, (mode_ == Mode::OUT) ? 255 : 0); SDL_SetTextureAlphaMod(backbuffer_, (mode_ == Mode::OUT) ? 255 : 0);
break;*/
case Type::FULLSCREEN: {
// La textura en sí siempre debe ser de un color sólido y opaco.
// La transparencia se gestionará con la modulación de alfa.
cleanBackbuffer(r_, g_, b_, 255);
// Ahora, inicializamos la modulación de alfa correctamente:
// - IN: Empieza opaco (255) y se desvanece a transparente.
// - OUT: Empieza transparente (0) y se desvanece a opaco.
const Uint8 initial_alpha = (mode_ == Mode::IN) ? 255 : 0;
SDL_SetTextureAlphaMod(backbuffer_, initial_alpha);
break; break;
}
case Type::CENTER: case Type::CENTER:
rect1_ = {.x = 0, .y = 0, .w = param.game.width, .h = 0}; rect1_ = {.x = 0, .y = 0, .w = param.game.width, .h = 0};