forked from jaildesigner-jailgames/jaildoctors_dilemma
Retocado el final del ending con fade de audio
This commit is contained in:
@@ -100,6 +100,9 @@ void Ending::update()
|
||||
|
||||
// Comprueba si se ha de cambiar de escena
|
||||
checkChangeScene();
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
updateMusicVolume();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,6 +487,7 @@ section_t Ending::run()
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
JA_SetVolume(128);
|
||||
|
||||
return section;
|
||||
}
|
||||
@@ -560,8 +564,12 @@ void Ending::checkChangeScene()
|
||||
coverCounter = 0;
|
||||
if (scene == 5)
|
||||
{
|
||||
// Termina el bucle
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
|
||||
// Mantiene los valores anteriores
|
||||
scene = 4;
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
coverCounter = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,14 +608,20 @@ void Ending::renderCoverTexture()
|
||||
{
|
||||
if (coverCounter > 0)
|
||||
{ // Dibuja la textura que cubre el texto
|
||||
// const int offset = std::min(coverCounter, 200 / 2);
|
||||
// SDL_Rect srcRect = {0, 0, 256, 200 - (offset * 2)};
|
||||
// SDL_Rect dstRect = {0, offset * 2, 256, 200 - (offset * 2)};
|
||||
// SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||
|
||||
const int offset = std::min(coverCounter, 100);
|
||||
SDL_Rect srcRect = {0, 200 - (coverCounter * 2), 256, offset * 2};
|
||||
SDL_Rect dstRect = {0, 0, 256, offset * 2};
|
||||
SDL_RenderCopy(renderer, coverTexture, &srcRect, &dstRect);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
void Ending::updateMusicVolume()
|
||||
{
|
||||
if (scene == 4 && coverCounter > 0)
|
||||
{
|
||||
const float step = (100.0f - coverCounter) / 100.0f;
|
||||
const int volume = 128 * step;
|
||||
JA_SetVolume(volume);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user