(fe150b924) Fix crashing when an invalid resolution is defined in the configs. Probably doesn't fix all crashes due to high resolutions.

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:42:51 +03:00
parent f90a849f25
commit 017293fdd9

View File

@@ -189,17 +189,21 @@ namespace Barotrauma
{
GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight;
if (Config.WindowMode == WindowMode.BorderlessWindowed)
switch (Config.WindowMode)
{
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
case WindowMode.BorderlessWindowed:
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
break;
case WindowMode.Windowed:
GraphicsWidth = Math.Min(GraphicsDevice.DisplayMode.Width, GraphicsWidth);
GraphicsHeight = Math.Min(GraphicsDevice.DisplayMode.Height, GraphicsHeight);
break;
}
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.Reach;
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
GraphicsDeviceManager.PreferMultiSampling = false;
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
SetWindowMode(Config.WindowMode);
defaultViewport = GraphicsDevice.Viewport;