Files
OpenRA/OpenRA.Game/Widgets/TimerWidget.cs
2012-05-16 19:04:43 +02:00

35 lines
972 B
C#

#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 System.Drawing;
namespace OpenRA.Widgets
{
public class TimerWidget : Widget
{
public override void Draw()
{
var font = Game.Renderer.Fonts["Title"];
var rb = RenderBounds;
var s = WidgetUtils.FormatTime(Game.LocalTick);
var pos = new float2(rb.Left - font.Measure(s).X / 2, rb.Top);
var s_paused = (Game.orderManager.GamePaused ? "\n (paused)" : "");
var pos_paused = new float2(rb.Left - font.Measure(s_paused).X / 2, rb.Top+1);
font.DrawTextWithContrast(s, pos, Color.White, Color.Black, 1);
font.DrawTextWithContrast(s_paused, pos_paused, Color.White, Color.Black, 1);
}
}
}