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:
@@ -278,7 +278,8 @@ void Game::init(int playerID)
|
||||
demo.counter = 0;
|
||||
|
||||
// Inicializa el objeto para el fundido
|
||||
fade->setColor(0x27, 0x27, 0x36);
|
||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||
fade->setType(FADE_VENETIAN);
|
||||
|
||||
// Con los globos creados, calcula el nivel de amenaza
|
||||
evaluateAndSetMenace();
|
||||
@@ -1627,52 +1628,21 @@ void Game::updateDeath()
|
||||
JA_Sound_t *sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
|
||||
JA_PlaySound(sound[index], 0);
|
||||
}
|
||||
|
||||
if (deathCounter == 150)
|
||||
{
|
||||
fade->activate();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (fade->hasEnded())
|
||||
{
|
||||
// section->subsection = SUBSECTION_GAME_GAMEOVER;
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_1;
|
||||
section->name = SECTION_PROG_HI_SCORE_TABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Renderiza el fade final cuando se acaba la partida
|
||||
void Game::renderDeathFade(int counter)
|
||||
{
|
||||
// Counter debe ir de 0 a 150
|
||||
SDL_SetRenderDrawColor(renderer, 0x27, 0x27, 0x36, 255);
|
||||
|
||||
const int desp = 16;
|
||||
const int max = param->gameHeight / desp;
|
||||
if (counter < 150)
|
||||
{
|
||||
// 192 / 6 = 32, 6 cuadrados de 32 pixeles
|
||||
SDL_Rect rect[max];
|
||||
Uint8 h = counter / 3;
|
||||
for (int i = 0; i < max; ++i)
|
||||
{
|
||||
rect[i].x = 0;
|
||||
rect[i].y = i * desp;
|
||||
rect[i].w = param->gameWidth;
|
||||
if (i == 0)
|
||||
{
|
||||
rect[i].h = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect[i].h = std::max(rect[i - 1].h - 3, 0);
|
||||
}
|
||||
SDL_RenderFillRect(renderer, &rect[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_Rect rect = {0, 0, param->gameWidth, param->gameHeight};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza los globos
|
||||
void Game::updateBalloons()
|
||||
{
|
||||
@@ -2541,6 +2511,9 @@ void Game::update()
|
||||
// Actualiza el objeto screen
|
||||
screen->update();
|
||||
|
||||
// Actualiza el objeto fade
|
||||
fade->update();
|
||||
|
||||
// Actualiza las variables del jugador
|
||||
updatePlayers();
|
||||
|
||||
@@ -2671,17 +2644,8 @@ void Game::render()
|
||||
// Dibuja el separador del marcador de la zona de juego
|
||||
renderSeparator();
|
||||
|
||||
// Dibuja el sprite del jugador al morir
|
||||
if ((deathCounter <= 150) && !players[0]->isAlive())
|
||||
{
|
||||
renderDeathFade(150 - deathCounter);
|
||||
}
|
||||
|
||||
// Dibuja el fade de fin de juego
|
||||
if ((gameCompleted) && (gameCompletedCounter >= GAME_COMPLETED_START_FADE))
|
||||
{
|
||||
renderDeathFade(gameCompletedCounter - GAME_COMPLETED_START_FADE);
|
||||
}
|
||||
// Dibuja el fade
|
||||
fade->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
|
||||
Reference in New Issue
Block a user