using Content.Client.Chat.Managers;
using Content.Client.Eui;
using Content.Client.Flash;
+using Content.Client.Fullscreen;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
using Content.Client.Info;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IStylesheetManager _stylesheetManager = default!;
[Dependency] private readonly IScreenshotHook _screenshotHook = default!;
+ [Dependency] private readonly FullscreenHook _fullscreenHook = default!;
[Dependency] private readonly ChangelogManager _changelogManager = default!;
[Dependency] private readonly RulesManager _rulesManager = default!;
[Dependency] private readonly ViewportManager _viewportManager = default!;
_componentFactory.GenerateNetIds();
_adminManager.Initialize();
_screenshotHook.Initialize();
+ _fullscreenHook.Initialize();
_changelogManager.Initialize();
_rulesManager.Initialize();
_viewportManager.Initialize();
--- /dev/null
+using Content.Shared.Input;
+using Robust.Client.Graphics;
+using Robust.Client.Input;
+using Robust.Shared.Input.Binding;
+using Robust.Shared;
+using Robust.Shared.Configuration;
+using Robust.Shared.Players;
+
+namespace Content.Client.Fullscreen;
+public sealed class FullscreenHook
+{
+ [Dependency] private readonly IInputManager _inputManager = default!;
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
+ [Dependency] private readonly ILogManager _logManager = default!;
+ private ISawmill _sawmill = default!;
+
+ public void Initialize()
+ {
+ _inputManager.SetInputCommand(ContentKeyFunctions.ToggleFullscreen, InputCmdHandler.FromDelegate(ToggleFullscreen));
+ _sawmill = _logManager.GetSawmill("fullscreen");
+ }
+
+ private void ToggleFullscreen(ICommonSession? session)
+ {
+ var currentWindowMode = _cfg.GetCVar(CVars.DisplayWindowMode);
+
+ switch (currentWindowMode)
+ {
+ case (int) WindowMode.Windowed:
+ _cfg.SetCVar(CVars.DisplayWindowMode, (int) WindowMode.Fullscreen);
+ _sawmill.Info("Switched to Fullscreen mode");
+ break;
+
+ case (int) WindowMode.Fullscreen:
+ _cfg.SetCVar(CVars.DisplayWindowMode, (int) WindowMode.Windowed);
+ _sawmill.Info("Switched to Windowed mode");
+ break;
+
+ default:
+ throw new InvalidOperationException($"Unexpected WindowMode value: {currentWindowMode}");
+ }
+ }
+}
common.AddFunction(ContentKeyFunctions.OpenAHelp);
common.AddFunction(ContentKeyFunctions.TakeScreenshot);
common.AddFunction(ContentKeyFunctions.TakeScreenshotNoUI);
+ common.AddFunction(ContentKeyFunctions.ToggleFullscreen);
common.AddFunction(ContentKeyFunctions.Point);
common.AddFunction(ContentKeyFunctions.ZoomOut);
common.AddFunction(ContentKeyFunctions.ZoomIn);
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Preferences;
using Content.Client.Screenshot;
+using Content.Client.Fullscreen;
using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Client.Replay;
using Content.Shared.Administration.Managers;
+
namespace Content.Client.IoC
{
internal static class ClientContentIoC
IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>();
IoCManager.Register<IStylesheetManager, StylesheetManager>();
IoCManager.Register<IScreenshotHook, ScreenshotHook>();
+ IoCManager.Register<FullscreenHook, FullscreenHook>();
IoCManager.Register<IClickMapManager, ClickMapManager>();
IoCManager.Register<IClientAdminManager, ClientAdminManager>();
IoCManager.Register<ISharedAdminManager, ClientAdminManager>();
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>
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
{
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();
}
}
}
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()
{
if (!first)
{
- KeybindsContainer.AddChild(new Control {MinSize = new Vector2(0, 8)});
+ KeybindsContainer.AddChild(new Control { MinSize = new Vector2(0, 8) });
}
first = false;
{
Text = Loc.GetString(headerContents),
FontColorOverride = StyleNano.NanoGold,
- StyleClasses = {StyleNano.StyleClassLabelKeyText}
+ StyleClasses = { StyleNano.StyleClassLabelKeyText }
});
}
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;
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())
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
{
{
_tab = tab;
KeyControl = keyControl;
- Button = new Button {StyleClasses = {styleClass}};
+ Button = new Button { StyleClasses = { styleClass } };
UpdateText();
AddChild(Button);
{
EnsureWindow();
+ _optionsWindow.UpdateTabs();
+
_optionsWindow.OpenCentered();
_optionsWindow.MoveToFront();
}
public static readonly BoundKeyFunction OpenAdminMenu = "OpenAdminMenu";
public static readonly BoundKeyFunction TakeScreenshot = "TakeScreenshot";
public static readonly BoundKeyFunction TakeScreenshotNoUI = "TakeScreenshotNoUI";
+ public static readonly BoundKeyFunction ToggleFullscreen = "ToggleFullscreen";
public static readonly BoundKeyFunction Point = "Point";
public static readonly BoundKeyFunction ZoomOut = "ZoomOut";
public static readonly BoundKeyFunction ZoomIn = "ZoomIn";
- function: ShowEscapeMenu
type: State
key: F10
+- function: ToggleFullscreen
+ type: State
+ key: F11
- function: CycleChatChannelForward
type: State
key: Tab