(e4191497a) Workaround to changing resolution in fullscreen + force borderless windowed to display resolution

This commit is contained in:
Joonas Rikkonen
2019-06-04 16:01:31 +03:00
parent a1e558d14a
commit 6ffe13b4b7
2 changed files with 31 additions and 18 deletions
+10 -14
View File
@@ -207,18 +207,6 @@ namespace Barotrauma
#endif
}
private void ApplyGraphicsSettings()
{
#if WINDOWS
if (WindowActive)
{
#endif
ApplyGraphicsSettings();
#if WINDOWS
}
#endif
}
private void ApplyGraphicsSettings()
{
#if !OSX
@@ -243,6 +231,7 @@ namespace Barotrauma
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
}
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.Reach;
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
GraphicsDeviceManager.PreferMultiSampling = false;
@@ -348,8 +337,15 @@ namespace Barotrauma
private void HandleDefocus(object sender, EventArgs e)
{
CoroutineManager.StopCoroutines("FocusCoroutine");
GraphicsDeviceManager.IsFullScreen = false;
GraphicsDeviceManager.ApplyChanges();
if (GraphicsDeviceManager.IsFullScreen && !GraphicsDeviceManager.HardwareModeSwitch)
{
DisplayMode minMode = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First(m => m.Format == SurfaceFormat.Color);
GraphicsDeviceManager.PreferredBackBufferWidth = minMode.Width;
GraphicsDeviceManager.PreferredBackBufferHeight = minMode.Height;
GraphicsDeviceManager.IsFullScreen = false;
GraphicsDeviceManager.ApplyChanges();
Thread.Sleep(100);
}
}
#endif