Rename TextRenderable to TextAnnotationRenderable.

This commit is contained in:
Paul Chote
2019-09-15 12:31:52 +01:00
committed by abcdefg30
parent 7937383bf4
commit 4ec0fa299d
8 changed files with 16 additions and 16 deletions

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Effects
if (wr.World.FogObscures(pos) || wr.World.ShroudObscures(pos)) if (wr.World.FogObscures(pos) || wr.World.ShroudObscures(pos))
yield break; yield break;
yield return new TextRenderable(font, pos, 0, color, text); yield return new TextAnnotationRenderable(font, pos, 0, color, text);
} }
public static string FormatCashTick(int cashAmount) public static string FormatCashTick(int cashAmount)

View File

@@ -16,7 +16,7 @@ using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Graphics namespace OpenRA.Mods.Common.Graphics
{ {
public struct TextRenderable : IRenderable, IFinalizedRenderable public struct TextAnnotationRenderable : IRenderable, IFinalizedRenderable
{ {
readonly SpriteFont font; readonly SpriteFont font;
readonly WPos pos; readonly WPos pos;
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Graphics
readonly Color bgLight; readonly Color bgLight;
readonly string text; readonly string text;
public TextRenderable(SpriteFont font, WPos pos, int zOffset, Color color, Color bgDark, Color bgLight, string text) public TextAnnotationRenderable(SpriteFont font, WPos pos, int zOffset, Color color, Color bgDark, Color bgLight, string text)
{ {
this.font = font; this.font = font;
this.pos = pos; this.pos = pos;
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Graphics
this.text = text; this.text = text;
} }
public TextRenderable(SpriteFont font, WPos pos, int zOffset, Color color, string text) public TextAnnotationRenderable(SpriteFont font, WPos pos, int zOffset, Color color, string text)
: this(font, pos, zOffset, color, : this(font, pos, zOffset, color,
ChromeMetrics.Get<Color>("TextContrastColorDark"), ChromeMetrics.Get<Color>("TextContrastColorDark"),
ChromeMetrics.Get<Color>("TextContrastColorLight"), ChromeMetrics.Get<Color>("TextContrastColorLight"),
@@ -48,9 +48,9 @@ namespace OpenRA.Mods.Common.Graphics
public int ZOffset { get { return zOffset; } } public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } } public bool IsDecoration { get { return true; } }
public IRenderable WithPalette(PaletteReference newPalette) { return new TextRenderable(font, pos, zOffset, color, text); } public IRenderable WithPalette(PaletteReference newPalette) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
public IRenderable WithZOffset(int newOffset) { return new TextRenderable(font, pos, zOffset, color, text); } public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
public IRenderable OffsetBy(WVec vec) { return new TextRenderable(font, pos + vec, zOffset, color, text); } public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
public IRenderable AsDecoration() { return this; } public IRenderable AsDecoration() { return this; }
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; } public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
var color = self.Owner.Color; var color = self.Owner.Color;
var vec = exitCell - self.Location; var vec = exitCell - self.Location;
var center = wr.World.Map.CenterOfCell(exitCell); var center = wr.World.Map.CenterOfCell(exitCell);
yield return new TextRenderable(manager.Font, center, 0, color, vec.ToString()); yield return new TextAnnotationRenderable(manager.Font, center, 0, color, vec.ToString());
} }
} }
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
var vec = perimCell - self.Location; var vec = perimCell - self.Location;
var center = wr.World.Map.CenterOfCell(perimCell); var center = wr.World.Map.CenterOfCell(perimCell);
yield return new TextRenderable(manager.Font, center, 0, color, vec.ToString()); yield return new TextAnnotationRenderable(manager.Font, center, 0, color, vec.ToString());
} }
} }

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
continue; continue;
var info = wr.World.Map.GetTerrainInfo(cell); var info = wr.World.Map.GetTerrainInfo(cell);
yield return new TextRenderable(font, center, 0, info.Color, info.Type); yield return new TextAnnotationRenderable(font, center, 0, info.Color, info.Type);
} }
} }

View File

@@ -75,12 +75,12 @@ namespace OpenRA.Mods.Common.Traits.Render
if (debugVis == null || !debugVis.ActorTags) if (debugVis == null || !debugVis.ActorTags)
yield break; yield break;
yield return new TextRenderable(font, self.CenterPosition - offset, 0, color, tagString); yield return new TextAnnotationRenderable(font, self.CenterPosition - offset, 0, color, tagString);
// Get the actor's activity. // Get the actor's activity.
var activity = self.CurrentActivity; var activity = self.CurrentActivity;
if (activity != null) if (activity != null)
yield return new TextRenderable(font, self.CenterPosition, 0, color, activity.DebugLabelComponents().JoinWith(".")); yield return new TextAnnotationRenderable(font, self.CenterPosition, 0, color, activity.DebugLabelComponents().JoinWith("."));
// Get the AI squad that this actor belongs to. // Get the AI squad that this actor belongs to.
if (!self.Owner.IsBot) if (!self.Owner.IsBot)
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits.Render
yield break; yield break;
var aiSquadInfo = "{0}, {1}".F(squad.Type, squad.TargetActor); var aiSquadInfo = "{0}, {1}".F(squad.Type, squad.TargetActor);
yield return new TextRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo); yield return new TextAnnotationRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo);
} }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } } bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render
var spaceBuffer = (int)(10 / wr.Viewport.Zoom); var spaceBuffer = (int)(10 / wr.Viewport.Zoom);
var effectPos = wr.ProjectedPosition(new int2((bounds.Left + bounds.Right) / 2, bounds.Y - spaceBuffer)); var effectPos = wr.ProjectedPosition(new int2((bounds.Left + bounds.Right) / 2, bounds.Y - spaceBuffer));
yield return new TextRenderable(font, effectPos, 0, color, name); yield return new TextAnnotationRenderable(font, effectPos, 0, color, name);
} }
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } } bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }

View File

@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits.Render
var screenPos = boundsOffset + sizeOffset + info.ScreenOffset; var screenPos = boundsOffset + sizeOffset + info.ScreenOffset;
yield return new TextRenderable(font, wr.ProjectedPosition(screenPos), info.ZOffset, color, number); yield return new TextAnnotationRenderable(font, wr.ProjectedPosition(screenPos), info.ZOffset, color, number);
} }
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)

View File

@@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits.Render
sizeOffset -= new int2(halfSize.X, 0); sizeOffset -= new int2(halfSize.X, 0);
} }
return new IRenderable[] { new TextRenderable(font, wr.ProjectedPosition(boundsOffset + sizeOffset), Info.ZOffset, color, Info.Text) }; return new IRenderable[] { new TextAnnotationRenderable(font, wr.ProjectedPosition(boundsOffset + sizeOffset), Info.ZOffset, color, Info.Text) };
} }
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)