Añadido FADE_VENETIAN a la clase fade
La clase game utiliza un objeto fade para sus fades en vez de sus propios procedimientos
This commit is contained in:
@@ -80,6 +80,17 @@ void Fade::render()
|
||||
break;
|
||||
}
|
||||
|
||||
case FADE_VENETIAN:
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, 0xFF);
|
||||
for (auto rect : square)
|
||||
{
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -148,6 +159,32 @@ void Fade::update()
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case FADE_VENETIAN:
|
||||
{
|
||||
// Counter debe ir de 0 a 150
|
||||
if (square.back().h < param->venetianSize)
|
||||
{
|
||||
const Uint8 h = counter / 3;
|
||||
for (int i = 0; i < (int)square.size(); ++i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
square[i].h = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
square[i].h = std::max(square[i - 1].h - 3, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finished = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (finished)
|
||||
@@ -223,6 +260,23 @@ void Fade::activate()
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case FADE_VENETIAN:
|
||||
{
|
||||
rect1 = {0, 0, param->gameWidth, 0};
|
||||
square.clear();
|
||||
|
||||
// Añade los cuadrados al vector
|
||||
const int max = param->gameHeight / param->venetianSize;
|
||||
|
||||
for (int i = 0; i < max; ++i)
|
||||
{
|
||||
rect1.y = i * param->venetianSize;
|
||||
square.push_back(rect1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user