Add support for rotatable tiles in map renderer (#37342)

* Initial commit

* Fixyfixfix
This commit is contained in:
SlamBamActionman
2025-05-15 02:12:14 +02:00
committed by GitHub
parent 8fab6556e2
commit cba88dc2dc

View File

@@ -54,7 +54,27 @@ namespace Content.MapRenderer.Painters
var x = (int) (tile.X + xOffset + customOffset.X);
var y = (int) (tile.Y + yOffset + customOffset.Y);
var image = images[path][tile.Tile.Variant];
var image = images[path][tile.Tile.Variant].CloneAs<Rgba32>();
switch (tile.Tile.RotationMirroring % 4)
{
case 0:
break;
case 1:
image.Mutate(o => o.Rotate(90f));
break;
case 2:
image.Mutate(o => o.Rotate(180f));
break;
case 3:
image.Mutate(o => o.Rotate(270f));
break;
}
if (tile.Tile.RotationMirroring > 3)
{
image.Mutate(o => o.Flip(FlipMode.Horizontal));
}
gridCanvas.Mutate(o => o.DrawImage(image, new Point(x * tileSize, y * tileSize), 1));