Docs / Input binder

Glossary: BaseInput

The members of BaseInput, in alphabetical order.

Color legend plain property method

The base of the three inputs: a physical control, with its identity and its live data.

An abstract class, in the namespace BorrowedTorch.InputBinding.Types.Inputs.Base. It implements IEquatable<BaseInput>. ButtonInput, OneAxisInput and TwoAxesInput derive from it, and they are the only ones: a class outside the library can’t derive from it. An input’s identity, its source, shape, id and modifier, is fixed when it is made, and is all that equality and bindings compare; its live data can be set every frame. The inputs page shows it in context, with a picture.

Names are colored by what they are: a property or a method; values and fields keep the plain color.

Properties

PlayerNumber →

int · Which player the input is from this frame: every action’s callback gets it. 0 at first. Live data, not part of the identity, so one binding serves every player.

Representation →

object · Init-only. Anything the game shows the input with, such as an icon. null by default. Not part of the identity; the binder never reads it.

Source →

InputSource · Read-only. Which kind of device the input is on. Part of the identity.

Methods

==() →

operator ==(BaseInput left, BaseInput right) · True when both have the same identity, or both are null. != is its opposite, and Equals compares the same way.

Parameter Type Description
left BaseInput The first input.
right BaseInput The second input.

Equals() →

Equals(BaseInput other) · True for an input with the same identity: source, shape, id and modifier. The live data and the representation don’t count.

Parameter Type Description
other BaseInput The input to compare with. null gives false.

Equals(object obj) · The same, for an object: false for anything that isn’t an input.

Parameter Type Description
obj object The object to compare with.

GetHashCode() →

GetHashCode() · A hash of the identity, the same for equal inputs, so an input can be a dictionary key.