Actualizadas las notificaciones a la última versión
This commit is contained in:
@@ -358,9 +358,10 @@ bool Director::setFileList()
|
||||
// Inicializa las opciones del programa
|
||||
void Director::initOptions()
|
||||
{
|
||||
// Crea el puntero a la estructura de opciones
|
||||
options = new options_t;
|
||||
|
||||
// Pone unos valores por defecto
|
||||
// Pone unos valores por defecto para las opciones de control
|
||||
options->input.clear();
|
||||
|
||||
input_t inp;
|
||||
@@ -374,7 +375,7 @@ void Director::initOptions()
|
||||
inp.deviceType = INPUT_USE_GAMECONTROLLER;
|
||||
options->input.push_back(inp);
|
||||
|
||||
// Video
|
||||
// Opciones de video
|
||||
options->gameWidth = GAMECANVAS_WIDTH;
|
||||
options->gameHeight = GAMECANVAS_HEIGHT;
|
||||
options->videoMode = 0;
|
||||
@@ -387,19 +388,29 @@ void Director::initOptions()
|
||||
options->borderHeight = 0;
|
||||
options->borderEnabled = false;
|
||||
|
||||
// Varios
|
||||
// Opciones varios
|
||||
options->playerSelected = 0;
|
||||
options->difficulty = DIFFICULTY_NORMAL;
|
||||
options->language = ba_BA;
|
||||
options->console = false;
|
||||
|
||||
// Online
|
||||
// Opciones online
|
||||
options->online.enabled = false;
|
||||
options->online.server = "jaildoctor.duckdns.org";
|
||||
options->online.port = 9911;
|
||||
#ifdef DEBUG
|
||||
options->online.gameID = "coffee_crisis_test";
|
||||
#else
|
||||
options->online.gameID = "coffee_crisis";
|
||||
#endif
|
||||
options->online.jailerID = "";
|
||||
options->online.score = 0;
|
||||
|
||||
// Opciones de las notificaciones
|
||||
options->notifications.posV = pos_top;
|
||||
options->notifications.posH = pos_left;
|
||||
options->notifications.sound = true;
|
||||
options->notifications.color = {48, 48, 48};
|
||||
}
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
@@ -550,7 +561,22 @@ bool Director::saveConfigFile()
|
||||
// Crea y abre el fichero de texto
|
||||
std::ofstream file(asset->get("config.txt"));
|
||||
|
||||
// Escribe en el fichero
|
||||
if (file.good())
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << asset->get("config.txt") << " open for writing" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << asset->get("config.txt") << " can't be opened" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Opciones g´raficas
|
||||
file << "## VISUAL OPTIONS\n";
|
||||
if (options->videoMode == 0)
|
||||
{
|
||||
@@ -585,18 +611,48 @@ bool Director::saveConfigFile()
|
||||
file << "borderWidth=" + std::to_string(options->borderWidth) + "\n";
|
||||
file << "borderHeight=" + std::to_string(options->borderHeight) + "\n";
|
||||
|
||||
// Otras opciones del programa
|
||||
file << "\n## OTHER OPTIONS\n";
|
||||
file << "language=" + std::to_string(options->language) + "\n";
|
||||
file << "difficulty=" + std::to_string(options->difficulty) + "\n";
|
||||
file << "input0=" + std::to_string(options->input[0].deviceType) + "\n";
|
||||
file << "input1=" + std::to_string(options->input[1].deviceType) + "\n";
|
||||
|
||||
// Opciones sobre la conexión online
|
||||
file << "\n## ONLINE OPTIONS\n";
|
||||
file << "enabled=" + boolToString(options->online.enabled) + "\n";
|
||||
file << "server=" + options->online.server + "\n";
|
||||
file << "port=" + std::to_string(options->online.port) + "\n";
|
||||
file << "jailerID=" + options->online.jailerID + "\n";
|
||||
|
||||
// Opciones de las notificaciones
|
||||
file << "\n## NOTIFICATION OPTIONS\n";
|
||||
file << "## notifications.posV = pos_top | pos_bottom\n";
|
||||
if (options->notifications.posV == pos_top)
|
||||
{
|
||||
file << "notifications.posV=pos_top\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
file << "notifications.posV=pos_bottom\n";
|
||||
}
|
||||
|
||||
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
|
||||
if (options->notifications.posH == pos_left)
|
||||
{
|
||||
file << "notifications.posH=pos_left\n";
|
||||
}
|
||||
else if (options->notifications.posH == pos_middle)
|
||||
{
|
||||
file << "notifications.posH=pos_middle\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
file << "notifications.posH=pos_right\n";
|
||||
}
|
||||
|
||||
file << "notifications.sound=" + boolToString(options->notifications.sound) + "\n";
|
||||
|
||||
// Cierra el fichero
|
||||
file.close();
|
||||
|
||||
@@ -873,6 +929,39 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->online.jailerID = value;
|
||||
}
|
||||
|
||||
else if (var == "notifications.posH")
|
||||
{
|
||||
if (value == "pos_left")
|
||||
{
|
||||
options->notifications.posH = pos_left;
|
||||
}
|
||||
else if (value == "pos_middle")
|
||||
{
|
||||
options->notifications.posH = pos_middle;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->notifications.posH = pos_right;
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "notifications.posV")
|
||||
{
|
||||
if (value == "pos_top")
|
||||
{
|
||||
options->notifications.posV = pos_top;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->notifications.posV = pos_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "notifications.sound")
|
||||
{
|
||||
options->notifications.sound = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "" || var.substr(0, 1) == "#")
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user