Options: afegida opció per a permetre apagar el sistema
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
"[NOTIFICATIONS] 14": "Sincronisme vertical",
|
||||
"[NOTIFICATIONS] 15": "Reiniciar",
|
||||
|
||||
"[RESOURCE] LOADING": "Carregant",
|
||||
|
||||
"[SERVICE_MENU] TITLE": "Menu de servei",
|
||||
"[SERVICE_MENU] RESET": "Reiniciar",
|
||||
"[SERVICE_MENU] QUIT": "Eixir del joc",
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
"[NOTIFICATIONS] 14": "Vertical Sync",
|
||||
"[NOTIFICATIONS] 15": "Reset",
|
||||
|
||||
"[RESOURCE] LOADING": "Loading",
|
||||
|
||||
"[SERVICE_MENU] TITLE": "Service Menu",
|
||||
"[SERVICE_MENU] RESET": "Reset",
|
||||
"[SERVICE_MENU] QUIT": "Quit Game",
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
"[NOTIFICATIONS] 14": "Sincronismo vertical",
|
||||
"[NOTIFICATIONS] 15": "Reiniciar",
|
||||
|
||||
"[RESOURCE] LOADING": "Cargando",
|
||||
|
||||
"[SERVICE_MENU] TITLE": "Menu de servicio",
|
||||
"[SERVICE_MENU] RESET": "Reiniciar",
|
||||
"[SERVICE_MENU] QUIT": "Salir del juego",
|
||||
|
||||
@@ -51,7 +51,7 @@ HiScoreTable::HiScoreTable()
|
||||
HiScoreTable::~HiScoreTable()
|
||||
{
|
||||
SDL_DestroyTexture(backbuffer_);
|
||||
options.game.clear_last_hi_score_entries();
|
||||
options.game.clearLastHiScoreEntries();
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
|
||||
@@ -39,7 +39,8 @@ void initOptions()
|
||||
options.game.difficulty = GameDifficulty::NORMAL;
|
||||
options.game.language = lang::Code::VALENCIAN;
|
||||
options.game.autofire = true;
|
||||
options.game.clear_last_hi_score_entries();
|
||||
options.game.shutdown_enabled = false;
|
||||
options.game.clearLastHiScoreEntries();
|
||||
|
||||
// Opciones de control
|
||||
options.controllers.clear();
|
||||
@@ -155,6 +156,7 @@ bool saveOptionsFile(std::string file_path)
|
||||
file << "game.language=" << static_cast<int>(options.game.language) << "\n";
|
||||
file << "game.difficulty=" << static_cast<int>(options.game.difficulty) << "\n";
|
||||
file << "game.autofire=" << boolToString(options.game.autofire) << "\n";
|
||||
file << "game.shutdown_enabled=" << boolToString(options.game.shutdown_enabled) << "\n";
|
||||
|
||||
// Opciones de mandos
|
||||
file << "\n\n## CONTROLLERS\n";
|
||||
@@ -255,6 +257,10 @@ bool setOptions(const std::string &var, const std::string &value)
|
||||
{
|
||||
options.game.autofire = stringToBool(value);
|
||||
}
|
||||
else if (var == "game.shutdown_enabled")
|
||||
{
|
||||
options.game.shutdown_enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
// Opciones de mandos
|
||||
else if (var == "controller.0.name")
|
||||
|
||||
@@ -68,11 +68,12 @@ struct GameOptions
|
||||
GameDifficulty difficulty; // Dificultad del juego
|
||||
lang::Code language; // Idioma usado en el juego
|
||||
bool autofire; // Indicador de autofire
|
||||
bool shutdown_enabled; // Especifica si se puede apagar el sistema
|
||||
std::vector<HiScoreEntry> hi_score_table; // Tabla de mejores puntuaciones
|
||||
std::vector<int> last_hi_score_entry = {-1, -1}; // Últimas posiciones de entrada en la tabla
|
||||
|
||||
// Reinicia las últimas entradas de puntuación
|
||||
void clear_last_hi_score_entries()
|
||||
void clearLastHiScoreEntries()
|
||||
{
|
||||
last_hi_score_entry[0] = -1;
|
||||
last_hi_score_entry[1] = -1;
|
||||
|
||||
@@ -450,7 +450,7 @@ void Resource::renderProgress()
|
||||
loading_text_->write(
|
||||
loading_wired_rect_.x,
|
||||
loading_wired_rect_.y - 9,
|
||||
"Loading : " + loading_resource_name_
|
||||
lang::getText("[RESOURCE] LOADING") + " : " + loading_resource_name_
|
||||
);
|
||||
|
||||
// Renderiza el frame en pantalla
|
||||
|
||||
@@ -327,6 +327,7 @@ void ServiceMenu::initializeOptions()
|
||||
// System
|
||||
options_.emplace_back(lang::getText("[SERVICE_MENU] RESET"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
|
||||
options_.emplace_back(lang::getText("[SERVICE_MENU] QUIT"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
|
||||
if (options.game.shutdown_enabled)
|
||||
options_.emplace_back(lang::getText("[SERVICE_MENU] SHUTDOWN"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
|
||||
|
||||
// Menu principal
|
||||
|
||||
@@ -117,7 +117,8 @@ bool checkCollision(const SDL_FPoint &p, const SDL_FRect &r)
|
||||
// Convierte una cadena en un valor booleano
|
||||
bool stringToBool(const std::string &str)
|
||||
{
|
||||
return str == "true";
|
||||
std::string s = trim(toLower(str));
|
||||
return (s == "true" || s == "1" || s == "yes" || s == "on");
|
||||
}
|
||||
|
||||
// Convierte un valor booleano en una cadena
|
||||
|
||||
Reference in New Issue
Block a user