diff --git a/src/game_config.cpp b/src/game_config.cpp index c41840e1a3..e559244d43 100644 --- a/src/game_config.cpp +++ b/src/game_config.cpp @@ -670,6 +670,7 @@ void Game_Config::LoadFromStream(Filesystem_Stream::InputStream& is) { player.font2.FromIni(ini); player.font2_size.FromIni(ini); player.log_enabled.FromIni(ini); + player.screenshot_scale.FromIni(ini); } void Game_Config::WriteToStream(Filesystem_Stream::OutputStream& os) const { @@ -756,6 +757,7 @@ void Game_Config::WriteToStream(Filesystem_Stream::OutputStream& os) const { player.font2.ToIni(os); player.font2_size.ToIni(os); player.log_enabled.ToIni(os); + player.screenshot_scale.ToIni(os); os << "\n"; } diff --git a/src/game_config.h b/src/game_config.h index e6c7f70f95..7627e266df 100644 --- a/src/game_config.h +++ b/src/game_config.h @@ -90,6 +90,7 @@ struct Game_ConfigPlayer { PathConfigParam font2 { "Font 2", "The game chooses whether it wants font 1 or 2", "Player", "Font2", "" }; RangeConfigParam font2_size { "Font 2 Size", "", "Player", "Font2Size", 12, 6, 16}; BoolConfigParam log_enabled{ "Logging", "Write diagnostic messages into a logfile", "Player", "Logging", true }; + RangeConfigParam screenshot_scale { "Screenshot scaling factor", "Scale screenshots by the given factor", "Player", "ScreenshotScale", 1, 1, 24}; void Hide(); }; diff --git a/src/output.cpp b/src/output.cpp index b76dc8a45b..e4f7fd2139 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -217,7 +217,15 @@ bool Output::TakeScreenshot(StringView file) { } bool Output::TakeScreenshot(std::ostream& os) { - return DisplayUi->GetDisplaySurface()->WritePNG(os); + int scale = Player::player_config.screenshot_scale.Get(); + if (scale > 1) { + auto& disp = DisplayUi->GetDisplaySurface(); + auto scaled_disp = Bitmap::Create(disp->GetWidth() * scale, disp->GetHeight() * scale, false); + scaled_disp->ZoomOpacityBlit(0, 0, 0, 0, *disp, disp->GetRect(), scale, scale, Opacity::Opaque()); + return scaled_disp->WritePNG(os); + } else { + return DisplayUi->GetDisplaySurface()->WritePNG(os); + } } void Output::ToggleLog() { diff --git a/src/window_settings.cpp b/src/window_settings.cpp index 7e41595b27..f692438a28 100644 --- a/src/window_settings.cpp +++ b/src/window_settings.cpp @@ -428,6 +428,10 @@ void Window_Settings::RefreshEngine() { AddOption(cfg.settings_in_title, [&cfg](){ cfg.settings_in_title.Toggle(); }); AddOption(cfg.settings_in_menu, [&cfg](){ cfg.settings_in_menu.Toggle(); }); AddOption(cfg.log_enabled, [&cfg]() { cfg.log_enabled.Toggle(); }); + AddOption(cfg.screenshot_scale, [this, &cfg](){ cfg.screenshot_scale.Set(GetCurrentOption().current_value); }); + + GetFrame().options.back().help2 = fmt::format("Screenshot size: {}x{}", + Player::screen_width * cfg.screenshot_scale.Get(), Player::screen_height * cfg.screenshot_scale.Get()); } void Window_Settings::RefreshEngineFont(bool mincho) {