diff --git a/src/Components/Drawing/Image.bf b/src/Components/Drawing/Image.bf index 4749d0a..91ce458 100644 --- a/src/Components/Drawing/Image.bf +++ b/src/Components/Drawing/Image.bf @@ -15,12 +15,12 @@ namespace Strawberry Offset = offset; } - public Point DrawPosition => Entity.Position + Offset - Origin; + public Point DrawPosition => Entity.Position + Offset; public void Draw() { if (Texture != null) - Game.Batcher.Tex(Texture, DrawPosition); + Game.Batcher.Tex(Texture, DrawPosition, Origin, Scale, Rotation); } } } diff --git a/src/PlatformLayer/Batcher.bf b/src/PlatformLayer/Batcher.bf index 1185a8b..920e094 100644 --- a/src/PlatformLayer/Batcher.bf +++ b/src/PlatformLayer/Batcher.bf @@ -102,12 +102,16 @@ namespace Strawberry public void Tex(Texture texture, Vector pos, Vector origin, Vector scale, float rotation) { - //TODO! + Mat3x2 mat = Mat3x2.CreateTranslation(-origin) + * Mat3x2.CreateScale(scale) + * Mat3x2.CreateRotation(rotation) + * Mat3x2.CreateTranslation(pos); + PushQuad(.TextureTint, texture, - .Tex(.(pos.X, pos.Y), .(0, 0), Color.White), - .Tex(.(pos.X + texture.Width, pos.Y), .(1, 0), Color.White), - .Tex(.(pos.X + texture.Width, pos.Y + texture.Height), .(1, 1), Color.White), - .Tex(.(pos.X, pos.Y + texture.Height), .(0, 1), Color.White)); + .Tex(.(0, 0) * mat, .(0, 0), Color.White), + .Tex(.(texture.Width, 0) * mat, .(1, 0), Color.White), + .Tex(.(texture.Width, texture.Height) * mat, .(1, 1), Color.White), + .Tex(.(0, texture.Height) * mat, .(0, 1), Color.White)); } } }