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

@@ -1,7 +1,7 @@
#include "intro.h"
// Constructor
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section)
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
{
// Copia los punteros
this->renderer = renderer;
@@ -11,15 +11,13 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
this->input = input;
this->param = param;
this->section = section;
this->music = music;
// Reserva memoria para los objetos
eventHandler = new SDL_Event();
texture = new Texture(renderer, asset->get("intro.png"));
text = new Text(asset->get("nokia.png"), asset->get("nokia.txt"), renderer);
// Carga los recursos
loadMedia();
// Inicializa variables
section->name = SECTION_PROG_INTRO;
section->subsection = 0;
@@ -161,17 +159,6 @@ Intro::~Intro()
{
delete text;
}
JA_DeleteMusic(music);
}
// Carga los recursos
bool Intro::loadMedia()
{
// Musicas
music = JA_LoadMusic(asset->get("intro.ogg").c_str());
return true;
}
// Comprueba los eventos