From 69b4b541d2828dc7753f192ac761755f0be2507d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 15 Oct 2017 11:33:34 +0100 Subject: [PATCH] Fix mutable use of float2 in SpriteFont. --- OpenRA.Game/Graphics/SpriteFont.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index 5a67268cc3..4514115854 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -70,14 +70,15 @@ namespace OpenRA.Graphics public void DrawText(string text, float2 location, Color c) { - location.Y += size; // baseline vs top + // Offset from the baseline position to the top-left of the glyph for rendering + location += new float2(0, size); var p = location; foreach (var s in text) { if (s == '\n') { - location.Y += size; + location += new float2(0, size); p = location; continue; } @@ -88,7 +89,8 @@ namespace OpenRA.Graphics (int)Math.Round(p.X * deviceScale + g.Offset.X, 0) / deviceScale, p.Y + g.Offset.Y / deviceScale), g.Sprite.Size / deviceScale); - p.X += g.Advance / deviceScale; + + p += new float2(g.Advance / deviceScale, 0); } }