feat(render): resolució d'offscreen configurable via YAML
Separa el tamany lògic (1280×720) del render target offscreen. Llista
tancada de 5 presets 16:9 (720p/900p/1080p/1440p/2160p) llegida de
rendering.render_{width,height} amb fallback a 1280×720 si invàlida.
Inclou API resizeRenderTarget() preparada per al menú de servei futur.
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "core/config/postfx_config.hpp"
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/defaults/game.hpp"
|
||||
#include "core/defaults/rendering.hpp"
|
||||
#include "core/defaults/window.hpp"
|
||||
#include "core/input/mouse.hpp"
|
||||
#include "core/rendering/coordinate_transform.hpp"
|
||||
#include "core/system/notifier.hpp"
|
||||
@@ -22,7 +24,9 @@ namespace {
|
||||
int width,
|
||||
int height,
|
||||
bool fullscreen,
|
||||
int initial_vsync) -> bool {
|
||||
int initial_vsync,
|
||||
int render_width,
|
||||
int render_height) -> bool {
|
||||
// Título estático estilo CCAE. El FPS y el estado de VSync los muestra
|
||||
// el DebugOverlay (toggle F11), no la barra de título.
|
||||
const std::string TITLE = std::format("© 2026 {} — JailDesigner",
|
||||
@@ -44,9 +48,13 @@ namespace {
|
||||
}
|
||||
|
||||
// Inicializar el FrameRenderer (claim del window + pipeline de líneas).
|
||||
// logical_*: espacio de coordenadas del juego (fijo 1280×720).
|
||||
// render_*: resolución física del offscreen (configurable vía YAML).
|
||||
if (!gpu_renderer.init(window,
|
||||
static_cast<float>(Defaults::Game::WIDTH),
|
||||
static_cast<float>(Defaults::Game::HEIGHT))) {
|
||||
static_cast<float>(Defaults::Game::HEIGHT),
|
||||
static_cast<float>(render_width),
|
||||
static_cast<float>(render_height))) {
|
||||
std::cerr << "Error inicialitzant GpuFrameRenderer\n";
|
||||
SDL_DestroyWindow(window);
|
||||
return false;
|
||||
@@ -80,7 +88,30 @@ SDLManager::SDLManager(int width, int height, bool fullscreen, Config::EngineCon
|
||||
|
||||
calculateMaxWindowSize();
|
||||
|
||||
if (!initWindowAndGpu(&finestra_, gpu_renderer_, current_width_, current_height_, is_fullscreen_, cfg_->rendering.vsync)) {
|
||||
// Validar la resolució de render del config: si no és un preset 16:9
|
||||
// conegut, fer fallback a 1280×720 i avisar. Això protegeix d'edicions
|
||||
// manuals invàlides al YAML.
|
||||
int effective_render_w = cfg_->rendering.render_width;
|
||||
int effective_render_h = cfg_->rendering.render_height;
|
||||
if (!Defaults::Rendering::isValidRenderResolution(effective_render_w, effective_render_h)) {
|
||||
std::cerr << "Resolució de render invàlida (" << effective_render_w << "x"
|
||||
<< effective_render_h << "), fent fallback a "
|
||||
<< Defaults::Rendering::RENDER_WIDTH_DEFAULT << "x"
|
||||
<< Defaults::Rendering::RENDER_HEIGHT_DEFAULT << '\n';
|
||||
effective_render_w = Defaults::Rendering::RENDER_WIDTH_DEFAULT;
|
||||
effective_render_h = Defaults::Rendering::RENDER_HEIGHT_DEFAULT;
|
||||
cfg_->rendering.render_width = effective_render_w;
|
||||
cfg_->rendering.render_height = effective_render_h;
|
||||
}
|
||||
|
||||
if (!initWindowAndGpu(&finestra_,
|
||||
gpu_renderer_,
|
||||
current_width_,
|
||||
current_height_,
|
||||
is_fullscreen_,
|
||||
cfg_->rendering.vsync,
|
||||
effective_render_w,
|
||||
effective_render_h)) {
|
||||
SDL_Quit();
|
||||
return;
|
||||
}
|
||||
@@ -97,7 +128,9 @@ SDLManager::SDLManager(int width, int height, bool fullscreen, Config::EngineCon
|
||||
|
||||
std::cout << "SDL3 inicialitzat: " << current_width_ << "x" << current_height_
|
||||
<< " (logic: " << Defaults::Game::WIDTH << "x"
|
||||
<< Defaults::Game::HEIGHT << ")";
|
||||
<< Defaults::Game::HEIGHT
|
||||
<< ", render: " << effective_render_w << "x" << effective_render_h
|
||||
<< ")";
|
||||
if (is_fullscreen_) {
|
||||
std::cout << " [FULLSCREEN]";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user