mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2024-11-25 16:18:56 +08:00
Image scale/rotation works
This commit is contained in:
parent
9f1f04358b
commit
6e1c8c7558
|
@ -15,12 +15,12 @@ namespace Strawberry
|
||||||
Offset = offset;
|
Offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point DrawPosition => Entity.Position + Offset - Origin;
|
public Point DrawPosition => Entity.Position + Offset;
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
if (Texture != null)
|
if (Texture != null)
|
||||||
Game.Batcher.Tex(Texture, DrawPosition);
|
Game.Batcher.Tex(Texture, DrawPosition, Origin, Scale, Rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,12 +102,16 @@ namespace Strawberry
|
||||||
|
|
||||||
public void Tex(Texture texture, Vector pos, Vector origin, Vector scale, float rotation)
|
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,
|
PushQuad(.TextureTint, texture,
|
||||||
.Tex(.(pos.X, pos.Y), .(0, 0), Color.White),
|
.Tex(.(0, 0) * mat, .(0, 0), Color.White),
|
||||||
.Tex(.(pos.X + texture.Width, pos.Y), .(1, 0), Color.White),
|
.Tex(.(texture.Width, 0) * mat, .(1, 0), Color.White),
|
||||||
.Tex(.(pos.X + texture.Width, pos.Y + texture.Height), .(1, 1), Color.White),
|
.Tex(.(texture.Width, texture.Height) * mat, .(1, 1), Color.White),
|
||||||
.Tex(.(pos.X, pos.Y + texture.Height), .(0, 1), Color.White));
|
.Tex(.(0, texture.Height) * mat, .(0, 1), Color.White));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user