InputAPI reference
Interface IInputBackend
Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.dll
Guide: Input
The input part of a platform: the devices and what happens on them, delivered as events. A capability of hosts with input (TryGetCapability``1); the engine drains it once per frame, at the start of the frame’s input phase.
public interface IInputBackendRemarks
The contract every input backend follows:
- Events are in the order they happened; a host gathers them in its event pump and hands them over in [Drain](/docs/api/microengine.input.iinputbackend/#MicroEngine_Input_IInputBackend_Drain_System_Collections_Generic_List_MicroEngine_Input_InputEvent__), never between drains.
- Every connected device is announced with [DeviceAdded](/docs/api/microengine.input.inputeventkind/) before its first other event, also those present at start; a disconnected one with [DeviceRemoved](/docs/api/microengine.input.inputeventkind/) after events releasing what it held.
- Keys are positions ([Key](/docs/api/microengine.input.key/)), never characters; characters come as [Text](/docs/api/microengine.input.inputeventkind/) only while text input is on ([ITextInputControl](/docs/api/microengine.input.itextinputcontrol/)).
- Pointer positions are in virtual canvas pixels. A backend does not synthesize mouse events from touches or touches from the mouse.
- When the window loses focus, the backend releases every key and button it reported down.
Methods
Drain(List<InputEvent>)
Moves every event since the previous call into events, oldest first.
void Drain(List<InputEvent> events)Parameters
events List<InputEvent>