Greetings,
I’ve got the following problem:
If I change the resolution:
[java]
AppSettings settings = new AppSettings(true);
settings.setWidth(mode.getWidth());
settings.setHeight(mode.getHeight());
settings.setFrequency(mode.getFrequency());
settings.setBitsPerPixel(mode.getBitsPerPixel());
settings.setFullscreen(fullScreen);
setSettings(settings);
restart();
[/java]
everything is fine. So to notify nifty about the changed resolution, I do this
[java]
//indicates that nifty has to refresh all screens
nifty.resolutionChanged();
[/java]
The current screen is reloaded and it looks nice, but all other screens don’t change the resolution.
It would work If I make a hard reset and reload the screens from the xml-file but that doesn’t seem to be a good idea.
So how can I notify nifty to notify all other screens, too?
greetz
ceiphren
I think just reloading them completely would be the best solution in your case. If this is supposed to be remedied then that solution will be the easiest to revert (instead of maybe updating all screens). Unless ofc theres a method like updateAllScreens()…
In your screen controller you could always do nifty.resolutionChanged in onStartScreen for all screen controllers.
It sounds like this may be a bug though. @void256, what do you think?
@zarch: that causes some wired flickering. Seems like that nifty try’s to paint and load the screen at the same time.
@normen: That worked so far.
Now I’ve got this one when I switch from fullscreen back to window:
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalStateException: Keyboard must be created before you can poll the device
at org.lwjgl.input.Keyboard.poll(Keyboard.java:378)
at com.jme3.input.lwjgl.LwjglKeyInput.update(LwjglKeyInput.java:79)
at com.jme3.input.InputManager.update(InputManager.java:840)
at com.jme3.app.Application.update(Application.java:598)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:233)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:182)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)
at java.lang.Thread.run(Thread.java:662)
A workaround would be to restart the app. Not really nice but as I remember there are many games out there that have trouble switching the resolution. So I think this is okay for now.
Okay, this was rubbish. I don’t really know what happened but it wasn’t a keyboard-problem.
Hmm, maybe the resolution changed causes onstartscreen to be called again?
Could always use a flag to avoid that…be better to get a proper fix though.