feat(service-menu): submenu RESOLUCIO amb canvi en calent de l'offscreen

This commit is contained in:
2026-05-24 12:30:47 +02:00
parent 22827c28fa
commit 7eafe21623
6 changed files with 116 additions and 19 deletions
+20
View File
@@ -385,6 +385,26 @@ void SDLManager::toggleAntialias() {
}
}
void SDLManager::setRenderResolution(int w, int h) {
if (!Defaults::Rendering::isValidRenderResolution(w, h)) {
std::cerr << "[SDLManager] Resolucio no valida (" << w << "x" << h
<< "), ignorant.\n";
return;
}
if (w == cfg_->rendering.render_width && h == cfg_->rendering.render_height) {
return; // ja era l'actual
}
if (!gpu_renderer_.resizeRenderTarget(static_cast<float>(w), static_cast<float>(h))) {
std::cerr << "[SDLManager] resizeRenderTarget ha fallat.\n";
return;
}
cfg_->rendering.render_width = w;
cfg_->rendering.render_height = h;
if (on_persist_) {
on_persist_();
}
}
void SDLManager::togglePostFx() {
const bool NEW_STATE = !gpu_renderer_.isPostFxEnabled();
gpu_renderer_.setPostFxEnabled(NEW_STATE);
+10 -6
View File
@@ -30,12 +30,16 @@ class SDLManager {
auto operator=(const SDLManager&) -> SDLManager& = delete;
// [NUEVO] Gestió de finestra dinàmica
void increaseWindowSize(); // F2: +100px
void decreaseWindowSize(); // F1: -100px
void toggleFullscreen(); // F3
void toggleVSync(); // F4
void toggleAntialias(); // F5
void togglePostFx(); // F6
void increaseWindowSize(); // F2: +100px
void decreaseWindowSize(); // F1: -100px
void toggleFullscreen(); // F3
void toggleVSync(); // F4
void toggleAntialias(); // F5
void togglePostFx(); // F6
// Canvia la resolució del render target offscreen (recrea la textura).
// Cal cridar-lo fora d'un frame (event phase, no draw phase). Si el
// valor no es un preset valid o ja es l'actual, es no-op.
void setRenderResolution(int w, int h);
auto handleWindowEvent(const SDL_Event& event) -> bool; // Per a SDL_EVENT_WINDOW_RESIZED
// Funciones principals (renderizado).