C# – Controller support for Xbox one in Windows UWP

cuwpxboxxbox-onexinput

I am wondering how I am supposed to handle input for UWP apps targeting Xbox One. I have noticed DirectInput, but I see two issues with it for my use cases:

  1. From MSDN, it only seems to support Xbox 360 controllers

    XInput is an API that allows applications to receive input from the Xbox 360 Controller for Windows. Controller rumble effects and voice input and output are supported.

  2. DirectX and all of its API's (Direct2d, Direct3D, Xinput, etc…) are only supported on C / C++. That means even if Xinput supported Xbox one controllers, I could not use C# or JavaScript to develop truly universal apps.

What options do I have (at least as far as C# is concerned) for supporting Xbox One controller support on a Windows UWP app?

Best Answer

Take a look at the Windows.Gaming.Input namespace. Its GamePad class is in the Universal API contract and available on all device families and languages.

Related Topic