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 int RemoveTime = 0;
|
||||||
public readonly bool UseContrast = false;
|
public readonly bool UseContrast = false;
|
||||||
|
public readonly bool UseShadow = false;
|
||||||
public readonly Color BackgroundColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
public readonly Color BackgroundColorDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
|
||||||
public readonly Color BackgroundColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
public readonly Color BackgroundColorLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
|
||||||
public string Notification = "";
|
public string Notification = "";
|
||||||
@@ -58,12 +59,24 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
{
|
{
|
||||||
font.DrawTextWithContrast(owner, chatpos,
|
if (UseContrast)
|
||||||
line.Color, BackgroundColorDark, BackgroundColorLight, UseContrast ? 1 : 0);
|
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),
|
if (UseContrast)
|
||||||
Color.White, Color.Black, UseContrast ? 1 : 0);
|
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();
|
Game.Renderer.DisableScissor();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
foreach (var t in texts)
|
foreach (var t in texts)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[Font];
|
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;
|
y += (font.Measure(t.First).Y + 5) * (int)Order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Container@CHAT_PANEL:
|
|||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
RemoveTime: 250
|
RemoveTime: 250
|
||||||
UseContrast: yes
|
UseShadow: True
|
||||||
Container@CHAT_CHROME:
|
Container@CHAT_CHROME:
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Container@CHAT_PANEL:
|
|||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
RemoveTime: 250
|
RemoveTime: 250
|
||||||
UseContrast: yes
|
UseShadow: True
|
||||||
Container@CHAT_CHROME:
|
Container@CHAT_CHROME:
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
|
|||||||
Reference in New Issue
Block a user