Don melitonada la classe Asset

This commit is contained in:
2024-09-28 13:49:00 +02:00
parent 878518babe
commit fa82758ce1
23 changed files with 99 additions and 56 deletions

View File

@@ -33,7 +33,8 @@ Director::Director(int argc, char *argv[])
createSystemFolder("jailgames/coffee_crisis_arcade_edition");
// Crea el objeto que controla los ficheros de recursos
asset = new Asset(executablePath);
Asset::init(executablePath);
asset = Asset::get();
// Si falta algún fichero no inicia el programa
if (!setFileList())
@@ -72,7 +73,7 @@ Director::Director(int argc, char *argv[])
input = new Input(asset->get("gamecontrollerdb.txt"));
initInput();
Screen::Init(window, renderer, asset, input);
Screen::init(window, renderer, input);
screen = Screen::get();
// Carga los sonidos del juego
@@ -86,9 +87,9 @@ Director::~Director()
{
saveOptionsFile(asset->get("config.txt"));
delete asset;
delete input;
Screen::Destroy();
Asset::destroy();
Screen::destroy();
deleteSounds();
deleteMusics();
@@ -597,7 +598,7 @@ void Director::deleteMusics()
// Ejecuta la sección con el logo
void Director::runLogo()
{
logo = new Logo(asset, input);
logo = new Logo(input);
logo->run();
delete logo;
}
@@ -605,7 +606,7 @@ void Director::runLogo()
// Ejecuta la sección con la secuencia de introducción
void Director::runIntro()
{
intro = new Intro(asset, input, getMusic(musics, "intro.ogg"));
intro = new Intro(input, getMusic(musics, "intro.ogg"));
intro->run();
delete intro;
}
@@ -613,7 +614,7 @@ void Director::runIntro()
// Ejecuta la sección con el titulo del juego
void Director::runTitle()
{
title = new Title(asset, input, getMusic(musics, "title.ogg"));
title = new Title(input, getMusic(musics, "title.ogg"));
title->run();
delete title;
}
@@ -621,9 +622,9 @@ void Director::runTitle()
// Ejecuta la sección donde se juega al juego
void Director::runGame()
{
const int playerID = section::options;
const int playerID = section::options == section::OPTIONS_GAME_PLAY_1P ? 1 : 2;
const int currentStage = 0;
game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, asset, input, getMusic(musics, "playing.ogg"));
game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, input, getMusic(musics, "playing.ogg"));
game->run();
delete game;
}
@@ -631,7 +632,7 @@ void Director::runGame()
// Ejecuta la sección donde se muestran las instrucciones
void Director::runInstructions()
{
instructions = new Instructions(asset, input, getMusic(musics, "title.ogg"));
instructions = new Instructions(input, getMusic(musics, "title.ogg"));
instructions->run();
delete instructions;
}
@@ -639,7 +640,7 @@ void Director::runInstructions()
// Ejecuta la sección donde se muestra la tabla de puntuaciones
void Director::runHiScoreTable()
{
hiScoreTable = new HiScoreTable(asset, input, getMusic(musics, "title.ogg"));
hiScoreTable = new HiScoreTable(input, getMusic(musics, "title.ogg"));
hiScoreTable->run();
delete hiScoreTable;
}
@@ -649,7 +650,7 @@ void Director::runDemoGame()
{
const int playerID = (rand() % 2) + 1;
const int currentStage = 0;
demoGame = new Game(playerID, currentStage, GAME_MODE_DEMO_ON, asset, input, nullptr);
demoGame = new Game(playerID, currentStage, GAME_MODE_DEMO_ON, input, nullptr);
demoGame->run();
delete demoGame;
}