diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 21a5ef3d03..f3e8158449 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -233,6 +233,7 @@ + diff --git a/OpenRA.Game/Widgets/RGBASpriteWidget.cs b/OpenRA.Game/Widgets/RGBASpriteWidget.cs new file mode 100644 index 0000000000..ef8de8f2c7 --- /dev/null +++ b/OpenRA.Game/Widgets/RGBASpriteWidget.cs @@ -0,0 +1,37 @@ +#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.Graphics; + +namespace OpenRA.Widgets +{ + public class RGBASpriteWidget : Widget + { + public Func GetSprite = () => null; + + public RGBASpriteWidget() { } + + protected RGBASpriteWidget(RGBASpriteWidget other) + : base(other) + { + GetSprite = other.GetSprite; + } + + public override Widget Clone() { return new RGBASpriteWidget(this); } + + public override void Draw() + { + var sprite = GetSprite(); + if (sprite != null) + Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, RenderOrigin); + } + } +}