예제 #1
0
  /**
   * Initializes the state.
   *
   * <p>Do not manually call this method! This method is invoked automatically by SimpleApplication.
   *
   * @param stateManager SimpleApplication's stateManager
   * @param app A class extending SimpleApplication
   */
  @Override
  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = (SimpleApplication) app; // cast to a more specific class
    // init stuff that is independent of whether state is PAUSED or RUNNING
    // // modify scene graph...
    initializeImages();
    GameView view = new GameView(this.app, game);
    guiView = new GameGUIView(nifty, game);

    input = new InputController(this.app, game, view);
    new InGameGUIController(input, nifty, guiView, game);

    initializeCamera();
    // Initialize view last, after model and controller, since its
    // initialization is dependent on the other's.
    view.initialize();
    guiView.initialize();
    input.addListener(guiView);
  }