diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index d4546a9890..5f454f14fe 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2013 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, @@ -23,10 +23,10 @@ namespace OpenRA.Widgets [Translate] public string Text = null; public TextAlign Align = TextAlign.Left; public TextVAlign VAlign = TextVAlign.Middle; - public string Font = "Regular"; - public Color Color = Color.White; - public bool Contrast = false; - public Color ContrastColor = Color.Black; + public string Font = ChromeMetrics.Get("TextFont"); + public Color TextColor = ChromeMetrics.Get("TextColor"); + public bool Contrast = ChromeMetrics.Get("TextContrast"); + public Color ContrastColor = ChromeMetrics.Get("TextContrastColor"); public bool WordWrap = false; public Func GetText; public Func GetColor; @@ -35,7 +35,7 @@ namespace OpenRA.Widgets public LabelWidget() { GetText = () => Text; - GetColor = () => Color; + GetColor = () => TextColor; GetContrastColor = () => ContrastColor; } @@ -45,7 +45,7 @@ namespace OpenRA.Widgets Text = other.Text; Align = other.Align; Font = other.Font; - Color = other.Color; + TextColor = other.TextColor; Contrast = other.Contrast; ContrastColor = other.ContrastColor; WordWrap = other.WordWrap; diff --git a/OpenRA.Game/Widgets/TimerWidget.cs b/OpenRA.Game/Widgets/TimerWidget.cs index e66bbc2611..41dade46c6 100644 --- a/OpenRA.Game/Widgets/TimerWidget.cs +++ b/OpenRA.Game/Widgets/TimerWidget.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2013 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, @@ -8,20 +8,28 @@ */ #endregion +using System; using System.Drawing; +using OpenRA.FileFormats; +using OpenRA.Graphics; namespace OpenRA.Widgets { - public class TimerWidget : Widget + public class TimerWidget : LabelWidget { public override void Draw() { - var font = Game.Renderer.Fonts["Title"]; + SpriteFont font = Game.Renderer.Fonts[Font]; var rb = RenderBounds; + var color = GetColor(); + var contrast = GetContrastColor(); var s = WidgetUtils.FormatTime(Game.LocalTick) + (Game.orderManager.world.Paused?" (paused)":""); var pos = new float2(rb.Left - font.Measure(s).X / 2, rb.Top); - font.DrawTextWithContrast(s, pos, Color.White, Color.Black, 1); + if (Contrast) + font.DrawTextWithContrast(s, pos, color, contrast, 1); + else + font.DrawText(s, pos, color); } } } diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 3533a7f621..fa94cd273f 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -4,6 +4,8 @@ Container@INGAME_ROOT: Timer@GAME_TIMER: X: WINDOW_RIGHT/2 Y: 0 + Font: Title + Contrast: true StrategicProgress@STRATEGIC_PROGRESS: X: WINDOW_RIGHT/2 Y: 40 diff --git a/mods/cnc/metrics.yaml b/mods/cnc/metrics.yaml index 80121ae959..9cff61744d 100644 --- a/mods/cnc/metrics.yaml +++ b/mods/cnc/metrics.yaml @@ -4,4 +4,8 @@ Metrics: ButtonDepth: 0 ButtonFont: Bold CheckboxPressedState: true + TextFont: Regular + TextColor: 255,255,255 + TextContrast: false + TextContrastColor: 0,0,0 ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190 \ No newline at end of file diff --git a/mods/d2k/chrome/ingame.yaml b/mods/d2k/chrome/ingame.yaml index 3d1dd5e046..92876a52a9 100644 --- a/mods/d2k/chrome/ingame.yaml +++ b/mods/d2k/chrome/ingame.yaml @@ -20,6 +20,8 @@ Container@INGAME_ROOT: Timer@GAME_TIMER: X: WINDOW_RIGHT/2 Y: 0 + Font: Title + Contrast: true StrategicProgress@STRATEGIC_PROGRESS: X: WINDOW_RIGHT/2 Y: 40 diff --git a/mods/d2k/metrics.yaml b/mods/d2k/metrics.yaml index c88a8055d8..22430341c3 100644 --- a/mods/d2k/metrics.yaml +++ b/mods/d2k/metrics.yaml @@ -4,4 +4,8 @@ Metrics: ButtonDepth: 1 ButtonFont: Regular CheckboxPressedState: false + TextFont: Regular + TextColor: 255,255,255 + TextContrast: false + TextContrastColor: 0,0,0 ColorPickerRemapIndices: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240 diff --git a/mods/ra/chrome/ingame.yaml b/mods/ra/chrome/ingame.yaml index 21280cc850..233cb833ea 100644 --- a/mods/ra/chrome/ingame.yaml +++ b/mods/ra/chrome/ingame.yaml @@ -20,6 +20,8 @@ Container@INGAME_ROOT: Timer@GAME_TIMER: X: WINDOW_RIGHT/2 Y: 0-10 + Font: Title + Contrast: true StrategicProgress@STRATEGIC_PROGRESS: X: WINDOW_RIGHT/2 Y: 40 diff --git a/mods/ra/metrics.yaml b/mods/ra/metrics.yaml index e5ae5dd388..f9f698467d 100644 --- a/mods/ra/metrics.yaml +++ b/mods/ra/metrics.yaml @@ -4,4 +4,8 @@ Metrics: ButtonDepth: 1 ButtonFont: Regular CheckboxPressedState: false + TextFont: Regular + TextColor: 255,255,255 + TextContrast: false + TextContrastColor: 0,0,0 ColorPickerRemapIndices: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 diff --git a/mods/ts/metrics.yaml b/mods/ts/metrics.yaml index c9c34371f2..d016b5aab9 100644 --- a/mods/ts/metrics.yaml +++ b/mods/ts/metrics.yaml @@ -4,4 +4,8 @@ Metrics: ButtonDepth: 1 ButtonFont: Regular CheckboxPressedState: false + TextFont: Regular + TextColor: 255,255,255 + TextContrast: false + TextContrastColor: 0,0,0 ColorPickerRemapIndices: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31