Expose GL Profile in settings menu.
This commit is contained in:
@@ -29,6 +29,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
static readonly WindowMode OriginalGraphicsMode;
|
||||
static readonly int2 OriginalGraphicsWindowedSize;
|
||||
static readonly int2 OriginalGraphicsFullscreenSize;
|
||||
static readonly GLProfile OriginalGLProfile;
|
||||
static readonly bool OriginalServerDiscoverNatDevices;
|
||||
|
||||
readonly Dictionary<PanelType, Action> leavePanelActions = new Dictionary<PanelType, Action>();
|
||||
@@ -57,6 +58,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
OriginalVideoDisplay = original.Graphics.VideoDisplay;
|
||||
OriginalGraphicsWindowedSize = original.Graphics.WindowedSize;
|
||||
OriginalGraphicsFullscreenSize = original.Graphics.FullscreenSize;
|
||||
OriginalGLProfile = original.Graphics.GLProfile;
|
||||
OriginalServerDiscoverNatDevices = original.Server.DiscoverNatDevices;
|
||||
}
|
||||
|
||||
@@ -98,6 +100,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
current.Graphics.VideoDisplay != OriginalVideoDisplay ||
|
||||
current.Graphics.WindowedSize != OriginalGraphicsWindowedSize ||
|
||||
current.Graphics.FullscreenSize != OriginalGraphicsFullscreenSize ||
|
||||
current.Graphics.GLProfile != OriginalGLProfile ||
|
||||
current.Server.DiscoverNatDevices != OriginalServerDiscoverNatDevices)
|
||||
{
|
||||
Action restart = () =>
|
||||
@@ -253,16 +256,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ?
|
||||
"Windowed" : ds.Mode == WindowMode.Fullscreen ? "Fullscreen (Legacy)" : "Fullscreen";
|
||||
|
||||
var modeChangesDesc = panel.Get("MODE_CHANGES_DESC");
|
||||
modeChangesDesc.IsVisible = () => ds.Mode != WindowMode.Windowed && (ds.Mode != OriginalGraphicsMode ||
|
||||
ds.VideoDisplay != OriginalVideoDisplay);
|
||||
|
||||
var displaySelectionDropDown = panel.Get<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
|
||||
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
|
||||
var displaySelectionLabel = new CachedTransform<int, string>(i => "Display {0}".F(i + 1));
|
||||
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
|
||||
displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2;
|
||||
|
||||
var glProfileLabel = new CachedTransform<GLProfile, string>(p => p.ToString());
|
||||
var glProfileDropdown = panel.Get<DropDownButtonWidget>("GL_PROFILE_DROPDOWN");
|
||||
glProfileDropdown.OnMouseDown = _ => ShowGLProfileDropdown(glProfileDropdown, ds);
|
||||
glProfileDropdown.GetText = () => glProfileLabel.Update(ds.GLProfile);
|
||||
glProfileDropdown.IsDisabled = () => Game.Renderer.SupportedGLProfiles.Length < 2;
|
||||
|
||||
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
||||
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
||||
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard ?
|
||||
@@ -307,10 +312,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var windowHeight = panel.Get<TextFieldWidget>("WINDOW_HEIGHT");
|
||||
var origHeightText = windowHeight.Text = ds.WindowedSize.Y.ToString();
|
||||
windowHeight.Text = ds.WindowedSize.Y.ToString();
|
||||
|
||||
var windowChangesDesc = panel.Get("WINDOW_CHANGES_DESC");
|
||||
windowChangesDesc.IsVisible = () => ds.Mode == WindowMode.Windowed &&
|
||||
(ds.Mode != OriginalGraphicsMode || origWidthText != windowWidth.Text || origHeightText != windowHeight.Text);
|
||||
var restartDesc = panel.Get("RESTART_REQUIRED_DESC");
|
||||
restartDesc.IsVisible = () => ds.Mode != OriginalGraphicsMode || ds.VideoDisplay != OriginalVideoDisplay || ds.GLProfile != OriginalGLProfile ||
|
||||
(ds.Mode == WindowMode.Windowed && (origWidthText != windowWidth.Text || origHeightText != windowHeight.Text));
|
||||
|
||||
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
|
||||
var frameLimitOrigLabel = frameLimitCheckbox.Text;
|
||||
@@ -380,6 +386,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
ds.CapFramerate = dds.CapFramerate;
|
||||
ds.MaxFramerate = dds.MaxFramerate;
|
||||
ds.Language = dds.Language;
|
||||
ds.GLProfile = dds.GLProfile;
|
||||
ds.Mode = dds.Mode;
|
||||
ds.VideoDisplay = dds.VideoDisplay;
|
||||
ds.WindowedSize = dds.WindowedSize;
|
||||
@@ -872,6 +879,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, Enumerable.Range(0, Game.Renderer.DisplayCount), setupItem);
|
||||
}
|
||||
|
||||
static void ShowGLProfileDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||
{
|
||||
Func<GLProfile, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.GLProfile == o,
|
||||
() => s.GLProfile = o);
|
||||
|
||||
var label = o.ToString();
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => label;
|
||||
return item;
|
||||
};
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, Game.Renderer.SupportedGLProfiles, setupItem);
|
||||
}
|
||||
|
||||
static void ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, TargetLinesType>()
|
||||
|
||||
@@ -228,13 +228,6 @@ Container@SETTINGS_PANEL:
|
||||
Height: 25
|
||||
MaxLength: 5
|
||||
Type: Integer
|
||||
Label@WINDOW_CHANGES_DESC:
|
||||
X: 60
|
||||
Y: 27
|
||||
Width: 200
|
||||
Height: 15
|
||||
Font: Tiny
|
||||
Text: Video mode and window size changes require restart
|
||||
Container@DISPLAY_SELECTION:
|
||||
Y: 240
|
||||
Children:
|
||||
@@ -249,13 +242,6 @@ Container@SETTINGS_PANEL:
|
||||
Width: 160
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Label@MODE_CHANGES_DESC:
|
||||
X: 60
|
||||
Y: 27
|
||||
Width: 200
|
||||
Height: 15
|
||||
Font: Tiny
|
||||
Text: Video mode and display changes require restart
|
||||
Checkbox@VSYNC_CHECKBOX:
|
||||
X: 310
|
||||
Y: 210
|
||||
@@ -278,6 +264,27 @@ Container@SETTINGS_PANEL:
|
||||
Ticks: 20
|
||||
MinimumValue: 50
|
||||
MaximumValue: 240
|
||||
Label@GL_PROFILE:
|
||||
X: 15
|
||||
Y: 270
|
||||
Width: 120
|
||||
Height: 25
|
||||
Align: Right
|
||||
Text: OpenGL Profile:
|
||||
DropDownButton@GL_PROFILE_DROPDOWN:
|
||||
X: 140
|
||||
Y: 270
|
||||
Width: 160
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Label@RESTART_REQUIRED_DESC:
|
||||
X: 300
|
||||
Y: PARENT_BOTTOM + 10
|
||||
Width: PARENT_RIGHT - 300
|
||||
Height: 15
|
||||
Font: TinyBold
|
||||
Text: Display and OpenGL changes require restart
|
||||
Align: Center
|
||||
Container@AUDIO_PANEL:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
|
||||
@@ -91,7 +91,7 @@ Background@SETTINGS_PANEL:
|
||||
X: 5
|
||||
Y: 50
|
||||
Width: PARENT_RIGHT - 10
|
||||
Height: PARENT_BOTTOM
|
||||
Height: PARENT_BOTTOM - 50
|
||||
Children:
|
||||
Label@PLAYER:
|
||||
Text: Player Name:
|
||||
@@ -249,13 +249,6 @@ Background@SETTINGS_PANEL:
|
||||
Height: 25
|
||||
MaxLength: 5
|
||||
Type: Integer
|
||||
Label@WINDOW_CHANGES_DESC:
|
||||
X: 60
|
||||
Y: 27
|
||||
Width: 200
|
||||
Height: 15
|
||||
Font: Tiny
|
||||
Text: Video mode and window size changes require restart
|
||||
Container@DISPLAY_SELECTION:
|
||||
Y: 240
|
||||
Children:
|
||||
@@ -271,13 +264,6 @@ Background@SETTINGS_PANEL:
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Text: Standard
|
||||
Label@MODE_CHANGES_DESC:
|
||||
X: 60
|
||||
Y: 27
|
||||
Width: 200
|
||||
Height: 15
|
||||
Font: Tiny
|
||||
Text: Video mode and display changes require restart
|
||||
Checkbox@FRAME_LIMIT_CHECKBOX:
|
||||
X: 310
|
||||
Y: 243
|
||||
@@ -293,6 +279,26 @@ Background@SETTINGS_PANEL:
|
||||
Ticks: 20
|
||||
MinimumValue: 50
|
||||
MaximumValue: 240
|
||||
Label@GL_PROFILE:
|
||||
X: 15
|
||||
Y: 270
|
||||
Width: 120
|
||||
Height: 25
|
||||
Align: Right
|
||||
Text: OpenGL Profile:
|
||||
DropDownButton@GL_PROFILE_DROPDOWN:
|
||||
X: 140
|
||||
Y: 270
|
||||
Width: 160
|
||||
Height: 25
|
||||
Font: Regular
|
||||
Label@RESTART_REQUIRED_DESC:
|
||||
Y: PARENT_BOTTOM - 40
|
||||
Width: PARENT_RIGHT
|
||||
Height: 15
|
||||
Font: Tiny
|
||||
Text: Display and OpenGL changes require restart
|
||||
Align: Center
|
||||
Container@AUDIO_PANEL:
|
||||
X: 5
|
||||
Y: 50
|
||||
|
||||
Reference in New Issue
Block a user