From 58762af379aafdfa03f6b064a0a0063521a54def Mon Sep 17 00:00:00 2001 From: aybe Date: Thu, 21 Aug 2025 00:05:36 +0200 Subject: [PATCH] Scale mapper according display resolution --- CHANGELOG | 1 + src/gui/sdl_mapper.cpp | 70 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 66277825e..3c12fff90 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -46,6 +46,7 @@ Next version - PC-98: Redraw the function keys after updating them (bobsayshilol) - Do not carriage return with a single LF('\n') (maron2000) - Fix mapper not rendering anything on SDL2/Windows (aybe) + - Scale mapper according display resolution (aybe) 2025.05.03 - Show TURBO status in title bar. (maron2000) diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index e41eefd42..afee37e48 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -838,6 +838,7 @@ class Typer { static struct CMapper { #if defined(C_SDL2) SDL_Window* window; + uint32_t window_scale; SDL_Rect draw_rect; SDL_Surface* draw_surface_nonpaletted; SDL_Surface* draw_surface; @@ -2616,6 +2617,9 @@ public: Draw(true, true); } virtual bool OnTop(Bitu _x,Bitu _y) { + const auto scale = mapper.window_scale; + _x /= scale; + _y /= scale; return ( enabled && (_x>=x) && (_x=y) && (_y