InputAPI reference
Class InputDevices
Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.dll
Guide: Input
The state of every device, derived from the events no input layer took: which keys and buttons are held, where the axes, the pointers and the wheel are, and which devices are connected. A press that started and ended between two updates still reads as held until an update has sampled it (EndSample): taps expire by updates, never by drawn frames. Players read it through views limited to their devices (View).
public sealed class InputDevicesInheritance
Constructors
InputDevices()
public InputDevices()Properties
Devices
The connected devices, in the order they connected.
public IReadOnlyList<InputDeviceInfo> Devices { get; }Property Value
IReadOnlyList<InputDeviceInfo>
Methods
Apply(in InputEvent)
Applies one event. An event of a device that was never announced announces it first as a generic device of the event’s kind, so a backend’s own ids always work.
public void Apply(in InputEvent e)Parameters
EndSample()
Ends a sample: presses that were already released stop reading as held, the wheel starts again from 0 and lifted fingers go. Called once after every update has read the devices.
public void EndSample()Find(DeviceId)
The device’s description, or null when it is not connected.
public InputDeviceInfo? Find(DeviceId id)Parameters
id DeviceId
Returns
HeldReleases(DeviceId, double)
The events that would release what device holds now: an up for every key and gamepad button
held, axes back to 0, and an up for every held pointer button (a cancel for fingers and pens). A backend sends them
when the system will not (the window lost the focus).
public IEnumerable<InputEvent> HeldReleases(DeviceId device, double time = 0)Parameters
device DeviceId
time double
Returns
ReleaseAll()
Releases everything held on every device (the window lost focus, the game was suspended).
public void ReleaseAll()View(Func<DeviceId, bool>)
The state of the devices owns accepts, read as one polled source: a key or button is down when
any of them has it down, the axis with the largest deflection wins, the pointer is the one that moved last.
public IInputSource View(Func<DeviceId, bool> owns)Parameters
Returns
Connected
Raised when a device connects (also those present at start), after it was added.
public event Action<InputDeviceInfo>? ConnectedEvent Type
Disconnected
Raised when a device disconnects, after it was removed.
public event Action<InputDeviceInfo>? Disconnected