Skip to content

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.

C#
public interface IInputBackend

Remarks

The contract every input backend follows:

  1. 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.
  2. 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.
  3. 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/)).
  4. Pointer positions are in virtual canvas pixels. A backend does not synthesize mouse events from touches or touches from the mouse.
  5. 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.

C#
void Drain(List<InputEvent> events)

Parameters

events List<InputEvent>