- attempt to fix "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE" exceptions (the game tries forcing focus to the window and running GameMain again, and if that doesn't help, disables hardware mode switching)

- messages can be added to debugconsole before it's initialized
This commit is contained in:
Regalis
2016-11-02 20:38:55 +02:00
parent 8011aecb31
commit 799efd8474
4 changed files with 115 additions and 32 deletions

View File

@@ -103,7 +103,7 @@ namespace Barotrauma
{
get { return NetworkMember as GameClient; }
}
public GameMain()
{
Graphics = new GraphicsDeviceManager(this);
@@ -119,21 +119,11 @@ namespace Barotrauma
Config.WasGameUpdated = false;
Config.Save("config.xml");
}
graphicsWidth = Config.GraphicsWidth;
graphicsHeight = Config.GraphicsHeight;
Graphics.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
Graphics.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
ApplyGraphicsSettings();
Graphics.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
Graphics.PreferredBackBufferWidth = graphicsWidth;
Graphics.PreferredBackBufferHeight = graphicsHeight;
Content.RootDirectory = "Content";
//graphics.SynchronizeWithVerticalRetrace = false;
//graphics.ApplyChanges();
FrameCounter = new FrameCounter();
//IsMouseVisible = true;
@@ -150,6 +140,20 @@ namespace Barotrauma
FarseerPhysics.Settings.VelocityIterations = 1;
FarseerPhysics.Settings.PositionIterations = 1;
}
public void ApplyGraphicsSettings()
{
graphicsWidth = Config.GraphicsWidth;
graphicsHeight = Config.GraphicsHeight;
Graphics.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
Graphics.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
Graphics.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
Graphics.PreferredBackBufferWidth = graphicsWidth;
Graphics.PreferredBackBufferHeight = graphicsHeight;
Graphics.ApplyChanges();
}