resource.pack
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
|
||||
#include "jail_audio.hpp" // for JA_StopMusic, JA_DeleteMusic, JA_LoadMusic
|
||||
#include "lang.h" // for Lang
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "text.h" // for Text
|
||||
@@ -28,11 +29,9 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
|
||||
|
||||
// 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();
|
||||
texture = Resource::get()->getTexture("intro.png");
|
||||
text = Resource::get()->getText("nokia");
|
||||
music = Resource::get()->getMusic("intro.ogg");
|
||||
|
||||
// Inicializa variables
|
||||
section->name = SECTION_PROG_INTRO;
|
||||
@@ -161,25 +160,18 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
|
||||
Intro::~Intro() {
|
||||
delete eventHandler;
|
||||
|
||||
texture->unload();
|
||||
delete texture;
|
||||
|
||||
// texture, text, music son propiedad de Resource — no liberar aquí.
|
||||
for (auto bitmap : bitmaps) {
|
||||
delete bitmap;
|
||||
}
|
||||
|
||||
for (auto text : texts) {
|
||||
delete text;
|
||||
for (auto t : texts) {
|
||||
delete t;
|
||||
}
|
||||
|
||||
JA_DeleteMusic(music);
|
||||
}
|
||||
|
||||
// Carga los recursos
|
||||
// Carga los recursos (ya no carga nada, se mantiene por si hay callers)
|
||||
bool Intro::loadMedia() {
|
||||
// Musicas
|
||||
music = JA_LoadMusic(asset->get("intro.ogg").c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user