The question: Obviously Windows somehow can "see" the controller and also recognizes the joystick movements; so what API do they use in this little "Game Controllers" window?
It uses DirectInput (mainly IDirectInputDevice8::Poll)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The situation: We need to use a new game controller (with a joystick only) hardware on Windows 10 IoT. In the properties of "Game Controllers", moving the joystick is visible in the displayed rectangle with the '+'. Our software using DirectX8 API only reads 0 values for x/y axes.
What I've tried so far:
The question: Obviously Windows somehow can "see" the controller and also recognizes the joystick movements; so what API do they use in this little "Game Controllers" window?
Any other suggestion on how to read joystick data?
The question: Obviously Windows somehow can "see" the controller and also recognizes the joystick movements; so what API do they use in this little "Game Controllers" window?
It uses DirectInput (mainly IDirectInputDevice8::Poll)
Hello @Robin Holenweger,
welcome to this moderated Azure community forum.
What kind of game controller do you mean?
If this is an XBOX gamecontroller, in the past I was able to connect to it using C#. Check out this blog post for details.
I used a Xbox One controller with wireless adapter for windows (to connect it to a laptop). More details are found here.
As you can see, I had to execute "Gamepad.GetCurrentReading();" in a infinite loop.
The library supports many more devices so you need to test this probably to see if this works with your game controller:
I hope this seems familiar to you.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.
Any other suggestion on how to read joystick data?
Use Raw Input, https://learn.microsoft.com/en-us/windows/win32/inputdev/about-raw-input.
Thanks for the contributions.
Meanwhile I found a working solution: joystick api (mmsystem.h/winmm.lib):- joyGetPos() to get the axis position (joyGetPosEx() if buttons and the like need to be read as well)
This API seems to be older than DirectX 8 / DirectInput, but I have not found any hints that this might be deprecated (as compared to DirectInput).