afegit el namespace Logger

This commit is contained in:
2025-10-19 18:10:55 +02:00
parent df6e7e5155
commit 413c3c30a6
17 changed files with 107 additions and 96 deletions

View File

@@ -15,6 +15,7 @@
#include "rendering/opengl/opengl_shader.hpp" // Para OpenGLShader
#include "text.hpp" // Para Text, Text::COLOR, Text::STROKE
#include "texture.hpp" // Para Texture
#include "ui/logger.hpp" // Para Logger
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Zone
@@ -279,8 +280,7 @@ void Screen::initShaders() {
#else
// En macOS, OpenGL está deprecated y rinde mal
// TODO: Implementar backend de Metal para shaders en macOS
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
Logger::info("WARNING: Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.", Logger::YELLOW);
#endif
}
@@ -407,7 +407,7 @@ auto Screen::initSDLVideo() -> bool {
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
SDL_SetRenderVSync(renderer_, Options::video.vsync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Video system initialized successfully");
Logger::info("Video system initialized successfully");
return true;
}
@@ -421,7 +421,8 @@ void Screen::getDisplayInfo() {
SDL_DisplayID instance_id = displays[i];
const char* name = SDL_GetDisplayName(instance_id);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Display %" SDL_PRIu32 ": %s", instance_id, (name != nullptr) ? name : "Unknown");
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Display %" SDL_PRIu32 ": %s", instance_id, (name != nullptr) ? name : "Unknown");
Logger::info(std::string("Display ") + std::to_string(instance_id) + ": " + (name != nullptr ? name : "Unknown"));
}
const auto* dm = SDL_GetCurrentDisplayMode(displays[0]);
@@ -437,15 +438,20 @@ void Screen::getDisplayInfo() {
Options::window.max_zoom = std::min(dm->w / param.game.width, dm->h / param.game.height);
Options::window.zoom = std::min(Options::window.zoom, Options::window.max_zoom);
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Current display mode: %dx%d @ %dHz", static_cast<int>(dm->w), static_cast<int>(dm->h), static_cast<int>(dm->refresh_rate));
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d", static_cast<int>(param.game.width), static_cast<int>(param.game.height), Options::window.zoom);
Options::video.info = std::to_string(static_cast<int>(dm->w)) + "x" +
std::to_string(static_cast<int>(dm->h)) + " @ " +
// Obtiene la cadena con la información sobre la resolución y el refresco
Options::video.info = std::to_string(dm->w) + "x" +
std::to_string(dm->h) + " @ " +
std::to_string(static_cast<int>(dm->refresh_rate)) + " Hz";
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Current display mode: %dx%d @ %dHz", static_cast<int>(dm->w), static_cast<int>(dm->h), static_cast<int>(dm->refresh_rate));
Logger::info("Current display mode: " + Options::video.info);
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d", static_cast<int>(param.game.width), static_cast<int>(param.game.height), Options::window.zoom);
Logger::info("Window resolution: " + std::to_string(static_cast<int>(param.game.width)) + "x" + std::to_string(static_cast<int>(param.game.height)) + "x" + std::to_string(Options::window.zoom));
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
const int MAX_ZOOM = std::min(dm->w / param.game.width, (dm->h - WINDOWS_DECORATIONS) / param.game.height);