merged RA/CncPerfDebugLogic

separate text and graph, fixes #3491
small repositions to fit with other widgets
This commit is contained in:
Matthias Mailänder
2013-08-08 23:09:48 +02:00
parent 3ae173394b
commit 03a0640f65
8 changed files with 64 additions and 88 deletions

View File

@@ -97,7 +97,6 @@
<Compile Include="Widgets\Logic\CncInstallFromCDLogic.cs" />
<Compile Include="Widgets\Logic\CncInstallLogic.cs" />
<Compile Include="Widgets\Logic\CncMenuLogic.cs" />
<Compile Include="Widgets\Logic\CncPerfDebugLogic.cs" />
<Compile Include="Widgets\Logic\CncSettingsLogic.cs" />
<Compile Include="Widgets\Logic\ProductionTooltipLogic.cs" />
<Compile Include="Widgets\Logic\SupportPowerTooltipLogic.cs" />

View File

@@ -1,33 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets.Logic
{
public class CncPerfDebugLogic
{
[ObjectCreator.UseCtor]
public CncPerfDebugLogic(Widget widget)
{
// Performance info
var perfRoot = widget.Get("PERFORMANCE_INFO");
perfRoot.IsVisible = () => Game.Settings.Debug.PerfGraph;
var text = perfRoot.Get<LabelWidget>("PERF_TEXT");
text.IsVisible = () => Game.Settings.Debug.PerfText;
text.GetText = () =>
"Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F(
Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
PerfHistory.items["batches"].LastValue);
}
}
}