Gondwana Game Engine
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, mobile, and web platforms using SkiaSharp for graphics and NAudio for sound.
Loading...
Searching...
No Matches
Gondwana.Input.Keyboard.KeyboardEventPoller Class Referencesealed

Cross-platform singleton keyboard handler with throttling and manual input state feeding. More...

Public Member Functions

void StartMonitoringKey (int keyCode, string? displayName=null, double timeBetweenEvents=-1, bool isPaused=false)
 Primary API: monitor by platform-agnostic key code. Platform layers (WinForms, SDL, etc.) are responsible for mapping their key enums/names to key codes.
void StopMonitoringKey (int keyCode)
 Unregisters a specific key from event monitoring by its platform-agnostic key code. After calling this method, the key will no longer be polled and will not generate KeyDown events until it is registered again using StartMonitoringKey.
void StopMonitoringKey (string key)
 Unregisters a specific key from event monitoring by parsing its string representation. If the string can be parsed as an integer key code, the key will be unregistered. After calling this method, the key will no longer generate KeyDown events.
void StopMonitoringAllKeys ()
 Unregisters all keys from event monitoring, clearing all key configurations and state tracking. After calling this method, no keys will generate events until they are registered again using StartMonitoringKey. This is useful for resetting the keyboard state when changing game modes or screens.

Static Public Member Functions

static void Initialize (IKeyboardAdapter adapter)
 Initializes the singleton instance of the KeyboardEventPoller with the specified keyboard adapter. This method replaces the existing instance and configures it to monitor keyboard input through the provided adapter.

Properties

static ? KeyboardEventPoller Instance [get]
 Singleton instance of the KeyboardEventPoller class.
IKeyboardAdapterAdapter [get]
 Gets the current keyboard adapter in use.
bool PauseAllKeyEvents [get, set]
 Pauses all key events globally.
IReadOnlyDictionary< int, KeyEventConfigurationAllKeyConfigs [get]
 Exposes monitored key configurations. Treat as engine-thread-only unless you add external synchronization.

Events

Action< KeyDownEventArgs >? KeyDown
 Occurs when a monitored keyboard key is pressed, released, or repeated based on its configuration and throttling settings. Subscribe to this event to handle keyboard input in your application. The event provides information about the key action (pressed, released, or repeated) and current keyboard modifier states.

Detailed Description

Cross-platform singleton keyboard handler with throttling and manual input state feeding.

Member Function Documentation

◆ Initialize()

void Gondwana.Input.Keyboard.KeyboardEventPoller.Initialize ( IKeyboardAdapter adapter)
static

Initializes the singleton instance of the KeyboardEventPoller with the specified keyboard adapter. This method replaces the existing instance and configures it to monitor keyboard input through the provided adapter.

Parameters
adapterThe keyboard adapter that provides access to the current keyboard state and key press information. This adapter abstracts platform-specific keyboard input handling.

◆ StartMonitoringKey()

void Gondwana.Input.Keyboard.KeyboardEventPoller.StartMonitoringKey ( int keyCode,
string? displayName = null,
double timeBetweenEvents = -1,
bool isPaused = false )

Primary API: monitor by platform-agnostic key code. Platform layers (WinForms, SDL, etc.) are responsible for mapping their key enums/names to key codes.

◆ StopMonitoringAllKeys()

void Gondwana.Input.Keyboard.KeyboardEventPoller.StopMonitoringAllKeys ( )

Unregisters all keys from event monitoring, clearing all key configurations and state tracking. After calling this method, no keys will generate events until they are registered again using StartMonitoringKey. This is useful for resetting the keyboard state when changing game modes or screens.

◆ StopMonitoringKey() [1/2]

void Gondwana.Input.Keyboard.KeyboardEventPoller.StopMonitoringKey ( int keyCode)

Unregisters a specific key from event monitoring by its platform-agnostic key code. After calling this method, the key will no longer be polled and will not generate KeyDown events until it is registered again using StartMonitoringKey.

Parameters
keyCodeThe platform-agnostic key code identifying the key to stop monitoring. This should match the key code used when calling StartMonitoringKey.

◆ StopMonitoringKey() [2/2]

void Gondwana.Input.Keyboard.KeyboardEventPoller.StopMonitoringKey ( string key)

Unregisters a specific key from event monitoring by parsing its string representation. If the string can be parsed as an integer key code, the key will be unregistered. After calling this method, the key will no longer generate KeyDown events.

Parameters
keyA string representation of the key code to stop monitoring. The string must be parseable as an integer. If parsing fails, this method has no effect.

Property Documentation

◆ Adapter

IKeyboardAdapter? Gondwana.Input.Keyboard.KeyboardEventPoller.Adapter
get

Gets the current keyboard adapter in use.

◆ AllKeyConfigs

IReadOnlyDictionary<int, KeyEventConfiguration> Gondwana.Input.Keyboard.KeyboardEventPoller.AllKeyConfigs
get

Exposes monitored key configurations. Treat as engine-thread-only unless you add external synchronization.

◆ Instance

? KeyboardEventPoller Gondwana.Input.Keyboard.KeyboardEventPoller.Instance
staticget

Singleton instance of the KeyboardEventPoller class.

◆ PauseAllKeyEvents

bool Gondwana.Input.Keyboard.KeyboardEventPoller.PauseAllKeyEvents
getset

Pauses all key events globally.

Event Documentation

◆ KeyDown

Action<KeyDownEventArgs>? Gondwana.Input.Keyboard.KeyboardEventPoller.KeyDown

Occurs when a monitored keyboard key is pressed, released, or repeated based on its configuration and throttling settings. Subscribe to this event to handle keyboard input in your application. The event provides information about the key action (pressed, released, or repeated) and current keyboard modifier states.