Clamp window resolution to size of monitor on game load (thanks kingoscaragames1)

This commit is contained in:
UnknownShadow200 2018-01-10 06:51:09 +11:00
parent fe5266d959
commit 200a1ac93b

View File

@ -34,13 +34,13 @@ namespace ClassicalSharp {
#endif
Options.Load();
int width = Options.GetInt(OptionsKey.WindowWidth, 0, 65536, 0);
int height = Options.GetInt(OptionsKey.WindowHeight, 0, 65536, 0);
DisplayDevice device = DisplayDevice.Primary;
int width = Options.GetInt(OptionsKey.WindowWidth, 0, device.Width, 0);
int height = Options.GetInt(OptionsKey.WindowHeight, 0, device.Height, 0);
// No custom resolution has been set
if (width == 0 || height == 0) {
width = 854; height = 480;
DisplayDevice device = DisplayDevice.Primary;
width = 854; height = 480;
if (device.Width < 854) width = 640;
}