afegides opcions per defecte per a les notificacions

This commit is contained in:
2024-08-03 12:10:41 +02:00
parent 770a4d5f96
commit 256959505d
3 changed files with 94 additions and 102 deletions

View File

@@ -338,10 +338,10 @@ bool Director::setFileList()
asset->add(prefix + "/data/gfx/explosion3.ani", t_animation);
asset->add(prefix + "/data/gfx/explosion4.png", t_bitmap);
asset->add(prefix + "/data/gfx/explosion4.ani", t_animation);
asset->add(prefix + "/data/gfx/powerball.png", t_bitmap);
asset->add(prefix + "/data/gfx/powerball.ani", t_animation);
asset->add(prefix + "/data/gfx/bullet.png", t_bitmap);
asset->add(prefix + "/data/gfx/game_buildings.png", t_bitmap);
@@ -382,17 +382,17 @@ bool Director::setFileList()
asset->add(prefix + "/data/gfx/player1_pal1.gif", t_palette);
asset->add(prefix + "/data/gfx/player1_pal2.gif", t_palette);
asset->add(prefix + "/data/gfx/player1_pal3.gif", t_palette);
asset->add(prefix + "/data/gfx/player2.gif", t_bitmap);
asset->add(prefix + "/data/gfx/player2_pal1.gif", t_palette);
asset->add(prefix + "/data/gfx/player2_pal2.gif", t_palette);
asset->add(prefix + "/data/gfx/player2_pal3.gif", t_palette);
asset->add(prefix + "/data/gfx/player.ani", t_animation);
asset->add(prefix + "/data/gfx/player1_power.gif", t_bitmap);
asset->add(prefix + "/data/gfx/player2_power.gif", t_bitmap);
asset->add(prefix + "/data/gfx/player_power.ani", t_animation);
// Fuentes de texto
@@ -458,6 +458,12 @@ void Director::initOptions()
options->video.border.enabled = false;
options->video.shaders = true;
// Opciones de las notificaciones
options->notification.posV = pos_top;
options->notification.posH = pos_left;
options->notification.sound = true;
options->notification.color = {48, 48, 48};
// Opciones de audio
options->audio.music.enabled = true;
options->audio.music.volume = 128;
@@ -692,6 +698,39 @@ bool Director::saveConfigFile()
file << "video.border.width=" + std::to_string(options->video.border.width) + "\n";
file << "video.border.height=" + std::to_string(options->video.border.height) + "\n";
// Opciones de notificaciones
file << "\n\n## NOTIFICATION\n";
file << "## notification.posV [pos_top | pos_bottom]\n";
file << "## notification.posH [pos_left | pos_middle | pos_right]\n";
file << "\n";
if (options->notification.posV == pos_top)
{
file << "notification.posV=pos_top\n";
}
else
{
file << "notification.posV=pos_bottom\n";
}
if (options->notification.posH == pos_left)
{
file << "notification.posH=pos_left\n";
}
else if (options->notification.posH == pos_middle)
{
file << "notification.posH=pos_middle\n";
}
else
{
file << "notification.posH=pos_right\n";
}
file << "notification.sound=" + boolToString(options->notification.sound) + "\n";
// Opciones de audio
file << "\n\n## AUDIO\n";
file << "## volume [0 .. 128]\n";
@@ -965,6 +1004,40 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
options->video.border.height = std::stoi(value);
}
// Opciones de notificaciones
else if (var == "notification.posH")
{
if (value == "pos_left")
{
options->notification.posH = pos_left;
}
else if (value == "pos_middle")
{
options->notification.posH = pos_middle;
}
else
{
options->notification.posH = pos_right;
}
}
else if (var == "notification.posV")
{
if (value == "pos_top")
{
options->notification.posV = pos_top;
}
else
{
options->notification.posV = pos_bottom;
}
}
else if (var == "notification.sound")
{
options->notification.sound = stringToBool(value);
}
// Opciones de audio
else if (var == "audio.music.enabled")
{