Clean up viewport internals.

This commit is contained in:
Paul Chote
2013-09-28 10:21:23 +12:00
parent 936bf98496
commit 919181e04d
13 changed files with 153 additions and 207 deletions

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Graphics
public void BeforeRender(WorldRenderer wr) {}
public void Render(WorldRenderer wr)
{
var screenPos = wr.Viewport.Zoom*(wr.ScreenPosition(pos) - wr.Viewport.Location) - 0.5f*font.Measure(text).ToFloat2();
var screenPos = wr.Viewport.Zoom*(wr.ScreenPosition(pos) - wr.Viewport.TopLeft.ToFloat2()) - 0.5f*font.Measure(text).ToFloat2();
var screenPxPos = new float2((float)Math.Round(screenPos.X), (float)Math.Round(screenPos.Y));
font.DrawTextWithContrast(text, screenPxPos, color, Color.Black, 1);
}