From 4ad4c4dfb0275bcf006fb3f426b5677d6a1d5a74 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 5 May 2011 16:26:40 +1200 Subject: [PATCH] Support contrast on labels --- OpenRA.Game/Widgets/LabelWidget.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 1a2ce21342..227e41e0f5 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -25,6 +25,7 @@ namespace OpenRA.Widgets public TextAlign Align = TextAlign.Left; public TextVAlign VAlign = TextVAlign.Middle; public bool Bold = false; + public bool Contrast = false; public bool WordWrap = false; public Func GetText; public Func GetBackground; @@ -42,6 +43,7 @@ namespace OpenRA.Widgets Text = other.Text; Align = other.Align; Bold = other.Bold; + Contrast = other.Contrast; GetText = other.GetText; GetBackground = other.GetBackground; } @@ -123,8 +125,11 @@ namespace OpenRA.Widgets text = string.Join("\n", newLines.ToArray()); } } - - font.DrawText(text, position, Color.White); + + if (Contrast) + font.DrawTextWithContrast(text, position, Color.White, Color.Black, 2); + else + font.DrawText(text, position, Color.White); } public override Widget Clone() { return new LabelWidget(this); }