Files
OpenRA/OpenRa.Game/SidebarItem.cs
Matthew Bowra-Dean 8a4c583882 Added grouping of items in sidebar + correct clock placement
Items in the sidebar are now grouped by their type and one of each item in the group can be 'built' at a time. Clock animation is now drawn on the items that are being built. Build time still not implemented. Behaviour after item built not correct.
2009-10-08 01:51:23 +13:00

36 lines
717 B
C#

using OpenRa.Game.Graphics;
using OpenRa.TechTree;
namespace OpenRa.Game
{
class SidebarItem
{
public readonly Item techTreeItem;
public readonly float2 location;
readonly Sprite sprite;
public SidebarItem(Sprite s, Item item, int y)
{
this.techTreeItem = item;
this.sprite = s;
location = new float2(item.IsStructure ? 0 : 64, y);
}
public bool Clicked(float2 p)
{
if (p.X < location.X || p.Y < location.Y)
return false;
if (p.X > location.X + 64 || p.Y > location.Y + 48)
return false;
return true;
}
public void Paint(SpriteRenderer renderer, float2 offset)
{
renderer.DrawSprite(sprite, location + offset, 0);
}
}
}