Vector.Transform. Batcher Matrix Stack. Image component

This commit is contained in:
Maddy Thorson
2021-02-08 22:36:48 -08:00
parent ccf4db2f9f
commit 9f1f04358b
4 changed files with 189 additions and 48 deletions

View File

@ -0,0 +1,26 @@
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;
}
public Point DrawPosition => Entity.Position + Offset - Origin;
public void Draw()
{
if (Texture != null)
Game.Batcher.Tex(Texture, DrawPosition);
}
}
}