From 6ce0e756fb32e8a2ca05c809069638c123980858 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 30 Jun 2025 11:26:44 +0200 Subject: [PATCH] fix: solventat el problema amb els shaders i el canvi a pantalla completa en sistemes unix --- source/global_events.cpp | 2 ++ source/screen.cpp | 3 --- source/screen.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/global_events.cpp b/source/global_events.cpp index 9be472c..04ffd50 100644 --- a/source/global_events.cpp +++ b/source/global_events.cpp @@ -2,6 +2,7 @@ #include // Para SDL_LogInfo, SDL_LogCategory #include "mouse.h" // Para handleEvent #include "section.h" // Para Name, Options, name, options +#include "screen.h" namespace GlobalEvents { @@ -21,6 +22,7 @@ namespace GlobalEvents break; case SDL_EVENT_WINDOW_RESIZED: + Screen::get()->initShaders(); break; default: diff --git a/source/screen.cpp b/source/screen.cpp index 49d778b..65a7c8a 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -124,7 +124,6 @@ void Screen::renderScreen() void Screen::setFullscreenMode() { SDL_SetWindowFullscreen(window_, Options::video.fullscreen); - initShaders(); } // Camibia entre pantalla completa y ventana @@ -291,8 +290,6 @@ void Screen::adjustWindowSize() SDL_SetWindowPosition(window_, std::max(NEW_POS_X, WINDOWS_DECORATIONS_), std::max(NEW_POS_Y, 0)); SDL_SetWindowSize(window_, WIDTH, HEIGHT); - - initShaders(); } } diff --git a/source/screen.h b/source/screen.h index b7c8248..a001d30 100644 --- a/source/screen.h +++ b/source/screen.h @@ -39,6 +39,7 @@ public: bool decWindowSize(); // Reduce el tamaño de la ventana bool incWindowSize(); // Aumenta el tamaño de la ventana void applySettings(); // Aplica los valores de las opciones + void initShaders(); // Inicializa los shaders // --- Efectos visuales --- void shake() { shake_effect_.enable(src_rect_, dst_rect_); } // Agita la pantalla @@ -203,7 +204,6 @@ private: void renderInfo(); // Muestra información por pantalla void renderScreen(); // Selecciona y ejecuta el método de renderizado adecuado void loadShaders(); // Carga el contenido del archivo GLSL - void initShaders(); // Inicializa los shaders void adjustWindowSize(); // Calcula el tamaño de la ventana void getDisplayInfo(); // Obtiene información sobre la pantalla void renderOverlays(); // Renderiza todos los overlays y efectos