(bc44f3622) Fixed credits not resizing when resolution is changed
This commit is contained in:
@@ -606,7 +606,7 @@ namespace Barotrauma
|
||||
.ThenByDescending(a => a.Strength).FirstOrDefault();
|
||||
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
|
||||
{
|
||||
var limbHealth = GetMathingLimbHealth(affliction);
|
||||
var limbHealth = GetMatchingLimbHealth(affliction);
|
||||
if (limbHealth != null)
|
||||
{
|
||||
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
|
||||
|
||||
@@ -256,4 +256,4 @@ namespace EventInput
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,27 +118,21 @@ 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;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,11 @@ namespace Barotrauma
|
||||
|
||||
GraphicsWidth = Config.GraphicsWidth;
|
||||
GraphicsHeight = Config.GraphicsHeight;
|
||||
|
||||
if (Config.WindowMode == WindowMode.BorderlessWindowed)
|
||||
{
|
||||
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
|
||||
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
|
||||
}
|
||||
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.Reach;
|
||||
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
|
||||
GraphicsDeviceManager.PreferMultiSampling = false;
|
||||
@@ -250,6 +254,8 @@ namespace Barotrauma
|
||||
|
||||
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
|
||||
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
|
||||
|
||||
GraphicsDeviceManager.ApplyChanges();
|
||||
}
|
||||
|
||||
public void ResetViewPort()
|
||||
@@ -267,10 +273,7 @@ namespace Barotrauma
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
DisplayWidth = GraphicsDevice.DisplayMode.Width;
|
||||
DisplayHeight = GraphicsDevice.DisplayMode.Height;
|
||||
|
||||
RequestGraphicsSettings();
|
||||
ApplyGraphicsSettings();
|
||||
|
||||
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
|
||||
|
||||
@@ -309,45 +312,8 @@ 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;
|
||||
}
|
||||
#endif
|
||||
|
||||
private void HandleDefocus(object sender, EventArgs e)
|
||||
{
|
||||
CoroutineManager.StopCoroutines("FocusCoroutine");
|
||||
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
|
||||
|
||||
|
||||
private void InitUserStats()
|
||||
{
|
||||
if (GameSettings.ShowUserStatisticsPrompt)
|
||||
|
||||
@@ -192,14 +192,13 @@ namespace Barotrauma
|
||||
foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
|
||||
{
|
||||
if (supportedDisplayModes.Any(m => m.Width == mode.Width && m.Height == mode.Height)) { continue; }
|
||||
if (mode.Width < MinSupportedResolution.X || mode.Height < MinSupportedResolution.Y) { continue; }
|
||||
#if OSX
|
||||
// Monogame currently doesn't support retina displays
|
||||
// so we need to disable resolutions above the viewport size.
|
||||
|
||||
// In a bundled .app you just disable HiDPI in the info.plist
|
||||
// but that's probably not gonna happen.
|
||||
if (mode.Width > GameMain.DisplayWidth || mode.Height > GameMain.DisplayHeight) { continue; }
|
||||
if (mode.Width > GameMain.Instance.GraphicsDevice.DisplayMode.Width || mode.Height > GameMain.Instance.GraphicsDevice.DisplayMode.Height) { continue; }
|
||||
#endif
|
||||
supportedDisplayModes.Add(mode);
|
||||
}
|
||||
@@ -207,11 +206,15 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("Resolution"));
|
||||
var resolutionDD = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), elementCount: supportedDisplayModes.Count)
|
||||
{
|
||||
OnSelected = SelectResolution
|
||||
};
|
||||
OnSelected = SelectResolution,
|
||||
#if !LINUX
|
||||
ButtonEnabled = GameMain.Config.WindowMode == WindowMode.Windowed
|
||||
#endif
|
||||
};
|
||||
|
||||
foreach (DisplayMode mode in supportedDisplayModes)
|
||||
{
|
||||
if (mode.Width < MinSupportedResolution.X || mode.Height < MinSupportedResolution.Y) { continue; }
|
||||
resolutionDD.AddItem(mode.Width + "x" + mode.Height, mode);
|
||||
if (GraphicsWidth == mode.Width && GraphicsHeight == mode.Height) resolutionDD.SelectItem(mode);
|
||||
}
|
||||
@@ -224,25 +227,6 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("DisplayMode"));
|
||||
var displayModeDD = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform));
|
||||
|
||||
displayModeDD.OnSelected = (guiComponent, obj) =>
|
||||
{
|
||||
UnsavedSettings = true;
|
||||
GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData;
|
||||
if (GameMain.Config.WindowMode == WindowMode.BorderlessWindowed)
|
||||
{
|
||||
resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First(
|
||||
m => m.Width == GameMain.DisplayWidth &&
|
||||
m.Height == GameMain.DisplayHeight));
|
||||
resolutionDD.ButtonEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolutionDD.ButtonEnabled = true;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
displayModeDD.AddItem(TextManager.Get("Fullscreen"), WindowMode.Fullscreen);
|
||||
displayModeDD.AddItem(TextManager.Get("Windowed"), WindowMode.Windowed);
|
||||
#if (!OSX)
|
||||
@@ -259,6 +243,16 @@ namespace Barotrauma
|
||||
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
||||
}
|
||||
#endif
|
||||
displayModeDD.OnSelected = (guiComponent, obj) =>
|
||||
{
|
||||
PauseOnFocusLost = tickBox.Selected;
|
||||
UnsavedSettings = true;
|
||||
GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData;
|
||||
#if !LINUX
|
||||
resolutionDD.ButtonEnabled = GameMain.Config.WindowMode == WindowMode.Windowed;
|
||||
#endif
|
||||
return true;
|
||||
};
|
||||
|
||||
GUITickBox vsyncTickBox = new GUITickBox(new RectTransform(new Point(32, 32), leftColumn.RectTransform), TextManager.Get("EnableVSync"))
|
||||
{
|
||||
@@ -534,10 +528,6 @@ namespace Barotrauma
|
||||
|
||||
voiceMode.AddRadioButton((VoiceMode)i, tick);
|
||||
}
|
||||
deviceList.OnSelected = (GUIComponent selected, object obj) =>
|
||||
{
|
||||
string name = obj as string;
|
||||
if (VoiceCaptureDevice == name) { return true; }
|
||||
|
||||
var micVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.Get("MicrophoneVolume"));
|
||||
var micVolumeSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform),
|
||||
@@ -852,7 +842,7 @@ namespace Barotrauma
|
||||
|
||||
GraphicsWidth = mode.Width;
|
||||
GraphicsHeight = mode.Height;
|
||||
GameMain.Instance.RequestGraphicsSettings();
|
||||
GameMain.Instance.ApplyGraphicsSettings();
|
||||
UnsavedSettings = true;
|
||||
|
||||
return true;
|
||||
@@ -991,7 +981,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.WindowMode != GameMain.Config.WindowMode)
|
||||
{
|
||||
GameMain.Instance.RequestGraphicsSettings();
|
||||
GameMain.Instance.ApplyGraphicsSettings();
|
||||
}
|
||||
|
||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||
|
||||
@@ -8,19 +8,32 @@ namespace Barotrauma
|
||||
{
|
||||
private GUIListBox listBox;
|
||||
|
||||
private readonly float scrollSpeed;
|
||||
private XElement configElement;
|
||||
private RectTransform parent;
|
||||
|
||||
private float scrollSpeed;
|
||||
|
||||
public CreditsPlayer(RectTransform rectT, string configFile) : base(null, rectT)
|
||||
{
|
||||
var doc = XMLExtensions.TryLoadXml(configFile);
|
||||
scrollSpeed = doc.Root.GetAttributeFloat("scrollspeed", 100.0f);
|
||||
int spacing = doc.Root.GetAttributeInt("spacing", 0);
|
||||
GameMain.Instance.OnResolutionChanged += () => { ClearChildren(); Load(); };
|
||||
|
||||
listBox = new GUIListBox(new RectTransform(Vector2.One, rectT), style: null)
|
||||
var doc = XMLExtensions.TryLoadXml(configFile);
|
||||
configElement = doc.Root;
|
||||
|
||||
Load();
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
scrollSpeed = configElement.GetAttributeFloat("scrollspeed", 100.0f);
|
||||
int spacing = configElement.GetAttributeInt("spacing", 0);
|
||||
|
||||
listBox = new GUIListBox(new RectTransform(Vector2.One, RectTransform), style: null)
|
||||
{
|
||||
Spacing = spacing
|
||||
};
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
foreach (XElement subElement in configElement.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
|
||||
@@ -967,7 +967,7 @@ namespace Barotrauma
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog()
|
||||
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
|
||||
{
|
||||
Multiselect = true,
|
||||
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
|
||||
@@ -1078,7 +1078,7 @@ namespace Barotrauma
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog()
|
||||
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
|
||||
{
|
||||
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
|
||||
Title = TextManager.Get("workshopitemaddfiles"),
|
||||
|
||||
@@ -1074,7 +1074,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog()
|
||||
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
|
||||
{
|
||||
InitialDirectory = Path.GetFullPath(Submarine.SavePath),
|
||||
Filter = "PNG file|*.png",
|
||||
|
||||
Reference in New Issue
Block a user