示例#1
0
  @Override
  public void setScreen(Screen screen) {
    if (screen == null) throw new IllegalArgumentException("Screen must not be null");

    // free asset resources
    if (this.screen.assets != null) {
      this.screen.assets.freeAssets();
      this.screen.assets = null;
    }

    // clear the current screen
    this.screen.pause();
    this.screen.dispose();
    this.screen = null;

    screen.resume();
    screen.update(0); // update the new screen w no delay before we set the current screen
    this.screen = screen;
  }