Repository navigation
Widgets RadioButtonWidget
RadioButtonWidget represents a mutually exclusive choice. Several radio buttons can share a RadioButtonGroup, ensuring that selecting one clears the others.
Use it when the player must choose exactly one option from a small visible set.
These examples assume you already have a
RenderSurfaceHostBasenamedhostand, where appropriate, aViewnamedview, aSceneLayernamedsceneLayer, or aSpritenamedsprite.
using System.Drawing;
using Gondwana.Widgets.Controls;
var displayModeGroup = new RadioButtonGroup();
var windowed = new RadioButtonWidget(
host,
view,
new Rectangle(40, 40, 220, 28),
"Windowed",
displayModeGroup,
isSelected: true);
var fullscreen = new RadioButtonWidget(
host,
view,
new Rectangle(40, 74, 220, 28),
"Fullscreen",
displayModeGroup);Selecting one button automatically clears the other:
fullscreen.Select();
RadioButtonWidget? selected = displayModeGroup.SelectedButton;fullscreen.SelectionChanged += isSelected =>
{
if (isSelected)
videoSettings.Fullscreen = true;
};The widget can be selected with the primary pointer button or Space while focused.
fullscreen
.SetColors(
normal: Color.FromArgb(255, 48, 48, 56),
hover: Color.FromArgb(255, 70, 70, 82),
dot: Color.Gold)
.SetTextColor(SkiaSharp.SKColors.White)
.SetRadioButtonZOrder(40);The group argument is optional. An ungrouped radio button can still be selected, but nothing else is automatically cleared.
| Member | Purpose |
|---|---|
Group |
Gets or changes the coordinating group. |
IsSelected |
Gets or sets the selected state. |
Select() |
Selects this button. |
SelectionChanged |
Raised when its state changes. |
Ring / Dot / Label
|
Underlying visuals. |
Both view-level and scene-layer constructors are available.
- 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