Use the font dictionary everywhere
This commit is contained in:
@@ -42,10 +42,8 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
Queue<IVertexBuffer<Vertex>> tempBuffersV = new Queue<IVertexBuffer<Vertex>>();
|
Queue<IVertexBuffer<Vertex>> tempBuffersV = new Queue<IVertexBuffer<Vertex>>();
|
||||||
|
|
||||||
public SpriteFont RegularFont, BoldFont, TitleFont, TinyFont, TinyBoldFont, BigBoldFont;
|
|
||||||
public Dictionary<string, SpriteFont> Fonts;
|
public Dictionary<string, SpriteFont> Fonts;
|
||||||
|
|
||||||
|
|
||||||
public Renderer()
|
public Renderer()
|
||||||
{
|
{
|
||||||
SpriteShader = device.CreateShader("world-shp");
|
SpriteShader = device.CreateShader("world-shp");
|
||||||
@@ -65,14 +63,6 @@ namespace OpenRA.Graphics
|
|||||||
public void InitializeFonts(Manifest m)
|
public void InitializeFonts(Manifest m)
|
||||||
{
|
{
|
||||||
Fonts = m.Fonts.ToDictionary(x => x.Key, x => new SpriteFont(x.Value.First, x.Value.Second));
|
Fonts = m.Fonts.ToDictionary(x => x.Key, x => new SpriteFont(x.Value.First, x.Value.Second));
|
||||||
|
|
||||||
// TODO: Remove these
|
|
||||||
RegularFont = Fonts["Regular"];
|
|
||||||
BoldFont = Fonts["Bold"];
|
|
||||||
TitleFont = Fonts["Title"];
|
|
||||||
BigBoldFont = Fonts["BigBold"];
|
|
||||||
TinyFont = Fonts["Tiny"];
|
|
||||||
TinyBoldFont = Fonts["TinyBold"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IGraphicsDevice Device { get { return device; } }
|
internal IGraphicsDevice Device { get { return device; } }
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
||||||
WidgetUtils.DrawPanel(Depressed ? "dialog3" : "dialog2", RenderBounds);
|
WidgetUtils.DrawPanel(Depressed ? "dialog3" : "dialog2", RenderBounds);
|
||||||
|
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ namespace OpenRA.Widgets
|
|||||||
if (!string.IsNullOrEmpty(line.Owner))
|
if (!string.IsNullOrEmpty(line.Owner))
|
||||||
{
|
{
|
||||||
var owner = line.Owner + ":";
|
var owner = line.Owner + ":";
|
||||||
inset = Game.Renderer.RegularFont.Measure(owner).X + 10;
|
inset = Game.Renderer.Fonts["Regular"].Measure(owner).X + 10;
|
||||||
|
|
||||||
Game.Renderer.RegularFont.DrawTextWithContrast(owner, chatpos,
|
Game.Renderer.Fonts["Regular"].DrawTextWithContrast(owner, chatpos,
|
||||||
line.Color, Color.Black, UseContrast ? 1 : 0);
|
line.Color, Color.Black, UseContrast ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.Renderer.RegularFont.DrawTextWithContrast(line.Text, chatpos + new int2(inset, 0),
|
Game.Renderer.Fonts["Regular"].DrawTextWithContrast(line.Text, chatpos + new int2(inset, 0),
|
||||||
Color.White, Color.Black, UseContrast ? 1 : 0);
|
Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ namespace OpenRA.Widgets
|
|||||||
if (composing)
|
if (composing)
|
||||||
{
|
{
|
||||||
var text = teamChat ? "Chat (Team): " : "Chat (All): ";
|
var text = teamChat ? "Chat (Team): " : "Chat (All): ";
|
||||||
var w = Game.Renderer.BoldFont.Measure(text).X;
|
var w = Game.Renderer.Fonts["Bold"].Measure(text).X;
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawTextWithContrast(text, RenderOrigin + new float2(3, 7), Color.White, Color.Black, UseContrast ? 1 : 0);
|
Game.Renderer.Fonts["Bold"].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);
|
Game.Renderer.Fonts["Regular"].DrawTextWithContrast(content, RenderOrigin + new float2(3 + w, 7), Color.White, Color.Black, UseContrast ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
var font = Bold ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = Bold ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var pos = RenderOrigin;
|
var pos = RenderOrigin;
|
||||||
var rect = RenderBounds;
|
var rect = RenderBounds;
|
||||||
var check = new Rectangle(rect.Location,
|
var check = new Rectangle(rect.Location,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Widgets
|
|||||||
u + new float2(12, 10 * k + 4),
|
u + new float2(12, 10 * k + 4),
|
||||||
item.c, item.c);
|
item.c, item.c);
|
||||||
|
|
||||||
Game.Renderer.TinyFont.DrawText(item.Name, new float2(rect.Left, rect.Top) + new float2(18, 10 * k - 3), Color.White);
|
Game.Renderer.Fonts["Tiny"].DrawText(item.Name, new float2(rect.Left, rect.Top) + new float2(18, 10 * k - 3), Color.White);
|
||||||
Game.Renderer.Flush();
|
Game.Renderer.Flush();
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace OpenRA.Widgets
|
|||||||
if (bg != null)
|
if (bg != null)
|
||||||
WidgetUtils.DrawPanel(bg, RenderBounds);
|
WidgetUtils.DrawPanel(bg, RenderBounds);
|
||||||
|
|
||||||
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var text = GetText();
|
var text = GetText();
|
||||||
if (text == null)
|
if (text == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
|||||||
if (Text == null)
|
if (Text == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var textSize = font.Measure(Text);
|
var textSize = font.Measure(Text);
|
||||||
|
|
||||||
var start = RenderOrigin.X + LeftMargin;
|
var start = RenderOrigin.X + LeftMargin;
|
||||||
@@ -187,7 +187,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
if (text == null) text = "";
|
if (text == null) text = "";
|
||||||
|
|
||||||
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var pos = RenderOrigin;
|
var pos = RenderOrigin;
|
||||||
|
|
||||||
if (CursorPosition > text.Length)
|
if (CursorPosition > text.Length)
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ namespace OpenRA.Widgets
|
|||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
var s = WidgetUtils.FormatTime(Game.LocalTick);
|
var s = WidgetUtils.FormatTime(Game.LocalTick);
|
||||||
var size = Game.Renderer.TitleFont.Measure(s);
|
var size = Game.Renderer.Fonts["Title"].Measure(s);
|
||||||
var pos = new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20);
|
var pos = new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20);
|
||||||
|
|
||||||
Game.Renderer.TitleFont.DrawTextWithContrast(s, pos, Color.White, Color.Black, 1);
|
Game.Renderer.Fonts["Title"].DrawTextWithContrast(s, pos, Color.White, Color.Black, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
public void AddChatLine(Color c, string from, string text)
|
public void AddChatLine(Color c, string from, string text)
|
||||||
{
|
{
|
||||||
var name = from+":";
|
var name = from+":";
|
||||||
var font = Game.Renderer.RegularFont;
|
var font = Game.Renderer.Fonts["Regular"];
|
||||||
var nameSize = font.Measure(from);
|
var nameSize = font.Measure(from);
|
||||||
|
|
||||||
var template = chatTemplate.Clone() as ContainerWidget;
|
var template = chatTemplate.Clone() as ContainerWidget;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
{
|
{
|
||||||
if (text == null) text = "";
|
if (text == null) text = "";
|
||||||
|
|
||||||
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
|
var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"];
|
||||||
var pos = RenderOrigin;
|
var pos = RenderOrigin;
|
||||||
|
|
||||||
if (CursorPosition > text.Length)
|
if (CursorPosition > text.Length)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
this.velocity = velocity;
|
this.velocity = velocity;
|
||||||
s = "{0}${1}".F(value < 0 ? "-" : "+", value);
|
s = "{0}${1}".F(value < 0 ? "-" : "+", value);
|
||||||
this.pos = pos - 0.5f*Game.Renderer.TinyBoldFont.Measure(s).ToFloat2();
|
this.pos = pos - 0.5f*Game.Renderer.Fonts["TinyBold"].Measure(s).ToFloat2();
|
||||||
remaining = lifetime;
|
remaining = lifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
public IEnumerable<Renderable> Render()
|
public IEnumerable<Renderable> Render()
|
||||||
{
|
{
|
||||||
Game.Renderer.TinyBoldFont.DrawTextWithContrast(s, pos - Game.viewport.Location, color, Color.Black,1);
|
Game.Renderer.Fonts["TinyBold"].DrawTextWithContrast(s, pos - Game.viewport.Location, color, Color.Black,1);
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -422,12 +422,12 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (rect.Contains(Viewport.LastMousePos))
|
if (rect.Contains(Viewport.LastMousePos))
|
||||||
{
|
{
|
||||||
var text = queue.Info.Type;
|
var text = queue.Info.Type;
|
||||||
var sz = Game.Renderer.BoldFont.Measure(text);
|
var sz = Game.Renderer.Fonts["Bold"].Measure(text);
|
||||||
WidgetUtils.DrawPanelPartial("dialog4",
|
WidgetUtils.DrawPanelPartial("dialog4",
|
||||||
Rectangle.FromLTRB((int)rect.Left - sz.X - 30, (int)rect.Top, (int)rect.Left - 5, (int)rect.Bottom),
|
Rectangle.FromLTRB((int)rect.Left - sz.X - 30, (int)rect.Top, (int)rect.Left - 5, (int)rect.Bottom),
|
||||||
PanelSides.All);
|
PanelSides.All);
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawText(text,
|
Game.Renderer.Fonts["Bold"].DrawText(text,
|
||||||
new float2(rect.Left - sz.X - 20, rect.Top + 12), Color.White);
|
new float2(rect.Left - sz.X - 20, rect.Top + 12), Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,8 +437,8 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
|
|
||||||
void DrawRightAligned(string text, int2 pos, Color c)
|
void DrawRightAligned(string text, int2 pos, Color c)
|
||||||
{
|
{
|
||||||
Game.Renderer.BoldFont.DrawText(text,
|
Game.Renderer.Fonts["Bold"].DrawText(text,
|
||||||
pos - new int2(Game.Renderer.BoldFont.Measure(text).X, 0), c);
|
pos - new int2(Game.Renderer.Fonts["Bold"].Measure(text).X, 0), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawProductionTooltip(World world, string unit, int2 pos)
|
void DrawProductionTooltip(World world, string unit, int2 pos)
|
||||||
@@ -454,12 +454,12 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
var cost = info.Traits.Get<ValuedInfo>().Cost;
|
var cost = info.Traits.Get<ValuedInfo>().Cost;
|
||||||
var canBuildThis = CurrentQueue.CanBuild(info);
|
var canBuildThis = CurrentQueue.CanBuild(info);
|
||||||
|
|
||||||
var longDescSize = Game.Renderer.RegularFont.Measure(tooltip.Description.Replace("\\n", "\n")).Y;
|
var longDescSize = Game.Renderer.Fonts["Regular"].Measure(tooltip.Description.Replace("\\n", "\n")).Y;
|
||||||
if (!canBuildThis) longDescSize += 8;
|
if (!canBuildThis) longDescSize += 8;
|
||||||
|
|
||||||
WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.viewport.Width - 300, pos.Y, 300, longDescSize + 65));
|
WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.viewport.Width - 300, pos.Y, 300, longDescSize + 65));
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawText(
|
Game.Renderer.Fonts["Bold"].DrawText(
|
||||||
tooltip.Name + ((buildable.Hotkey != null)? " ({0})".F(buildable.Hotkey.ToUpper()) : ""),
|
tooltip.Name + ((buildable.Hotkey != null)? " ({0})".F(buildable.Hotkey.ToUpper()) : ""),
|
||||||
p.ToInt2() + new int2(5, 5), Color.White);
|
p.ToInt2() + new int2(5, 5), Color.White);
|
||||||
|
|
||||||
@@ -484,7 +484,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
{
|
{
|
||||||
var prereqs = buildable.Prerequisites
|
var prereqs = buildable.Prerequisites
|
||||||
.Select( a => Description( a ) );
|
.Select( a => Description( a ) );
|
||||||
Game.Renderer.RegularFont.DrawText(
|
Game.Renderer.Fonts["Regular"].DrawText(
|
||||||
"Requires {0}".F(string.Join(", ", prereqs.ToArray())),
|
"Requires {0}".F(string.Join(", ", prereqs.ToArray())),
|
||||||
p.ToInt2(),
|
p.ToInt2(),
|
||||||
Color.White);
|
Color.White);
|
||||||
@@ -493,7 +493,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
p += new int2(0, 15);
|
p += new int2(0, 15);
|
||||||
Game.Renderer.RegularFont.DrawText(tooltip.Description.Replace("\\n", "\n"),
|
Game.Renderer.Fonts["Regular"].DrawText(tooltip.Description.Replace("\\n", "\n"),
|
||||||
p.ToInt2(), Color.White);
|
p.ToInt2(), Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
var m = pos + new int2(rect.Width, rect.Height);
|
var m = pos + new int2(rect.Width, rect.Height);
|
||||||
var br = pos + new int2(rect.Width, rect.Height + 20);
|
var br = pos + new int2(rect.Width, rect.Height + 20);
|
||||||
|
|
||||||
var u = Game.Renderer.RegularFont.Measure(GetLongDesc().Replace("\\n", "\n"));
|
var u = Game.Renderer.Fonts["Regular"].Measure(GetLongDesc().Replace("\\n", "\n"));
|
||||||
|
|
||||||
br.X -= u.X;
|
br.X -= u.X;
|
||||||
br.Y += u.Y;
|
br.Y += u.Y;
|
||||||
@@ -65,10 +65,10 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
|
|
||||||
pos.X = br.X + 8;
|
pos.X = br.X + 8;
|
||||||
pos.Y = m.Y + 8;
|
pos.Y = m.Y + 8;
|
||||||
Game.Renderer.BoldFont.DrawText(GetDescription(), pos, Color.White);
|
Game.Renderer.Fonts["Bold"].DrawText(GetDescription(), pos, Color.White);
|
||||||
|
|
||||||
pos += new int2(0, 20);
|
pos += new int2(0, 20);
|
||||||
Game.Renderer.RegularFont.DrawText(GetLongDesc().Replace("\\n", "\n"), pos, Color.White);
|
Game.Renderer.Fonts["Regular"].DrawText(GetLongDesc().Replace("\\n", "\n"), pos, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(image, new int2(RenderBounds.X, RenderBounds.Y));
|
Game.Renderer.RgbaSpriteRenderer.DrawSprite(image, new int2(RenderBounds.X, RenderBounds.Y));
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
br += new int2(0,20);
|
br += new int2(0,20);
|
||||||
|
|
||||||
if (sp.Info.LongDesc != null)
|
if (sp.Info.LongDesc != null)
|
||||||
br += Game.Renderer.RegularFont.Measure(sp.Info.LongDesc.Replace("\\n", "\n"));
|
br += Game.Renderer.Fonts["Regular"].Measure(sp.Info.LongDesc.Replace("\\n", "\n"));
|
||||||
else
|
else
|
||||||
br += new int2(300,0);
|
br += new int2(300,0);
|
||||||
|
|
||||||
@@ -125,19 +125,19 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
PanelSides.Left | PanelSides.Right | PanelSides.Bottom);
|
PanelSides.Left | PanelSides.Right | PanelSides.Bottom);
|
||||||
|
|
||||||
pos += new int2(77, 5);
|
pos += new int2(77, 5);
|
||||||
Game.Renderer.BoldFont.DrawText(sp.Info.Description, pos, Color.White);
|
Game.Renderer.Fonts["Bold"].DrawText(sp.Info.Description, pos, Color.White);
|
||||||
|
|
||||||
if (sp.TotalTime > 0)
|
if (sp.TotalTime > 0)
|
||||||
{
|
{
|
||||||
pos += new int2(0,20);
|
pos += new int2(0,20);
|
||||||
Game.Renderer.BoldFont.DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White);
|
Game.Renderer.Fonts["Bold"].DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White);
|
||||||
Game.Renderer.BoldFont.DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White);
|
Game.Renderer.Fonts["Bold"].DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp.Info.LongDesc != null)
|
if (sp.Info.LongDesc != null)
|
||||||
{
|
{
|
||||||
pos += new int2(0, 20);
|
pos += new int2(0, 20);
|
||||||
Game.Renderer.RegularFont.DrawText(sp.Info.LongDesc.Replace("\\n", "\n"), pos, Color.White);
|
Game.Renderer.Fonts["Regular"].DrawText(sp.Info.LongDesc.Replace("\\n", "\n"), pos, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
isVictory ? "victory" : "defeat",
|
isVictory ? "victory" : "defeat",
|
||||||
WidgetUtils.FormatTime(Math.Max(winnerSvc.CriticalTicksLeft, winnerSvc.TicksLeft)));
|
WidgetUtils.FormatTime(Math.Max(winnerSvc.CriticalTicksLeft, winnerSvc.TicksLeft)));
|
||||||
|
|
||||||
var size = Game.Renderer.BoldFont.Measure(tc);
|
var size = Game.Renderer.Fonts["Bold"].Measure(tc);
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawText(tc, offset + new float2(RenderBounds.Left - size.X / 2 + 1, RenderBounds.Top + 1), Color.Black);
|
Game.Renderer.Fonts["Bold"].DrawText(tc, offset + new float2(RenderBounds.Left - size.X / 2 + 1, RenderBounds.Top + 1), Color.Black);
|
||||||
Game.Renderer.BoldFont.DrawText(tc, offset + new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top), Color.WhiteSmoke);
|
Game.Renderer.Fonts["Bold"].DrawText(tc, offset + new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top), Color.WhiteSmoke);
|
||||||
offset += new int2(0, size.Y + 1);
|
offset += new int2(0, size.Y + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (!world.LocalPlayer.Shroud.IsExplored(cell))
|
if (!world.LocalPlayer.Shroud.IsExplored(cell))
|
||||||
{
|
{
|
||||||
var utext = "Unexplored Terrain";
|
var utext = "Unexplored Terrain";
|
||||||
var usz = Game.Renderer.BoldFont.Measure(utext) + new int2(20, 24);
|
var usz = Game.Renderer.Fonts["Bold"].Measure(utext) + new int2(20, 24);
|
||||||
|
|
||||||
WidgetUtils.DrawPanel("dialog4", Rectangle.FromLTRB(
|
WidgetUtils.DrawPanel("dialog4", Rectangle.FromLTRB(
|
||||||
Viewport.LastMousePos.X + 20, Viewport.LastMousePos.Y + 20,
|
Viewport.LastMousePos.X + 20, Viewport.LastMousePos.Y + 20,
|
||||||
Viewport.LastMousePos.X + usz.X + 20, Viewport.LastMousePos.Y + usz.Y + 20));
|
Viewport.LastMousePos.X + usz.X + 20, Viewport.LastMousePos.Y + usz.Y + 20));
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawText(utext,
|
Game.Renderer.Fonts["Bold"].DrawText(utext,
|
||||||
new float2(Viewport.LastMousePos.X + 30, Viewport.LastMousePos.Y + 30), Color.White);
|
new float2(Viewport.LastMousePos.X + 30, Viewport.LastMousePos.Y + 30), Color.White);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
var owner = (tooltip != null && !tooltip.Owner().NonCombatant) ? "{0}".F(tooltip.Owner().PlayerName) : "";
|
var owner = (tooltip != null && !tooltip.Owner().NonCombatant) ? "{0}".F(tooltip.Owner().PlayerName) : "";
|
||||||
var stance = (tooltip != null && tooltip.Owner() != actor.World.LocalPlayer && !tooltip.Owner().NonCombatant) ? " ({0})".F(tooltip.Stance()) : "";
|
var stance = (tooltip != null && tooltip.Owner() != actor.World.LocalPlayer && !tooltip.Owner().NonCombatant) ? " ({0})".F(tooltip.Stance()) : "";
|
||||||
|
|
||||||
var nameSize = Game.Renderer.BoldFont.Measure(name);
|
var nameSize = Game.Renderer.Fonts["Bold"].Measure(name);
|
||||||
var ownerSize = Game.Renderer.RegularFont.Measure(owner);
|
var ownerSize = Game.Renderer.Fonts["Regular"].Measure(owner);
|
||||||
var stanceSize = Game.Renderer.RegularFont.Measure(stance);
|
var stanceSize = Game.Renderer.Fonts["Regular"].Measure(stance);
|
||||||
|
|
||||||
var panelSize = new int2(Math.Max(nameSize.X, ownerSize.X + stanceSize.X + 35) + 20, nameSize.Y + 24);
|
var panelSize = new int2(Math.Max(nameSize.X, ownerSize.X + stanceSize.X + 35) + 20, nameSize.Y + 24);
|
||||||
|
|
||||||
@@ -72,15 +72,15 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
Viewport.LastMousePos.X + 20, Viewport.LastMousePos.Y + 20,
|
Viewport.LastMousePos.X + 20, Viewport.LastMousePos.Y + 20,
|
||||||
Viewport.LastMousePos.X + panelSize.X + 20, Viewport.LastMousePos.Y + panelSize.Y + 20));
|
Viewport.LastMousePos.X + panelSize.X + 20, Viewport.LastMousePos.Y + panelSize.Y + 20));
|
||||||
|
|
||||||
Game.Renderer.BoldFont.DrawText(name,
|
Game.Renderer.Fonts["Bold"].DrawText(name,
|
||||||
new float2(Viewport.LastMousePos.X + 30, Viewport.LastMousePos.Y + 30), Color.White);
|
new float2(Viewport.LastMousePos.X + 30, Viewport.LastMousePos.Y + 30), Color.White);
|
||||||
|
|
||||||
if (owner != "")
|
if (owner != "")
|
||||||
{
|
{
|
||||||
Game.Renderer.RegularFont.DrawText(owner,
|
Game.Renderer.Fonts["Regular"].DrawText(owner,
|
||||||
new float2(Viewport.LastMousePos.X + 65, Viewport.LastMousePos.Y + 50), actor.Owner.ColorRamp.GetColor(0));
|
new float2(Viewport.LastMousePos.X + 65, Viewport.LastMousePos.Y + 50), actor.Owner.ColorRamp.GetColor(0));
|
||||||
|
|
||||||
Game.Renderer.RegularFont.DrawText(stance,
|
Game.Renderer.Fonts["Regular"].DrawText(stance,
|
||||||
new float2(Viewport.LastMousePos.X + 65 + ownerSize.X, Viewport.LastMousePos.Y + 50), Color.White);
|
new float2(Viewport.LastMousePos.X + 65 + ownerSize.X, Viewport.LastMousePos.Y + 50), Color.White);
|
||||||
|
|
||||||
WidgetUtils.DrawRGBA(
|
WidgetUtils.DrawRGBA(
|
||||||
|
|||||||
Reference in New Issue
Block a user