/**
   * Update this state.
   *
   * @param container The gamecontainer that contains this state
   * @param sbg the state based game that uses this state
   * @param delta the time in ms since the last frame
   * @throws SlickException if something goes wrong
   */
  public void update(GameContainer container, StateBasedGame sbg, int delta) throws SlickException {

    if (RND.getInstance().getOpacity() < 1.0f && !mainGame.getShouldSwitchState()) {
      RND.getInstance()
          .setOpacity(
              RND.getInstance().getOpacity() + ((float) delta) / mainGame.getOpacityFadeTimer());
    }

    input = container.getInput();
    nameField.update(input);
    ipField.update(input);
    elements.update(input);

    if ((input.isMousePressed(Input.MOUSE_LEFT_BUTTON) || input.isKeyDown(Input.KEY_ENTER))
        && !mainGame.getShouldSwitchState()) {
      processButtons(input);
    }

    SoundPlayer.getInstance().playEffects();

    exit(container, sbg, delta);
  }
 /**
  * Exit function for state. Fades out and everything.
  *
  * @param container the GameContainer we are running in
  * @param sbg the gamestate cont.
  * @param delta the deltatime in ms
  */
 public void exit(GameContainer container, StateBasedGame sbg, int delta) {
   if (mainGame.getShouldSwitchState()) {
     if (RND.getInstance().getOpacity() > 0.0f) {
       RND.getInstance()
           .setOpacity(
               RND.getInstance().getOpacity() - ((float) delta) / mainGame.getOpacityFadeTimer());
     } else {
       Logger.getInstance()
           .log("Exiting MenuMultiplayerState", Logger.PriorityLevels.LOW, "States");
       if (mainGame.getSwitchState() == -1) {
         container.exit();
       } else {
         mainGame.switchColor();
         sbg.enterState(mainGame.getSwitchState());
       }
     }
   }
 }