git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1339 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
37
OpenRa.Game/SidebarItem.cs
Normal file
37
OpenRa.Game/SidebarItem.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user