2021-02-09 14:36:48 +08:00
|
|
|
namespace Strawberry
|
|
|
|
{
|
|
|
|
public class Image : Component, IDraw
|
|
|
|
{
|
|
|
|
public Texture Texture;
|
|
|
|
public Point Offset;
|
|
|
|
public Point Origin;
|
|
|
|
public float Rotation;
|
|
|
|
public Vector Scale = .One;
|
|
|
|
|
|
|
|
public this(Texture texture, Point origin = .Zero, Point offset = .Zero)
|
|
|
|
{
|
|
|
|
Texture = texture;
|
|
|
|
Origin = origin;
|
|
|
|
Offset = offset;
|
|
|
|
}
|
|
|
|
|
2021-02-09 14:43:25 +08:00
|
|
|
public Point DrawPosition => Entity.Position + Offset;
|
2021-02-09 14:36:48 +08:00
|
|
|
|
|
|
|
public void Draw()
|
|
|
|
{
|
|
|
|
if (Texture != null)
|
2021-02-09 14:43:25 +08:00
|
|
|
Game.Batcher.Tex(Texture, DrawPosition, Origin, Scale, Rotation);
|
2021-02-09 14:36:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|