List of usage examples for net.minecraftforge.fml.client.config GuiButtonExt GuiButtonExt
public GuiButtonExt(int xPos, int yPos, int width, int height, String displayString, IPressable handler)
From source file:code.elix_x.excore.utils.client.gui.elements.ButtonGuiElement.java
License:Apache License
public ButtonGuiElement(String name, int xPos, int yPos, int width, int height, int borderX, int borderY, String buttonText) {/*from w ww . j ava 2 s .com*/ super(name, xPos, yPos, width, height, borderX, borderY); this.button = new GuiButtonExt(0, xPos + borderX, yPos + borderY, width, height, buttonText); }
From source file:code.elix_x.excore.utils.client.gui.elements.ButtonGuiElement.java
License:Apache License
public void resetButton() { this.button = new GuiButtonExt(0, xPos + borderX, yPos + borderY, width, height, button.displayString); }
From source file:code.elix_x.excore.utils.client.gui.elements.CheckBoxGuiElement.java
License:Apache License
@Override public void drawGuiPost(H handler, GuiScreen gui, int mouseX, int mouseY, float partialTicks) { new GuiButtonExt(0, xPos + borderX, yPos + borderY, width, height, isChecked() ? "x" : "") .drawButton(gui.mc, mouseX, mouseY, partialTicks); }
From source file:code.elix_x.excore.utils.client.gui.elements.IncrementerGuiElement.java
License:Apache License
@Override public void drawGuiPost(H handler, GuiScreen gui, int mouseX, int mouseY, float partialTicks) { drawStringFull(gui.mc.fontRenderer, String.valueOf(getValue()), xPos + borderX, yPos + borderY + height - 8, new RGBA(1f, 1f, 1f, 1f)); new GuiButtonExt(0, xPos + borderX + numberWidth, yPos + borderY, buttonsWidth, height / 2, "") .drawButton(gui.mc, mouseX, mouseY, partialTicks); new GuiButtonExt(0, xPos + borderX + numberWidth, yPos + borderY + height / 2, buttonsWidth, height / 2, "").drawButton(gui.mc, mouseX, mouseY, partialTicks); }
From source file:com.kegare.friendlymobs.client.gui.GuiSelectMob.java
License:Minecraft Mod Public
@Override public void initGui() { Keyboard.enableRepeatEvents(true);/*from www.j av a 2 s . c o m*/ if (mobList == null) { mobList = new MobList(this); } mobList.setDimensions(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; buttonList.clear(); buttonList.add(doneButton); if (filterTextField == null) { filterTextField = new GuiTextField(1, fontRendererObj, 0, 0, 150, 16); filterTextField.setMaxStringLength(100); } filterTextField.xPosition = width / 2 - filterTextField.width - 5; filterTextField.yPosition = height - filterTextField.height - 6; if (selectedHoverChecker == null) { selectedHoverChecker = new HoverChecker(0, 20, 0, 100, 800); } }
From source file:org.blockartistry.Presets.gui.PresetInfoModifyGui.java
License:MIT License
@Override public void initGui() { this.labelList.clear(); this.buttonList.clear(); this.anchorX = (this.width - REGION_WIDTH) / 2; this.anchorY = (this.height - REGION_HEIGHT) / 2; final String theTitle = this.editMode ? EDIT_TITLE : CREATE_TITLE; final int titleWidth = this.fontRendererObj.getStringWidth(theTitle); int X = this.anchorX + (REGION_WIDTH - titleWidth) / 2; int Y = this.anchorY + MARGIN; GuiLabel label = new GuiLabel(this.fontRendererObj, ID_TITLE, X, Y, REGION_WIDTH, BUTTON_HEIGHT, Color.MC_GOLD.rgb()); label.addLine(theTitle);//from www.j a v a2 s .c o m this.labelList.add(label); X = this.anchorX + MARGIN; Y += BUTTON_HEIGHT; final int entryWidth = REGION_WIDTH - MARGIN * 2; final int labelColor = Color.WHITE.rgb(); final int requiredWidth = this.fontRendererObj.getStringWidth(REQUIRED_TEXT); label = new GuiLabel(this.fontRendererObj, ID_PRESET_FILENAME, X, Y, LABEL_WIDTH, BUTTON_HEIGHT, labelColor); label.addLine(FILENAME_LABEL); this.labelList.add(label); this.fileNameRequired = new GuiLabel(this.fontRendererObj, ID_FILENAME_REQUIRED, X + entryWidth - requiredWidth, Y, LABEL_WIDTH, BUTTON_HEIGHT, Color.RED.rgb()); this.fileNameRequired.addLine(REQUIRED_TEXT); this.fileNameRequired.visible = false; this.labelList.add(this.fileNameRequired); Y += BUTTON_HEIGHT; this.fileName = new GuiTextField(ID_PRESET_FILENAME_TEXT, this.fontRendererObj, X, Y, entryWidth, BUTTON_HEIGHT); this.fileName.setMaxStringLength(32); this.fileName.setText(this.info.getFilename()); this.fileName.setValidator(new Predicate<String>() { @Override public boolean apply(String input) { return !input.matches(FILENAME_VALIDATION_REGEX); } }); Y += BUTTON_HEIGHT + INSET; label = new GuiLabel(this.fontRendererObj, ID_PRESET_FILENAME, X, Y, LABEL_WIDTH, BUTTON_HEIGHT, labelColor); label.addLine(PRESET_TITLE_LABEL); this.labelList.add(label); this.presetTitleRequired = new GuiLabel(this.fontRendererObj, ID_TITLE_REQUIRED, X + entryWidth - requiredWidth, Y, LABEL_WIDTH, BUTTON_HEIGHT, Color.RED.rgb()); this.presetTitleRequired.addLine(REQUIRED_TEXT); this.presetTitleRequired.visible = false; this.labelList.add(this.presetTitleRequired); Y += BUTTON_HEIGHT; this.presetTitle = new GuiTextField(ID_PRESET_TITLE_TEXT, this.fontRendererObj, X, Y, entryWidth, BUTTON_HEIGHT); this.presetTitle.setMaxStringLength(48); this.presetTitle.setText(this.info.getTitle()); Y += BUTTON_HEIGHT + INSET; label = new GuiLabel(this.fontRendererObj, ID_PRESET_FILENAME, X, Y, LABEL_WIDTH, BUTTON_HEIGHT, labelColor); label.addLine(PRESET_DESCRIPTION_LABEL); this.labelList.add(label); Y += BUTTON_HEIGHT; this.presetDescription = new GuiTextField(ID_PRESET_DESCRIPTION_TEXT, this.fontRendererObj, X, Y, entryWidth, BUTTON_HEIGHT); this.presetDescription.setMaxStringLength(255); this.presetDescription.setText(this.info.getDescription()); Y += BUTTON_HEIGHT * 2 + INSET * 2 + MARGIN; // Set the final size of the background panel; this.regionWidth = REGION_WIDTH; this.regionHeight = Y - this.anchorY; this.backgroundPanel.setWidth(this.regionWidth); this.backgroundPanel.setHeight(this.regionHeight); // Done button int doneX = this.anchorX + (this.regionWidth - BUTTON_WIDTH * 3) / 2; final int doneY = this.anchorY + this.regionHeight - (int) (BUTTON_HEIGHT * 1.5F); this.doneButton = new GuiButtonExt(ID_DONE, doneX, doneY, BUTTON_WIDTH, BUTTON_HEIGHT, DONE_BUTTON_LABEL); this.buttonList.add(this.doneButton); // Cancel button doneX += BUTTON_WIDTH * 2; GuiButtonExt button = new GuiButtonExt(ID_CANCEL, doneX, doneY, BUTTON_WIDTH, BUTTON_HEIGHT, CANCEL_BUTTON_LABEL); this.buttonList.add(button); // Filename field has first focus this.fileName.setFocused(true); this.doneEnableCheck(); }
From source file:org.blockartistry.Presets.gui.PresetsConfigGui.java
License:MIT License
protected GuiButtonExt setupButton(final int id, final int x, final int y, @Nonnull final String buttonLabel) { final String label = Localization.format(buttonLabel); final String tip = Localization.format(buttonLabel + ".tooltip"); final GuiButtonExt button = new GuiButtonExt(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, label); this.buttonList.add(button); if (!tip.endsWith(".tooltip")) this.buttonTips.add(new GuiTooltip(this, button, tip)); return button; }
From source file:org.blockartistry.Presets.gui.PresetsConfigGui.java
License:MIT License
@Override public void initGui() { this.presetButtons.clear(); this.tooltips.clear(); this.buttonTips.clear(); this.labelList.clear(); this.buttonList.clear(); this.anchorX = (this.width - REGION_WIDTH) / 2; this.anchorY = (this.height - REGION_HEIGHT) / 2; final int titleWidth = this.fontRendererObj.getStringWidth(TITLE); final int titleX = this.anchorX + (REGION_WIDTH - titleWidth) / 2; int Y = this.anchorY + INSET; GuiLabel title = new GuiLabel(this.fontRendererObj, ID_TITLE, titleX, Y, REGION_WIDTH, BUTTON_HEIGHT, Color.MC_GOLD.rgb()); title.addLine(TITLE);//ww w . ja v a 2 s .c om this.labelList.add(title); Y += INSET + BUTTON_HEIGHT; final int presetWidth = PRESET_BUTTON_WIDTH + INSET * 2; final int presetHeight = (int) (PRESET_BUTTON_HEIGHT * (MAX_PRESETS_PAGE + 1.5F)) + INSET; this.presetPanel.setWidth(presetWidth); this.presetPanel.setHeight(presetHeight); for (int i = 0; i < MAX_PRESETS_PAGE; i++) { final int id = ID_PRESET_BASE + i; final int x = this.anchorX + MARGIN + INSET; final int y = Y + i * BUTTON_HEIGHT; final GuiButtonExt button = new GuiButtonExt(id, x, y, PRESET_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, "<NOT SET>"); button.visible = false; this.presetButtons.add(button); this.tooltips.add(new GuiTooltip(this, button, "")); } Y += PRESET_BUTTON_HEIGHT * MAX_PRESETS_PAGE; this.buttonList.addAll(this.presetButtons); // Do the previous and next buttons Y += INSET; int navButtonX = this.anchorX + MARGIN + NAV_BUTTON_INSET + INSET; this.previousButton = new GuiButtonExt(ID_PREV_PAGE, navButtonX, Y, NAV_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, PREV_BUTTON_TEXT); this.buttonList.add(this.previousButton); navButtonX = this.anchorX + MARGIN + presetWidth - INSET - NAV_BUTTON_WIDTH - NAV_BUTTON_INSET; this.nextButton = new GuiButtonExt(ID_NEXT_PAGE, navButtonX, Y, NAV_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, NEXT_BUTTON_TEXT); this.buttonList.add(this.nextButton); // Buttons to the side. Offset is the spacing between the buttons based // on the preset region size and the number of buttons to render. final int offset = (presetHeight - 6 * BUTTON_HEIGHT) / 7; final int buttonsX = this.anchorX + MARGIN + presetWidth + INSET; int buttonsY = this.anchorY + MARGIN * 2 + INSET + offset; this.refreshButton = setupButton(ID_REFRESH, buttonsX, buttonsY, "presets.button.Refresh"); buttonsY += BUTTON_HEIGHT + offset; this.createButton = setupButton(ID_CREATE, buttonsX, buttonsY, "presets.button.Create"); buttonsY += BUTTON_HEIGHT + offset; this.editButton = setupButton(ID_EDIT, buttonsX, buttonsY, "presets.button.Edit"); buttonsY += BUTTON_HEIGHT + offset; this.applyButton = setupButton(ID_APPLY, buttonsX, buttonsY, "presets.button.Apply"); buttonsY += BUTTON_HEIGHT + offset; this.saveButton = setupButton(ID_SAVE, buttonsX, buttonsY, "presets.button.Save"); buttonsY += BUTTON_HEIGHT + offset; this.deleteButton = setupButton(ID_DELETE, buttonsX, buttonsY, "presets.button.Delete"); // Set the final size of the background panel this.regionWidth = MARGIN * 2 + presetWidth + INSET + BUTTON_WIDTH; this.regionHeight = MARGIN * 2 + presetHeight + BUTTON_HEIGHT * 2; this.backgroundPanel.setWidth(this.regionWidth); this.backgroundPanel.setHeight(this.regionHeight); // Done button final int doneX = (this.regionWidth - BUTTON_WIDTH) / 2 + this.anchorX; final int doneY = this.anchorY + this.regionHeight - (int) (BUTTON_HEIGHT * 1.5F); setupButton(ID_DONE, doneX, doneY, "presets.button.Done"); this.reload(); }
From source file:uk.kihira.tails.client.gui.PartsPanel.java
License:Open Source License
@Override public void initGui() { initPartList(); buttonList .add(partTypeButton = new GuiButtonExt(0, width / 2 - 25, 16, 50, 16, parent.getPartType().name())); }
From source file:zeldaswordskills.client.gui.config.GuiConfigZeldaSwordSkills.java
License:Open Source License
public GuiConfigZeldaSwordSkills(GuiScreen parentScreen) { super(parentScreen, getElements(), ModInfo.ID, GuiConfig.getAbridgedConfigPath(Config.config.toString()), false, false, I18n.format("config.zss.parent.title")); String key = "config.zss.parent.overlays"; String overlayTitle = StringUtils.translateKey(key); fakeScreen = new GuiButtonExt(26, 0, 50, 300, 18, overlayTitle); }