Gets a list of all connected gamepads.
public:
static property IVectorView<IGamepad^ >^ Gamepads {
IVectorView<IGamepad^ >^ get ();
}
Type: IVectorView<IGamepad^ >
An enumerable list of all connected gamepads.
Namespace: Windows.Xbox.Input
Metadata: windows.winmd
The following code shows how to use this method to get all connected gamepads.
C++
void Game::Update(float totalTime, float elapsedTime)
{
IVectorView<IGamepad^>^ gamepads = Gamepad::Gamepads;
for ( unsigned int i = 0; i < gamepads->Size; ++i )
{
IGamepadReading^ reading = gamepads->GetAt(i)->GetCurrentReading();
if ( reading->IsAPressed )
{
// Add game logic for A button pressed.
}
}
}
Note
This is a cross-OS call. For more information, see Cross-OS Calls.
Getting Started with the Gamepad API