Replace use of Contrast with Shadow for ingame chat and support power timers
This commit is contained in:
@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
public readonly int RemoveTime = 0;
|
||||
public readonly bool UseContrast = false;
|
||||
public readonly bool UseShadow = false;
|
||||
public readonly Color BackgroundColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
||||
public readonly Color BackgroundColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
||||
public string Notification = "";
|
||||
@@ -58,12 +59,24 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (owner != null)
|
||||
{
|
||||
font.DrawTextWithContrast(owner, chatpos,
|
||||
line.Color, BackgroundColorDark, BackgroundColorLight, UseContrast ? 1 : 0);
|
||||
if (UseContrast)
|
||||
font.DrawTextWithContrast(owner, chatpos,
|
||||
line.Color, BackgroundColorDark, BackgroundColorLight, 1);
|
||||
else if (UseShadow)
|
||||
font.DrawTextWithShadow(owner, chatpos,
|
||||
line.Color, BackgroundColorDark, BackgroundColorLight, 1);
|
||||
else
|
||||
font.DrawText(owner, chatpos, line.Color);
|
||||
}
|
||||
|
||||
font.DrawTextWithContrast(text, chatpos + new int2(inset, 0),
|
||||
Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||
if (UseContrast)
|
||||
font.DrawTextWithContrast(text, chatpos + new int2(inset, 0),
|
||||
Color.White, Color.Black, 1);
|
||||
else if (UseShadow)
|
||||
font.DrawTextWithShadow(text, chatpos + new int2(inset, 0),
|
||||
Color.White, Color.Black, 1);
|
||||
else
|
||||
font.DrawText(text, chatpos + new int2(inset, 0), Color.White);
|
||||
}
|
||||
|
||||
Game.Renderer.DisableScissor();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
foreach (var t in texts)
|
||||
{
|
||||
var font = Game.Renderer.Fonts[Font];
|
||||
font.DrawTextWithContrast(t.First, new float2(Bounds.Location) + new float2(0, y), t.Second, bgDark, bgLight, 1);
|
||||
font.DrawTextWithShadow(t.First, new float2(Bounds.Location) + new float2(0, y), t.Second, bgDark, bgLight, 1);
|
||||
y += (font.Measure(t.First).Y + 5) * (int)Order;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ Container@CHAT_PANEL:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
RemoveTime: 250
|
||||
UseContrast: yes
|
||||
UseShadow: True
|
||||
Container@CHAT_CHROME:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
|
||||
@@ -14,7 +14,7 @@ Container@CHAT_PANEL:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
RemoveTime: 250
|
||||
UseContrast: yes
|
||||
UseShadow: True
|
||||
Container@CHAT_CHROME:
|
||||
Width: PARENT_RIGHT
|
||||
Height: PARENT_BOTTOM
|
||||
|
||||
Reference in New Issue
Block a user