示例#1
0
  public void switchTo(State state) {
    Log.info("Changing game state to [" + state + "] from [" + current + "]");
    game.updateLimiter.changedState();
    game.enterState(state.ordinal(), new FadeOutTransition(), new FadeInTransition());

    ScreenState last = (ScreenState) game.getState(current.ordinal());
    ScreenState next = (ScreenState) game.getState(state.ordinal());

    if (state == State.GAME) {
      ((GameState) next).start();
    } else if (current == State.GAME) {
      ((GameState) last).close();
    }
    current = state;
  }
示例#2
0
 public GameState getGameState() {
   return (GameState) game.getState(State.GAME.ordinal());
 }
示例#3
0
 public void init(GameContainer container, GameThread game) {
   DisplayWindow.setUpGameContainer(container);
   game.addState(new IntroState(game, width, height, State.INTRO.ordinal()));
   game.addState(new MenuState(game, width, height, State.MENU.ordinal()));
   game.addState(new GameState(game, width, height, State.GAME.ordinal()));
 }