Añadido puntero a la estructura param en las clases necesarias
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
// Constructor
|
||||
Director::Director(int argc, char *argv[])
|
||||
{
|
||||
// Carga los parametros para configurar el juego
|
||||
loadParams();
|
||||
|
||||
// Inicializa variables
|
||||
section = new section_t();
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
@@ -70,6 +73,7 @@ Director::~Director()
|
||||
delete screen;
|
||||
delete lang;
|
||||
delete options;
|
||||
delete param;
|
||||
delete section;
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
@@ -186,9 +190,6 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
// Uint32 flags = SDL_RENDERER_SOFTWARE;
|
||||
// Uint32 flags = SDL_RENDERER_ACCELERATED;
|
||||
Uint32 flags = 0;
|
||||
if (options->video.vSync)
|
||||
{
|
||||
@@ -357,6 +358,17 @@ bool Director::setFileList()
|
||||
return asset->check();
|
||||
}
|
||||
|
||||
// Carga los parametros para configurar el juego
|
||||
void Director::loadParams()
|
||||
{
|
||||
param = new param_t;
|
||||
|
||||
param->gameWidth = 320;
|
||||
param->gameHeight = 240;
|
||||
|
||||
param->scoreboard = {0, 240-32, 320, 32};
|
||||
}
|
||||
|
||||
// Inicializa las opciones del programa
|
||||
void Director::initOptions()
|
||||
{
|
||||
@@ -378,8 +390,8 @@ void Director::initOptions()
|
||||
options->input.push_back(inp);
|
||||
|
||||
// Opciones de video
|
||||
options->video.gameWidth = GAMECANVAS_WIDTH;
|
||||
options->video.gameHeight = GAMECANVAS_HEIGHT;
|
||||
options->video.gameWidth = param->gameWidth;
|
||||
options->video.gameHeight = param->gameHeight;
|
||||
options->video.mode = 0;
|
||||
options->video.window.size = 3;
|
||||
options->video.window.width = options->video.window.size * options->video.gameWidth;
|
||||
@@ -625,21 +637,21 @@ bool Director::saveConfigFile()
|
||||
|
||||
void Director::runLogo()
|
||||
{
|
||||
logo = new Logo(renderer, screen, asset, input, section);
|
||||
logo = new Logo(renderer, screen, asset, input, param, section);
|
||||
logo->run();
|
||||
delete logo;
|
||||
}
|
||||
|
||||
void Director::runIntro()
|
||||
{
|
||||
intro = new Intro(renderer, screen, asset, input, lang, section);
|
||||
intro = new Intro(renderer, screen, asset, input, lang, param, section);
|
||||
intro->run();
|
||||
delete intro;
|
||||
}
|
||||
|
||||
void Director::runTitle()
|
||||
{
|
||||
title = new Title(renderer, screen, input, asset, options, lang, section);
|
||||
title = new Title(renderer, screen, input, asset, options, lang, param, section);
|
||||
title->run();
|
||||
delete title;
|
||||
}
|
||||
@@ -647,7 +659,7 @@ void Director::runTitle()
|
||||
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);
|
||||
game = new Game(numPlayers, 0, renderer, screen, asset, lang, input, false, param, options, section);
|
||||
game->run();
|
||||
delete game;
|
||||
}
|
||||
@@ -768,7 +780,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->audio.sound.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "sound.volume")
|
||||
else if (var == "sound.volume")
|
||||
{
|
||||
options->audio.sound.volume = std::stoi(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user