Take screenshot in dialogs #13184
This commit is contained in:
@@ -239,7 +239,6 @@
|
|||||||
<Compile Include="Support\PerfSample.cs" />
|
<Compile Include="Support\PerfSample.cs" />
|
||||||
<Compile Include="Graphics\SpriteRenderable.cs" />
|
<Compile Include="Graphics\SpriteRenderable.cs" />
|
||||||
<Compile Include="Widgets\Widget.cs" />
|
<Compile Include="Widgets\Widget.cs" />
|
||||||
<Compile Include="Widgets\RootWidget.cs" />
|
|
||||||
<Compile Include="Widgets\WidgetLoader.cs" />
|
<Compile Include="Widgets\WidgetLoader.cs" />
|
||||||
<Compile Include="Widgets\ChromeMetrics.cs" />
|
<Compile Include="Widgets\ChromeMetrics.cs" />
|
||||||
<Compile Include="Widgets\WidgetUtils.cs" />
|
<Compile Include="Widgets\WidgetUtils.cs" />
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2017 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
|
||||||
{
|
|
||||||
public class RootWidget : ContainerWidget
|
|
||||||
{
|
|
||||||
public RootWidget()
|
|
||||||
{
|
|
||||||
IgnoreMouseOver = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleKeyPress(KeyInput e)
|
|
||||||
{
|
|
||||||
if (e.Event == KeyInputEvent.Down)
|
|
||||||
{
|
|
||||||
var hk = Hotkey.FromKeyInput(e);
|
|
||||||
|
|
||||||
if (hk == Game.Settings.Keys.DevReloadChromeKey)
|
|
||||||
{
|
|
||||||
ChromeProvider.Initialize(Game.ModData);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
|
|
||||||
{
|
|
||||||
foreach (var child in Children)
|
|
||||||
child.Visible ^= true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hk == Game.Settings.Keys.TakeScreenshotKey)
|
|
||||||
{
|
|
||||||
if (e.Event == KeyInputEvent.Down)
|
|
||||||
Game.TakeScreenshot = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.HandleKeyPress(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public static class Ui
|
public static class Ui
|
||||||
{
|
{
|
||||||
public static Widget Root = new RootWidget();
|
public static Widget Root = new ContainerWidget();
|
||||||
|
|
||||||
public static long LastTickTime = Game.RunTime;
|
public static long LastTickTime = Game.RunTime;
|
||||||
|
|
||||||
@@ -128,6 +128,29 @@ namespace OpenRA.Widgets
|
|||||||
/// <param name="e">Key input data</param>
|
/// <param name="e">Key input data</param>
|
||||||
public static bool HandleKeyPress(KeyInput e)
|
public static bool HandleKeyPress(KeyInput e)
|
||||||
{
|
{
|
||||||
|
if (e.Event == KeyInputEvent.Down)
|
||||||
|
{
|
||||||
|
var hk = Hotkey.FromKeyInput(e);
|
||||||
|
|
||||||
|
if (hk == Game.Settings.Keys.DevReloadChromeKey)
|
||||||
|
{
|
||||||
|
ChromeProvider.Initialize(Game.ModData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
|
||||||
|
{
|
||||||
|
Root.Visible ^= true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hk == Game.Settings.Keys.TakeScreenshotKey)
|
||||||
|
{
|
||||||
|
Game.TakeScreenshot = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (KeyboardFocusWidget != null)
|
if (KeyboardFocusWidget != null)
|
||||||
return KeyboardFocusWidget.HandleKeyPressOuter(e);
|
return KeyboardFocusWidget.HandleKeyPressOuter(e);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user