Move hardcoded screenshot hotkey into yaml.
This commit is contained in:
@@ -60,6 +60,7 @@ namespace OpenRA
|
|||||||
public static string EngineVersion { get; private set; }
|
public static string EngineVersion { get; private set; }
|
||||||
|
|
||||||
static Task discoverNat;
|
static Task discoverNat;
|
||||||
|
static bool takeScreenshot = false;
|
||||||
|
|
||||||
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
|
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
|
||||||
{
|
{
|
||||||
@@ -630,7 +631,10 @@ namespace OpenRA
|
|||||||
InnerLogicTick(worldRenderer.World.OrderManager);
|
InnerLogicTick(worldRenderer.World.OrderManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TakeScreenshot = false;
|
public static void TakeScreenshot()
|
||||||
|
{
|
||||||
|
takeScreenshot = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void RenderTick()
|
static void RenderTick()
|
||||||
{
|
{
|
||||||
@@ -666,9 +670,9 @@ namespace OpenRA
|
|||||||
using (new PerfSample("render_flip"))
|
using (new PerfSample("render_flip"))
|
||||||
Renderer.EndFrame(new DefaultInputHandler(OrderManager.World));
|
Renderer.EndFrame(new DefaultInputHandler(OrderManager.World));
|
||||||
|
|
||||||
if (TakeScreenshot)
|
if (takeScreenshot)
|
||||||
{
|
{
|
||||||
TakeScreenshot = false;
|
takeScreenshot = false;
|
||||||
TakeScreenshotInner();
|
TakeScreenshotInner();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,6 @@ namespace OpenRA.Widgets
|
|||||||
Root.Visible ^= true;
|
Root.Visible ^= true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hk == Game.Settings.Keys.TakeScreenshotKey)
|
|
||||||
{
|
|
||||||
Game.TakeScreenshot = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyboardFocusWidget != null)
|
if (KeyboardFocusWidget != null)
|
||||||
|
|||||||
@@ -822,6 +822,7 @@
|
|||||||
<Compile Include="Lint\CheckChromeHotkeys.cs" />
|
<Compile Include="Lint\CheckChromeHotkeys.cs" />
|
||||||
<Compile Include="UtilityCommands\LintInterfaces.cs" />
|
<Compile Include="UtilityCommands\LintInterfaces.cs" />
|
||||||
<Compile Include="Widgets\Logic\SingleHotkeyBaseLogic.cs" />
|
<Compile Include="Widgets\Logic\SingleHotkeyBaseLogic.cs" />
|
||||||
|
<Compile Include="Widgets\Logic\ScreenshotHotkeyLogic.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
|
|||||||
31
OpenRA.Mods.Common/Widgets/Logic/ScreenshotHotkeyLogic.cs
Normal file
31
OpenRA.Mods.Common/Widgets/Logic/ScreenshotHotkeyLogic.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#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 System.Collections.Generic;
|
||||||
|
using OpenRA.Mods.Common.Lint;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
|
{
|
||||||
|
[ChromeLogicArgsHotkeys("TakeScreenshotKey")]
|
||||||
|
public class ScreenshotHotkeyLogic : SingleHotkeyBaseLogic
|
||||||
|
{
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public ScreenshotHotkeyLogic(Widget widget, Dictionary<string, MiniYaml> logicArgs)
|
||||||
|
: base(widget, "TakeScreenshotKey", "GLOBAL_KEYHANDLER", logicArgs) { }
|
||||||
|
|
||||||
|
protected override bool OnHotkeyActivated(KeyInput e)
|
||||||
|
{
|
||||||
|
Game.TakeScreenshot();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -192,11 +192,12 @@ Container@EDITOR_ROOT:
|
|||||||
Logic: LoadMapEditorLogic
|
Logic: LoadMapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ Container@INGAME_ROOT:
|
|||||||
Logic: LoadIngamePlayerOrObserverUILogic
|
Logic: LoadIngamePlayerOrObserverUILogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Logic: LoadIngamePerfLogic
|
Logic: LoadIngamePerfLogic
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ Container@MENU_BACKGROUND:
|
|||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Container@SHELLMAP_DECORATIONS:
|
Container@SHELLMAP_DECORATIONS:
|
||||||
Children:
|
Children:
|
||||||
Image@NOD:
|
Image@NOD:
|
||||||
|
|||||||
@@ -183,11 +183,12 @@ Container@EDITOR_ROOT:
|
|||||||
Logic: LoadMapEditorLogic
|
Logic: LoadMapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ Container@INGAME_ROOT:
|
|||||||
Logic: LoadIngamePlayerOrObserverUILogic
|
Logic: LoadIngamePlayerOrObserverUILogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Container@WORLD_ROOT:
|
Container@WORLD_ROOT:
|
||||||
Logic: LoadIngamePerfLogic
|
Logic: LoadIngamePerfLogic
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ Container@MAINMENU:
|
|||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Background@BORDER:
|
Background@BORDER:
|
||||||
Background: mainmenu-border
|
Background: mainmenu-border
|
||||||
X: 0 - 15
|
X: 0 - 15
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ Container@MAINMENU:
|
|||||||
Logic: MainMenuLogic
|
Logic: MainMenuLogic
|
||||||
Children:
|
Children:
|
||||||
LogicKeyListener@GLOBAL_KEYHANDLER:
|
LogicKeyListener@GLOBAL_KEYHANDLER:
|
||||||
Logic: MusicHotkeyLogic
|
Logic: MusicHotkeyLogic, ScreenshotHotkeyLogic
|
||||||
StopMusicKey: StopMusic
|
StopMusicKey: StopMusic
|
||||||
PauseMusicKey: PauseMusic
|
PauseMusicKey: PauseMusic
|
||||||
PrevMusicKey: PrevMusic
|
PrevMusicKey: PrevMusic
|
||||||
NextMusicKey: NextMusic
|
NextMusicKey: NextMusic
|
||||||
|
TakeScreenshotKey: TakeScreenshot
|
||||||
Label@VERSION_LABEL:
|
Label@VERSION_LABEL:
|
||||||
X: WINDOW_RIGHT - 10
|
X: WINDOW_RIGHT - 10
|
||||||
Y: WINDOW_BOTTOM - 20
|
Y: WINDOW_BOTTOM - 20
|
||||||
|
|||||||
Reference in New Issue
Block a user