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\SpecialPowerBinWidget.cs" />
<Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" /> <Compile Include="Widgets\Delegates\MusicPlayerDelegate.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" /> <Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -51,22 +51,6 @@ namespace OpenRA.Widgets.Delegates
Game.Exit(); Game.Exit();
return true; 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); 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, 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) foreach (var item in PerfHistory.items.Values)
{ {

View File

@@ -151,7 +151,11 @@ namespace OpenRA.Widgets
return (T)GetWidget(id); 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) public Widget ShowMenu(string menu)
{ {

View File

@@ -248,19 +248,6 @@ Container:
Delegate:IngameChromeDelegate Delegate:IngameChromeDelegate
Visible:false Visible:false
Children: Children:
PerfGraph@PERFGRAPH:
Id:PERFGRAPH
X:10
Y:WINDOW_BOTTOM - 250
Width:200
Height:200
Label@PERFTEXT:
Id:PERFTEXT
Bold: false
X:10
Y:WINDOW_BOTTOM - 40
Width:200
Height:100
SpecialPowerBin@INGAME_POWERS_BIN: SpecialPowerBin@INGAME_POWERS_BIN:
Id:INGAME_POWERS_BIN Id:INGAME_POWERS_BIN
X:0 X:0
@@ -309,6 +296,29 @@ Container:
Width:160 Width:160
Height:25 Height:25
Text:Quit Text:Quit
Background@PERF_BG:
Id:PERF_BG
Background:dialog4
Delegate:PerfDebugDelegate
X:10
Y:WINDOW_BOTTOM - 250
Width: 210
Height: 250
Visible: true
Children:
PerfGraph@GRAPH:
Id:GRAPH
X:5
Y:5
Width:200
Height:200
Label@TEXT:
Id:TEXT
Bold: false
X:20
Y:210
Width:200
Height:100
Background@MUSIC_BG: Background@MUSIC_BG:
Id:MUSIC_BG Id:MUSIC_BG
Delegate:MusicPlayerDelegate Delegate:MusicPlayerDelegate