Fade acabado y no convence

This commit is contained in:
2022-09-15 22:41:19 +02:00
parent 8125e47d17
commit 06cb1e748d
3 changed files with 33 additions and 12 deletions

View File

@@ -287,7 +287,9 @@ void Screen::iniSpectrumFade()
{
spectrumFade = false;
spectrumFadeCounter = 0;
spectrumFadeLenght = 200;
spectrumFadeLenght = 50;
spectrumColor.clear();
color_t c;
c = stringToColor("black");
@@ -327,6 +329,7 @@ void Screen::updateSpectrumFade()
if (spectrumFadeCounter > spectrumFadeLenght)
{
iniSpectrumFade();
SDL_SetTextureColorMod(gameCanvas, 255, 255, 255);
}
}
@@ -339,7 +342,10 @@ void Screen::renderSpectrumFade()
}
const float step = (float)spectrumFadeCounter / (float)spectrumFadeLenght;
SDL_SetTextureColorMod(gameCanvas, 255, 0, 0);
const int max = spectrumColor.size() - 1;
const int index = max + (0 - max) * step;
const color_t c = spectrumColor[index];
SDL_SetTextureColorMod(gameCanvas, c.r, c.g, c.b);
}
// Actualiza los efectos