Gamepad.GetCurrentReading Method

Gets a gamepad reading.

Syntax

public:
IGamepadReading^ GetCurrentReading()  

Return value

Type: IGamepadReading 

a gamepad reading object that contains the current state of the controller.

Remarks

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.

Requirements

Namespace: Windows.Xbox.Input

Metadata: windows.winmd

See also

Reference

Gamepad Class

Gamepad Members

Windows.Xbox.Input Namespace