fix(engine): corregir figura 3D i text en real fullscreen

- Bug 2: moure shape_manager_->updateScreenSize() fora del bloc
  condicional SHAPE a les dues branques de toggleRealFullscreen(),
  de manera que ShapeManager sempre té les dimensions correctes quan
  s'activa una figura després d'entrar en fullscreen
- Bug text: passar base_screen_width_/height_ com a dimensions lògiques
  a ui_manager_->initialize() en recreateOffscreenTexture(), evitant
  que calculateFontSize() s'avaluï amb la resolució nativa de fullscreen

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 22:51:31 +01:00
parent af0276255e
commit 310c6d244e

View File

@@ -927,6 +927,9 @@ void Engine::toggleRealFullscreen() {
// Actualizar tamaño de pantalla para boids (wrapping boundaries) // Actualizar tamaño de pantalla para boids (wrapping boundaries)
boid_manager_->updateScreenSize(current_screen_width_, current_screen_height_); boid_manager_->updateScreenSize(current_screen_width_, current_screen_height_);
// Actualizar ShapeManager con nueva resolución (siempre, independientemente del modo actual)
shape_manager_->updateScreenSize(current_screen_width_, current_screen_height_);
// Actualizar AppLogo con nueva resolución // Actualizar AppLogo con nueva resolución
if (app_logo_) { if (app_logo_) {
app_logo_->updateScreenSize(current_screen_width_, current_screen_height_); app_logo_->updateScreenSize(current_screen_width_, current_screen_height_);
@@ -960,6 +963,9 @@ void Engine::toggleRealFullscreen() {
scene_manager_->updateScreenSize(current_screen_width_, current_screen_height_); scene_manager_->updateScreenSize(current_screen_width_, current_screen_height_);
scene_manager_->changeScenario(scene_manager_->getCurrentScenario(), current_mode_); scene_manager_->changeScenario(scene_manager_->getCurrentScenario(), current_mode_);
// Actualizar ShapeManager con resolución restaurada (siempre, independientemente del modo actual)
shape_manager_->updateScreenSize(current_screen_width_, current_screen_height_);
// Actualizar AppLogo con resolución restaurada // Actualizar AppLogo con resolución restaurada
if (app_logo_) { if (app_logo_) {
app_logo_->updateScreenSize(current_screen_width_, current_screen_height_); app_logo_->updateScreenSize(current_screen_width_, current_screen_height_);
@@ -973,6 +979,23 @@ void Engine::toggleRealFullscreen() {
} }
} }
void Engine::handlePostFXCycle() {
static constexpr float presets[5][3] = {
{1.5f, 0.0f, 0.0f}, {1.5f, 0.0f, 0.8f},
{1.5f, 1.0f, 0.0f}, {1.5f, 1.0f, 0.8f},
{0.0f, 0.0f, 0.0f}
};
static constexpr const char* names[5] = {
"PostFX: Vinyeta", "PostFX: Scanlines",
"PostFX: Cromàtica", "PostFX: Complet", "PostFX: Desactivat"
};
postfx_effect_mode_ = (postfx_effect_mode_ + 1) % 5;
postfx_uniforms_.vignette_strength = presets[postfx_effect_mode_][0];
postfx_uniforms_.chroma_strength = presets[postfx_effect_mode_][1];
postfx_uniforms_.scanline_strength = presets[postfx_effect_mode_][2];
showNotificationForAction(names[postfx_effect_mode_]);
}
void Engine::toggleIntegerScaling() { void Engine::toggleIntegerScaling() {
// Solo permitir cambio si estamos en modo fullscreen normal (F3) // Solo permitir cambio si estamos en modo fullscreen normal (F3)
if (!fullscreen_enabled_) { if (!fullscreen_enabled_) {
@@ -1310,11 +1333,21 @@ void Engine::recreateOffscreenTexture() {
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM); SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM);
} }
// Recreate software surface to match new screen size // Recreate renderer de software (DESTRUIR renderer PRIMER, després surface)
if (ui_renderer_) { SDL_DestroyRenderer(ui_renderer_); ui_renderer_ = nullptr; }
if (ui_surface_) { SDL_DestroySurface(ui_surface_); ui_surface_ = nullptr; }
ui_surface_ = SDL_CreateSurface(current_screen_width_, current_screen_height_, SDL_PIXELFORMAT_RGBA32);
if (ui_surface_) { if (ui_surface_) {
SDL_DestroySurface(ui_surface_); ui_renderer_ = SDL_CreateSoftwareRenderer(ui_surface_);
ui_surface_ = SDL_CreateSurface(current_screen_width_, current_screen_height_, }
SDL_PIXELFORMAT_RGBA32); // Re-inicialitzar components UI amb nou renderer
if (ui_renderer_ && ui_manager_) {
ui_manager_->initialize(ui_renderer_, theme_manager_.get(),
current_screen_width_, current_screen_height_, // physical
base_screen_width_, base_screen_height_); // logical (font size based on base)
}
if (ui_renderer_ && app_logo_) {
app_logo_->initialize(ui_renderer_, current_screen_width_, current_screen_height_);
} }
} }