(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:
@@ -189,17 +189,21 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GraphicsWidth = Config.GraphicsWidth;
|
GraphicsWidth = Config.GraphicsWidth;
|
||||||
GraphicsHeight = Config.GraphicsHeight;
|
GraphicsHeight = Config.GraphicsHeight;
|
||||||
if (Config.WindowMode == WindowMode.BorderlessWindowed)
|
switch (Config.WindowMode)
|
||||||
{
|
{
|
||||||
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
|
case WindowMode.BorderlessWindowed:
|
||||||
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
|
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.GraphicsProfile = GraphicsProfile.Reach;
|
||||||
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
|
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
|
||||||
GraphicsDeviceManager.PreferMultiSampling = false;
|
GraphicsDeviceManager.PreferMultiSampling = false;
|
||||||
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
|
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
|
||||||
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
|
|
||||||
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
|
|
||||||
SetWindowMode(Config.WindowMode);
|
SetWindowMode(Config.WindowMode);
|
||||||
|
|
||||||
defaultViewport = GraphicsDevice.Viewport;
|
defaultViewport = GraphicsDevice.Viewport;
|
||||||
|
|||||||
Reference in New Issue
Block a user