code cleanup

This commit is contained in:
Michele 2021-02-04 14:45:40 +00:00
parent 47ea480b18
commit 85274034f3

View File

@ -800,14 +800,14 @@ namespace Sledgemapper
var fscale = 1.2f;
var width = Math.Abs((endposX - posX));
var height = Math.Abs((posY - endposY));
var tilesWidth = width / (double)_state.TileSize;
var tilesWidth = width / (double)_state.TileSize;
var tilesHeight = height / (double)_state.TileSize;
tilesWidth = Math.Round(tilesWidth * 2, MidpointRounding.AwayFromZero) / 2;
tilesHeight = Math.Round(tilesHeight * 2, MidpointRounding.AwayFromZero) / 2;
var xmeasure = ffont.MeasureString($"{tilesWidth}");
var ymeasure = ffont.MeasureString($"{tilesHeight}");
float widthX = 0, widthY = 0, heightX = 0, heightY = 0;
Rectangle area = new Rectangle();
if (posX != endposX && posY != endposY)
{
@ -829,7 +829,7 @@ namespace Sledgemapper
widthY = posY - ymeasure.Y * 1.2f;
heightX = endposX + xmeasure.X / 2;
heightY = posY + (height/ 2) - ymeasure.Y / 2;
heightY = posY + (height / 2) - ymeasure.Y / 2;
}
}
else
@ -873,16 +873,16 @@ namespace Sledgemapper
0);
_spriteBatch.DrawString(ffont,
$"{tilesHeight}",
new Vector2(
heightX, heightY
),
Color.Red,
0,
Vector2.Zero,
fscale,
SpriteEffects.None,
0);
$"{tilesHeight}",
new Vector2(
heightX, heightY
),
Color.Red,
0,
Vector2.Zero,
fscale,
SpriteEffects.None,
0);
}
}