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 WindowMode OriginalGraphicsMode;
|
||||||
static readonly int2 OriginalGraphicsWindowedSize;
|
static readonly int2 OriginalGraphicsWindowedSize;
|
||||||
static readonly int2 OriginalGraphicsFullscreenSize;
|
static readonly int2 OriginalGraphicsFullscreenSize;
|
||||||
|
static readonly GLProfile OriginalGLProfile;
|
||||||
static readonly bool OriginalServerDiscoverNatDevices;
|
static readonly bool OriginalServerDiscoverNatDevices;
|
||||||
|
|
||||||
readonly Dictionary<PanelType, Action> leavePanelActions = new Dictionary<PanelType, Action>();
|
readonly Dictionary<PanelType, Action> leavePanelActions = new Dictionary<PanelType, Action>();
|
||||||
@@ -57,6 +58,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
OriginalVideoDisplay = original.Graphics.VideoDisplay;
|
OriginalVideoDisplay = original.Graphics.VideoDisplay;
|
||||||
OriginalGraphicsWindowedSize = original.Graphics.WindowedSize;
|
OriginalGraphicsWindowedSize = original.Graphics.WindowedSize;
|
||||||
OriginalGraphicsFullscreenSize = original.Graphics.FullscreenSize;
|
OriginalGraphicsFullscreenSize = original.Graphics.FullscreenSize;
|
||||||
|
OriginalGLProfile = original.Graphics.GLProfile;
|
||||||
OriginalServerDiscoverNatDevices = original.Server.DiscoverNatDevices;
|
OriginalServerDiscoverNatDevices = original.Server.DiscoverNatDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +100,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
current.Graphics.VideoDisplay != OriginalVideoDisplay ||
|
current.Graphics.VideoDisplay != OriginalVideoDisplay ||
|
||||||
current.Graphics.WindowedSize != OriginalGraphicsWindowedSize ||
|
current.Graphics.WindowedSize != OriginalGraphicsWindowedSize ||
|
||||||
current.Graphics.FullscreenSize != OriginalGraphicsFullscreenSize ||
|
current.Graphics.FullscreenSize != OriginalGraphicsFullscreenSize ||
|
||||||
|
current.Graphics.GLProfile != OriginalGLProfile ||
|
||||||
current.Server.DiscoverNatDevices != OriginalServerDiscoverNatDevices)
|
current.Server.DiscoverNatDevices != OriginalServerDiscoverNatDevices)
|
||||||
{
|
{
|
||||||
Action restart = () =>
|
Action restart = () =>
|
||||||
@@ -253,16 +256,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ?
|
windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed ?
|
||||||
"Windowed" : ds.Mode == WindowMode.Fullscreen ? "Fullscreen (Legacy)" : "Fullscreen";
|
"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");
|
var displaySelectionDropDown = panel.Get<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
|
||||||
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
|
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
|
||||||
var displaySelectionLabel = new CachedTransform<int, string>(i => "Display {0}".F(i + 1));
|
var displaySelectionLabel = new CachedTransform<int, string>(i => "Display {0}".F(i + 1));
|
||||||
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
|
displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay);
|
||||||
displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2;
|
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");
|
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
||||||
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
||||||
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard ?
|
statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard ?
|
||||||
@@ -307,10 +312,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var windowHeight = panel.Get<TextFieldWidget>("WINDOW_HEIGHT");
|
var windowHeight = panel.Get<TextFieldWidget>("WINDOW_HEIGHT");
|
||||||
var origHeightText = windowHeight.Text = ds.WindowedSize.Y.ToString();
|
var origHeightText = windowHeight.Text = ds.WindowedSize.Y.ToString();
|
||||||
|
windowHeight.Text = ds.WindowedSize.Y.ToString();
|
||||||
|
|
||||||
var windowChangesDesc = panel.Get("WINDOW_CHANGES_DESC");
|
var restartDesc = panel.Get("RESTART_REQUIRED_DESC");
|
||||||
windowChangesDesc.IsVisible = () => ds.Mode == WindowMode.Windowed &&
|
restartDesc.IsVisible = () => ds.Mode != OriginalGraphicsMode || ds.VideoDisplay != OriginalVideoDisplay || ds.GLProfile != OriginalGLProfile ||
|
||||||
(ds.Mode != OriginalGraphicsMode || origWidthText != windowWidth.Text || origHeightText != windowHeight.Text);
|
(ds.Mode == WindowMode.Windowed && (origWidthText != windowWidth.Text || origHeightText != windowHeight.Text));
|
||||||
|
|
||||||
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
|
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
|
||||||
var frameLimitOrigLabel = frameLimitCheckbox.Text;
|
var frameLimitOrigLabel = frameLimitCheckbox.Text;
|
||||||
@@ -380,6 +386,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
ds.CapFramerate = dds.CapFramerate;
|
ds.CapFramerate = dds.CapFramerate;
|
||||||
ds.MaxFramerate = dds.MaxFramerate;
|
ds.MaxFramerate = dds.MaxFramerate;
|
||||||
ds.Language = dds.Language;
|
ds.Language = dds.Language;
|
||||||
|
ds.GLProfile = dds.GLProfile;
|
||||||
ds.Mode = dds.Mode;
|
ds.Mode = dds.Mode;
|
||||||
ds.VideoDisplay = dds.VideoDisplay;
|
ds.VideoDisplay = dds.VideoDisplay;
|
||||||
ds.WindowedSize = dds.WindowedSize;
|
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);
|
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)
|
static void ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, TargetLinesType>()
|
var options = new Dictionary<string, TargetLinesType>()
|
||||||
|
|||||||
@@ -228,13 +228,6 @@ Container@SETTINGS_PANEL:
|
|||||||
Height: 25
|
Height: 25
|
||||||
MaxLength: 5
|
MaxLength: 5
|
||||||
Type: Integer
|
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:
|
Container@DISPLAY_SELECTION:
|
||||||
Y: 240
|
Y: 240
|
||||||
Children:
|
Children:
|
||||||
@@ -249,13 +242,6 @@ Container@SETTINGS_PANEL:
|
|||||||
Width: 160
|
Width: 160
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
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:
|
Checkbox@VSYNC_CHECKBOX:
|
||||||
X: 310
|
X: 310
|
||||||
Y: 210
|
Y: 210
|
||||||
@@ -278,6 +264,27 @@ Container@SETTINGS_PANEL:
|
|||||||
Ticks: 20
|
Ticks: 20
|
||||||
MinimumValue: 50
|
MinimumValue: 50
|
||||||
MaximumValue: 240
|
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:
|
Container@AUDIO_PANEL:
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ Background@SETTINGS_PANEL:
|
|||||||
X: 5
|
X: 5
|
||||||
Y: 50
|
Y: 50
|
||||||
Width: PARENT_RIGHT - 10
|
Width: PARENT_RIGHT - 10
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM - 50
|
||||||
Children:
|
Children:
|
||||||
Label@PLAYER:
|
Label@PLAYER:
|
||||||
Text: Player Name:
|
Text: Player Name:
|
||||||
@@ -249,13 +249,6 @@ Background@SETTINGS_PANEL:
|
|||||||
Height: 25
|
Height: 25
|
||||||
MaxLength: 5
|
MaxLength: 5
|
||||||
Type: Integer
|
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:
|
Container@DISPLAY_SELECTION:
|
||||||
Y: 240
|
Y: 240
|
||||||
Children:
|
Children:
|
||||||
@@ -271,13 +264,6 @@ Background@SETTINGS_PANEL:
|
|||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Standard
|
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:
|
Checkbox@FRAME_LIMIT_CHECKBOX:
|
||||||
X: 310
|
X: 310
|
||||||
Y: 243
|
Y: 243
|
||||||
@@ -293,6 +279,26 @@ Background@SETTINGS_PANEL:
|
|||||||
Ticks: 20
|
Ticks: 20
|
||||||
MinimumValue: 50
|
MinimumValue: 50
|
||||||
MaximumValue: 240
|
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:
|
Container@AUDIO_PANEL:
|
||||||
X: 5
|
X: 5
|
||||||
Y: 50
|
Y: 50
|
||||||
|
|||||||
Reference in New Issue
Block a user