add a tiny font; add labels in PerfGraphWidget

This commit is contained in:
Chris Forbes
2010-12-28 17:24:20 +13:00
parent 6425fc8a4b
commit ae1710896a
2 changed files with 19 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Graphics
public ITexture PaletteTexture; public ITexture PaletteTexture;
public readonly SpriteFont RegularFont, BoldFont, TitleFont; public readonly SpriteFont RegularFont, BoldFont, TitleFont, TinyFont;
internal const int TempBufferSize = 8192; internal const int TempBufferSize = 8192;
const int TempBufferCount = 8; const int TempBufferCount = 8;
@@ -59,6 +59,7 @@ namespace OpenRA.Graphics
RegularFont = new SpriteFont("FreeSans.ttf", 14); RegularFont = new SpriteFont("FreeSans.ttf", 14);
BoldFont = new SpriteFont("FreeSansBold.ttf", 14); BoldFont = new SpriteFont("FreeSansBold.ttf", 14);
TitleFont = new SpriteFont("titles.ttf", 48); TitleFont = new SpriteFont("titles.ttf", 48);
TinyFont = new SpriteFont("FreeSans.ttf", 10);
for( int i = 0 ; i < TempBufferCount ; i++ ) for( int i = 0 ; i < TempBufferCount ; i++ )
{ {

View File

@@ -28,6 +28,7 @@ namespace OpenRA.Widgets
Game.Renderer.LineRenderer.DrawLine(origin, origin + new float2(100, 0) * basis, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(origin, origin + new float2(100, 0) * basis, Color.White, Color.White);
Game.Renderer.LineRenderer.DrawLine(origin + new float2(100, 0) * basis, origin + new float2(100, 100) * basis, Color.White, Color.White); Game.Renderer.LineRenderer.DrawLine(origin + new float2(100, 0) * basis, origin + new float2(100, 100) * basis, Color.White, Color.White);
int k = 0;
foreach (var item in PerfHistory.items.Values) foreach (var item in PerfHistory.items.Values)
{ {
int n = 0; int n = 0;
@@ -40,6 +41,22 @@ namespace OpenRA.Widgets
++n; ++n;
return b; return b;
}); });
var u = Game.viewport.Location + new float2(rect.Left, rect.Top);
Game.Renderer.LineRenderer.DrawLine(
u + new float2(10, 10 * k + 5),
u + new float2(12, 10 * k + 5),
item.c, item.c);
Game.Renderer.LineRenderer.DrawLine(
u + new float2(10, 10 * k + 4),
u + new float2(12, 10 * k + 4),
item.c, item.c);
Game.Renderer.TinyFont.DrawText(item.Name, new float2(rect.Left, rect.Top) + new float2(18, 10 * k - 3), Color.White);
Game.Renderer.Flush();
++k;
} }
} }
} }