Afegit custom fadeout de so sincronitzat amb el fadeout de video per a quan acaba la partida
This commit is contained in:
@@ -151,7 +151,7 @@ void Fade::update()
|
||||
|
||||
case FadeType::VENETIAN:
|
||||
{
|
||||
// Counter debe ir de 0 a 150
|
||||
// Counter debe ir de 0 a 150 <-- comprobar si esto es aún cierto
|
||||
if (square_.back().h < param.fade.venetian_size)
|
||||
{
|
||||
// Dibuja sobre el backbuffer_
|
||||
@@ -176,6 +176,16 @@ void Fade::update()
|
||||
// A partir del segundo rectangulo se pinta en función del anterior
|
||||
square_.at(i).h = i == 0 ? h : std::max(square_.at(i - 1).h - 2, 0);
|
||||
}
|
||||
|
||||
int completed = 0;
|
||||
for (const auto &square : square_)
|
||||
{
|
||||
if (square.h >= param.fade.venetian_size)
|
||||
{
|
||||
++completed;
|
||||
}
|
||||
}
|
||||
value_ = calculateValue(0, square_.size() - 1, completed);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -315,9 +325,9 @@ void Fade::cleanBackbuffer(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
// Calcula el valor del estado del fade
|
||||
int Fade::calculateValue(int min, int max, int current)
|
||||
{
|
||||
if (max == 0)
|
||||
{
|
||||
if (current < min)
|
||||
return 0;
|
||||
}
|
||||
return std::clamp(current * 100 / max, 0, 100);
|
||||
if (current > max)
|
||||
return 100;
|
||||
return static_cast<int>(100.0 * (current - min) / (max - min));
|
||||
}
|
||||
Reference in New Issue
Block a user