Added a toggle fullscreen button (default F11) (#20272)

* Added a toggle fullscreen button (default F11)

* Removed un-needed comments

* Review Requested Changes

* Fixed Acidental Spacing Change

* bwoink, removed extraneous code

* nothing, litterally
This commit is contained in:
Miro Kavaliou
2023-09-28 19:55:10 -04:00
committed by GitHub
parent 3477349dfe
commit c06586f942
11 changed files with 82 additions and 9 deletions

View File

@@ -3,9 +3,9 @@
Title="{Loc 'ui-options-title'}"
MinSize="800 450">
<TabContainer Name="Tabs" Access="Public">
<tabs:GraphicsTab />
<tabs:KeyRebindTab />
<tabs:AudioTab />
<tabs:NetworkTab/>
<tabs:GraphicsTab Name="GraphicsTab" />
<tabs:KeyRebindTab Name="KeyRebindTab" />
<tabs:AudioTab Name="AudioTab" />
<tabs:NetworkTab Name="NetworkTab" />
</TabContainer>
</DefaultWindow>

View File

@@ -1,6 +1,9 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Content.Client.Options.UI.Tabs;
namespace Content.Client.Options.UI
{
@@ -16,6 +19,13 @@ namespace Content.Client.Options.UI
Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-controls"));
Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-audio"));
Tabs.SetTabTitle(3, Loc.GetString("ui-options-tab-network"));
UpdateTabs();
}
public void UpdateTabs()
{
GraphicsTab.UpdateProperties();
}
}
}

View File

@@ -229,6 +229,12 @@ namespace Content.Client.Options.UI.Tabs
private bool ConfigIsFullscreen =>
_cfg.GetCVar(CVars.DisplayWindowMode) == (int) WindowMode.Fullscreen;
public void UpdateProperties()
{
FullscreenCheckBox.Pressed = ConfigIsFullscreen;
}
private float ConfigUIScale => _cfg.GetCVar(CVars.DisplayUIScale);
private int GetConfigLightingQuality()

View File

@@ -61,7 +61,7 @@ namespace Content.Client.Options.UI.Tabs
{
if (!first)
{
KeybindsContainer.AddChild(new Control {MinSize = new Vector2(0, 8)});
KeybindsContainer.AddChild(new Control { MinSize = new Vector2(0, 8) });
}
first = false;
@@ -69,7 +69,7 @@ namespace Content.Client.Options.UI.Tabs
{
Text = Loc.GetString(headerContents),
FontColorOverride = StyleNano.NanoGold,
StyleClasses = {StyleNano.StyleClassLabelKeyText}
StyleClasses = { StyleNano.StyleClassLabelKeyText }
});
}
@@ -82,7 +82,7 @@ namespace Content.Client.Options.UI.Tabs
void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.ButtonToggledEventArgs>? callBackOnClick)
{
CheckBox newCheckBox = new CheckBox() { Text = Loc.GetString(checkBoxName)};
CheckBox newCheckBox = new CheckBox() { Text = Loc.GetString(checkBoxName) };
newCheckBox.Pressed = currentState;
newCheckBox.OnToggled += callBackOnClick;
@@ -159,6 +159,7 @@ namespace Content.Client.Options.UI.Tabs
AddHeader("ui-options-header-misc");
AddButton(ContentKeyFunctions.TakeScreenshot);
AddButton(ContentKeyFunctions.TakeScreenshotNoUI);
AddButton(ContentKeyFunctions.ToggleFullscreen);
AddHeader("ui-options-header-hotbar");
foreach (var boundKey in ContentKeyFunctions.GetHotbarBoundKeys())
@@ -409,7 +410,7 @@ namespace Content.Client.Options.UI.Tabs
BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight);
BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft);
ResetButton = new Button {Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = {StyleBase.ButtonCaution}};
ResetButton = new Button { Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = { StyleBase.ButtonCaution } };
var hBox = new BoxContainer
{
@@ -449,7 +450,7 @@ namespace Content.Client.Options.UI.Tabs
{
_tab = tab;
KeyControl = keyControl;
Button = new Button {StyleClasses = {styleClass}};
Button = new Button { StyleClasses = { styleClass } };
UpdateText();
AddChild(Button);