public:
IGamepadReading^ GetCurrentReading()
Type: IGamepadReading
a gamepad reading object that contains the current state of the controller.
The following code shows how to use this method to get the current reading of the gamepad.
void Game::Update(float totalTime, float elapsedTime)
{
IVectorView<Gamepad^>^ gamepads = Gamepad::Gamepads;
for ( unsigned int i = 0; i < gamepads->Size; ++i )
{
IGamepadReading^ reading = gamepads->GetAt(i)->GetCurrentReading();
if ( reading->IsAPressed )
{
// Add your game logic for A button pressed.
}
}
}
Note
This is a cross-OS call. For more information, see Cross-OS Calls.
Namespace: Windows.Xbox.Input
Metadata: windows.winmd