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 bool Shadow = ChromeMetrics.Get<bool>("ButtonTextShadow");
|
||||||
public Color ContrastColorDark = ChromeMetrics.Get<Color>("ButtonTextContrastColorDark");
|
public Color ContrastColorDark = ChromeMetrics.Get<Color>("ButtonTextContrastColorDark");
|
||||||
public Color ContrastColorLight = ChromeMetrics.Get<Color>("ButtonTextContrastColorLight");
|
public Color ContrastColorLight = ChromeMetrics.Get<Color>("ButtonTextContrastColorLight");
|
||||||
|
public int ContrastRadius = ChromeMetrics.Get<int>("ButtonTextContrastRadius");
|
||||||
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||||
public string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
|
public string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
|
||||||
public bool Disabled = false;
|
public bool Disabled = false;
|
||||||
@@ -114,6 +115,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
GetColorDisabled = other.GetColorDisabled;
|
GetColorDisabled = other.GetColorDisabled;
|
||||||
ContrastColorDark = other.ContrastColorDark;
|
ContrastColorDark = other.ContrastColorDark;
|
||||||
ContrastColorLight = other.ContrastColorLight;
|
ContrastColorLight = other.ContrastColorLight;
|
||||||
|
ContrastRadius = other.ContrastRadius;
|
||||||
GetContrastColorDark = other.GetContrastColorDark;
|
GetContrastColorDark = other.GetContrastColorDark;
|
||||||
GetContrastColorLight = other.GetContrastColorLight;
|
GetContrastColorLight = other.GetContrastColorLight;
|
||||||
OnMouseDown = other.OnMouseDown;
|
OnMouseDown = other.OnMouseDown;
|
||||||
@@ -251,7 +253,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
DrawBackground(rb, disabled, Depressed, hover, highlighted);
|
DrawBackground(rb, disabled, Depressed, hover, highlighted);
|
||||||
if (Contrast)
|
if (Contrast)
|
||||||
font.DrawTextWithContrast(text, position + stateOffset,
|
font.DrawTextWithContrast(text, position + stateOffset,
|
||||||
disabled ? colordisabled : color, bgDark, bgLight, 2);
|
disabled ? colordisabled : color, bgDark, bgLight, ContrastRadius);
|
||||||
else if (Shadow)
|
else if (Shadow)
|
||||||
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
|
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public bool Shadow = ChromeMetrics.Get<bool>("TextShadow");
|
public bool Shadow = ChromeMetrics.Get<bool>("TextShadow");
|
||||||
public Color ContrastColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
public Color ContrastColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
||||||
public Color ContrastColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
public Color ContrastColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
||||||
|
public int ContrastRadius = ChromeMetrics.Get<int>("TextContrastRadius");
|
||||||
public bool WordWrap = false;
|
public bool WordWrap = false;
|
||||||
public Func<string> GetText;
|
public Func<string> GetText;
|
||||||
public Func<Color> GetColor;
|
public Func<Color> GetColor;
|
||||||
@@ -56,6 +57,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
Contrast = other.Contrast;
|
Contrast = other.Contrast;
|
||||||
ContrastColorDark = other.ContrastColorDark;
|
ContrastColorDark = other.ContrastColorDark;
|
||||||
ContrastColorLight = other.ContrastColorLight;
|
ContrastColorLight = other.ContrastColorLight;
|
||||||
|
ContrastRadius = other.ContrastRadius;
|
||||||
Shadow = other.Shadow;
|
Shadow = other.Shadow;
|
||||||
WordWrap = other.WordWrap;
|
WordWrap = other.WordWrap;
|
||||||
GetText = other.GetText;
|
GetText = other.GetText;
|
||||||
@@ -100,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var bgDark = GetContrastColorDark();
|
var bgDark = GetContrastColorDark();
|
||||||
var bgLight = GetContrastColorLight();
|
var bgLight = GetContrastColorLight();
|
||||||
if (Contrast)
|
if (Contrast)
|
||||||
font.DrawTextWithContrast(text, position, color, bgDark, bgLight, 2);
|
font.DrawTextWithContrast(text, position, color, bgDark, bgLight, ContrastRadius);
|
||||||
else if (Shadow)
|
else if (Shadow)
|
||||||
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
|
font.DrawTextWithShadow(text, position, color, bgDark, bgLight, 1);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Metrics:
|
|||||||
ButtonTextContrast: false
|
ButtonTextContrast: false
|
||||||
ButtonTextContrastColorDark: 000000
|
ButtonTextContrastColorDark: 000000
|
||||||
ButtonTextContrastColorLight: 7F7F7F
|
ButtonTextContrastColorLight: 7F7F7F
|
||||||
|
ButtonTextContrastRadius: 1
|
||||||
ButtonTextShadow: false
|
ButtonTextShadow: false
|
||||||
CheckboxPressedState: false
|
CheckboxPressedState: false
|
||||||
GameStartedColor: FFA500
|
GameStartedColor: FFA500
|
||||||
@@ -31,6 +32,7 @@ Metrics:
|
|||||||
TextContrast: false
|
TextContrast: false
|
||||||
TextContrastColorDark: 000000
|
TextContrastColorDark: 000000
|
||||||
TextContrastColorLight: 7F7F7F
|
TextContrastColorLight: 7F7F7F
|
||||||
|
TextContrastRadius: 1
|
||||||
TextFont: Regular
|
TextFont: Regular
|
||||||
TextShadow: false
|
TextShadow: false
|
||||||
TextfieldColor: FFFFFF
|
TextfieldColor: FFFFFF
|
||||||
|
|||||||
Reference in New Issue
Block a user