Skip to content

Struct Binding

Namespace: Apogee.Input
Assembly: Apogee.Input.dll

What an action is bound to, in the text form players edit: [Hold |Double ][Ctrl+][Shift+][Alt+]input. Keys go by their position on a US QWERTY keyboard (W, Tab, F1, BracketLeft…: ), so AZERTY players get ZQSD for WASD; mouse inputs are Mouse Left, Mouse Right, Mouse Middle, Mouse Wheel Up, Mouse Wheel Down, Mouse Back, Mouse Forward and the motion Mouse X- … Mouse Y+; gamepad inputs are Joy A … Joy Right (Xbox names), the sticks Joy LX- … Joy RY+ (Y+ is down) and the triggers Joy LT, Joy RT. Names are case-insensitive when read and written the way this lists them.

public readonly record struct Binding : IEquatable<Binding>

Implements

IEquatable<Binding>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

Binding(string, Modifiers, Trigger)

What an action is bound to, in the text form players edit: [Hold |Double ][Ctrl+][Shift+][Alt+]input. Keys go by their position on a US QWERTY keyboard (W, Tab, F1, BracketLeft…: ), so AZERTY players get ZQSD for WASD; mouse inputs are Mouse Left, Mouse Right, Mouse Middle, Mouse Wheel Up, Mouse Wheel Down, Mouse Back, Mouse Forward and the motion Mouse X- … Mouse Y+; gamepad inputs are Joy A … Joy Right (Xbox names), the sticks Joy LX- … Joy RY+ (Y+ is down) and the triggers Joy LT, Joy RT. Names are case-insensitive when read and written the way this lists them.

public Binding(string Input, Modifiers Modifiers, Trigger Trigger)

Parameters

Input string

Modifiers Modifiers

Trigger Trigger

Properties

GamepadInputs

Every gamepad input, as it is written.

public static IReadOnlyList<string> GamepadInputs { get; }

Property Value

IReadOnlyList<string>

Input

public string Input { get; init; }

Property Value

string

Modifiers

public Modifiers Modifiers { get; init; }

Property Value

Modifiers

MouseInputs

Every mouse input, as it is written.

public static IReadOnlyList<string> MouseInputs { get; }

Property Value

IReadOnlyList<string>

Trigger

public Trigger Trigger { get; init; }

Property Value

Trigger

Methods

DeviceOf(string)

public static InputDevice DeviceOf(string input)

Parameters

input string

Returns

InputDevice

IsAxis(string)

A stick direction, a mouse motion direction or a trigger: inputs with a strength between 0 and 1 (more, for the mouse), not just down or up.

public static bool IsAxis(string input)

Parameters

input string

Returns

bool

IsTrigger(string)

A gamepad trigger: an axis that only goes one way, so its name has no sign.

public static bool IsTrigger(string input)

Parameters

input string

Returns

bool

Parse(string)

Reads the text form, or throws a (a script error) that says what is wrong.

public static Binding Parse(string text)

Parameters

text string

Returns

Binding

Prefix(Modifiers)

public static string Prefix(Modifiers modifiers)

Parameters

modifiers Modifiers

Returns

string

Prefix(Trigger)

public static string Prefix(Trigger trigger)

Parameters

trigger Trigger

Returns

string

ToString()

The text form: Hold Ctrl+Shift+L.

public override string ToString()

Returns

string

TryParse(string, out Binding, out string)

Reads the text form; error says what is wrong when it returns false.

public static bool TryParse(string text, out Binding binding, out string error)

Parameters

text string

binding Binding

error string

Returns

bool