Se puede saltar la animación del titulo y empezar a jugar directamente

This commit is contained in:
2024-06-30 15:32:39 +02:00
parent 8340bdfe32
commit b278941918
2 changed files with 48 additions and 49 deletions

View File

@@ -23,12 +23,12 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
miniLogoTexture = new Texture(renderer, asset->get("logo_jailgames_mini.png"));
miniLogoSprite = new Sprite(GAMECANVAS_CENTER_X - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture, renderer);
backgroundObj = new Background(renderer, screen, asset, param);
backgroundObj->setSrcDest(windowArea);
backgroundObj->setDstDest(windowArea);
backgroundObj->setCloudsSpeed(-0.5f);
backgroundObj->setGradientNumber(1);
backgroundObj->setTransition(0.8f);
background = new Background(renderer, screen, asset, param);
background->setSrcDest(windowArea);
background->setDstDest(windowArea);
background->setCloudsSpeed(-0.5f);
background->setGradientNumber(1);
background->setTransition(0.8f);
tiledbg = new Tiledbg(renderer, screen, asset, {0, 0, param->gameWidth, param->gameHeight});
@@ -56,7 +56,7 @@ Title::~Title()
delete miniLogoTexture;
delete miniLogoSprite;
delete backgroundObj;
delete background;
delete tiledbg;
delete gameLogo;
@@ -90,7 +90,34 @@ void Title::update()
ticks = SDL_GetTicks();
// Actualiza el objeto 'background'
backgroundObj->update();
background->update();
// Comprueba el fade y si se ha acabado
fade->update();
if (fade->hasEnded())
{
switch (postFade)
{
case 0: // 1 PLAYER
section->name = SECTION_PROG_GAME;
section->subsection = SUBSECTION_GAME_PLAY_1P;
JA_StopMusic();
break;
case 1: // 2 PLAYER
section->name = SECTION_PROG_GAME;
section->subsection = SUBSECTION_GAME_PLAY_2P;
JA_StopMusic();
break;
case 3: // TIME OUT
section->name = SECTION_PROG_GAME_DEMO;
break;
default:
break;
}
}
// Sección 1 - Titulo animandose
if (section->subsection == SUBSECTION_TITLE_1)
@@ -120,34 +147,6 @@ void Title::update()
// Actualiza el mosaico de fondo
tiledbg->update();
// Actualiza la lógica del titulo
fade->update();
if (fade->hasEnded())
{
switch (postFade)
{
case 0: // 1 PLAYER
section->name = SECTION_PROG_GAME;
section->subsection = SUBSECTION_GAME_PLAY_1P;
JA_StopMusic();
break;
case 1: // 2 PLAYER
section->name = SECTION_PROG_GAME;
section->subsection = SUBSECTION_GAME_PLAY_2P;
JA_StopMusic();
break;
case 3: // TIME OUT
section->name = SECTION_PROG_GAME_DEMO;
break;
default:
break;
}
}
}
else if (counter >= param->titleCounter)
{
@@ -168,7 +167,7 @@ void Title::render()
// Dibuja el mosacico de fondo
tiledbg->render();
// backgroundObj->render();
// background->render();
// Dinuja el logo con el título del juego
gameLogo->render();

View File

@@ -39,7 +39,7 @@ private:
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
SDL_Event *eventHandler; // Manejador de eventos
section_t *section; // Indicador para el bucle del titulo
Background *backgroundObj; // Objeto para dibujar el fondo del juego
Background *background; // Objeto para dibujar el fondo del juego
Tiledbg *tiledbg; // Objeto para dibujar el mosaico animado de fondo
GameLogo *gameLogo; // Objeto para dibujar el logo con el título del juego
Texture *miniLogoTexture; // Textura con el logo de JailGames mini