Qt: add option to automatically resize the game window

This commit is contained in:
Megamouse 2022-11-17 19:37:12 +01:00
parent 2eef3ab645
commit 8199f97e7a
4 changed files with 35 additions and 6 deletions

View file

@ -281,8 +281,17 @@ std::unique_ptr<gs_frame> gui_application::get_gs_frame()
if (m_gui_settings->GetValue(gui::gs_resize).toBool())
{
w = m_gui_settings->GetValue(gui::gs_width).toInt();
h = m_gui_settings->GetValue(gui::gs_height).toInt();
if (m_gui_settings->GetValue(gui::gs_resize_manual).toBool())
{
w = m_gui_settings->GetValue(gui::gs_width).toInt();
h = m_gui_settings->GetValue(gui::gs_height).toInt();
}
else
{
const qreal device_pixel_ratio = devicePixelRatio();
w /= device_pixel_ratio;
h /= device_pixel_ratio;
}
}
const auto screen = m_main_window ? m_main_window->screen() : primaryScreen();