From 2d563a7907c79a547acc181e30a4205cf80a18aa Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sun, 8 Mar 2026 20:06:48 +0100 Subject: [PATCH] =?UTF-8?q?-=20[FIX]=20Arreglats=20els=20modes=20fullscree?= =?UTF-8?q?n=20de=20consola=20y=20kiosk=20-=20[NEW]=20En=20kiosk=20mode=20?= =?UTF-8?q?se=20fica=20en=20pantalla=20completa=20i=20no=20deixa=20canviar?= =?UTF-8?q?-ho=20-=20[FIX]=20Quan=20est=C3=A0=20en=20pantalla=20completa,?= =?UTF-8?q?=20F1=20i=20F2=20no=20cambien=20el=20zoom=20(quan=20isques=20es?= =?UTF-8?q?tar=C3=A0=20com=20estava=20abans=20d'entrar=20a=20fullscreen)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/config.cpp | 2 ++ source/jdraw.cpp | 29 ++++++++++++++++------------- source/jdraw.h | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/source/config.cpp b/source/config.cpp index d5e324d..2117636 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -1,6 +1,7 @@ #include "config.h" #include "jfile.h" #include +#include "jdraw.h" namespace config { @@ -88,6 +89,7 @@ namespace config { kiosk_mode = value; file::setConfigValue("kiosk", kiosk_mode ? "yes" : "no"); + draw::reinit(); } const bool getKioskMode() diff --git a/source/jdraw.cpp b/source/jdraw.cpp index 714854c..dd94eda 100644 --- a/source/jdraw.cpp +++ b/source/jdraw.cpp @@ -2,6 +2,7 @@ #include #include "gif.h" #include "jfile.h" +#include "config.h" #include namespace draw @@ -24,6 +25,7 @@ namespace draw static int screen_height = 240; std::string screen_title = ""; static int screen_mode = SCREEN_MODE_NORMAL; + static bool any_fullscreen = false; surface *screen = nullptr; // La superficie screen, que representa la pantalla. Se crea i destrueix internament surface *destination = nullptr; // Punter a la actual superficie de destí @@ -207,16 +209,16 @@ namespace draw SDL_DestroyTexture(sdl_texture); SDL_DestroyRenderer(sdl_renderer); SDL_DestroyWindow(sdl_window); + any_fullscreen = screen_fullscreen || config::getKioskMode() || console; - const int zoom = screen_fullscreen ? 1 : screen_zoom; + const int zoom = any_fullscreen ? 1 : screen_zoom; - if (console) { + if (any_fullscreen) { SDL_DisplayID display = SDL_GetPrimaryDisplay(); const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(display); - screen_fullscreen = true; sdl_window = SDL_CreateWindow(screen_title.c_str(), mode->w, mode->h, SDL_WINDOW_FULLSCREEN); } else { - sdl_window = SDL_CreateWindow(screen_title.c_str(), screen_width * zoom, screen_height * zoom, screen_fullscreen?SDL_WINDOW_FULLSCREEN:0); + sdl_window = SDL_CreateWindow(screen_title.c_str(), screen_width * zoom, screen_height * zoom, 0); } sdl_renderer = SDL_CreateRenderer(sdl_window, nullptr); @@ -225,7 +227,7 @@ namespace draw SDL_HideCursor(); - if (screen_fullscreen) + if (any_fullscreen) { int w, h; SDL_GetWindowSize(sdl_window, &w, &h); @@ -248,7 +250,7 @@ namespace draw void setZoom(const int value) { - if (console) return; + if (screen_fullscreen || config::getKioskMode() || console) return; if (value < 1) return; const SDL_DisplayMode *dm = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(sdl_window)); @@ -261,26 +263,26 @@ namespace draw void incZoom() { - if (console) return; + if (screen_fullscreen || config::getKioskMode() || console) return; setZoom(screen_zoom+1); } void decZoom() { - if (console) return; + if (screen_fullscreen || config::getKioskMode() || console) return; setZoom(screen_zoom-1); } void toggleFullscreen() { - if (console) return; + if (config::getKioskMode() || console) return; screen_fullscreen = !screen_fullscreen; reinit(); } void setFullscreen(const bool value) { - if (console) return; + if (config::getKioskMode() || console) return; if (screen_fullscreen == value) return; screen_fullscreen = value; reinit(); @@ -763,7 +765,7 @@ bool SaveIndexedAsBMP(const char *filename, // Desbloquejem la textura SDL_UnlockTexture(sdl_texture); - if (screen_fullscreen) + if (any_fullscreen) { SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 255); SDL_RenderClear(sdl_renderer); @@ -774,9 +776,10 @@ bool SaveIndexedAsBMP(const char *filename, if (screen_mode & SCREEN_MODE_SCANLINES) { - if (screen_zoom>=3 || screen_fullscreen) + + if (screen_zoom>=3 || any_fullscreen) { - int zoom = screen_fullscreen ? fullscreen_scale : screen_zoom; + int zoom = any_fullscreen ? fullscreen_scale : screen_zoom; SDL_SetRenderDrawBlendMode(sdl_renderer, SDL_BLENDMODE_BLEND); for (int y=0; y