add contrast surround to timer & chat which are displayed straight over the world

This commit is contained in:
Chris Forbes
2011-01-08 12:10:29 +13:00
parent 303525a5ba
commit db63724aeb
6 changed files with 30 additions and 6 deletions

View File

@@ -69,6 +69,19 @@ namespace OpenRA.Graphics
}
}
public void DrawTextWithContrast(string text, float2 location, Color fg, Color bg, int offset)
{
if (offset > 0)
{
DrawText(text, location + new float2(-offset, 0), bg);
DrawText(text, location + new float2(offset, 0), bg);
DrawText(text, location + new float2(0, -offset), bg);
DrawText(text, location + new float2(0, offset), bg);
}
DrawText(text, location, fg);
}
public int2 Measure(string text)
{
return new int2((int)text.Split( '\n' ).Max( s => s.Sum(a => glyphs[Pair.New(a, Color.White)].Advance)), text.Split('\n').Count()*size);