@Override
  public void HUDAreaClicked(HUDArea ha) {
    HUDArea hudArea = null;

    for (int i = 0; i < hudAreas.size(); i++) {
      hudArea = hudAreas.get(i);
      if (hudArea == ha) {
        if (hudArea.getType().equals("single_player")) {
          hudManager.unloadHUD(name);
          hudManager.loadHUD(HUDManager.HUDType.ScreenCharacterSelection);
        } else if (hudArea.getType().equals("multi_player")) {
          if (hudManager.getIsOnline() && Game.VERSION.equals(hudManager.getCurrentVersion())) {
            hudManager.unloadHUD(name);
            hudManager.loadHUD(HUDManager.HUDType.ScreenMultiPlayer);
          } else {
            registry.showMessage(
                "Error",
                "Must be online and have latest version to play.  Try updating and restarting.");
          }
        } else if (hudArea.getType().equals("settings")) {
          hudManager.unloadHUD(name);
          hudManager.loadHUD(HUDManager.HUDType.ScreenSettings);
        } else if (hudArea.getType().equals("exit")) {
          hudManager.gameExit();
        } else if (hudArea.getType().equals("donate")) {
          String url = "http://www.epicinventor.com/donate.html";

          try {
            Desktop.getDesktop().browse(java.net.URI.create(url));
          } catch (Exception e) {
          }
        } else if (hudArea.getType().equals("help")) {
          String url = "http://www.epicinventor.com/help.html";

          try {
            Desktop.getDesktop().browse(java.net.URI.create(url));
          } catch (Exception e) {
          }
        } else if (hudArea.getType().equals("download")) {
          Process p = null;
          try {
            p = Runtime.getRuntime().exec("EpicInventorUpdater");
          } catch (IOException ex) {
          }

          if (p == null) {
            registry.showMessage(
                "Error", "Could not launch auto-updater, run manually from folder");
          } else {
            hudManager.gameExit();
          }
        }
      }
    }
  }
  public HUDScreenMain(HUDManager hm, Registry rg, int x, int y, int w, int h) {
    super(hm, rg, x, y, w, h);

    setImage("HUD/ScreenMain/BG");

    HUDArea hudArea = null;

    // single player
    hudArea =
        addArea(
            BUTTON_SINGLE_PLAYER_X,
            BUTTON_SINGLE_PLAYER_Y,
            BUTTON_LARGE_WIDTH,
            BUTTON_LARGE_HEIGHT,
            "single_player");
    hudArea.setImage("HUD/ScreenMain/ButtonSinglePlayer");

    // multi player
    hudArea =
        addArea(
            BUTTON_MULTI_PLAYER_X,
            BUTTON_MULTI_PLAYER_Y,
            BUTTON_LARGE_WIDTH,
            BUTTON_LARGE_HEIGHT,
            "multi_player");
    if (hudManager.getIsOnline() && Game.VERSION.equals(hudManager.getCurrentVersion())) {
      hudArea.setImage("HUD/ScreenMain/ButtonMultiPlayer");
    } else {
      hudArea.setImage("HUD/ScreenMain/ButtonMultiPlayerOff");
    }

    // settings
    hudArea =
        addArea(BUTTON_SETTINGS_X, BUTTON_SETTINGS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "settings");
    hudArea.setImage("HUD/ScreenMain/ButtonSettings");

    // credits
    // hudArea = addArea(BUTTON_CREDITS_X, BUTTON_CREDITS_Y, BUTTON_WIDTH, BUTTON_HEIGHT,
    // "credits");
    // hudArea.setImage("HUD/ScreenMain/ButtonCredits");

    // exit
    hudArea = addArea(BUTTON_EXIT_X, BUTTON_EXIT_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "exit");
    hudArea.setImage("HUD/ScreenMain/ButtonExit");

    // donate
    hudArea =
        addArea(
            BUTTON_DONATE_X, BUTTON_DONATE_Y, BUTTON_DONATE_WIDTH, BUTTON_DONATE_HEIGHT, "donate");
    hudArea.setImage("HUD/Common/Donate");

    // help
    // hudArea = addArea(BUTTON_HELP_X, BUTTON_HELP_Y, BUTTON_HELP_WIDTH, BUTTON_HELP_HEIGHT,
    // "help");
    // hudArea.setImage("HUD/Common/Help");

    if (hudManager.getIsOnline() && !Game.VERSION.equals(hudManager.getCurrentVersion())) {
      // download
      hudArea =
          addArea(
              BUTTON_DOWNLOAD_X,
              BUTTON_DOWNLOAD_Y,
              BUTTON_DOWNLOAD_WIDTH,
              BUTTON_DOWNLOAD_HEIGHT,
              "download");
      hudArea.setImage("HUD/ScreenMain/NewVersion");
    }

    hudManager.setStartServer(false);
    hudManager.setServerJoin(false);
  }