add contrast surround to timer & chat which are displayed straight over the world
This commit is contained in:
@@ -18,6 +18,7 @@ namespace OpenRA.Widgets
|
||||
public class ChatDisplayWidget : Widget
|
||||
{
|
||||
public readonly int RemoveTime = 0;
|
||||
public readonly bool UseContrast = false;
|
||||
|
||||
const int logLength = 9;
|
||||
public string Notification = "";
|
||||
@@ -52,10 +53,13 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
var owner = line.Owner + ":";
|
||||
inset = Game.Renderer.RegularFont.Measure(owner).X + 10;
|
||||
Game.Renderer.RegularFont.DrawText(owner, chatpos, line.Color);
|
||||
|
||||
Game.Renderer.RegularFont.DrawTextWithContrast(owner, chatpos,
|
||||
line.Color, Color.Black, UseContrast ? 1 : 0);
|
||||
}
|
||||
|
||||
Game.Renderer.RegularFont.DrawText(line.Text, chatpos + new int2(inset, 0), Color.White);
|
||||
Game.Renderer.RegularFont.DrawTextWithContrast(line.Text, chatpos + new int2(inset, 0),
|
||||
Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||
}
|
||||
|
||||
Game.Renderer.DisableScissor();
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace OpenRA.Widgets
|
||||
string content = "";
|
||||
bool composing = false;
|
||||
bool teamChat = false;
|
||||
public readonly bool UseContrast = false;
|
||||
|
||||
readonly OrderManager orderManager;
|
||||
[ObjectCreator.UseCtor]
|
||||
@@ -40,8 +41,8 @@ namespace OpenRA.Widgets
|
||||
var text = teamChat ? "Chat (Team): " : "Chat (All): ";
|
||||
var w = Game.Renderer.BoldFont.Measure(text).X;
|
||||
|
||||
Game.Renderer.BoldFont.DrawText(text, RenderOrigin + new float2(3, 7), Color.White);
|
||||
Game.Renderer.RegularFont.DrawText(content, RenderOrigin + new float2(3 + w, 7), Color.White);
|
||||
Game.Renderer.BoldFont.DrawTextWithContrast(text, RenderOrigin + new float2(3, 7), Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||
Game.Renderer.RegularFont.DrawTextWithContrast(content, RenderOrigin + new float2(3 + w, 7), Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ namespace OpenRA.Widgets
|
||||
public override void DrawInner( WorldRenderer wr )
|
||||
{
|
||||
var s = WidgetUtils.FormatTime(Game.LocalTick);
|
||||
var size = Game.Renderer.TitleFont.Measure(s);
|
||||
Game.Renderer.TitleFont.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White);
|
||||
var size = Game.Renderer.TitleFont.Measure(s);
|
||||
var pos = new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20);
|
||||
|
||||
Game.Renderer.TitleFont.DrawTextWithContrast(s, pos, Color.White, Color.Black, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user