fix: ja torna a funcionar el cicle de música per les diferents seccions

This commit is contained in:
2024-08-14 08:38:19 +02:00
parent a5a3bb23da
commit 45ed1106cb
7 changed files with 35 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
#include <iostream>
// Constructor
Instructions::Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section)
Instructions::Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
{
// Copia los punteros
this->screen = screen;
@@ -11,6 +11,7 @@ Instructions::Instructions(Screen *screen, Asset *asset, Input *input, Lang *lan
this->lang = lang;
this->param = param;
this->section = section;
this->music = music;
renderer = screen->getRenderer();
// Crea objetos
@@ -229,6 +230,10 @@ void Instructions::update()
// Actualiza el contador de ticks
ticks = SDL_GetTicks();
// Mantiene la música sonando
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
JA_PlayMusic(music);
// Actualiza el objeto screen
screen->update();
@@ -241,8 +246,10 @@ void Instructions::update()
// Actualiza el mosaico de fondo
tiledbg->update();
// Actualiza el objeto "fade"
fade->update();
// Comprueba si el contador ha llegado al final
if (counter == counterEnd)
{
section->name = SECTION_PROG_TITLE;