Adds "hide UI" keybind.

Man posting screenshots is much nicer when there's no ugly chat window.
This commit is contained in:
Pieter-Jan Briers
2019-03-27 22:50:19 +01:00
parent 84b4b3d6b5
commit a2e9e0d15f
4 changed files with 16 additions and 0 deletions

View File

@@ -3,6 +3,9 @@ binds:
- function: ShowDebugMonitors
key: F3
type: Toggle
- function: HideUI
key: F4
type: Toggle
- function: MoveUp
key: W
type: State

View File

@@ -16,6 +16,7 @@ namespace SS14.Client.Input
var common = contexts.GetContext(InputContextContainer.DefaultContextName);
common.AddFunction(EngineKeyFunctions.EscapeMenu);
common.AddFunction(EngineKeyFunctions.FocusChat);
common.AddFunction(EngineKeyFunctions.HideUI);
common.AddFunction(EngineKeyFunctions.ShowDebugMonitors);
common.AddFunction(EngineKeyFunctions.MoveUp);
common.AddFunction(EngineKeyFunctions.MoveDown);

View File

@@ -49,6 +49,8 @@ namespace SS14.Client.UserInterface
private readonly List<Control> _modalStack = new List<Control>();
private bool _rendering = true;
public void PostInject()
{
_config.RegisterCVar("key.keyboard.console", Keyboard.Key.Tilde, CVar.ARCHIVE);
@@ -69,6 +71,11 @@ namespace SS14.Client.UserInterface
_inputManager.SetInputCommand(EngineKeyFunctions.ShowDebugMonitors,
InputCmdHandler.FromDelegate(enabled: session => { DebugMonitors.Visible = true; },
disabled: session => { DebugMonitors.Visible = false; }));
_inputManager.SetInputCommand(EngineKeyFunctions.HideUI,
InputCmdHandler.FromDelegate(
enabled: session => _rendering = false,
disabled: session => _rendering = true));
}
private void _initializeCommon()
@@ -399,6 +406,10 @@ namespace SS14.Client.UserInterface
public void Render(IRenderHandle renderHandle)
{
if (!_rendering)
{
return;
}
var drawHandle = renderHandle.CreateHandleScreen();
_render(drawHandle, RootControl, Vector2.Zero, Color.White, null);

View File

@@ -19,6 +19,7 @@ namespace SS14.Shared.Input
public static readonly BoundKeyFunction Run = "Run";
public static readonly BoundKeyFunction ShowDebugMonitors = "ShowDebugMonitors";
public static readonly BoundKeyFunction HideUI = "HideUI";
public static readonly BoundKeyFunction EscapeMenu = "ShowEscapeMenu";
public static readonly BoundKeyFunction FocusChat = "FocusChatWindow";