File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/TSMapEditor/Rendering Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 77using System . IO ;
88using System . Text ;
99using System . Threading ;
10+ #if WINDOWS
11+ using System . Windows . Forms ;
12+ #endif
1013using TSMapEditor . CCEngine ;
1114using TSMapEditor . Misc ;
1215using TSMapEditor . Settings ;
@@ -138,6 +141,26 @@ protected override void Initialize()
138141 menuWidth = ( int ) ( menuWidth * dpi_ratio ) ;
139142 menuHeight = ( int ) ( menuHeight * dpi_ratio ) ;
140143
144+ #if WINDOWS
145+ // If the user has a very large display, it's better to integer-upscale the main menu instead of DPI-scaling it.
146+ const int margin = 100 ;
147+ int scaleFactor = ( int ) dpi_ratio + 1 ;
148+ while ( true )
149+ {
150+ if ( Screen . PrimaryScreen . Bounds . Width > ( menuRenderWidth + margin ) * scaleFactor &&
151+ Screen . PrimaryScreen . Bounds . Height > ( menuRenderHeight + margin ) * scaleFactor )
152+ {
153+ menuWidth = menuRenderWidth * 2 ;
154+ menuHeight = menuRenderHeight * 2 ;
155+ scaleFactor ++ ;
156+ }
157+ else
158+ {
159+ break ;
160+ }
161+ }
162+ #endif
163+
141164 windowManager . InitGraphicsMode ( menuWidth , menuHeight , false ) ;
142165
143166 windowManager . SetRenderResolution ( menuRenderWidth , menuRenderHeight ) ;
You can’t perform that action at this time.
0 commit comments