Add LogicKeyListenerWidget for binding keys to UI logic.

This commit is contained in:
Paul Chote
2014-03-22 22:20:51 +13:00
parent 2c8fc4603a
commit 8beb9ffc57
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 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. For more information,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets
{
public class LogicKeyListenerWidget : Widget
{
public Func<KeyInput, bool> OnKeyPress = _ => false;
public override bool HandleKeyPress(KeyInput e)
{
return OnKeyPress(e);
}
}
}