InputAPI reference
Struct InputEvent
Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.dll
Guide: Input
One thing that happened on an input device, in the order it happened, with the time it happened on the host’s monotonic clock. Backends deliver them (IInputBackend); the engine routes them through the input layers (UI, on-screen controls, then gameplay) and derives the polled state actions read from those no layer took. Build one with the static methods (KeyDown, PointerDown…).
public readonly struct InputEvent : IEquatable<InputEvent>Implements
Properties
Axis
The gamepad axis of axis events.
public PadAxis Axis { get; init; }Property Value
Button
The gamepad button of button events.
public PadButton Button { get; init; }Property Value
Device
The device it happened on.
public DeviceId Device { get; init; }Property Value
Info
The device of DeviceAdded.
public InputDeviceInfo? Info { get; init; }Property Value
IsPress
Whether this is a press: a key-down that is not a repeat, a pointer-down or a gamepad button-down.
public bool IsPress { get; }Property Value
Key
The key of key events.
public Key Key { get; init; }Property Value
Kind
What happened.
public InputEventKind Kind { get; init; }Property Value
Pointer
The pointer of pointer events: 0 for the mouse, the finger’s id for touches.
public long Pointer { get; init; }Property Value
PointerButton
The pointer button of pointer-down and pointer-up events.
public PointerButton PointerButton { get; init; }Property Value
PointerKind
The kind of pointer.
public PointerKind PointerKind { get; init; }Property Value
Position
The pointer’s position in virtual canvas pixels (may lie outside the canvas, in the letterbox).
public Vector2 Position { get; init; }Property Value
Repeat
Whether a key-down is the system’s auto-repeat of a held key (it does not change what is held).
public bool Repeat { get; init; }Property Value
ScreenPosition
The pointer’s position in the window’s pixels, for overlays drawn in screen pixels (touches; the mouse when known).
public Vector2 ScreenPosition { get; init; }Property Value
Text
The text of text and composition events.
public string? Text { get; init; }Property Value
Time
When, in seconds of the host’s monotonic clock (0 for scripted and polled events).
public double Time { get; init; }Property Value
Value
The axis value: sticks -1..1 (right and down positive), triggers 0..1.
public float Value { get; init; }Property Value
Wheel
How far the wheel turned: Y positive away from the player, X positive to the right, in notches.
public Vector2 Wheel { get; init; }Property Value
Methods
Added(InputDeviceInfo, double)
A device was connected.
public static InputEvent Added(InputDeviceInfo info, double time = 0)Parameters
info InputDeviceInfo
time double
Returns
AxisMoved(DeviceId, PadAxis, float, double)
A gamepad axis moved.
public static InputEvent AxisMoved(DeviceId device, PadAxis axis, float value, double time = 0)Parameters
device DeviceId
axis PadAxis
value float
time double
Returns
ButtonDown(DeviceId, PadButton, double)
A gamepad button went down.
public static InputEvent ButtonDown(DeviceId device, PadButton button, double time = 0)Parameters
device DeviceId
button PadButton
time double
Returns
ButtonUp(DeviceId, PadButton, double)
A gamepad button went up.
public static InputEvent ButtonUp(DeviceId device, PadButton button, double time = 0)Parameters
device DeviceId
button PadButton
time double
Returns
Composition(DeviceId, string, double)
The text being composed changed.
public static InputEvent Composition(DeviceId device, string text, double time = 0)Parameters
device DeviceId
text string
time double
Returns
Equals(object)
public override bool Equals(object obj)Parameters
obj object
Returns
Equals(InputEvent)
public bool Equals(InputEvent other)Parameters
other InputEvent
Returns
GetHashCode()
public override int GetHashCode()Returns
KeyDown(DeviceId, Key, double, bool)
A key went down.
public static InputEvent KeyDown(DeviceId device, Key key, double time = 0, bool repeat = false)Parameters
device DeviceId
key Key
time double
repeat bool
Returns
KeyUp(DeviceId, Key, double)
A key went up.
public static InputEvent KeyUp(DeviceId device, Key key, double time = 0)Parameters
device DeviceId
key Key
time double
Returns
PointerDown(DeviceId, long, PointerKind, Vector2, PointerButton, double)
A pointer button went down or a finger touched.
public static InputEvent PointerDown(DeviceId device, long pointer, PointerKind kind, Vector2 position, PointerButton button = PointerButton.Primary, double time = 0)Parameters
device DeviceId
pointer long
kind PointerKind
position Vector2
button PointerButton
time double
Returns
PointerMove(DeviceId, long, PointerKind, Vector2, double)
A pointer moved.
public static InputEvent PointerMove(DeviceId device, long pointer, PointerKind kind, Vector2 position, double time = 0)Parameters
device DeviceId
pointer long
kind PointerKind
position Vector2
time double
Returns
PointerUp(DeviceId, long, PointerKind, Vector2, PointerButton, double)
A pointer button went up or a finger lifted.
public static InputEvent PointerUp(DeviceId device, long pointer, PointerKind kind, Vector2 position, PointerButton button = PointerButton.Primary, double time = 0)Parameters
device DeviceId
pointer long
kind PointerKind
position Vector2
button PointerButton
time double
Returns
Removed(DeviceId, double)
A device was disconnected.
public static InputEvent Removed(DeviceId device, double time = 0)Parameters
device DeviceId
time double
Returns
TextInput(DeviceId, string, double)
Text was entered.
public static InputEvent TextInput(DeviceId device, string text, double time = 0)Parameters
device DeviceId
text string
time double
Returns
ToString()
public override string ToString()Returns
WheelMoved(DeviceId, Vector2, Vector2, double)
The wheel turned.
public static InputEvent WheelMoved(DeviceId device, Vector2 wheel, Vector2 position = default, double time = 0)Parameters
device DeviceId
wheel Vector2
position Vector2
time double
Returns
Operators
operator ==(InputEvent, InputEvent)
public static bool operator ==(InputEvent left, InputEvent right)Parameters
left InputEvent
right InputEvent
Returns
operator !=(InputEvent, InputEvent)
public static bool operator !=(InputEvent left, InputEvent right)Parameters
left InputEvent
right InputEvent