Perf info in main menu

This commit is contained in:
Paul Chote
2010-04-11 15:41:43 +12:00
parent 1441d9b2f1
commit 1646f202d5
5 changed files with 30 additions and 31 deletions

View File

@@ -298,6 +298,7 @@
<Compile Include="Widgets\SpecialPowerBinWidget.cs" />
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -51,22 +51,6 @@ namespace OpenRA.Widgets.Delegates
Game.Exit();
return true;
};
// Perf text
var perfText = gameRoot.GetWidget<LabelWidget>("PERFTEXT");
perfText.GetText = () => {
return "RenderFrame {0} ({2:F1} ms)\nTick {4}/ Net{1} ({3:F1} ms)".F(
Game.RenderFrame,
Game.orderManager.FrameNumber,
PerfHistory.items["render"].LastValue,
PerfHistory.items["tick_time"].LastValue,
Game.LocalTick);
};
perfText.IsVisible = () => {return (perfText.Visible && Game.Settings.PerfText);};
// Perf graph
var perfGraph = gameRoot.GetWidget("PERFGRAPH");
perfGraph.IsVisible = () => {return (perfGraph.Visible && Game.Settings.PerfGraph);};
}
}
}

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Widgets
float2 basis = new float2(-Bounds.Width/100,-Bounds.Height/100);
Game.chrome.lineRenderer.DrawLine(origin, origin + new float2(100, 0) * basis, Color.White, Color.White);
Game.chrome.lineRenderer.DrawLine(origin + new float2(100,0) * basis, origin + new float2(100,70) * basis, Color.White, Color.White);
Game.chrome.lineRenderer.DrawLine(origin + new float2(100,0) * basis, origin + new float2(100,100) * basis, Color.White, Color.White);
foreach (var item in PerfHistory.items.Values)
{

View File

@@ -151,7 +151,11 @@ namespace OpenRA.Widgets
return (T)GetWidget(id);
}
public Widget GetCurrentMenu() { return Children.FirstOrDefault(c => c.Visible); }
public Widget GetCurrentMenu()
{
// HACK HACK HACK (this method will vanish soon, so not going to hack the widget yaml itself)
return Children.FirstOrDefault(c => c.Visible && c.Id != "MUSIC_BG" && c.Id != "PERF_BG");
}
public Widget ShowMenu(string menu)
{