Añadida música al titulo

This commit is contained in:
2022-08-23 17:03:10 +02:00
parent 87f6ec39ea
commit 2425ab5142
6 changed files with 25 additions and 19 deletions

View File

@@ -16,6 +16,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
sprite = new AnimatedSprite(texture, renderer, asset->get("intro.ani"));
sprite->setCurrentAnimation("menu");
text = new Text(asset->get("debug.png"), asset->get("debug.txt"), renderer);
music = JA_LoadMusic(asset->get("music_title.ogg").c_str());
// Inicializa variables
section = {SECTION_PROG_TITLE, 0};
@@ -42,6 +43,8 @@ Title::~Title()
delete text;
text = nullptr;
JA_DeleteMusic(music);
}
// Actualiza las variables
@@ -85,7 +88,9 @@ void Title::render()
// Dibuja los objetos
sprite->render();
text->writeCentered(160, 200, "@2016,2022 JailDesigner (v0.6)", -1);
//text->writeCentered(160, 200, "@2016,2022 JAILDESIGNER & JAILBROTHER (v0.6)", -1);
const color_t color = {179,83,71};
text->writeDX(TXT_CENTER|TXT_COLOR,160, 200, "@2016,2022 JAILDESIGNER & JAILBROTHER (v0.6)", -1, color);
// Vuelca el contenido del renderizador en pantalla
screen->blit();
@@ -94,6 +99,8 @@ void Title::render()
// Bucle principal
section_t Title::run()
{
JA_PlayMusic(music);
while (section.name == SECTION_PROG_TITLE)
{
update();
@@ -101,4 +108,6 @@ section_t Title::run()
}
return section;
JA_StopMusic();
}