Repository navigation
Widgets ToastWidget
ToastWidget displays a temporary text notification inside a View. It can slide into place from a view edge or fade in, remain visible for a configured duration, and then dismiss itself.
Use it for messages such as Game saved, Achievement unlocked, Controller connected, or other non-blocking notifications.
These examples assume you already have a
RenderSurfaceHostBasenamedhostand, where appropriate, aViewnamedview, aSceneLayernamedsceneLayer, or aSpritenamedsprite.
using System.Drawing;
using Gondwana.Widgets.Overlays;
var toast = new ToastWidget(
host,
view,
new Size(320, 72),
"Game saved",
WidgetAnchor.TopRight)
{
Transition = ToastTransition.Slide,
SlideOrigin = ToastSlideOrigin.Right,
HoldDurationSec = 2.5f
};
toast.ShowToast();toast.Transition = ToastTransition.Fade;
toast.TransitionDurationSec = 0.25f;
toast.ShowToast();Set HoldDurationSec to null when the toast should remain until explicitly dismissed:
toast.HoldDurationSec = null;
toast.ShowToast();
// Later:
toast.Dismiss();By default, clicking the toast also dismisses it.
toast.DismissOnClick = false;var toast = new ToastWidget(
host,
view,
new Rectangle(100, 80, 360, 72),
"Network connection restored");For slide transitions, you can also provide an exact source position:
toast.SourceLocationPx = new Point(640, 80);The default is DisposeOnDismiss = true. To reuse the same instance:
toast.DisposeOnDismiss = false;
toast.ShowToast();
// after dismissal:
toast.SetText("Second notification");
toast.ShowToast();| Member | Purpose |
|---|---|
Transition |
Slide or Fade. |
SlideOrigin |
Edge used for slide transitions. |
HoldDurationSec |
Time at rest; null disables automatic dismissal. |
TransitionDurationSec |
Entrance/exit duration. |
DismissOnClick |
Whether clicking dismisses it. |
AnimateDismissal |
Whether exit reverses the entrance transition. |
CurrentState |
Hidden, entering, holding, or exiting. |
Dismissed |
Raised after dismissal completes. |
ShowToast() / Dismiss()
|
Starts and ends the notification. |
- 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