InputSourceExtensions

Reads an InputControl through an IInputSource, which is the one place the action layer crosses from a described control to a device query.

Fields

PressThreshold (float) = 0.5f: A button held this far past rest counts as pressed, matching how a trigger is read.

Public Methods

Read

public static float Read(IInputSource source, InputControl control, int playerIndex = -1)

The control's current value: 1 or 0 for a button, the axis value otherwise.

Parameters:

  • source (IInputSource): The source to read from.
  • control (InputControl): The control to read.
  • playerIndex (int): The player slot for a gamepad control, or −1 for any. (Default: -1)

Returns: float

WentDown

public static bool WentDown(IInputSource source, InputControl control)

Whether the control went down this frame, for a rebinding listener.

Parameters:

  • source (IInputSource): The source to read from.
  • control (InputControl): The control to test.

Returns: bool