Repository navigation
Widgets PopupWidget
PopupWidget displays short-lived text or image content that can move, accelerate, fade in, and fade out. It is intended for transient feedback such as damage numbers, healing values, XP gains, status effects, item pickups, or score popups.
A popup can live in either view coordinates or scene-layer world coordinates.
These examples assume you already have a
RenderSurfaceHostBasenamedhostand, where appropriate, aViewnamedview, aSceneLayernamedsceneLayer, or aSpritenamedsprite.
using System.Drawing;
using System.Numerics;
using Gondwana.Widgets.Overlays;
using SkiaSharp;
var damage = new PopupWidget(
host,
sceneLayer,
new Rectangle(200, 180, 96, 36),
"-25")
.SetTextColor(SKColors.OrangeRed);
damage.LifetimeSec = 1.0f;
damage.FadeInSec = 0.08f;
damage.FadeOutSec = 0.25f;
damage.VelocityPxPerSec = new Vector2(0f, -64f);
damage.ShowPopup();A scene-layer popup can resolve its starting point from a tile when it is shown:
var damage = new PopupWidget(
host,
targetTile,
new Size(96, 36),
"-25",
WidgetAnchor.TopCenter)
.SetTextColor(SKColors.OrangeRed);
damage.ShowPopup();You can also bind to a fixed grid coordinate:
damage.BindTo(
sceneLayer,
new Point(12, 8),
WidgetAnchor.Center);The source is resolved when ShowPopup() starts. After that, the popup moves independently from the source.
damage.VelocityPxPerSec = new Vector2(0f, -80f);
damage.AccelerationPxPerSecSquared = new Vector2(0f, 30f);PopupWidget also accepts SKImage or SKBitmap content:
var iconPopup = new PopupWidget(
host,
view,
new Rectangle(300, 80, 48, 48),
pickupImage);
iconPopup.ShowPopup();damage.Completed += () =>
{
// Optional follow-up work.
};
damage.DisposeOnComplete = true;Call Dismiss() to end it immediately.
| Member | Purpose |
|---|---|
LifetimeSec |
Total popup lifetime. |
FadeInSec / FadeOutSec
|
Fade durations. |
VelocityPxPerSec |
Initial movement. |
AccelerationPxPerSecSquared |
Movement acceleration. |
BindTo() |
Resolves source from a tile or grid cell. |
ShowPopup() |
Starts the popup lifecycle. |
Dismiss() |
Completes it immediately. |
Completed |
Raised when the popup ends. |
- 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