Sanejar codi
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <iostream> // for cout
|
||||
#include <string> // for basic_string, operator+, char_t...
|
||||
#include <vector> // for vector
|
||||
#include <memory>
|
||||
#include "asset.h" // for Asset, assetType
|
||||
#include "const.h" // for SECTION_PROG_LOGO, GAMECANVAS_H...
|
||||
#include "game.h" // for Game
|
||||
@@ -35,8 +36,9 @@
|
||||
#endif
|
||||
|
||||
// Constructor
|
||||
Director::Director(int argc, char *argv[])
|
||||
Director::Director(int argc, const char *argv[])
|
||||
{
|
||||
std::cout << "Game start" << std::endl;
|
||||
// Inicializa variables
|
||||
section = new section_t();
|
||||
section->name = SECTION_PROG_LOGO;
|
||||
@@ -99,6 +101,8 @@ Director::~Director()
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
std::cout << "\nBye!" << std::endl;
|
||||
}
|
||||
|
||||
// Inicializa el objeto input
|
||||
@@ -416,7 +420,7 @@ void Director::initOptions()
|
||||
}
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
void Director::checkProgramArguments(int argc, char *argv[])
|
||||
void Director::checkProgramArguments(int argc, const char *argv[])
|
||||
{
|
||||
// Establece la ruta del programa
|
||||
executablePath = argv[0];
|
||||
@@ -639,34 +643,30 @@ bool Director::saveConfigFile()
|
||||
|
||||
void Director::runLogo()
|
||||
{
|
||||
logo = new Logo(renderer, screen, asset, input, section);
|
||||
auto logo = std::make_unique<Logo>(renderer, screen, asset, input, section);
|
||||
logo->run();
|
||||
delete logo;
|
||||
}
|
||||
|
||||
void Director::runIntro()
|
||||
{
|
||||
intro = new Intro(renderer, screen, asset, input, lang, section);
|
||||
auto intro = std::make_unique<Intro>(renderer, screen, asset, input, lang, section);
|
||||
intro->run();
|
||||
delete intro;
|
||||
}
|
||||
|
||||
void Director::runTitle()
|
||||
{
|
||||
title = new Title(renderer, screen, input, asset, options, lang, section);
|
||||
auto title = std::make_unique<Title>(renderer, screen, input, asset, options, lang, section);
|
||||
title->run();
|
||||
delete title;
|
||||
}
|
||||
|
||||
void Director::runGame()
|
||||
{
|
||||
const int numPlayers = section->subsection == SUBSECTION_GAME_PLAY_1P ? 1 : 2;
|
||||
game = new Game(numPlayers, 0, renderer, screen, asset, lang, input, false, options, section);
|
||||
auto game = std::make_unique<Game>(numPlayers, 0, renderer, screen, asset, lang, input, false, options, section);
|
||||
game->run();
|
||||
delete game;
|
||||
}
|
||||
|
||||
void Director::run()
|
||||
int Director::run()
|
||||
{
|
||||
// Bucle principal
|
||||
while (section->name != SECTION_PROG_QUIT)
|
||||
@@ -690,6 +690,8 @@ void Director::run()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Asigna variables a partir de dos cadenas
|
||||
|
||||
Reference in New Issue
Block a user