Add support for rotatable tiles in map renderer (#37342)
* Initial commit * Fixyfixfix
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user