
Untitled
By: a guest on
May 7th, 2012 | syntax:
C# | size: 0.83 KB | hits: 20 | expires: Never
public class DrawableComponent : Component
{
Entity entity;
public Texture2D Texture
{
get;
set;
}
public Color TextureColor
{
get;
set;
}
public DrawableComponent(Entity e)
: base(e)
{
TextureColor = Color.White;
}
public DrawableComponent(Entity e, Texture2D t)
: base(e)
{
Texture = t;
TextureColor = Color.White;
}
public void Draw(GameTime gameTime)
{
Rectangle targetRectangle = new Rectangle(entity.posX, entity.posY, Texture.Width, Texture.Height);
entity.spritebatch.Draw(Texture, targetRectangle, TextureColor);
}
}