Se puede especificar con argumentos el fichero de parametros a utilizar
This commit is contained in:
@@ -47,7 +47,8 @@ Director::Director(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Carga los parametros para configurar el juego
|
||||
loadParams();
|
||||
const std::string paramFilePath = paramFileArgument == "--320x240" ? asset->get("param_320x240.txt") : asset->get("param_320x256.txt");
|
||||
loadParams(paramFilePath);
|
||||
|
||||
// Carga el fichero de configuración
|
||||
loadConfigFile();
|
||||
@@ -213,6 +214,7 @@ bool Director::initSDL()
|
||||
SDL_DisplayMode DM;
|
||||
SDL_GetCurrentDisplayMode(0, &DM);
|
||||
std::cout << "\nDisplay info: " + std::to_string(DM.w) + "x" + std::to_string(DM.h) + " @ " + std::to_string(DM.refresh_rate) + "Hz" << std::endl;
|
||||
std::cout << "Window info : " + std::to_string(param->game.width) + "x" + std::to_string(param->game.height) + " x" + std::to_string(options->video.window.size) << std::endl;
|
||||
}
|
||||
|
||||
// Establece el filtro de la textura
|
||||
@@ -297,7 +299,8 @@ bool Director::setFileList()
|
||||
// Ficheros de configuración
|
||||
asset->add(systemFolder + "/config.txt", t_data, false, true);
|
||||
asset->add(systemFolder + "/score.bin", t_data, false, true);
|
||||
asset->add(prefix + "/data/config/param.txt", t_data);
|
||||
asset->add(prefix + "/data/config/param_320x240.txt", t_data);
|
||||
asset->add(prefix + "/data/config/param_320x256.txt", t_data);
|
||||
asset->add(prefix + "/data/config/demo1.bin", t_data);
|
||||
asset->add(prefix + "/data/config/demo2.bin", t_data);
|
||||
asset->add(prefix + "/data/config/gamecontrollerdb.txt", t_data);
|
||||
@@ -429,11 +432,11 @@ bool Director::setFileList()
|
||||
}
|
||||
|
||||
// Carga los parametros para configurar el juego
|
||||
void Director::loadParams()
|
||||
void Director::loadParams(std::string filepath)
|
||||
{
|
||||
param = new param_t;
|
||||
|
||||
loadParamsFromFile(param, asset->get("param.txt"));
|
||||
loadParamsFromFile(param, filepath);
|
||||
|
||||
// Modifica las opciones desde el fichero de parametros
|
||||
options->video.window.width = options->video.window.size * param->game.width;
|
||||
@@ -519,6 +522,9 @@ void Director::checkProgramArguments(int argc, char *argv[])
|
||||
// Establece la ruta del programa
|
||||
executablePath = argv[0];
|
||||
|
||||
// Valores por defecto
|
||||
paramFileArgument = "";
|
||||
|
||||
// Comprueba el resto de parametros
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
@@ -526,6 +532,11 @@ void Director::checkProgramArguments(int argc, char *argv[])
|
||||
{
|
||||
options->console = true;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--320x240") == 0)
|
||||
{
|
||||
paramFileArgument = argv[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user