コード例 #1
0
ファイル: GuiCraftingEX.java プロジェクト: kegare/Crafting-EX
  @Override
  public void initGui() {
    Keyboard.enableRepeatEvents(true);

    super.initGui();

    if (prevButton == null) {
      prevButton = new GuiButton(0, 0, 0, 20, 20, "<");
      prevButton.visible = false;
    }

    prevButton.xPosition = guiLeft + 107;
    prevButton.yPosition = guiTop + 60;

    if (nextButton == null) {
      nextButton = new GuiButton(1, 0, 0, prevButton.width, prevButton.height, ">");
      nextButton.visible = false;
    }

    nextButton.xPosition = prevButton.xPosition + prevButton.width + 10;
    nextButton.yPosition = prevButton.yPosition;

    buttonList.add(prevButton);
    buttonList.add(nextButton);

    if (prevHover == null) {
      prevHover = new HoverChecker(prevButton, 0);
    }

    if (nextHover == null) {
      nextHover = new HoverChecker(nextButton, 0);
    }
  }
コード例 #2
0
ファイル: GuiScreenCustom.java プロジェクト: ZerpHmm/OpenGuid
  @Override
  /**
   * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX,
   * mouseY, lastButtonClicked & timeSinceMouseClick.
   */
  protected void mouseClickMove(
      int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) {
    super.mouseClickMove(mouseX, mouseY, lastButtonClicked, timeSinceMouseClick);

    if (lastClick == 0) {
      gb.xPosition = mouseX - (lastClickX - lastButtonX);
      gb.yPosition = mouseY - (lastClickY - lastButtonY);
    } else if (lastClick == 1) {
      if (mouseX > gb.xPosition && mouseY > gb.yPosition) {
        int sizeY = mouseY - gb.yPosition;

        if (sizeY > 20) sizeY = 20;

        gb = new GuiButton(1, gb.xPosition, gb.yPosition, mouseX - gb.xPosition, sizeY, "text");
        buttonList.set(0, gb);
      }
    }

    positionX = gb.xPosition;
    positionY = gb.yPosition;
  }
コード例 #3
0
  @Override
  public void initGui() {
    if (rankList == null) {
      rankList = new RankList();
    }

    rankList.func_148122_a(width, height, 32, height - 28);

    if (doneButton == null) {
      doneButton = new GuiButtonExt(0, 0, 0, 145, 20, I18n.format("gui.done"));
    }

    doneButton.xPosition = width / 2 + 10;
    doneButton.yPosition = height - doneButton.height - 4;

    if (detailInfo == null) {
      detailInfo = new GuiCheckBox(1, 0, 5, I18n.format(Caveworld.CONFIG_LANG + "detail"), true);
    }

    detailInfo.setIsChecked(CaveConfigGui.detailInfo);
    detailInfo.xPosition = width / 2 + 95;

    if (instantFilter == null) {
      instantFilter =
          new GuiCheckBox(
              2,
              0,
              detailInfo.yPosition + detailInfo.height + 2,
              I18n.format(Caveworld.CONFIG_LANG + "instant"),
              true);
    }

    instantFilter.setIsChecked(CaveConfigGui.instantFilter);
    instantFilter.xPosition = detailInfo.xPosition;

    buttonList.clear();
    buttonList.add(doneButton);
    buttonList.add(detailInfo);
    buttonList.add(instantFilter);

    if (filterTextField == null) {
      filterTextField = new GuiTextField(fontRendererObj, 0, 0, 150, 16);
      filterTextField.setMaxStringLength(100);
    }

    filterTextField.xPosition = width / 2 - filterTextField.width - 5;
    filterTextField.yPosition = height - filterTextField.height - 6;

    detailHoverChecker = new HoverChecker(detailInfo, 800);
    instantHoverChecker = new HoverChecker(instantFilter, 800);
  }
コード例 #4
0
  public void initGui() {
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, 0, 0, this.getDrawCoordsString()));
    this.buttonList.add(new GuiButton(2, 0, 0, this.getCircularModeString()));
    this.buttonList.add(new GuiButton(5, 0, 0, this.getTrailString()));
    this.buttonList.add(new GuiButton(3, 0, 0, this.getTextureSizeString()));
    this.buttonList.add(new GuiButton(4, 0, 0, this.getTextureScalingString()));
    this.buttonList.add(new GuiButton(0, 0, 0, "Done"));

    int y = Math.max(60, this.height / 4);
    int x = this.width / 2 - 100;
    for (Object o : this.buttonList) {
      GuiButton button = (GuiButton) o;
      button.xPosition = x;
      button.yPosition = y;
      y += 25;
    }
  }
コード例 #5
0
  /**
   * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
   */
  private void addSingleplayerMultiplayerButtons(int par1, int par2) {
    this.buttonList.add(
        new GuiButton(
            1, this.width / 2 - 100, par1, I18n.format("menu.singleplayer", new Object[0])));
    this.buttonList.add(
        new GuiButton(
            2,
            this.width / 2 - 100,
            par1 + par2 * 1,
            I18n.format("menu.multiplayer", new Object[0])));
    // If Minecraft Realms is enabled, halve the size of both buttons and set them next to
    // eachother.
    fmlModButton = new GuiButton(6, this.width / 2 - 100, par1 + par2 * 2, "Mods");
    this.buttonList.add(fmlModButton);

    minecraftRealmsButton =
        new GuiButton(14, this.width / 2 - 100, par1 + par2 * 2, I18n.format("menu.online"));
    int mcr = minecraftRealmsButton.getButtonWidth();
    mcr = 98;
    minecraftRealmsButton.xPosition = this.width / 2 - 100;
    this.buttonList.add(minecraftRealmsButton);
    this.minecraftRealmsButton.visible = false;
  }
コード例 #6
0
 private void func_130022_h() {
   int fml = fmlModButton.getButtonWidth();
   this.minecraftRealmsButton.visible = true;
   fml = 98;
   fmlModButton.xPosition = this.width / 2 + 2;
 }