Color legend method
Makes inputs in a few characters, to bind or to poll.
A static class, in the namespace BorrowedTorch.InputBinding.Factories. Each method is short for a constructor: InputFactory.Key(32) is new ButtonInput(InputSource.Keyboard, 32). The state or value only matters to a polled input, since a binding matches on identity alone. None of them takes a Representation: for one, use the constructor with an initializer. The inputs page shows it in context, with code.
Names are colored by what they are: a method.
Methods
Axes() →
Axes(InputSource source, int axesId, Vector2? value = null) · Static. A TwoAxesInput on any source.
| Parameter | Type | Description |
|---|---|---|
source |
InputSource |
Which kind of device. |
axesId |
int |
Which pair of axes. |
value |
Vector2? |
The value, for a polled input. Default: null, for zero. |
Axis() →
Axis(InputSource source, int axisId, float? value = null) · Static. A OneAxisInput on any source.
| Parameter | Type | Description |
|---|---|---|
source |
InputSource |
Which kind of device. |
axisId |
int |
Which axis. |
value |
float? |
The value, for a polled input. Default: null, for 0. |
Button() →
Button(InputSource source, int buttonId, ButtonState state = ButtonState.None, ButtonModifier modifier = ButtonModifier.None) · Static. A ButtonInput on any source. The modifier is kept for the keyboard only.
| Parameter | Type | Description |
|---|---|---|
source |
InputSource |
Which kind of device. |
buttonId |
int |
Which button. |
state |
ButtonState |
The state, for a polled input. Default: None. |
modifier |
ButtonModifier |
For a key, the modifier held with it. Default: None. |
GamePadAxes() →
GamePadAxes(int axesId, Vector2? value = null) · Static. A TwoAxesInput on a pad, such as a stick.
| Parameter | Type | Description |
|---|---|---|
axesId |
int |
Which pair of axes, such as 0 for the left stick. |
value |
Vector2? |
The value, for a polled input. Default: null, for zero. |
GamePadAxis() →
GamePadAxis(int axisId, float? value = null) · Static. A OneAxisInput on a pad, such as a trigger.
| Parameter | Type | Description |
|---|---|---|
axisId |
int |
Which axis, such as 0 for the left trigger. |
value |
float? |
The value, for a polled input. Default: null, for 0. |
GamePadButton() →
GamePadButton(int button, ButtonState state = ButtonState.None) · Static. A ButtonInput on a pad.
| Parameter | Type | Description |
|---|---|---|
button |
int |
Which button, such as (int)GamePadButtonTypes.A with MonoInput. |
state |
ButtonState |
The state, for a polled input. Default: None. |
Key() →
Key(int keyCode, ButtonState state = ButtonState.None, ButtonModifier modifier = ButtonModifier.None) · Static. A ButtonInput on the keyboard. Pass the modifier by name, modifier: ButtonModifier.Ctrl, since the second parameter is the state.
| Parameter | Type | Description |
|---|---|---|
keyCode |
int |
Which key, such as (int)Keys.Space with MonoGame. |
state |
ButtonState |
The state, for a polled input. Default: None. |
modifier |
ButtonModifier |
The modifier held with the key, for a binding such as Ctrl+S. Default: None. |
MidiAxis() →
MidiAxis(int axisId, float? value = null) · Static. A OneAxisInput on a MIDI device, such as a knob.
| Parameter | Type | Description |
|---|---|---|
axisId |
int |
Which axis, such as the controller number. |
value |
float? |
The value, for a polled input. Default: null, for 0. |
MidiButton() →
MidiButton(int note, ButtonState state = ButtonState.None) · Static. A ButtonInput on a MIDI device: a note.
| Parameter | Type | Description |
|---|---|---|
note |
int |
The note number, 0 to 127. |
state |
ButtonState |
The state, for a polled input. Default: None. |
MouseAxes() →
MouseAxes(int axesId, Vector2? value = null) · Static. A TwoAxesInput on the mouse, such as its movement.
| Parameter | Type | Description |
|---|---|---|
axesId |
int |
Which pair of axes. |
value |
Vector2? |
The value, for a polled input. Default: null, for zero. |
MouseAxis() →
MouseAxis(int axisId, float? value = null) · Static. A OneAxisInput on the mouse, such as the wheel.
| Parameter | Type | Description |
|---|---|---|
axisId |
int |
Which axis. |
value |
float? |
The value, for a polled input. Default: null, for 0. |
MouseButton() →
MouseButton(int button, ButtonState state = ButtonState.None) · Static. A ButtonInput on the mouse.
| Parameter | Type | Description |
|---|---|---|
button |
int |
Which button, such as (int)MouseButtonTypes.Left with MonoInput. |
state |
ButtonState |
The state, for a polled input. Default: None. |