diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems
index 96e169d05..991ce2d39 100644
--- a/Barotrauma/BarotraumaClient/ClientCode.projitems
+++ b/Barotrauma/BarotraumaClient/ClientCode.projitems
@@ -223,7 +223,6 @@
Never
-
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index 0b95e4306..c3c50da75 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -247,9 +247,6 @@
PreserveNewest
-
- PreserveNewest
-
PreserveNewest
@@ -271,12 +268,6 @@
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-
PreserveNewest
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
index 90748c3f2..afa1d3daf 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
@@ -606,7 +606,7 @@ namespace Barotrauma
.ThenByDescending(a => a.Strength).FirstOrDefault();
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
{
- var limbHealth = GetMatchingLimbHealth(affliction);
+ var limbHealth = GetMathingLimbHealth(affliction);
if (limbHealth != null)
{
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
diff --git a/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs b/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs
index ee3619634..e156dd669 100644
--- a/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs
+++ b/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs
@@ -256,4 +256,4 @@ namespace EventInput
}
#endif
}
-}
\ No newline at end of file
+}
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
index e93f22c76..9a02dd655 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
@@ -118,21 +118,27 @@ namespace Barotrauma
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "font":
+ if (Font == null) { continue; }
Font.Size = GetFontSize(subElement);
break;
case "smallfont":
+ if (SmallFont == null) { continue; }
SmallFont.Size = GetFontSize(subElement);
break;
case "largefont":
+ if (LargeFont == null) { continue; }
LargeFont.Size = GetFontSize(subElement);
break;
case "objectivetitle":
+ if (ObjectiveTitleFont == null) { continue; }
ObjectiveTitleFont.Size = GetFontSize(subElement);
break;
case "objectivename":
+ if (ObjectiveNameFont == null) { continue; }
ObjectiveNameFont.Size = GetFontSize(subElement);
break;
case "videotitle":
+ if (VideoTitleFont == null) { continue; }
VideoTitleFont.Size = GetFontSize(subElement);
break;
}
diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs
index 983fa9c6c..0ce77a2bb 100644
--- a/Barotrauma/BarotraumaClient/Source/GameMain.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs
@@ -120,7 +120,7 @@ namespace Barotrauma
get;
private set;
}
-
+
public static int GraphicsWidth
{
get;
@@ -192,7 +192,19 @@ namespace Barotrauma
FarseerPhysics.Settings.PositionIterations = 1;
}
- public void ApplyGraphicsSettings()
+ public void RequestGraphicsSettings()
+ {
+#if WINDOWS
+ if (WindowActive)
+ {
+#endif
+ ApplyGraphicsSettings();
+#if WINDOWS
+ }
+#endif
+ }
+
+ private void ApplyGraphicsSettings()
{
GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight;
@@ -208,13 +220,14 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
SetWindowMode(Config.WindowMode);
+ GraphicsDeviceManager.ApplyChanges();
defaultViewport = GraphicsDevice.Viewport;
OnResolutionChanged?.Invoke();
}
- public void SetWindowMode(WindowMode windowMode)
+ private void SetWindowMode(WindowMode windowMode)
{
WindowMode = windowMode;
GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
@@ -223,8 +236,6 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
-
- GraphicsDeviceManager.ApplyChanges();
}
public void ResetViewPort()
@@ -242,7 +253,7 @@ namespace Barotrauma
{
base.Initialize();
- ApplyGraphicsSettings();
+ RequestGraphicsSettings();
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
@@ -281,6 +292,38 @@ namespace Barotrauma
#endif
loadingCoroutine = CoroutineManager.StartCoroutine(Load(canLoadInSeparateThread), "", canLoadInSeparateThread);
+
+#if WINDOWS
+ var gameForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(Window.Handle);
+ gameForm.Activated += new EventHandler(HandleFocus);
+ gameForm.Deactivate += new EventHandler(HandleDefocus);
+ if (WindowActive) { HandleFocus(null, null); }
+#endif
+ }
+
+#if WINDOWS
+ private void HandleFocus(object sender, EventArgs e)
+ {
+ CoroutineManager.StopCoroutines("FocusCoroutine");
+ CoroutineManager.StartCoroutine(FocusCoroutine(),"FocusCoroutine");
+ }
+
+ private IEnumerable