Eliminado todo el código de las notificaciones
This commit is contained in:
@@ -166,12 +166,12 @@ bool Director::initSDL()
|
||||
// Crea la ventana
|
||||
int incW = 0;
|
||||
int incH = 0;
|
||||
if (options->video.borderEnabled)
|
||||
if (options->video.border.enabled)
|
||||
{
|
||||
incW = options->video.borderWidth * 2;
|
||||
incH = options->video.borderHeight * 2;
|
||||
incW = options->video.border.width * 2;
|
||||
incH = options->video.border.height * 2;
|
||||
}
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->video.gameWidth + incW) * options->video.windowSize, (options->video.gameHeight + incH) * options->video.windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->video.gameWidth + incW) * options->video.window.size, (options->video.gameHeight + incH) * options->video.window.size, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
if (window == nullptr)
|
||||
{
|
||||
if (options->console)
|
||||
@@ -184,13 +184,13 @@ bool Director::initSDL()
|
||||
{
|
||||
// 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 = SDL_RENDERER_SOFTWARE;
|
||||
// Uint32 flags = SDL_RENDERER_ACCELERATED;
|
||||
Uint32 flags = 0;
|
||||
if (options->video.vSync)
|
||||
{
|
||||
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
{
|
||||
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
|
||||
if (renderer == nullptr)
|
||||
@@ -381,32 +381,28 @@ void Director::initOptions()
|
||||
options->video.gameWidth = GAMECANVAS_WIDTH;
|
||||
options->video.gameHeight = GAMECANVAS_HEIGHT;
|
||||
options->video.mode = 0;
|
||||
options->video.windowSize = 3;
|
||||
options->video.windowWidth = options->video.windowSize * options->video.gameWidth;
|
||||
options->video.windowHeight = options->video.windowSize * options->video.gameHeight;
|
||||
options->video.window.size = 3;
|
||||
options->video.window.width = options->video.window.size * options->video.gameWidth;
|
||||
options->video.window.height = options->video.window.size * options->video.gameHeight;
|
||||
options->video.filter = FILTER_NEAREST;
|
||||
options->video.vSync = true;
|
||||
options->video.integerScale = true;
|
||||
options->video.keepAspect = true;
|
||||
options->video.borderWidth = 0;
|
||||
options->video.borderHeight = 0;
|
||||
options->video.borderEnabled = false;
|
||||
options->video.border.width = 0;
|
||||
options->video.border.height = 0;
|
||||
options->video.border.enabled = false;
|
||||
|
||||
// Opciones de audio
|
||||
options->audio.musicEnabled = false;
|
||||
options->audio.soundEnabled = false;
|
||||
options->audio.music.enabled = false;
|
||||
options->audio.music.volume = 128;
|
||||
options->audio.sound.enabled = false;
|
||||
options->audio.sound.volume = 128;
|
||||
|
||||
// Opciones varios
|
||||
options->playerSelected = 0;
|
||||
options->difficulty = DIFFICULTY_NORMAL;
|
||||
options->language = ba_BA;
|
||||
options->console = false;
|
||||
|
||||
// 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
|
||||
@@ -536,9 +532,9 @@ bool Director::loadConfigFile()
|
||||
options->video.mode = 0;
|
||||
}
|
||||
|
||||
if (options->video.windowSize < 1 || options->video.windowSize > 4)
|
||||
if (options->video.window.size < 1 || options->video.window.size > 4)
|
||||
{
|
||||
options->video.windowSize = 3;
|
||||
options->video.window.size = 3;
|
||||
}
|
||||
|
||||
if (options->language < 0 || options->language > MAX_LANGUAGES)
|
||||
@@ -572,11 +568,11 @@ bool Director::saveConfigFile()
|
||||
}
|
||||
}
|
||||
|
||||
// Opciones g´raficas
|
||||
file << "## VISUAL OPTIONS\n";
|
||||
// Opciones de video
|
||||
file << "## VIDEO\n";
|
||||
if (options->video.mode == 0)
|
||||
{
|
||||
file << "videoMode=0\n";
|
||||
file << "mode=0\n";
|
||||
}
|
||||
|
||||
else if (options->video.mode == SDL_WINDOW_FULLSCREEN)
|
||||
@@ -589,7 +585,7 @@ bool Director::saveConfigFile()
|
||||
file << "fullScreenMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
||||
}
|
||||
|
||||
file << "windowSize=" + std::to_string(options->video.windowSize) + "\n";
|
||||
file << "window.size=" + std::to_string(options->video.window.size) + "\n";
|
||||
|
||||
if (options->video.filter == FILTER_NEAREST)
|
||||
{
|
||||
@@ -603,45 +599,24 @@ bool Director::saveConfigFile()
|
||||
file << "vSync=" + boolToString(options->video.vSync) + "\n";
|
||||
file << "integerScale=" + boolToString(options->video.integerScale) + "\n";
|
||||
file << "keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
||||
file << "borderEnabled=" + boolToString(options->video.borderEnabled) + "\n";
|
||||
file << "borderWidth=" + std::to_string(options->video.borderWidth) + "\n";
|
||||
file << "borderHeight=" + std::to_string(options->video.borderHeight) + "\n";
|
||||
file << "border.enabled=" + boolToString(options->video.border.enabled) + "\n";
|
||||
file << "border.width=" + std::to_string(options->video.border.width) + "\n";
|
||||
file << "border.height=" + std::to_string(options->video.border.height) + "\n";
|
||||
|
||||
// Otras opciones del programa
|
||||
file << "\n## OTHER OPTIONS\n";
|
||||
// Opciones de audio
|
||||
file << "\n## AUDIO\n";
|
||||
file << "music.enabled=" + boolToString(options->audio.music.enabled) + "\n";
|
||||
file << "music.volume=" + std::to_string(options->audio.music.volume) + "\n";
|
||||
file << "sound.enabled=" + boolToString(options->audio.sound.enabled) + "\n";
|
||||
file << "sound.volume=" + std::to_string(options->audio.sound.volume) + "\n";
|
||||
|
||||
// Opciones del juego
|
||||
file << "\n## GAME\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 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();
|
||||
|
||||
@@ -710,7 +685,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
bool success = true;
|
||||
|
||||
// Opciones de video
|
||||
if (var == "videoMode")
|
||||
if (var == "mode")
|
||||
{
|
||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
||||
{
|
||||
@@ -726,12 +701,12 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "windowSize")
|
||||
else if (var == "window.size")
|
||||
{
|
||||
options->video.windowSize = std::stoi(value);
|
||||
if ((options->video.windowSize < 1) || (options->video.windowSize > 4))
|
||||
options->video.window.size = std::stoi(value);
|
||||
if ((options->video.window.size < 1) || (options->video.window.size > 4))
|
||||
{
|
||||
options->video.windowSize = 3;
|
||||
options->video.window.size = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,22 +737,43 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->video.keepAspect = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "borderEnabled")
|
||||
else if (var == "border.enabled")
|
||||
{
|
||||
options->video.borderEnabled = stringToBool(value);
|
||||
options->video.border.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "borderWidth")
|
||||
else if (var == "border.width")
|
||||
{
|
||||
options->video.borderWidth = std::stoi(value);
|
||||
options->video.border.width = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "borderHeight")
|
||||
else if (var == "border.height")
|
||||
{
|
||||
options->video.borderHeight = std::stoi(value);
|
||||
options->video.border.height = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones varias
|
||||
// Opciones de audio
|
||||
else if (var == "music.enabled")
|
||||
{
|
||||
options->audio.music.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "music.volume")
|
||||
{
|
||||
options->audio.music.volume = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "sound.enabled")
|
||||
{
|
||||
options->audio.sound.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "sound.volume")
|
||||
{
|
||||
options->audio.sound.volume = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones de juego
|
||||
else if (var == "language")
|
||||
{
|
||||
options->language = std::stoi(value);
|
||||
@@ -798,40 +794,6 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->input[1].deviceType = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones de notificaciones
|
||||
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);
|
||||
}
|
||||
|
||||
// Lineas vacias o que empiezan por comentario
|
||||
else if (var == "" || var.substr(0, 1) == "#")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user