Controller support for Xbox one in Windows UWP

前端 未结 3 1326
遇见更好的自我
遇见更好的自我 2020-12-05 19:08

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:

相关标签:
3条回答
  • 2020-12-05 19:43

    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.

    0 讨论(0)
  • 2020-12-05 19:56

    To back @Rob Caplan - MSFT with a source, this blog from the Microsoft Developer Network states:

    Windows 10: There is a new WinRT API in the Windows.Gaming.Input namespace for universal Windows apps. This API supports both the Xbox 360 Common Controller and the Xbox One controller, including access to the left/right trigger motors. The latest version of GamePad is implemented using this new API when built for Windows 10. Note that existing XInput-based Windows Store applications can link against xinputuap.lib which is an adapter for the new API for universal Windows apps--this adapter does not exist headset audio either.

    0 讨论(0)
  • 2020-12-05 20:00

    DirectX and all of its API's (Direct2d, Direct3D, Xinput, etc...) are only supported on C / C++

    Only natively supported, yes, but implementing DirectInput from C# is trivial using SharpDX
    However, DirectInput is not much use for reading XB controllers as the trigger axes are merged into one, and it's impossible to differentiate between no triggers held and both triggers held.

    0 讨论(0)
提交回复
热议问题