InputControl
- Namespace: Turian.Engine.Core
- Source File: InputControl.cs
One physical control on one kind of device — a key, a mouse button, a stick axis. This is the only place in the input stack that knows about hardware; an InputAction is defined in terms of these and gameplay code never names one directly.
Properties
None
(InputControl): The unbound control, which never reads as pressed and always reads zero.
IsAxis
(bool): Whether this control reports a continuous value rather than a press.
Public Methods
Keyboard
public static InputControl Keyboard(Key key)
Names a keyboard key.
Parameters:
key(Key): The key.
Returns: InputControl
Mouse
public static InputControl Mouse(MouseButton button)
Names a mouse button.
Parameters:
button(MouseButton): The button.
Returns: InputControl
MouseMotion
public static InputControl MouseMotion(MouseAxis axis)
Names a mouse movement or wheel axis.
Parameters:
axis(MouseAxis): The axis.
Returns: InputControl
Gamepad
public static InputControl Gamepad(GamepadButton button)
Names a gamepad button.
Parameters:
button(GamepadButton): The button.
Returns: InputControl
GamepadStick
public static InputControl GamepadStick(GamepadAxis axis)
Names a gamepad stick or trigger axis.
Parameters:
axis(GamepadAxis): The axis.
Returns: InputControl
ToString
public override string ToString()
The control as a binding path, e.g. Keyboard/W or Gamepad/LeftStickX.
Returns: string
- The path, or an empty string for
None.
TryParse
public static bool TryParse(string? path, InputControl control)
Reads a binding path written the way ToString prints one.
Parameters:
path(string?): The path, e.g.Keyboard/W.control(InputControl): The parsed control, orNonewhen the path names nothing.
Returns: bool
- True when the path was understood.
Parse
public static InputControl Parse(string? path)
Reads a binding path, returning None when it names nothing.
Parameters:
path(string?): The path to read.
Returns: InputControl
All
public static IEnumerable<InputControl> All()
Every control a rebinding operation can capture, in the order it scans them.
Returns: IEnumerable<InputControl>