eliminat Options::console

This commit is contained in:
2026-03-29 18:14:51 +02:00
parent fd9be2066d
commit 3b233f0e12
6 changed files with 34 additions and 111 deletions

View File

@@ -5,7 +5,6 @@
#include <string>
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "game/options.hpp" // Para Options::console
// [SINGLETON]
Locale* Locale::instance = nullptr;
@@ -34,9 +33,7 @@ auto Locale::get(const std::string& key) const -> std::string { // NOLINT(reada
return it->second;
}
if (Options::console) {
std::cerr << "Locale: clave no encontrada: " << key << '\n';
}
std::cerr << "Locale: clave no encontrada: " << key << '\n';
return key;
}
@@ -61,17 +58,13 @@ void Locale::flatten(const void* node_ptr, const std::string& prefix) { // NOLI
// Carga las traducciones desde el fichero YAML indicado
void Locale::loadFromFile(const std::string& file_path) { // NOLINT(readability-convert-member-functions-to-static)
if (file_path.empty()) {
if (Options::console) {
std::cerr << "Locale: ruta de fichero vacía, sin traducciones cargadas\n";
}
std::cerr << "Locale: ruta de fichero vacía, sin traducciones cargadas\n";
return;
}
std::ifstream file(file_path);
if (!file.is_open()) {
if (Options::console) {
std::cerr << "Locale: no se puede abrir " << file_path << '\n';
}
std::cerr << "Locale: no se puede abrir " << file_path << '\n';
return;
}
@@ -79,12 +72,8 @@ void Locale::loadFromFile(const std::string& file_path) { // NOLINT(readability
auto yaml = fkyaml::node::deserialize(file);
flatten(&yaml, "");
if (Options::console) {
std::cout << "Locale: " << strings_.size() << " traducciones cargadas desde " << file_path << '\n';
}
std::cout << "Locale: " << strings_.size() << " traducciones cargadas desde " << file_path << '\n';
} catch (const fkyaml::exception& e) {
if (Options::console) {
std::cerr << "Locale: error al parsear YAML: " << e.what() << '\n';
}
std::cerr << "Locale: error al parsear YAML: " << e.what() << '\n';
}
}

View File

@@ -64,9 +64,7 @@ Screen::Screen()
game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Options::game.width, Options::game.height);
if (game_texture_ == nullptr) {
// Registrar el error si está habilitado
if (Options::console) {
std::cerr << "Error: game_texture_ could not be created!\nSDL Error: " << SDL_GetError() << '\n';
}
std::cerr << "Error: game_texture_ could not be created!\nSDL Error: " << SDL_GetError() << '\n';
}
SDL_SetTextureScaleMode(game_texture_, SDL_SCALEMODE_NEAREST);
@@ -74,9 +72,7 @@ Screen::Screen()
border_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2));
if (border_texture_ == nullptr) {
// Registrar el error si está habilitado
if (Options::console) {
std::cerr << "Error: border_texture_ could not be created!\nSDL Error: " << SDL_GetError() << '\n';
}
std::cerr << "Error: border_texture_ could not be created!\nSDL Error: " << SDL_GetError() << '\n';
}
SDL_SetTextureScaleMode(border_texture_, SDL_SCALEMODE_NEAREST);
@@ -469,9 +465,9 @@ void Screen::textureToRenderer() {
// Renderiza todos los overlays (orden: último dibujado queda encima)
void Screen::renderOverlays() {
renderNotifications(); // Notifier (abajo)
if (RenderInfo::get() != nullptr) { RenderInfo::get()->render(); } // RenderInfo (medio)
if (Console::get() != nullptr) { Console::get()->render(); } // Console (encima)
renderNotifications(); // Notifier (abajo)
if (RenderInfo::get() != nullptr) { RenderInfo::get()->render(); } // RenderInfo (medio)
if (Console::get() != nullptr) { Console::get()->render(); } // Console (encima)
}
// Localiza la paleta dentro del vector de paletas

View File

@@ -47,9 +47,6 @@
Director::Director() {
std::cout << "Game start" << '\n';
// Crea e inicializa las opciones del programa
Options::init();
// Obtiene la ruta del ejecutable
std::string base = SDL_GetBasePath();
if (!base.empty() && base.back() == '/') base.pop_back();