Count preferences dialog when detecting max UI scale to fit (Fix #740)
Some checks failed
/ release (Debug, map[deps:macos-universal flag:arm64 name:macos scons-script:./.github/workflows/scripts/mac/scons-build.sh suffix:-silicon version:14]) (push) Has been cancelled
/ release (Debug, map[deps:macos-universal flag:x86_64 name:macos scons-script:./.github/workflows/scripts/mac/scons-build.sh suffix:-intel version:13]) (push) Has been cancelled
/ release (Debug, map[name:windows scons-script:./.github/workflows/scripts/win/scons-build.bat suffix: version:2019]) (push) Has been cancelled
/ release (Release, map[deps:macos-universal flag:arm64 name:macos scons-script:./.github/workflows/scripts/mac/scons-build.sh suffix:-silicon version:14]) (push) Has been cancelled
/ release (Release, map[deps:macos-universal flag:x86_64 name:macos scons-script:./.github/workflows/scripts/mac/scons-build.sh suffix:-intel version:13]) (push) Has been cancelled
/ release (Release, map[name:windows scons-script:./.github/workflows/scripts/win/scons-build.bat suffix: version:2019]) (push) Has been cancelled

This commit is contained in:
2025-05-23 09:11:15 -05:00
parent 6559cb95fd
commit 01deb71bee
3 changed files with 12 additions and 2 deletions

View File

@@ -445,6 +445,12 @@ void cDialog::recalcRect(){
winRect.right *= get_ui_scale();
winRect.bottom *= get_ui_scale();
// Uncomment if you need to measure any dialogs.
/*
LOG_VALUE(fname);
LOG_VALUE(winRect.right);
LOG_VALUE(winRect.bottom);
*/
}
bool cDialog::initCalled = false;

View File

@@ -1079,6 +1079,7 @@ void init_boe(int argc, char* argv[]) {
init_tiling();
init_snd_tool();
// see fallback_scale() in winutil.cpp for where the default UI scale is calculated based on screen size
adjust_window_mode();
init_ui();
// If we don't do this now it'll flash white to start with

View File

@@ -3,8 +3,11 @@
#include <boost/filesystem/operations.hpp>
#include "keymods.hpp"
// Measured on 5/23/25. For now, must be re-measured at 1x UI scale whenever preferences change (unless making the window smaller, maybe).
short prefs_height = 529;
// The default scale should be the largest that the user's screen can fit all three
// BoE application windows (because they should probably default to match each other).
// BoE application windows and core dialogs of the main game (because they should probably default to match each other).
double fallback_scale() {
static double scale = 0;
// Suppress the float comparison warning.
@@ -17,7 +20,7 @@ double fallback_scale() {
sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
short max_width = max(boe_width, max(pc_width, scen_width));
short max_height = max(boe_height, max(pc_height, scen_height)) + getMenubarHeight();
short max_height = max(prefs_height, max(boe_height, max(pc_height, scen_height))) + getMenubarHeight();
std::vector<double> scale_options = {1.0, 1.5, 2.0, 3.0, 4.0};
for(auto it = scale_options.rbegin(); it != scale_options.rend(); ++it){