Reestructurando la lógica del titulo
This commit is contained in:
@@ -199,10 +199,10 @@ void Title::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza el objeto 'background'
|
||||
backgroundObj->update();
|
||||
//screen->update();
|
||||
counter++;
|
||||
|
||||
// Se realizan diferentes cosas en funcion de la subsección actual
|
||||
switch (section->subsection)
|
||||
{
|
||||
// Sección 1 - Titulo desplazandose
|
||||
@@ -219,7 +219,7 @@ void Title::update()
|
||||
|
||||
// Pantallazo blanco
|
||||
screen->setFlash({0xFF, 0xFF, 0xFF}, 5);
|
||||
|
||||
|
||||
// Reproduce el efecto sonoro
|
||||
JA_PlaySound(crashSound);
|
||||
}
|
||||
@@ -253,7 +253,10 @@ void Title::update()
|
||||
case SUBSECTION_TITLE_3:
|
||||
{
|
||||
if (counter > 0)
|
||||
{ // Reproduce la música
|
||||
{
|
||||
counter--;
|
||||
|
||||
// Reproduce la música
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
{
|
||||
JA_PlayMusic(titleMusic);
|
||||
@@ -367,7 +370,7 @@ void Title::render()
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Dibuja el tileado de fondo
|
||||
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
// SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
backgroundObj->render();
|
||||
|
||||
// Dibuja los objetos
|
||||
@@ -381,41 +384,26 @@ void Title::render()
|
||||
|
||||
// Sección 2 - Titulo vibrando
|
||||
case SUBSECTION_TITLE_2:
|
||||
{ // Reproduce el efecto sonoro
|
||||
JA_PlaySound(crashSound);
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Agita la pantalla
|
||||
const int v[] = {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0};
|
||||
const int a = coffeeBitmap->getPosX();
|
||||
const int b = crisisBitmap->getPosX();
|
||||
for (int n = 0; n < 11 * 3; ++n)
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
// Dibuja el tileado de fondo
|
||||
// SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
backgroundObj->render();
|
||||
|
||||
// Dibuja el tileado de fondo
|
||||
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
backgroundObj->render();
|
||||
// Dibuja los objetos
|
||||
coffeeBitmap->render();
|
||||
crisisBitmap->render();
|
||||
|
||||
// Dibuja los objetos
|
||||
coffeeBitmap->setPosX(a + v[n / 3]);
|
||||
crisisBitmap->setPosX(b + v[n / 3]);
|
||||
coffeeBitmap->render();
|
||||
crisisBitmap->render();
|
||||
dustBitmapR->render();
|
||||
dustBitmapL->render();
|
||||
|
||||
dustBitmapR->update();
|
||||
dustBitmapL->update();
|
||||
dustBitmapR->render();
|
||||
dustBitmapL->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
section->subsection = SUBSECTION_TITLE_3;
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -429,7 +417,7 @@ void Title::render()
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Dibuja el tileado de fondo
|
||||
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
// SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||
backgroundObj->render();
|
||||
|
||||
coffeeBitmap->render();
|
||||
@@ -440,7 +428,6 @@ void Title::render()
|
||||
dustBitmapL->render();
|
||||
|
||||
// PRESS ANY KEY!
|
||||
//if ((counter % 50 > 14) && (menuVisible == false))
|
||||
if (counter % 50 > 14)
|
||||
{
|
||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, GAMECANVAS_CENTER_X, GAMECANVAS_THIRD_QUARTER_Y + BLOCK, lang->getText(23), 1, noColor, 1, shdwTxtColor);
|
||||
|
||||
Reference in New Issue
Block a user