From 470d2b85a4449bbb00c4c900d2572554c34df13d Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 20 May 2026 22:10:24 +0200 Subject: [PATCH] feat(notifier): notificacions visuals als toggles F1-F5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Substitueixen els std::cout dels handlers per crides a notifyInfo() del Notifier: - F1/F2: ZOOM: X.YX (amb el valor actual) - F3: PANTALLA COMPLETA / MODE FINESTRA - F4: VSYNC ACTIU / VSYNC INACTIU - F5: AA ACTIU / AA INACTIU Tots els missatges en majúscules perquè la font vectorial actual només té glyphs A-Z. Es manté la lògica de toggle i de persistència de cfg; únicament canvia el canal de feedback (consola → toast HUD). Co-Authored-By: Claude Opus 4.7 (1M context) --- source/core/rendering/sdl_manager.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/core/rendering/sdl_manager.cpp b/source/core/rendering/sdl_manager.cpp index 3bf8060..ffecacb 100644 --- a/source/core/rendering/sdl_manager.cpp +++ b/source/core/rendering/sdl_manager.cpp @@ -13,6 +13,7 @@ #include "core/defaults.hpp" #include "core/input/mouse.hpp" #include "core/rendering/coordinate_transform.hpp" +#include "core/system/notifier.hpp" #include "project.h" namespace { @@ -215,7 +216,9 @@ void SDLManager::increaseWindowSize() { } float new_zoom = zoom_factor_ + Defaults::Window::ZOOM_INCREMENT; applyZoom(new_zoom); - std::cout << "F2: Zoom aumentat a " << zoom_factor_ << "x" << '\n'; + if (auto* notifier = System::Notifier::get(); notifier != nullptr) { + notifier->notifyInfo(std::format("ZOOM: {:.1f}X", zoom_factor_)); + } } void SDLManager::decreaseWindowSize() { @@ -224,7 +227,9 @@ void SDLManager::decreaseWindowSize() { } float new_zoom = zoom_factor_ - Defaults::Window::ZOOM_INCREMENT; applyZoom(new_zoom); - std::cout << "F1: Zoom reduït a " << zoom_factor_ << "x" << '\n'; + if (auto* notifier = System::Notifier::get(); notifier != nullptr) { + notifier->notifyInfo(std::format("ZOOM: {:.1f}X", zoom_factor_)); + } } void SDLManager::applyWindowSize(int new_width, int new_height) { @@ -262,18 +267,18 @@ void SDLManager::toggleFullscreen() { // comportament depèn del mode que tingués la finestra anteriorment. SDL_SetWindowFullscreenMode(finestra_, nullptr); SDL_SetWindowFullscreen(finestra_, true); - std::cout << "F3: Fullscreen activat (guardada: " - << windowed_width_ << "x" << windowed_height_ << ")" << '\n'; } else { is_fullscreen_ = false; SDL_SetWindowFullscreen(finestra_, false); applyWindowSize(windowed_width_, windowed_height_); - std::cout << "F3: Fullscreen desactivat (restaurada: " - << windowed_width_ << "x" << windowed_height_ << ")" << '\n'; } cfg_->window.fullscreen = is_fullscreen_; Mouse::setForceHidden(is_fullscreen_); + + if (auto* notifier = System::Notifier::get(); notifier != nullptr) { + notifier->notifyInfo(is_fullscreen_ ? "PANTALLA COMPLETA" : "MODE FINESTRA"); + } } auto SDLManager::handleWindowEvent(const SDL_Event& event) -> bool { @@ -325,6 +330,9 @@ void SDLManager::toggleVSync() { if (on_persist_) { on_persist_(); } + if (auto* notifier = System::Notifier::get(); notifier != nullptr) { + notifier->notifyInfo(cfg_->rendering.vsync != 0 ? "VSYNC ACTIU" : "VSYNC INACTIU"); + } } void SDLManager::toggleAntialias() { @@ -332,5 +340,7 @@ void SDLManager::toggleAntialias() { gpu_renderer_.setAntialias(cfg_->rendering.antialias != 0); // No persistim: l'AA és toggleable runtime però el seu estat no es // guarda al YAML de moment (decisió volgudament conservadora). - std::cout << "F5: AA " << (cfg_->rendering.antialias != 0 ? "ON" : "OFF") << '\n'; + if (auto* notifier = System::Notifier::get(); notifier != nullptr) { + notifier->notifyInfo(cfg_->rendering.antialias != 0 ? "AA ACTIU" : "AA INACTIU"); + } }