La música la tiene ahora la clase Director

This commit is contained in:
2024-07-05 07:20:20 +02:00
parent 8051cbbc39
commit 2b628d2d61
12 changed files with 169 additions and 45 deletions

View File

@@ -3,7 +3,7 @@
#define DEATH_COUNTER 350
// Constructor
Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section)
Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section, JA_Music_t *music)
{
// Copia los punteros
this->renderer = renderer;
@@ -14,6 +14,7 @@ Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *scree
this->param = param;
this->options = options;
this->section = section;
this->music = music;
// Pasa variables
this->demo.enabled = demo;
@@ -150,8 +151,6 @@ Game::~Game()
JA_DeleteSound(clockSound);
JA_DeleteSound(powerBallSound);
JA_DeleteSound(coffeeMachineSound);
JA_DeleteMusic(gameMusic);
}
// Inicializa las variables necesarias para la sección 'Game'
@@ -499,9 +498,6 @@ void Game::loadMedia()
stageChangeSound = JA_LoadSound(asset->get("stage_change.wav").c_str());
coffeeMachineSound = JA_LoadSound(asset->get("title.wav").c_str());
// Musicas
gameMusic = JA_LoadMusic(asset->get("playing.ogg").c_str());
if (options->console)
{
std::cout << "** RESOURCES FOR GAME SECTION LOADED" << std::endl
@@ -3001,7 +2997,7 @@ void Game::run()
{
if (players[0]->isAlive())
{
JA_PlayMusic(gameMusic);
JA_PlayMusic(music);
}
}
}