From 5173d6d29ccdbdc74f3e65497a58a60c31a40c33 Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Fri, 16 Aug 2024 20:23:15 -0400 Subject: [PATCH] pad title screens to 640x480 before scaling down in the scenario chooser --- Source_Files/Misc/ScenarioChooser.cpp | 7 ++++++- Source_Files/Misc/ScenarioChooser.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Source_Files/Misc/ScenarioChooser.cpp b/Source_Files/Misc/ScenarioChooser.cpp index 0e64e2bcf..0a4d170b7 100644 --- a/Source_Files/Misc/ScenarioChooser.cpp +++ b/Source_Files/Misc/ScenarioChooser.cpp @@ -496,7 +496,12 @@ void ScenarioChooser::optimize_image(ScenarioChooserScenario& scenario, SDL_Wind SurfacePtr optimized(SDL_ConvertSurface(scenario.image.get(), format, 0), SDL_FreeSurface); SDL_Rect src_rect{0, 0, optimized->w, optimized->h}; - SDL_Rect dst_rect{0, (scenario_height - optimized->h / 2) / 2, scenario_width, optimized->h / 2}; + SDL_Rect dst_rect; + + dst_rect.w = optimized->w * scenario_width / title_screen_width; + dst_rect.h = optimized->h * scenario_height / title_screen_height; + dst_rect.x = (scenario_width - dst_rect.w) / 2; + dst_rect.y = (scenario_height - dst_rect.h) / 2; scenario.image.reset(SDL_CreateRGBSurface(0, scenario_width, scenario_height, format->BitsPerPixel, format->Rmask, format->Gmask, format->Bmask, format->Amask)); diff --git a/Source_Files/Misc/ScenarioChooser.h b/Source_Files/Misc/ScenarioChooser.h index 775f9dba5..e0f913ed4 100644 --- a/Source_Files/Misc/ScenarioChooser.h +++ b/Source_Files/Misc/ScenarioChooser.h @@ -30,6 +30,9 @@ class font_info; class ScenarioChooser { public: + static constexpr auto title_screen_width = 640; // nominal + static constexpr auto title_screen_height = 480; // nominal + static constexpr auto scenario_width = 320; static constexpr auto scenario_height = 240;