(d9894f840) Round UI text positions to integers, rendering at a fractional position makes them look messy

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:20:25 +03:00
parent 1e00493502
commit 09ddcc8436
4 changed files with 7 additions and 2 deletions
@@ -328,9 +328,13 @@ namespace Barotrauma
if (!string.IsNullOrEmpty(text))
{
Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset;
pos.X = (int)pos.X;
pos.Y = (int)pos.Y;
Font.DrawString(spriteBatch,
Wrap ? wrappedText : text,
rect.Location.ToVector2() + textPos + TextOffset,
pos,
textColor * (textColor.A / 255.0f),
0.0f, origin, TextScale,
SpriteEffects.None, textDepth);
@@ -208,7 +208,7 @@ namespace Barotrauma
for (int i = 0; i < lines.Length; i++)
{
GUI.Font.DrawString(spriteBatch, lines[i],
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f, GameMain.GraphicsHeight * 0.78f + i * lineHeight), Color.White);
new Vector2((int)(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f), (int)(GameMain.GraphicsHeight * 0.78f + i * lineHeight)), Color.White);
}
}