1

When making the application full screen with the following call:

Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());

I no longer have signals from my controller. The issue is not solved by changing the display back from full screen like:

 Gdx.graphics.setWindowedMode(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

I'm using Gdx version: 1.9.8. It appears this was an issue fixed in a previous version, but I'm not sure what the necessary steps are to get the work around functioning. Here's some posts I found about the issue:

https://github.com/libgdx/libgdx/issues/4723

https://github.com/GoranM/bdx/issues/518

(this one is old) http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=10692

Any help is much appreciated.


*Edit: This is using the controller extension that can be checked from the libgdx set up application. *


Edit2: I can get a responsive controller if I re-poll the controllers like the following:

 Array<Controller> controllers = Controllers.getControllers();

However, this cannot be done instantly after changing the display mode; I have to wait some amount of time after. I'm not sure what I need to poll to determine how long I have to wait until the controller instances are valid (also, when it is valid to assign a listener).


Edit3: The only solution I've been able to come up with is to set a flag inside the resize callback like the following

@Override
public void resize(int width, int height) {
    resizeDirty = true;
    resizeTimestamp = System.currentTimeMillis();
}

Then in my main loop call:

private void controllerCheck() {
    if (resizeDirty) {
        long currentTime = System.currentTimeMillis();
        if (currentTime > resizeTimestamp + controllerResetDelay) {
            resizeDirty = false;
            //get new controller instance | re-add a controller listener
        }
    }
}

This isn't ideal, I'd rather find a way to listen to when the change in context is done initializing then update the controllers. But I haven't been able to find a hook for that. I'd appreciate it if anyone knows a better way to go about maintaining controllers with change in display mode.

Enigma22134
  • 532
  • 5
  • 12
  • Why you posted it here? If you are sure that it's a bug I think LibGDX developers most likely will see this on github issues than here. So you sure that problem appears in `1.9.8` ? I also checked these issues and no one has changed this file. – icarumbas Dec 18 '17 at 05:34
  • 1
    I'm not sure that it is a bug, but rather a lack of my understanding of Libgdx. – Enigma22134 Dec 18 '17 at 13:24
  • @icarumbas There may also be workarounds. – Steve Smith Aug 02 '19 at 19:59

1 Answers1

0

Why don't you try to use the immersive fullscreen? If the objective is to set the fullscreen mode, I think this is the better way to.