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
HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section)
HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section, JA_Music_t *music)
{
// Copia punteros
this->screen = screen;
@@ -12,6 +12,7 @@ HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lan
this->section = section;
this->options = options;
this->param = param;
this->music = music;
renderer = screen->getRenderer();
// Objetos
@@ -68,6 +69,10 @@ void HiScoreTable::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();
@@ -77,6 +82,7 @@ void HiScoreTable::update()
// Gestiona el fade
updateFade();
// Gestiona el contador y sus eventos
counter++;
if (counter == 150)