![]() |
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 gamepad button inputs across multiple gamepad devices. This singleton class monitors registered buttons on connected gamepads and raises events when buttons are pressed, with support for event throttling and pause states at both global and per-button levels. More...
Public Member Functions | |
| void | StartMonitoringButton (string gamepadId, string button, double timeBetweenEvents=-1, bool isPaused=false) |
| Registers a button on a specific gamepad for event monitoring with optional throttling and pause configuration. Once registered, the button will be polled during calls to PollForEvents(long) and generate ButtonDown events when pressed. | |
| void | StopMonitoringButton (string gamepadId, string button) |
| Unregisters a specific button on a gamepad from event monitoring. After calling this method, the button will no longer be polled and will not generate ButtonDown events until it is registered again using StartMonitoringButton. | |
| void | StopMonitoringAllButtons (string gamepadId) |
| Unregisters all buttons on a specific gamepad from event monitoring. This effectively removes all button configurations for the specified gamepad, and no buttons on that gamepad will generate events until they are registered again. | |
Static Public Member Functions | |
| static void | Initialize (IEnumerable< IGamepadAdapter >? adapters) |
| Initializes the singleton instance of the GamepadEventPoller with the specified gamepad adapters. This method replaces the existing instance and configures it to monitor the provided adapters. | |
Properties | |
| static ? GamepadEventPoller | Instance = new() [get] |
| Gets the singleton instance of the GamepadEventPoller class. This instance is created automatically on first access and can be reinitialized using the Initialize(IEnumerable<IGamepadAdapter>?) method. | |
| IEnumerable< IGamepadAdapter >? | Adapters [get] |
| Gets the collection of gamepad adapters currently being monitored by this poller. Each adapter represents a physical or virtual gamepad device and provides access to its current state. | |
| bool | PauseAllInput [get, set] |
Gets or sets a value indicating whether all input processing is globally paused. When set to true, the poller will not raise any button events regardless of individual button configuration pause states. This provides a convenient way to temporarily disable all gamepad input, such as when a game is paused or a modal dialog is displayed. | |
| IReadOnlyDictionary< string, IReadOnlyDictionary< string, GamepadButtonEventConfiguration > > | AllButtonConfigsByGamepadId [get] |
| Gets a read-only view of all button configurations organized by gamepad ID. The outer dictionary maps gamepad IDs to inner dictionaries, where each inner dictionary maps button identifiers to their respective GamepadButtonEventConfiguration instances. This property is useful for inspecting the current monitoring state of all gamepads and buttons. | |
Events | |
| Action< GamepadButtonDownEventArgs >? | ButtonDown |
| Occurs when a monitored gamepad button is pressed and the button's configuration allows the event to be raised based on throttling settings. Subscribe to this event to handle gamepad button down input in your application. | |
Provides centralized polling and event management for gamepad button inputs across multiple gamepad devices. This singleton class monitors registered buttons on connected gamepads and raises events when buttons are pressed, with support for event throttling and pause states at both global and per-button levels.
Definition at line 8 of file GamepadEventPoller.cs.
|
static |
Initializes the singleton instance of the GamepadEventPoller with the specified gamepad adapters. This method replaces the existing instance and configures it to monitor the provided adapters.
| adapters | A collection of gamepad adapters representing the connected gamepad devices to be monitored. Pass null to create an instance without any adapters. |
Definition at line 37 of file GamepadEventPoller.cs.
| void Gondwana.Input.Gamepad.GamepadEventPoller.StartMonitoringButton | ( | string | gamepadId, |
| string | button, | ||
| double | timeBetweenEvents = -1, | ||
| bool | isPaused = false ) |
Registers a button on a specific gamepad for event monitoring with optional throttling and pause configuration. Once registered, the button will be polled during calls to PollForEvents(long) and generate ButtonDown events when pressed.
| gamepadId | The unique identifier of the gamepad device on which the button should be monitored. This must match the IGamepadAdapter.GamepadId of one of the configured adapters. |
| button | The identifier of the button to monitor (e.g., "A", "B", "X", "Y", "Start", "Back"). This should match the button naming convention used by the gamepad adapter. |
| timeBetweenEvents | The minimum time interval in seconds between consecutive events for this button. Use this to throttle rapid button presses. A value of -1 (default) will use the engine's default time between gamepad events from Gondwana.Configuration.EngineConfiguration.TimeBetweenGamepadEvents. A value of 0 means no throttling. |
| isPaused | A value indicating whether event processing for this button should be initially paused. When paused, the button will not generate events even if pressed. Default is false. |
Definition at line 156 of file GamepadEventPoller.cs.
| void Gondwana.Input.Gamepad.GamepadEventPoller.StopMonitoringAllButtons | ( | string | gamepadId | ) |
Unregisters all buttons on a specific gamepad from event monitoring. This effectively removes all button configurations for the specified gamepad, and no buttons on that gamepad will generate events until they are registered again.
| gamepadId | The unique identifier of the gamepad device for which all button monitoring should be stopped. |
Definition at line 197 of file GamepadEventPoller.cs.
| void Gondwana.Input.Gamepad.GamepadEventPoller.StopMonitoringButton | ( | string | gamepadId, |
| string | button ) |
Unregisters a specific button on a gamepad from event monitoring. After calling this method, the button will no longer be polled and will not generate ButtonDown events until it is registered again using StartMonitoringButton.
| gamepadId | The unique identifier of the gamepad device from which the button should be removed. |
| button | The identifier of the button to stop monitoring. |
Definition at line 181 of file GamepadEventPoller.cs.
|
get |
Gets the collection of gamepad adapters currently being monitored by this poller. Each adapter represents a physical or virtual gamepad device and provides access to its current state.
Definition at line 70 of file GamepadEventPoller.cs.
|
get |
Gets a read-only view of all button configurations organized by gamepad ID. The outer dictionary maps gamepad IDs to inner dictionaries, where each inner dictionary maps button identifiers to their respective GamepadButtonEventConfiguration instances. This property is useful for inspecting the current monitoring state of all gamepads and buttons.
Definition at line 208 of file GamepadEventPoller.cs.
|
staticget |
Gets the singleton instance of the GamepadEventPoller class. This instance is created automatically on first access and can be reinitialized using the Initialize(IEnumerable<IGamepadAdapter>?) method.
Definition at line 17 of file GamepadEventPoller.cs.
|
getset |
Gets or sets a value indicating whether all input processing is globally paused. When set to true, the poller will not raise any button events regardless of individual button configuration pause states. This provides a convenient way to temporarily disable all gamepad input, such as when a game is paused or a modal dialog is displayed.
Definition at line 78 of file GamepadEventPoller.cs.
| Action<GamepadButtonDownEventArgs>? Gondwana.Input.Gamepad.GamepadEventPoller.ButtonDown |
Occurs when a monitored gamepad button is pressed and the button's configuration allows the event to be raised based on throttling settings. Subscribe to this event to handle gamepad button down input in your application.
Definition at line 85 of file GamepadEventPoller.cs.