Extract text contrast radius to ChromeMetrics and reduce to 1px.
This commit is contained in:
committed by
Matthias Mailänder
parent
7611449d3d
commit
f1325e12d4
@@ -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
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public bool Shadow = ChromeMetrics.Get<bool>("TextShadow");
|
||||
public Color ContrastColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
||||
public Color ContrastColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
||||
public int ContrastRadius = ChromeMetrics.Get<int>("TextContrastRadius");
|
||||
public bool WordWrap = false;
|
||||
public Func<string> GetText;
|
||||
public Func<Color> GetColor;
|
||||
@@ -56,6 +57,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Contrast = other.Contrast;
|
||||
ContrastColorDark = other.ContrastColorDark;
|
||||
ContrastColorLight = other.ContrastColorLight;
|
||||
ContrastRadius = other.ContrastRadius;
|
||||
Shadow = other.Shadow;
|
||||
WordWrap = other.WordWrap;
|
||||
GetText = other.GetText;
|
||||
@@ -100,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
var bgDark = GetContrastColorDark();
|
||||
var bgLight = GetContrastColorLight();
|
||||
if (Contrast)
|
||||
font.DrawTextWithContrast(text, position, color, bgDark, bgLight, 2);
|
||||
font.DrawTextWithContrast(text, position, color, bgDark, bgLight, ContrastRadius);
|
||||
else if (Shadow)
|
||||
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
|
||||
else
|
||||
|
||||
@@ -6,6 +6,7 @@ Metrics:
|
||||
ButtonTextContrast: false
|
||||
ButtonTextContrastColorDark: 000000
|
||||
ButtonTextContrastColorLight: 7F7F7F
|
||||
ButtonTextContrastRadius: 1
|
||||
ButtonTextShadow: false
|
||||
CheckboxPressedState: false
|
||||
GameStartedColor: FFA500
|
||||
@@ -31,6 +32,7 @@ Metrics:
|
||||
TextContrast: false
|
||||
TextContrastColorDark: 000000
|
||||
TextContrastColorLight: 7F7F7F
|
||||
TextContrastRadius: 1
|
||||
TextFont: Regular
|
||||
TextShadow: false
|
||||
TextfieldColor: FFFFFF
|
||||
|
||||
Reference in New Issue
Block a user