Repository navigation
Widgets NameTagWidget
Mike Adkins edited this page Sep 14, 2026
·
1 revision
NameTagWidget displays a world-space text label above a Sprite and follows that sprite automatically.
Use it for NPC names, player names, unit labels, merchant names, quest-giver labels, or similar entity identification.
These examples assume you already have a
RenderSurfaceHostBasenamedhostand, where appropriate, aViewnamedview, aSceneLayernamedsceneLayer, or aSpritenamedsprite.
using System.Drawing;
using Gondwana.Widgets.Hud;
var nameTag = new NameTagWidget(
host,
sprite,
"Merchant",
size: new Size(120, 26));As the sprite moves—or its visual bounds change—the tag updates its position automatically.
nameTag.SetText("Master Merchant");nameTag.OffsetPx = new Point(0, -4);
nameTag.Size = new Size(150, 28);nameTag
.SetTextColor(SkiaSharp.SKColors.Gold)
.SetBackgroundColor(Color.FromArgb(180, 20, 22, 28))
.SetNameTagZOrder(20);For text without a box:
nameTag.ShowBackground(false);NameTagWidget subscribes to the target sprite's movement, visual-bounds, and disposal events. Disposing the sprite automatically disposes the name tag.
| Member | Purpose |
|---|---|
Target |
Sprite being followed. |
Text |
Current name. |
SetText() |
Changes the displayed name. |
Size |
Tag size in world pixels. |
OffsetPx |
Additional offset above the sprite. |
BoundsWorld |
Current world-space bounds. |
ShowBackground() |
Shows or hides the backing rectangle. |
Background / TextBlock
|
Underlying visuals. |
- Home
- Make Your First Game in 30 Minutes
- Engine Architecture Overview
- Game Hosts and Application Startup
- Gondwana Engine Lifecycle
- Gondwana CLI Cheatsheet
- Using Gondwana with ChatGPT and Codex
Core Concepts
Systems
Rendering
Widgets
-
Controls
-
Dialogs
- AboutBox
- ConversationBox
- DialogBox — base class for custom dialogs
-
Hud
-
Layout
-
Menus
-
Overlays