Extract text contrast radius to ChromeMetrics and reduce to 1px.

This commit is contained in:
Paul Chote
2020-01-12 15:36:36 +00:00
committed by Matthias Mailänder
parent 7611449d3d
commit f1325e12d4
3 changed files with 8 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
public bool Shadow = ChromeMetrics.Get<bool>("ButtonTextShadow");
public Color ContrastColorDark = ChromeMetrics.Get<Color>("ButtonTextContrastColorDark");
public Color ContrastColorLight = ChromeMetrics.Get<Color>("ButtonTextContrastColorLight");
public int ContrastRadius = ChromeMetrics.Get<int>("ButtonTextContrastRadius");
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
public string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
public bool Disabled = false;
@@ -114,6 +115,7 @@ namespace OpenRA.Mods.Common.Widgets
GetColorDisabled = other.GetColorDisabled;
ContrastColorDark = other.ContrastColorDark;
ContrastColorLight = other.ContrastColorLight;
ContrastRadius = other.ContrastRadius;
GetContrastColorDark = other.GetContrastColorDark;
GetContrastColorLight = other.GetContrastColorLight;
OnMouseDown = other.OnMouseDown;
@@ -251,7 +253,7 @@ namespace OpenRA.Mods.Common.Widgets
DrawBackground(rb, disabled, Depressed, hover, highlighted);
if (Contrast)
font.DrawTextWithContrast(text, position + stateOffset,
disabled ? colordisabled : color, bgDark, bgLight, 2);
disabled ? colordisabled : color, bgDark, bgLight, ContrastRadius);
else if (Shadow)
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
else