don't overlay the timer on the perf widget; make it big; measure game time, not wallclock time

This commit is contained in:
Chris Forbes
2010-07-15 20:55:01 +12:00
parent 69f499936b
commit 2622ee7171
3 changed files with 11 additions and 13 deletions

View File

@@ -29,7 +29,6 @@ namespace OpenRA.Widgets.Delegates
var optionsBG = gameRoot.GetWidget("INGAME_OPTIONS_BG");
Game.OnGameStart += () => r.OpenWindow("INGAME_ROOT");
Game.OnGameStart += () => gameRoot.GetWidget<TimerWidget>("GAME_TIMER").Stopwatch.Reset();
r.GetWidget("INGAME_OPTIONS_BUTTON").OnMouseUp = mi => {
optionsBG.Visible = !optionsBG.Visible;

View File

@@ -1,4 +1,3 @@
using System;
using System.Drawing;
using OpenRA.Support;
@@ -10,17 +9,17 @@ namespace OpenRA.Widgets
public TimerWidget ()
{
Stopwatch = new Stopwatch();
IsVisible = () => Game.Settings.ShowGameTimer;
}
public override void DrawInner (World world)
{
var s = WorldUtils.FormatTime((int) Stopwatch.ElapsedTime() * 25);
var size = Game.chrome.renderer.RegularFont.Measure(s);
var padding = 5;
WidgetUtils.DrawPanel("dialog4",new Rectangle(RenderBounds.Top - padding, RenderBounds.Left - padding, size.X + 2*padding, size.Y + 2*padding));
Game.chrome.renderer.RegularFont.DrawText(s, new float2(RenderBounds.Top, RenderBounds.Left), Color.White);
}
public override void DrawInner(World world)
{
var s = WorldUtils.FormatTime(Game.LocalTick);
var f = Game.chrome.renderer.TitleFont;
var size = f.Measure(s);
// var padding = 5;
// WidgetUtils.DrawPanel("dialog4", new Rectangle(RenderBounds.Left - padding, RenderBounds.Top - padding, size.X + 2 * padding, size.Y + 2 * padding));
f.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White);
}
}
}

View File

@@ -7,7 +7,7 @@ Container@ROOT:
Children:
Timer@GAME_TIMER:
Id:GAME_TIMER
X: WINDOW_BOTTOM - 30
X: WINDOW_RIGHT/2
Y: 10
PostGame@POSTGAME_TEXT:
Id:POSTGAME_TEXT