Skip to content

Commit

Permalink
pad title screens to 640x480 before scaling down in the scenario chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
treellama committed Aug 17, 2024
1 parent f7d41a4 commit 5173d6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source_Files/Misc/ScenarioChooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
3 changes: 3 additions & 0 deletions Source_Files/Misc/ScenarioChooser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5173d6d

Please sign in to comment.