MrStahlfelge / gdx-controllerutils

Controller Utilities for libGDX
Apache License 2.0
59 stars 13 forks source link

0.2.0 disconnect/connect events not triggering on desktop #9

Closed tomcashman closed 5 years ago

tomcashman commented 5 years ago

I've been using 0.2.0 and found that connect/disconnect events aren't working on desktop. I'm using Windows 10 64 bit + Java 8.

MrStahlfelge commented 5 years ago

Hi, is it working for you with v0.1.2?

MrStahlfelge commented 5 years ago

And another question: Is the problem that just the events are not triggered, or is it that hotplugging does not work at all? Is the Controllers.getControllers() changing for you?

tomcashman commented 5 years ago

I can test 0.1.2 this evening. My current sequence of events are as follows:

MrStahlfelge commented 5 years ago

I can confirm. I didn't notice this because I don't use listeners per controller, but just a listener on the ControllerManager (Controllers.addListener(). The pushed commit changes it.

However, a reconnect can not be fired. Jamepad does not reuse the same index and object in general on reconnects, indeed often the controller index array is completely rearranged just on a disconnect. Unfortunately, this is a behaviour that is the same on GWT, too. I can just recommend you to completely design the games in a way that players that were disconnected have to reconnect their controller in game. If you see a way to improve the situation, I am happy to accept PRs.