mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-07-06 20:45:26 +08:00
Vector.Transform. Batcher Matrix Stack. Image component
This commit is contained in:
26
src/Components/Drawing/Image.bf
Normal file
26
src/Components/Drawing/Image.bf
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user