Replace use of Contrast with Shadow for ingame chat and support power timers

This commit is contained in:
Oliver Brakmann
2016-08-31 20:55:22 +02:00
parent 38c16e4f7a
commit 624e69e97b
4 changed files with 20 additions and 7 deletions

View File

@@ -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();