Delen via


RawGameController.GetCurrentReading Method

Definition

Gets a snapshot of the raw game controller's state.

public:
 virtual unsigned long long GetCurrentReading(Platform::Array <bool> ^ buttonArray, Platform::Array <GameControllerSwitchPosition> ^ switchArray, Platform::Array <double> ^ axisArray) = GetCurrentReading;
uint64_t GetCurrentReading(winrt::array_view <bool> & buttonArray, winrt::array_view <GameControllerSwitchPosition> & switchArray, winrt::array_view <double> & axisArray);
public ulong GetCurrentReading(bool[] buttonArray, GameControllerSwitchPosition[] switchArray, double[] axisArray);
function getCurrentReading(buttonArray, switchArray, axisArray)
Public Function GetCurrentReading (buttonArray As Boolean(), switchArray As GameControllerSwitchPosition(), axisArray As Double()) As ULong

Parameters

buttonArray

Boolean[]

bool[]

The button array for the raw game controller to be populated with the current state of each button.

switchArray
GameControllerSwitchPosition[]

The switch array for the raw game controller to be populated with the current state of each switch.

axisArray

Double[]

double[]

The axis array for the raw game controller to be populated with the current state of each axis.

Returns

UInt64

unsigned long long

uint64_t

The timestamp of when the reading was retrieved from the raw game controller.

Remarks

Unlike the GetCurrentReading member functions of other classes, such as ArcadeStick.GetCurrentReading, RawGameController.GetCurrentReading takes three parameters: the button, switch, and axis arrays of the raw game controller. You create these arrays yourself, with the sizes RawGameController.ButtonCount, RawGameController.SwitchCount, and RawGameController.AxisCount, respectively.

RawGameController.GetCurrentReading populates each of these arrays with the current states of each input. The button array is an array of Booleans, where true means the button is pressed and false means it is not. The switch array is an array of GameControllerSwitchPosition, where the value at each index represents that switch's current position. Finally, the axis array is an array of doubles, where the value at each index (between 0.0 and 1.0) represents the position of that axis.

See Raw game controller for more information about how to read input from a raw game controller.

Applies to

See also