This is very odd. So if I start my game windowed or full screen, my controllers work fine. But if I change resolutions or go from fullscreen->windowed (or vis-versa) I lose my controllers (they stop working, both events and polling). The ControllerListener#disconnected is never called.
The game starts like this:
initialize display
Create [ControllerListener] listener
Add listener to controller ( Controllers.addListener(this); )
Which works.
But then when I resize resolution it stops working. This is how I'm resizing my display
- Code: Select all
cfg.resizable = prefs.getBoolean("resizable", false);
int width = 1024, height = 640;
// -1 means adjust resolution based on window size.
if (Config.prefs.getInteger("width", -1) != -1) {
width = prefs.getInteger("width", 1024);
height = prefs.getInteger("height", 640);
}
if (prefs.getBoolean("fullscreen", false)) {
Gdx.graphics.setDisplayMode(Gdx.graphics.getDesktopDisplayMode());
} else {
Gdx.graphics.setDisplayMode(width, height, false);
}
// cfg.useCPUSynch = prefs.getBoolean("vsync");
// cfg.vSyncEnabled = prefs.getBoolean("vsync");
Gdx.graphics.setVSync(prefs.getBoolean("vsync"));
I'm not sure how that affects the controllers? Maybe I'm screwing up an lwjgl state or something?
I tried running this after the setDisplayMode, but didn't work
- Code: Select all
Controllers.removeListener(this);
Controllers.addListener(this);
When I remove/add though, I don't get any message. It should say something about Controllers [added/removed] manager for application, x managers active. So, no message means the Controller is getting hosed up?
I also run this after wards and still shows the controller:
- Code: Select all
// loop though em all
Gdx.app.log("Controller", "Searching...");
for (Controller controller : Controllers.getControllers()) {
Gdx.app.log("Controller", controller.getName());
}
Controller: resolution changed.
Controller: Searching...
Controller: Controller (XBOX 360 For Windows)
Any hints on what might be going on?
