InputAPI reference
Class BufferedInputBackend
Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.dll
Guide: Input
A base for input backends of platforms whose system reports input as it happens or as per-frame state: a backend
emits events (Emit) while it processes the system’s, and the engine drains them
(Drain). It also answers the polled questions (IInputSource) from the same events, for
code that reads a platform’s Input directly; there a press shorter than a frame reads as held until the next
BeginFrame.
public abstract class BufferedInputBackend : IInputBackend, IInputSourceInheritance
Implements
Constructors
BufferedInputBackend()
Creates the backend with an empty queue.
protected BufferedInputBackend()Properties
LeftStick
Left stick, each axis in -1..1.
public Vector2 LeftStick { get; }Property Value
PadConnected
Whether a gamepad is connected. Sources without gamepads keep the default.
public bool PadConnected { get; }Property Value
PadStyle
The family of the connected gamepad, for button names in prompts; sources that cannot tell keep Xbox.
public GamepadStyle PadStyle { get; }Property Value
Pointer
The mouse over the virtual canvas; sources without one keep the default (not present).
public PointerState Pointer { get; }Property Value
Pointers
Every pointer: the mouse while over the window, each finger or pen on the screen. Sources without pointers keep the default (none).
public IReadOnlyList<PointerInfo> Pointers { get; }Property Value
State
The state of the devices this backend reported, as its polled view reads it.
protected InputDevices State { get; }Property Value
Methods
BeginFrame()
Starts a frame of the polled view: presses already released stop reading as held. Call before the frame’s events.
public void BeginFrame()Drain(List<InputEvent>)
Moves every event since the previous call into events, oldest first.
public void Drain(List<InputEvent> events)Parameters
events List<InputEvent>
Emit(in InputEvent)
Queues e for the engine and applies it to the polled view.
protected void Emit(in InputEvent e)Parameters
GetPadAxis(PadAxis)
Any gamepad axis. Sources that only know the left stick keep the default.
public float GetPadAxis(PadAxis axis)Parameters
axis PadAxis
Returns
IsKeyDown(Key)
Whether key is held.
public bool IsKeyDown(Key key)Parameters
key Key
Returns
IsPadDown(PadButton)
Whether button is held on the gamepad.
public bool IsPadDown(PadButton button)Parameters
button PadButton
Returns
ReleaseHeld(double)
Emits releases of every key, button and pointer button this backend reported held, as the window loses the focus (the system will not send them).
protected void ReleaseHeld(double time)Parameters
time double