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.Avalonia.Input.Touch.AvaloniaTouchInputAdapter Class Referencesealed

Provides a passive touch/pointer state adapter for Avalonia applications, implementing ITouchAdapter by translating Avalonia PointerPressed, PointerMoved, PointerReleased, and PointerCaptureLost events into Gondwana touch state. Events are not raised directly; the TouchEventPoller polls this adapter each engine frame to detect transitions and raise events. More...

Inheritance diagram for Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter:
Gondwana.Input.Touch.ITouchAdapter

Public Member Functions

 AvaloniaTouchInputAdapter (Control control, bool emulateMouse=false)
 Initializes a new instance of the AvaloniaTouchInputAdapter class, attaching pointer event handlers to the specified Avalonia control.
IReadOnlyList< TouchPoint > 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< TouchPoint > 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 held by this adapter, unsubscribing from all Avalonia pointer events. After disposal, no further touch events will be raised.

Properties

IReadOnlyList< TouchPoint > 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/pointer state adapter for Avalonia applications, implementing ITouchAdapter by translating Avalonia PointerPressed, PointerMoved, PointerReleased, and PointerCaptureLost 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 physical touch devices (Android, iOS), each finger contact is tracked by Avalonia's pointer ID and exposed as a unique TouchPoint. Mouse pointers are ignored by default so an application that also initializes AvaloniaMouseAdapter does not receive duplicate mouse and touch input. Pass emulateMouse: true to the constructor when single-contact mouse emulation is desired.

Dispose this adapter to unsubscribe from all Avalonia pointer events.

Definition at line 28 of file AvaloniaTouchInputAdapter.cs.

Constructor & Destructor Documentation

◆ AvaloniaTouchInputAdapter()

Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter.AvaloniaTouchInputAdapter ( Control control,
bool emulateMouse = false )

Initializes a new instance of the AvaloniaTouchInputAdapter class, attaching pointer event handlers to the specified Avalonia control.

Parameters
controlThe Avalonia Control whose pointer events will be translated into touch events. Must not be null.
emulateMouseWhen true, primary mouse-button input is also exposed as touch ID 0. The default is false to keep mouse and physical touch distinct.
Exceptions
ArgumentNullExceptionThrown when control is null.

Definition at line 56 of file AvaloniaTouchInputAdapter.cs.

Member Function Documentation

◆ ConsumeBeganTouches()

IReadOnlyList< TouchPoint > Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter.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 144 of file AvaloniaTouchInputAdapter.cs.

◆ ConsumeEndedTouches()

IReadOnlyList< TouchPoint > Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter.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 156 of file AvaloniaTouchInputAdapter.cs.

◆ Dispose()

void Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter.Dispose ( )

Releases all resources held by this adapter, unsubscribing from all Avalonia pointer events. After disposal, no further touch events will be raised.

Definition at line 192 of file AvaloniaTouchInputAdapter.cs.

Property Documentation

◆ ActiveTouches

IReadOnlyList<TouchPoint> Gondwana.Avalonia.Input.Touch.AvaloniaTouchInputAdapter.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 39 of file AvaloniaTouchInputAdapter.cs.