Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WithTextDecoration rendering with RequiresSelection: false #17465

Merged
merged 1 commit into from
Dec 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
}
}

public class WithTextDecoration : ConditionalTrait<WithTextDecorationInfo>, IRender, IRenderAnnotationsWhenSelected, INotifyOwnerChanged
public class WithTextDecoration : ConditionalTrait<WithTextDecorationInfo>, IRenderAnnotations, IRenderAnnotationsWhenSelected, INotifyOwnerChanged
{
readonly SpriteFont font;
readonly IDecorationBounds[] decorationBounds;
Expand All @@ -73,16 +73,12 @@ public WithTextDecoration(Actor self, WithTextDecorationInfo info)

public virtual bool ShouldRender(Actor self) { return true; }

IEnumerable<IRenderable> IRender.Render(Actor self, WorldRenderer wr)
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
{
return !Info.RequiresSelection ? RenderInner(self, wr) : SpriteRenderable.None;
}

IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
{
// Text decorations don't contribute to actor bounds
yield break;
}
public bool SpatiallyPartitionable { get { return true; } }

IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
{
Expand Down