Question

I'm trying to have several gamepad at the same time in JInput, while also checking for newly plugged gamepad. Here is the code used to check for new controllers.

new DirectAndRawInputEnvironmentPlugin().getControllers();

If I run this code several time and store the results, the same peripheric appear on a different "Controller" instance amongst the results. Which lead to a lot of problems.

How do I check if two instance of Controller are similar ? IE if they control the same peripheric ?

I guess it could work if I checked for the name/number of components/rumblers, etc to see if they are similar (like hashing the device). But what if I plug the same gamepad twice ?

Thanks !

Était-ce utile?

La solution

Currently you can't do this with JInput. Ideally you would be using the DefaultEnvironmentPlugin too, which will auto detect for the platform you are running on.

There is an interface in JInput for controller connection/disconnection, but it's never been implemented. I've asked a number of times for volunteers, but nobody seems to worry about it enough to do it. Feel free to contact us over on the javagaming.org forum if you wish to implement the notification interface.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top