![]() |
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.
|
Provides centralized polling and event management for touch input. This singleton class monitors touch adapter state each engine frame, detects contact transitions, and raises events with comprehensive touch point information, with support for event throttling and pause functionality. More...
Public Member Functions | |
| void | StartMonitoringTouch (double timeBetweenEvents=-1, bool isPaused=false) |
| Starts or reconfigures touch input monitoring with the specified settings. This method creates a new configuration that controls event throttling and pause state. Call this method to begin monitoring touch input or to change monitoring settings. | |
| void | StopMonitoringTouch () |
| Stops monitoring touch input by clearing the configuration. After calling this method, touch events will no longer be raised until StartMonitoringTouch is called again. | |
| void | Dispose () |
| Releases recognizers and the current platform adapter. | |
Static Public Member Functions | |
| static void | Initialize (ITouchAdapter adapter, TouchEventConfiguration? config=null) |
| Initializes the singleton instance of the TouchEventPoller with the specified touch adapter and optional configuration. This method replaces the existing instance and configures it to monitor touch input through the provided adapter. | |
| static void | Reset () |
| Disposes and clears the current singleton instance, including its adapter. | |
Properties | |
| static ? TouchEventPoller | Instance [get] |
| Gets the singleton instance of the TouchEventPoller class. This instance is created through the Initialize method and provides centralized access to touch event polling functionality throughout the application. | |
| IReadOnlyList< TouchPoint > | ActiveTouches [get] |
| Gets the list of touch contact points that are currently active (in contact with the surface). This list is updated before each event is raised and reflects the state at the time of the last pointer action. An empty list indicates no fingers are currently in contact. | |
| ITouchAdapter? | Adapter [get] |
Gets the touch adapter currently in use, which provides access to the underlying touch state including active contacts and ended contacts. Returns null if no adapter has been configured. | |
| TouchEventConfiguration? | Configuration [get] |
Gets the current touch event configuration, which controls movement-event throttling and pause state. Returns null if touch monitoring has been stopped or not yet configured. | |
| TapGestureRecognizer | TapRecognizer [get] |
| Gets the tap gesture recognizer used by this poller. Adjust TapGestureRecognizer.MaxTapDurationSeconds and TapGestureRecognizer.MaxTapMovementPixels to tune tap detection thresholds. | |
| SwipeGestureRecognizer | SwipeRecognizer [get] |
| Gets the swipe gesture recognizer used by this poller. Adjust SwipeGestureRecognizer.MinimumSwipeSpeedPixelsPerSecond to tune swipe detection thresholds. | |
| PinchGestureRecognizer | PinchRecognizer [get] |
| Gets the pinch gesture recognizer used by this poller. | |
Events | |
| EventHandler< TouchEventArgs >? | TouchBegan |
| EventHandler< TouchEventArgs >? | TouchMoved |
| EventHandler< TouchEventArgs >? | TouchEnded |
| Action< GestureEventArgs >? | TouchEvent |
| Occurs when any recognized gesture — tap, swipe, or pinch — is detected. Inspect GestureEventArgs.IsTap, GestureEventArgs.IsSwipe, or GestureEventArgs.IsPinch to determine the gesture kind, then access the corresponding property (GestureEventArgs.Tap, GestureEventArgs.Swipe, or GestureEventArgs.Pinch) for the specific data. | |
| Events inherited from Gondwana.Input.Touch.ITouchInput | |
| EventHandler< TouchEventArgs > | TouchBegan |
| Occurs when a new touch contact begins — a finger or pointer first makes contact with the surface. The TouchEventArgs.Touch property contains the new contact point with TouchPhase.Began. | |
| EventHandler< TouchEventArgs > | TouchMoved |
| Occurs when an active touch contact moves across the surface. The TouchEventArgs.Touch property contains the updated contact point with TouchPhase.Moved. | |
| EventHandler< TouchEventArgs > | TouchEnded |
| Occurs when an active touch contact ends — a finger or pointer lifts from the surface, or the contact is cancelled by the system. The TouchEventArgs.Touch property contains the final contact point with TouchPhase.Ended or TouchPhase.Cancelled. | |
Provides centralized polling and event management for touch input. This singleton class monitors touch adapter state each engine frame, detects contact transitions, and raises events with comprehensive touch point information, with support for event throttling and pause functionality.
TouchEventPoller implements ITouchInput so that all gesture recognizers (TapGestureRecognizer, SwipeGestureRecognizer, PinchGestureRecognizer) work unchanged.
The adapter (ITouchAdapter) is a passive state holder updated by platform events on the UI thread. The poller is called by the engine each frame to diff state, detect transitions, and raise events on the engine thread.
Definition at line 23 of file TouchEventPoller.cs.
| void Gondwana.Input.Touch.TouchEventPoller.Dispose | ( | ) |
Releases recognizers and the current platform adapter.
Definition at line 297 of file TouchEventPoller.cs.
|
static |
Initializes the singleton instance of the TouchEventPoller with the specified touch adapter and optional configuration. This method replaces the existing instance and configures it to monitor touch input through the provided adapter.
| adapter | The touch adapter that provides access to the current touch state including active contacts and ended contacts. This adapter abstracts platform-specific touch input handling. |
| config | Optional configuration for touch event monitoring. If null, a default configuration is created using Engine.Instance's Gondwana.Configuration.EngineConfiguration.TimeBetweenTouchEvents as the throttle interval. |
Definition at line 47 of file TouchEventPoller.cs.
|
static |
Disposes and clears the current singleton instance, including its adapter.
Definition at line 61 of file TouchEventPoller.cs.
| void Gondwana.Input.Touch.TouchEventPoller.StartMonitoringTouch | ( | double | timeBetweenEvents = -1, |
| bool | isPaused = false ) |
Starts or reconfigures touch input monitoring with the specified settings. This method creates a new configuration that controls event throttling and pause state. Call this method to begin monitoring touch input or to change monitoring settings.
| timeBetweenEvents | The minimum time interval in seconds between consecutive touch movement events. Touch beginnings, endings, and cancellations are never throttled. Use the default time between touch events from Gondwana.Configuration.EngineConfiguration.TimeBetweenTouchEvents when a value less than zero is supplied. A value of 0 means no throttling. |
| isPaused | A value indicating whether event processing for touch should be initially paused. When paused, touch will not generate events even if contacts change. Default is false. |
Definition at line 267 of file TouchEventPoller.cs.
| void Gondwana.Input.Touch.TouchEventPoller.StopMonitoringTouch | ( | ) |
Stops monitoring touch input by clearing the configuration. After calling this method, touch events will no longer be raised until StartMonitoringTouch is called again.
Definition at line 279 of file TouchEventPoller.cs.
|
get |
Gets the list of touch contact points that are currently active (in contact with the surface). This list is updated before each event is raised and reflects the state at the time of the last pointer action. An empty list indicates no fingers are currently in contact.
Implements Gondwana.Input.Touch.ITouchInput.
Definition at line 71 of file TouchEventPoller.cs.
|
get |
Gets the touch adapter currently in use, which provides access to the underlying touch state including active contacts and ended contacts. Returns null if no adapter has been configured.
Definition at line 78 of file TouchEventPoller.cs.
|
get |
Gets the current touch event configuration, which controls movement-event throttling and pause state. Returns null if touch monitoring has been stopped or not yet configured.
Definition at line 84 of file TouchEventPoller.cs.
|
staticget |
Gets the singleton instance of the TouchEventPoller class. This instance is created through the Initialize method and provides centralized access to touch event polling functionality throughout the application.
Definition at line 30 of file TouchEventPoller.cs.
|
get |
Gets the pinch gesture recognizer used by this poller.
Definition at line 128 of file TouchEventPoller.cs.
|
get |
Gets the swipe gesture recognizer used by this poller. Adjust SwipeGestureRecognizer.MinimumSwipeSpeedPixelsPerSecond to tune swipe detection thresholds.
Definition at line 123 of file TouchEventPoller.cs.
|
get |
Gets the tap gesture recognizer used by this poller. Adjust TapGestureRecognizer.MaxTapDurationSeconds and TapGestureRecognizer.MaxTapMovementPixels to tune tap detection thresholds.
Definition at line 116 of file TouchEventPoller.cs.
| EventHandler<TouchEventArgs>? Gondwana.Input.Touch.TouchEventPoller.TouchBegan |
Definition at line 87 of file TouchEventPoller.cs.
| EventHandler<TouchEventArgs>? Gondwana.Input.Touch.TouchEventPoller.TouchEnded |
Definition at line 93 of file TouchEventPoller.cs.
| Action<GestureEventArgs>? Gondwana.Input.Touch.TouchEventPoller.TouchEvent |
Occurs when any recognized gesture — tap, swipe, or pinch — is detected. Inspect GestureEventArgs.IsTap, GestureEventArgs.IsSwipe, or GestureEventArgs.IsPinch to determine the gesture kind, then access the corresponding property (GestureEventArgs.Tap, GestureEventArgs.Swipe, or GestureEventArgs.Pinch) for the specific data.
The internal gesture recognizers (TapRecognizer, SwipeRecognizer, PinchRecognizer) are owned by this poller instance. They subscribe to this poller's own touch events and their lifetime is bound to the lifetime of this instance — when the instance is replaced via Initialize the entire object graph (poller + recognizers + subscriptions) becomes unreachable and is collected together.
Definition at line 109 of file TouchEventPoller.cs.
| EventHandler<TouchEventArgs>? Gondwana.Input.Touch.TouchEventPoller.TouchMoved |
Definition at line 90 of file TouchEventPoller.cs.