Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Widgets.WidgetInputRouter Class Referencesealed

Routes mouse, touch, and keyboard input to registered widgets for a render surface host. More...

Inheritance diagram for Gondwana.Widgets.WidgetInputRouter:

Public Member Functions

 WidgetInputRouter (RenderSurfaceHostBase renderSurfaceHost, KeyboardEventPoller? keyboardEventPoller, MouseEventPoller? mouseEventPoller, TouchEventPoller? touchEventPoller)
 Initializes a new instance of the WidgetInputRouter class.
void Register (WidgetBase widget)
 Registers a widget so that it can receive routed input.
void Unregister (WidgetBase widget)
 Unregisters a widget so that it no longer receives routed input.
void BringToFront (WidgetBase widget)
 Moves a registered widget to the front of the input routing order.
void Focus (WidgetBase? widget)
 Assigns keyboard focus to the specified widget.
void ClearFocus ()
 Clears the current keyboard focus.
void Start ()
 Starts routing input events from the configured pollers to registered widgets.
void Stop ()
 Stops routing input events and releases current pointer and focus state.
void Dispose ()
 Releases the resources used by the router and unregisters all widgets.

Static Public Attributes

const int MousePointerId = -1
 Identifies mouse pointer events in routed widget input.

Properties

WidgetBase? FocusedWidget [get]
 Gets the widget that currently has keyboard focus.

Events

Action< PrimaryPointerActionEventArgs >? UnhandledPrimaryAction
 Occurs when a primary gameplay action was not claimed by a widget. Mouse left-button presses fire on press; touch fires only for a recognized single-finger tap whose contact began outside widgets.

Detailed Description

Routes mouse, touch, and keyboard input to registered widgets for a render surface host.

Definition at line 16 of file WidgetInputRouter.cs.

Constructor & Destructor Documentation

◆ WidgetInputRouter()

Gondwana.Widgets.WidgetInputRouter.WidgetInputRouter ( RenderSurfaceHostBase renderSurfaceHost,
KeyboardEventPoller? keyboardEventPoller,
MouseEventPoller? mouseEventPoller,
TouchEventPoller? touchEventPoller )

Initializes a new instance of the WidgetInputRouter class.

Parameters
renderSurfaceHostThe render surface host whose widgets will receive routed input.
keyboardEventPollerThe keyboard event poller that supplies keyboard input, or null.
mouseEventPollerThe mouse event poller that supplies mouse input, or null.
touchEventPollerThe touch event poller that supplies touch input, or null.

Definition at line 55 of file WidgetInputRouter.cs.

Member Function Documentation

◆ BringToFront()

void Gondwana.Widgets.WidgetInputRouter.BringToFront ( WidgetBase widget)

Moves a registered widget to the front of the input routing order.

Parameters
widgetThe widget to move to the front.

Definition at line 124 of file WidgetInputRouter.cs.

◆ ClearFocus()

void Gondwana.Widgets.WidgetInputRouter.ClearFocus ( )

Clears the current keyboard focus.

Definition at line 160 of file WidgetInputRouter.cs.

◆ Dispose()

void Gondwana.Widgets.WidgetInputRouter.Dispose ( )

Releases the resources used by the router and unregisters all widgets.

Definition at line 235 of file WidgetInputRouter.cs.

◆ Focus()

void Gondwana.Widgets.WidgetInputRouter.Focus ( WidgetBase? widget)

Assigns keyboard focus to the specified widget.

Parameters
widgetThe widget to focus, or null to clear focus.

Definition at line 142 of file WidgetInputRouter.cs.

◆ Register()

void Gondwana.Widgets.WidgetInputRouter.Register ( WidgetBase widget)

Registers a widget so that it can receive routed input.

Parameters
widgetThe widget to register.

Definition at line 90 of file WidgetInputRouter.cs.

◆ Start()

void Gondwana.Widgets.WidgetInputRouter.Start ( )

Starts routing input events from the configured pollers to registered widgets.

Definition at line 168 of file WidgetInputRouter.cs.

◆ Stop()

void Gondwana.Widgets.WidgetInputRouter.Stop ( )

Stops routing input events and releases current pointer and focus state.

Definition at line 199 of file WidgetInputRouter.cs.

◆ Unregister()

void Gondwana.Widgets.WidgetInputRouter.Unregister ( WidgetBase widget)

Unregisters a widget so that it no longer receives routed input.

Parameters
widgetThe widget to unregister.

Definition at line 114 of file WidgetInputRouter.cs.

Member Data Documentation

◆ MousePointerId

const int Gondwana.Widgets.WidgetInputRouter.MousePointerId = -1
static

Identifies mouse pointer events in routed widget input.

Definition at line 21 of file WidgetInputRouter.cs.

Property Documentation

◆ FocusedWidget

WidgetBase? Gondwana.Widgets.WidgetInputRouter.FocusedWidget
get

Gets the widget that currently has keyboard focus.

The focused widget, or null if no widget currently has focus.

Definition at line 73 of file WidgetInputRouter.cs.

Event Documentation

◆ UnhandledPrimaryAction

Action<PrimaryPointerActionEventArgs>? Gondwana.Widgets.WidgetInputRouter.UnhandledPrimaryAction

Occurs when a primary gameplay action was not claimed by a widget. Mouse left-button presses fire on press; touch fires only for a recognized single-finger tap whose contact began outside widgets.

Positions are logical screen pixels belonging to PrimaryPointerActionEventArgs.View. The game chooses how to hit-test sprites, tiles, or other objects.

Definition at line 84 of file WidgetInputRouter.cs.