Add an "Automatic" GL profile.

This commit is contained in:
Paul Chote
2020-10-01 18:47:06 +01:00
committed by abcdefg30
parent fc844cfa6d
commit 87c5cc96ad
4 changed files with 14 additions and 7 deletions

View File

@@ -105,18 +105,21 @@ namespace OpenRA.Mods.Common.LoadScreens
public virtual bool BeforeLoad()
{
var graphicSettings = Game.Settings.Graphics;
// Reset the UI scaling if the user has configured a UI scale that pushes us below the minimum allowed effective resolution
var minResolution = ModData.Manifest.Get<WorldViewportSizes>().MinEffectiveResolution;
var resolution = Game.Renderer.Resolution;
if ((resolution.Width < minResolution.Width || resolution.Height < minResolution.Height) && Game.Settings.Graphics.UIScale > 1.0f)
{
Game.Settings.Graphics.UIScale = 1.0f;
graphicSettings.UIScale = 1.0f;
Game.Renderer.SetUIScale(1.0f);
}
// Saved settings may have been invalidated by a hardware change
Game.Settings.Graphics.GLProfile = Game.Renderer.GLProfile;
Game.Settings.Graphics.VideoDisplay = Game.Renderer.CurrentDisplay;
graphicSettings.VideoDisplay = Game.Renderer.CurrentDisplay;
if (graphicSettings.GLProfile != GLProfile.Automatic && graphicSettings.GLProfile != Game.Renderer.GLProfile)
graphicSettings.GLProfile = GLProfile.Automatic;
// If a ModContent section is defined then we need to make sure that the
// required content is installed or switch to the defined content installer.