Let's assume you want to use settings.setResolution()
to change the resolution while playing a cut scene. If the game is already running, changing application settings
has no effect, unless you reload them.
Make a copy of
Main.java
and name the classReloadSettings.java
. Remember to also refactor the first line of themain()
method toReloadSettings app = new ReloadSettings();
.Add the following temporary variable and code to the
simpleUpdate()
method:float temp; public void simpleUpdate(float tpf) { // a trivial 2-second timer temp+=tpf; if( temp>2 ) { restartDemo(); temp=0; } }
Add the following custom demo method:
private void restartDemo() { settings.setResolution(FastMath.nextRandomInt(100, 800),FastMath.nextRandomInt(100, 800) ); // a random resolution this.restart(); // reload settings }
When you run this code, the application closes and reopens its window every two seconds, with a random resolution.