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.Blazor.Input.Touch.BlazorTouchAdapter Class Referencesealed

Provides a passive touch state adapter for Blazor applications, implementing ITouchAdapter by translating Blazor ontouchstart, ontouchmove, ontouchend, and ontouchcancel events into Gondwana touch state. More...

Inheritance diagram for Gondwana.Blazor.Input.Touch.BlazorTouchAdapter:
Gondwana.Input.Touch.ITouchAdapter

Public Member Functions

 BlazorTouchAdapter (BlazorBitmapRenderSurfaceComponent component)
 Initializes a new instance of BlazorTouchAdapter and attaches it to the touch events on the specified render surface component.
 BlazorTouchAdapter (BlazorRenderSurfaceComponentBase component)
 Initializes a new instance of BlazorTouchAdapter for any Gondwana Blazor render surface.
IReadOnlyList< GondwanaTouchPoint > ConsumeBeganTouches ()
 Drains and returns all touch contacts that began since the last call. Keeping beginnings in a queue prevents a short tap that begins and ends between two engine polls from being lost. Adapters that do not maintain a beginning queue may rely on the default empty implementation; the poller will still discover active contacts from ActiveTouches.
Returns
The newly begun touch contacts, consumed from the pending collection.

IReadOnlyList< GondwanaTouchPoint > ConsumeEndedTouches ()
 Drains and returns all touch contacts that ended (lifted or cancelled) since the last call. Each entry preserves the original TouchPhase (TouchPhase.Ended or TouchPhase.Cancelled) so the poller can distinguish between the two. This method is intended to be called once per engine tick by the TouchEventPoller.
Returns
A snapshot of all contacts that ended since the previous call to this method. The returned list is cleared from the adapter's internal queue on each call.

void Dispose ()
 Releases all resources and removes event handlers registered by this adapter.

Properties

IReadOnlyList< GondwanaTouchPoint > ActiveTouches [get]
 Gets the list of touch contact points that are currently active (in contact with the surface). This list reflects the state at the most recent platform pointer event. An empty list indicates no fingers are currently in contact.

Detailed Description

Provides a passive touch state adapter for Blazor applications, implementing ITouchAdapter by translating Blazor ontouchstart, ontouchmove, ontouchend, and ontouchcancel events into Gondwana touch state.

Events are not raised directly; the TouchEventPoller polls this adapter each engine frame to detect transitions and raise events.

On touch-capable devices each finger contact is tracked by its browser touch identifier. On desktop platforms where touch events are not available, use the mouse adapter for pointer input.

Definition at line 28 of file BlazorTouchAdapter.cs.

Constructor & Destructor Documentation

◆ BlazorTouchAdapter() [1/2]

Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.BlazorTouchAdapter ( BlazorBitmapRenderSurfaceComponent component)

Initializes a new instance of BlazorTouchAdapter and attaches it to the touch events on the specified render surface component.

Parameters
componentThe render surface component to capture touch input from.
Exceptions
ArgumentNullExceptionThrown when component is null.

Definition at line 46 of file BlazorTouchAdapter.cs.

◆ BlazorTouchAdapter() [2/2]

Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.BlazorTouchAdapter ( BlazorRenderSurfaceComponentBase component)

Initializes a new instance of BlazorTouchAdapter for any Gondwana Blazor render surface.

Parameters
componentThe render surface component to capture touch input from.
Exceptions
ArgumentNullExceptionThrown when component is null.

Definition at line 57 of file BlazorTouchAdapter.cs.

Member Function Documentation

◆ ConsumeBeganTouches()

IReadOnlyList< GondwanaTouchPoint > Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.ConsumeBeganTouches ( )

Drains and returns all touch contacts that began since the last call. Keeping beginnings in a queue prevents a short tap that begins and ends between two engine polls from being lost. Adapters that do not maintain a beginning queue may rely on the default empty implementation; the poller will still discover active contacts from ActiveTouches.

Returns
The newly begun touch contacts, consumed from the pending collection.

Implements Gondwana.Input.Touch.ITouchAdapter.

Definition at line 120 of file BlazorTouchAdapter.cs.

◆ ConsumeEndedTouches()

IReadOnlyList< GondwanaTouchPoint > Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.ConsumeEndedTouches ( )

Drains and returns all touch contacts that ended (lifted or cancelled) since the last call. Each entry preserves the original TouchPhase (TouchPhase.Ended or TouchPhase.Cancelled) so the poller can distinguish between the two. This method is intended to be called once per engine tick by the TouchEventPoller.

Returns
A snapshot of all contacts that ended since the previous call to this method. The returned list is cleared from the adapter's internal queue on each call.

Implements Gondwana.Input.Touch.ITouchAdapter.

Definition at line 132 of file BlazorTouchAdapter.cs.

◆ Dispose()

void Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.Dispose ( )

Releases all resources and removes event handlers registered by this adapter.

Definition at line 152 of file BlazorTouchAdapter.cs.

Property Documentation

◆ ActiveTouches

IReadOnlyList<GondwanaTouchPoint> Gondwana.Blazor.Input.Touch.BlazorTouchAdapter.ActiveTouches
get

Gets the list of touch contact points that are currently active (in contact with the surface). This list reflects the state at the most recent platform pointer event. An empty list indicates no fingers are currently in contact.

Implements Gondwana.Input.Touch.ITouchAdapter.

Definition at line 38 of file BlazorTouchAdapter.cs.