Java 类org.newdawn.slick.state.transition.VerticalSplitTransition 实例源码

项目:Spacerun    文件:MainMenuState.java   
@Override
public void update (GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
    Input input = gc.getInput();

  if(input.isKeyPressed(Input.KEY_UP)){
      if(index > 0){
      index--;
      }
  }else if(input.isKeyPressed(Input.KEY_DOWN)){
    if(index < (menuText.length -1)){
      index++;
    }
  }else if(input.isKeyPressed(Input.KEY_ENTER)){
      if(menuText[index] == "Spiel starten"){ //make sure player is connected
          if( (spOne.getConnected() && ((boolean)status.get(1).getData())) || 
              !(boolean)status.get(1).getData() ){
            sbg.getState(Spacerun.GAMESTATE).init(gc, sbg);
            sbg.enterState(Spacerun.GAMESTATE, null, new VerticalSplitTransition());
      }
    }else if(menuText[index] == "Multiplayer"){ //make sure player is connected
      if( (spOne.getConnected() && spTwo.getConnected() && ((boolean)status.get(1).getData())) ||
          !(boolean)status.get(1).getData()){
        status.get(0).setData(true);
            sbg.getState(Spacerun.GAMESTATE).init(gc, sbg);
            sbg.enterState(Spacerun.GAMESTATE, null, new VerticalSplitTransition());
      }
      }else if(menuText[index] == "Highscores"){
        sbg.getState(Spacerun.HIGHSCORESTATE).init(gc, sbg);
      sbg.enterState(Spacerun.HIGHSCORESTATE, null, new VerticalSplitTransition());
    }else if(menuText[index] == "Steuerung"){
      sbg.getState(Spacerun.CONTROLSTATE).init(gc, sbg);
      sbg.enterState(Spacerun.CONTROLSTATE, null, new VerticalSplitTransition());
        }else if(menuText[index] == "Exit"){
      gc.exit();
      }   
  }
  if(input.isKeyPressed(Input.KEY_ESCAPE)){
      gc.exit();
  }
}