Esempio n. 1
0
  @Override
  public void render(Graphics g2) {
    if (!worldName.isEmpty()) {
      createWorldButton.enabled = true;
    } else {
      createWorldButton.enabled = false;
    }

    org.newdawn.slick.Color temp = g2.getColor();

    super.render(g2);

    // g2.setPaint(p);
    g2.setColor(org.newdawn.slick.Color.black);

    FontHandler.resizeFont(g2, 16);
    FontHandler.changeFontStyle(g2, Font.BOLD);
    g2.drawString("Enter world name:", renderStart + 5, 100);
    FontHandler.resetFont(g2);

    g2.setColor(temp);
  }
Esempio n. 2
0
  public CreateWorldMenu() {
    super();

    int buttonSize = 50, buttonPos = (buttonSize);

    createWorldButton = new createWorldButton(buttonPos * 8);
    createWorldButton.enabled = false;

    guiObjects.add(new backButton((buttonPos * 14) - (buttonSize / 2)));
    guiObjects.add(new worldNameInput(buttonPos * 2 + 20));

    gameModeButton =
        new MainMenuButton(
            MainFile.game, renderStart, (buttonPos * 3) + 20, 190, 32, "Creative: ", guiInst) {

          @Override
          public void renderObject(Graphics g2, UIMenu menu) {
            super.renderObject(g2, menu);
            text = gameMode.name + " mode";
          }

          @Override
          public void onClicked(int button, int x, int y, UIMenu menu) {
            int i = 0;
            for (GameMode em : GameMode.values()) {
              if (i > worldModeInt) {
                worldModeInt += 1;
                gameMode = em;
                return;
              }

              i += 1;
            }

            worldModeInt = 0;
            gameMode = GameMode.SURVIVAL;
          }
        };

    worldGenTypeButton =
        new MainMenuButton(MainFile.game, renderStart, (buttonPos * 4) + 20, 190, 32, "", guiInst) {

          @Override
          public void renderObject(Graphics g2, UIMenu menu) {
            super.renderObject(g2, menu);
            text = worldGenType.getWorldTypeName();
          }

          @Override
          public void onClicked(int button, int x, int y, UIMenu menu) {
            int i = 0;

            // ????

            for (WorldGenType.WorldGenTypes emm : WorldGenType.WorldGenTypes.values()) {

              if (i > worldGenInt) {
                worldGenInt += 1;
                worldGenType = emm.genType;
                return;
              }

              i += 1;
            }

            worldGenInt = 0;
            worldGenType = WorldGenType.WorldGenTypes.NORMAL_WORLD.genType;
          }
        };

    guiObjects.add(gameModeButton);
    guiObjects.add(worldGenTypeButton);
    guiObjects.add(createWorldButton);
  }