public void setState(int state) {
    if (gamestate != null) gamestate.dispose();

    if (state == LOGIN) {
      gamestate = new LoginState(this);
    }
    if (state == MAIN) {
      gamestate = new MainMenu(this);
    }
    if (state == MATCH) {
      gamestate = new Match(this);
    }
    if (state == CHANGETEAM) {
      gamestate = new ChangeTeamState(this);
    }
    if (state == FORMATION) {
      gamestate = new FormationState(this);
    }
  }
 public void draw() {
   gamestate.draw();
 }
 public void update(float dt) {
   gamestate.update(dt);
 }