perf stuff is a bit nicer; render time shown
This commit is contained in:
@@ -85,8 +85,7 @@ namespace OpenRa.Game
|
||||
PlaySound("intro.aud", false);
|
||||
|
||||
skipMakeAnims = false;
|
||||
|
||||
sw = new Stopwatch();
|
||||
PerfHistory.items["render"].hasNormalTick = false;
|
||||
}
|
||||
|
||||
static void LoadMapBuildings( IniFile mapfile )
|
||||
@@ -148,8 +147,6 @@ namespace OpenRa.Game
|
||||
public static double TickTime = 0.0;
|
||||
public static double OreTime = 0.0;
|
||||
|
||||
public static Stopwatch sw;
|
||||
|
||||
public static void Tick()
|
||||
{
|
||||
int t = Environment.TickCount;
|
||||
@@ -158,7 +155,6 @@ namespace OpenRa.Game
|
||||
{
|
||||
using (new PerfSample("tick_time"))
|
||||
{
|
||||
sw.Reset();
|
||||
lastTime += timestep;
|
||||
|
||||
if (orderManager.Tick())
|
||||
@@ -178,18 +174,20 @@ namespace OpenRa.Game
|
||||
foreach (var player in players.Values)
|
||||
player.Tick();
|
||||
}
|
||||
|
||||
TickTime = sw.ElapsedTime();
|
||||
}
|
||||
|
||||
PerfHistory.Tick();
|
||||
}
|
||||
|
||||
sw.Reset();
|
||||
using (new PerfSample("render"))
|
||||
{
|
||||
|
||||
++RenderFrame;
|
||||
viewport.cursor = controller.ChooseCursor();
|
||||
viewport.DrawRegions();
|
||||
RenderTime = sw.ElapsedTime();
|
||||
}
|
||||
|
||||
PerfHistory.items["render"].Tick();
|
||||
}
|
||||
|
||||
public static bool IsCellBuildable(int2 a, UnitMovementType umt)
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
terrainRenderer.Draw( Game.viewport );
|
||||
terrainRenderer.Draw(Game.viewport);
|
||||
|
||||
var rect = new RectangleF((region.Position + Game.viewport.Location).ToPointF(),
|
||||
region.Size.ToSizeF());
|
||||
|
||||
foreach (Actor a in Game.world.Actors.OrderBy( u => u.CenterLocation.Y ))
|
||||
foreach (Actor a in Game.world.Actors.OrderBy(u => u.CenterLocation.Y))
|
||||
DrawSpriteList(rect, a.Render());
|
||||
|
||||
foreach (var a in Game.world.Actors
|
||||
@@ -94,18 +94,17 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
|
||||
if (uog != null)
|
||||
foreach( var a in uog.selection )
|
||||
foreach (var a in uog.selection)
|
||||
DrawSelectionBox(a, Color.White, true);
|
||||
|
||||
lineRenderer.Flush();
|
||||
|
||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nPower {7}\nTiles Expanded {6:F0}",
|
||||
Game.RenderFrame, Game.orderManager.FrameNumber,
|
||||
Game.RenderTime * 1000,
|
||||
Game.TickTime * 1000,
|
||||
Game.OreTime * 1000,
|
||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\n$ {4}\nPower {5}",
|
||||
Game.RenderFrame,
|
||||
Game.orderManager.FrameNumber,
|
||||
PerfHistory.items["render"].LastValue,
|
||||
PerfHistory.items["tick_time"].LastValue,
|
||||
Game.LocalPlayer.Cash,
|
||||
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
||||
Game.LocalPlayer.GetTotalPower()
|
||||
), new int2(5, 5), Color.White);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace OpenRa.Game.Support
|
||||
public static void Tick()
|
||||
{
|
||||
foreach (var item in items.Values)
|
||||
if (item.hasNormalTick)
|
||||
item.Tick();
|
||||
}
|
||||
|
||||
@@ -65,6 +66,7 @@ namespace OpenRa.Game.Support
|
||||
public double[] samples = new double[100];
|
||||
public double val = 0.0;
|
||||
int head = 1, tail = 0;
|
||||
public bool hasNormalTick = true;
|
||||
|
||||
public PerfItem(string name, Color c)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user