KernelAPI reference
Class HeadlessInputBackend
Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Game lifecycle and time
An input backend tests drive by hand: device events sent with Send are delivered at the next drain, in order; key labels can be set as a keyboard layout would print them; rumbles and text-input switches are recorded.
public sealed class HeadlessInputBackend : IInputBackend, IKeyLabels, IGamepadRumble, ITextInputControlInheritance
Implements
IInputBackend, IKeyLabels, IGamepadRumble, ITextInputControl
Constructors
HeadlessInputBackend()
public HeadlessInputBackend()Properties
Labels
The labels KeyLabel reports, as a layout would print them; keys not in it report null.
public Dictionary<Key, string> Labels { get; }Property Value
Rumbles
Every Rumble call, in order.
public List<(DeviceId Pad, float Low, float High, double Seconds)> Rumbles { get; }Property Value
List<(DeviceId Pad, float Low, float High, double Seconds)>
TextInput
Whether text input is on, and the caret it was turned on with.
public (bool Active, RectF Caret) TextInput { get; }Property Value
Methods
Drain(List<InputEvent>)
Moves every event since the previous call into events, oldest first.
public void Drain(List<InputEvent> events)Parameters
events List<InputEvent>
KeyLabel(Key)
The key’s label in the current layout, or null when the backend cannot tell (the US name is used then).
public string? KeyLabel(Key key)Parameters
key Key
Returns
Rumble(DeviceId, float, float, double)
Records the call; every pad can rumble here.
public bool Rumble(DeviceId pad, float low, float high, double seconds)Parameters
pad DeviceId
low float
high float
seconds double
Returns
Send(InputEvent)
Queues an event for the next drain.
public HeadlessInputBackend Send(InputEvent e)Parameters
Returns
Start(RectF)
Turns text input on; caret is where the text being edited is, in virtual canvas pixels, so an
input method can place its candidate list next to it.
public void Start(RectF caret)Parameters
caret RectF
Stop()
Turns text input off.
public void Stop()