While running, upon "update" (I just call an update() once per frame), I normally check the DInput devices and same for XInput devices.
![xinput test not connected xinput test not connected](https://d33v4339jhl8k0.cloudfront.net/docs/assets/580efc3cc697915f88a37b05/images/6001c8e9cfe30d219ccd8405/file-4AlYU2oN6f.png)
Basically gamepads #1 to #4 will be XInput gamepads, anything above will be DInput gamepads.Ĭreate the devices for non-XInput devices (the WMI stuff from the DirectX SDK). Then I have some vector with both XInput and DInput pads (instances from each), however it's initialized with a size of XUSER_MAX_COUNT and instances of the xinput gamepads (with enabled = false). The XInput one doesn't have much info other than the GUIDs for the headset, battery state/level and knowing whether the pad is enabled or not. I just have some gamepad base class (with the buttons/sticks/triggers states) and some inherited version for XInput and DInput. Or at least, let me know how you support XInput and DirectInput in your games? So, can anyone give me some advice or point me to some tech docs about this? Since one keeps such a device connected I suppose he wants to use it - if not he should remove it before starting the game.Īfter that, if the game should support more players than the number of old gamepads found, I instance some cXIGamePad classes, that tests for the 360 device, allowing the player to plug them in later, or remove them as they like. One idea is to test first for non-360 controllers with DI and instance cDIGamePad classes for these. I'm also considering the fact that the 360 controller can be wireless and I think it's common to start the game before you activate your controller. I want to deal with the fact that the 360 controllers can be tested during the game (plugged in later), while the old devices can't and should be tested at input initialization. I know the basic idea from the MS XInput docs, but I'd like to know the best way to organize the input, from a "Techical Requiremets" point of view.
![xinput test not connected xinput test not connected](https://www.addictivetips.com/app/uploads/2020/11/Test-game-controller-input-1.jpg)
#Xinput test not connected how to
I need some advice on how to support both XInput (360 controller) and DirectInput.