Singletonejada la classe Input
This commit is contained in:
@@ -70,10 +70,11 @@ Director::Director(int argc, char *argv[])
|
||||
// Crea los objetos
|
||||
lang::loadFromFile(getLangFile((lang::lang_e)options.game.language));
|
||||
|
||||
input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
Input::init(asset->get("gamecontrollerdb.txt"));
|
||||
input = Input::get();
|
||||
initInput();
|
||||
|
||||
Screen::init(window, renderer, input);
|
||||
Screen::init(window, renderer);
|
||||
screen = Screen::get();
|
||||
|
||||
// Carga los sonidos del juego
|
||||
@@ -87,8 +88,8 @@ Director::~Director()
|
||||
{
|
||||
saveOptionsFile(asset->get("config.txt"));
|
||||
|
||||
delete input;
|
||||
Asset::destroy();
|
||||
Input::destroy();
|
||||
Screen::destroy();
|
||||
|
||||
deleteSounds();
|
||||
@@ -598,7 +599,7 @@ void Director::deleteMusics()
|
||||
// Ejecuta la sección con el logo
|
||||
void Director::runLogo()
|
||||
{
|
||||
logo = new Logo(input);
|
||||
logo = new Logo();
|
||||
logo->run();
|
||||
delete logo;
|
||||
}
|
||||
@@ -606,7 +607,7 @@ void Director::runLogo()
|
||||
// Ejecuta la sección con la secuencia de introducción
|
||||
void Director::runIntro()
|
||||
{
|
||||
intro = new Intro(input, getMusic(musics, "intro.ogg"));
|
||||
intro = new Intro(getMusic(musics, "intro.ogg"));
|
||||
intro->run();
|
||||
delete intro;
|
||||
}
|
||||
@@ -614,7 +615,7 @@ void Director::runIntro()
|
||||
// Ejecuta la sección con el titulo del juego
|
||||
void Director::runTitle()
|
||||
{
|
||||
title = new Title(input, getMusic(musics, "title.ogg"));
|
||||
title = new Title(getMusic(musics, "title.ogg"));
|
||||
title->run();
|
||||
delete title;
|
||||
}
|
||||
@@ -624,7 +625,7 @@ void Director::runGame()
|
||||
{
|
||||
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, input, getMusic(musics, "playing.ogg"));
|
||||
game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, getMusic(musics, "playing.ogg"));
|
||||
game->run();
|
||||
delete game;
|
||||
}
|
||||
@@ -632,7 +633,7 @@ void Director::runGame()
|
||||
// Ejecuta la sección donde se muestran las instrucciones
|
||||
void Director::runInstructions()
|
||||
{
|
||||
instructions = new Instructions(input, getMusic(musics, "title.ogg"));
|
||||
instructions = new Instructions(getMusic(musics, "title.ogg"));
|
||||
instructions->run();
|
||||
delete instructions;
|
||||
}
|
||||
@@ -640,7 +641,7 @@ void Director::runInstructions()
|
||||
// Ejecuta la sección donde se muestra la tabla de puntuaciones
|
||||
void Director::runHiScoreTable()
|
||||
{
|
||||
hiScoreTable = new HiScoreTable(input, getMusic(musics, "title.ogg"));
|
||||
hiScoreTable = new HiScoreTable(getMusic(musics, "title.ogg"));
|
||||
hiScoreTable->run();
|
||||
delete hiScoreTable;
|
||||
}
|
||||
@@ -650,7 +651,7 @@ void Director::runDemoGame()
|
||||
{
|
||||
const int playerID = (rand() % 2) + 1;
|
||||
const int currentStage = 0;
|
||||
demoGame = new Game(playerID, currentStage, GAME_MODE_DEMO_ON, input, nullptr);
|
||||
demoGame = new Game(playerID, currentStage, GAME_MODE_DEMO_ON, nullptr);
|
||||
demoGame->run();
|
||||
delete demoGame;
|
||||
}
|
||||
@@ -693,7 +694,7 @@ int Director::run()
|
||||
case section::NAME_INSTRUCTIONS:
|
||||
runInstructions();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user