I am developing a 3D panel inside of a Swing application to show models in. I am having an issue with Cinematics not showing properly when the Window becomes inactive or out of focus.
I have listed a test case below to repeat the issue.
Run this and then press P to start the cinematic. Then click on any other window this will stop the cinematic.
I am looking for a way for this not to happen because I need to run cinematics while making a different window the focus and then coming back to the JME window.
I have run this against the Beta release from 10/22/2011 as well as the nightly build from 12/31/2011.
I have tested the code listed above on the alpha release of JME3 and there is no issue with cinematics pausing when the window looses or gains focus. This issue exhists in the Beta release download as well as the nightly build from 1/9/2011.
Setting setPauseOnLostFocus(false); does note resolve the issue. What happens is when the window gains focus the cinematic stops for a number a seconds and the resumes.
This issue causes problems for any software that has a second window such as a control panel or tool palette.
It will break any time there is a WindowStateChange event that occurs when a user moves between applications, or when the OS pushes an action that creates a window state change in the program.
I have posted video examples of the issue I am encountering.
The Cinematic correctly works on the Alpha Release of JME 3 when the window loses and gains focus. http://youtu.be/X-LPQBZR2Bs
The Cinematic does not work properly on Beta or Nightly Releases. When the window regains focus the cinematic stops for a number of seconds and then continues. http://youtu.be/XMDZxzogg58
@Momoko_Fan, @normen,@pspeed. So we kept asking what feature had the old “smoothed” timer over the NanoTimer…well one feature was that it was paused when the app was paused…
In discussion, it’s becoming clearer that “pause on lost focus” is not really the same as “pause the game”. You may want one, the other, or both in various combinations depending on your usage.
For example, when the game pauses you may want to pop-up a menu until the user clicks “go” again… but you’d still want the update() loop to run (which is currently what “pause on lost focus” pauses).
@nehon said:
I know what's going on here.... @Momoko_Fan, @normen,@pspeed. So we kept asking what feature had the old "smoothed" timer over the NanoTimer....well one feature was that it was paused when the app was paused....
NanoTimer just keep fetching System.nanoTime();
the issue is that NOT pausing is causing issues, ie: setPauseOnFocusLost() is false. I suspect somewhere a heavy-handed timer reset was added that should not have been. Because otherwise, gain and loss of focus should not cause issues.
The fact that pausing does not pause the timer is another issue that cannot be fixed by simply resetting the timer... and if that was done then it should be reverted.
But as it is now… not pausing is also broken. That’s bad. So now there is no way to avoid issues, apparently. You can’t even just turn off pausing.
@pspeed said:
I thought I remembered in conversation that you added a timer.reset() somewhere. Since JME doesn't implement game pause yet that should be removed.
...then we can focus on making pause actually pause time. But first I think we should go back to having NOT pausing work right.
i did not commit this because we agreed it shouldn't be reset :p
@pspeed said:
Remember... the original posted is trying NOT to pause the cinematics.