(657674526) Reallow changing resolution in fullscreen/borderless. TODO: test, disable in borderless because it seems to do nothing?

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:30:32 +03:00
parent 88c4c9a248
commit 93e4767fb8
17 changed files with 82 additions and 91 deletions
@@ -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);
@@ -256,4 +256,4 @@ namespace EventInput
}
#endif
}
}
}
@@ -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;
}
+33 -3
View File
@@ -236,8 +236,6 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
GraphicsDeviceManager.ApplyChanges();
}
public void ResetViewPort()
@@ -255,7 +253,7 @@ namespace Barotrauma
{
base.Initialize();
ApplyGraphicsSettings();
RequestGraphicsSettings();
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
@@ -294,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<object> FocusCoroutine()
{
yield return new WaitForSeconds(0.01f);
ApplyGraphicsSettings();
yield return CoroutineStatus.Success;
}
private void HandleDefocus(object sender, EventArgs e)
{
CoroutineManager.StopCoroutines("FocusCoroutine");
GraphicsDeviceManager.IsFullScreen = false;
GraphicsDeviceManager.ApplyChanges();
}
#endif
loadingCoroutine = CoroutineManager.StartCoroutine(Load(canLoadInSeparateThread), "", canLoadInSeparateThread);
}
private void InitUserStats()
@@ -207,9 +207,7 @@ namespace Barotrauma
var resolutionDD = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), elementCount: supportedDisplayModes.Count)
{
OnSelected = SelectResolution,
#if !LINUX
ButtonEnabled = GameMain.Config.WindowMode == WindowMode.Windowed
#endif
};
foreach (DisplayMode mode in supportedDisplayModes)
@@ -841,7 +839,7 @@ namespace Barotrauma
GraphicsWidth = mode.Width;
GraphicsHeight = mode.Height;
GameMain.Instance.ApplyGraphicsSettings();
GameMain.Instance.RequestGraphicsSettings();
UnsavedSettings = true;
return true;
@@ -980,7 +978,7 @@ namespace Barotrauma
if (GameMain.WindowMode != GameMain.Config.WindowMode)
{
GameMain.Instance.ApplyGraphicsSettings();
GameMain.Instance.RequestGraphicsSettings();
}
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
@@ -967,7 +967,7 @@ namespace Barotrauma
{
try
{
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
OpenFileDialog ofd = new OpenFileDialog()
{
Multiselect = true,
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
@@ -1078,7 +1078,7 @@ namespace Barotrauma
{
try
{
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
OpenFileDialog ofd = new OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
Title = TextManager.Get("workshopitemaddfiles"),
@@ -1074,7 +1074,7 @@ namespace Barotrauma
{
OnClicked = (btn, userdata) =>
{
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
OpenFileDialog ofd = new OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(Submarine.SavePath),
Filter = "PNG file|*.png",