diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 8fdbd6bb77..82a67c82db 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -328,6 +328,7 @@ + diff --git a/OpenRA.Mods.RA/Widgets/SidebarButtonWidget.cs b/OpenRA.Mods.RA/Widgets/SidebarButtonWidget.cs new file mode 100644 index 0000000000..e9f0f42b97 --- /dev/null +++ b/OpenRA.Mods.RA/Widgets/SidebarButtonWidget.cs @@ -0,0 +1,45 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 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 System.Drawing; +using OpenRA.Graphics; +using OpenRA.Widgets; + +namespace OpenRA.Mods.RA +{ + public class SidebarButtonWidget : ButtonWidget + { + public string Image = ""; + + readonly World world; + [ObjectCreator.UseCtor] + public SidebarButtonWidget( [ObjectCreator.Param] World world ) + : base() + { + this.world = world; + } + + protected SidebarButtonWidget(SidebarButtonWidget widget) + : base(widget) + { + this.world = widget.world; + } + + public override void DrawInner() + { + var state = Depressed ? "pressed" : + RenderBounds.Contains(Viewport.LastMousePos) ? "hover" : "normal"; + + WidgetUtils.DrawRGBA(ChromeProvider.GetImage(Image + "-" + world.LocalPlayer.Country.Race, state), RenderOrigin); + } + } +} +