use of net.minecraftforge.fml.client.config.GuiButtonExt in project DynamicSurroundings by OreCruncher.
the class PresetsConfigGui method drawScreen.
@Override
public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) {
drawDefaultBackground();
this.backgroundPanel.render(this.anchorX, this.anchorY, Reference.UPPER_LEFT);
this.presetPanel.render(this.anchorX + MARGIN, this.anchorY + MARGIN + INSET * 3, Reference.UPPER_LEFT);
super.drawScreen(mouseX, mouseY, partialTicks);
for (int i = 0; i < MAX_PRESETS_PAGE; i++) {
final GuiButtonExt button = this.presetButtons.get(i);
if (button.visible && this.tooltips.get(i).handle(mouseX, mouseY))
return;
}
for (final GuiTooltip tip : this.buttonTips) if (tip.handle(mouseX, mouseY))
return;
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project DynamicSurroundings by OreCruncher.
the class PresetInfoModifyGui method initGui.
@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.fontRenderer.getStringWidth(theTitle);
int X = this.anchorX + (REGION_WIDTH - titleWidth) / 2;
int Y = this.anchorY + MARGIN;
GuiLabel label = new GuiLabel(this.fontRenderer, ID_TITLE, X, Y, REGION_WIDTH, BUTTON_HEIGHT, Color.MC_GOLD.rgb());
label.addLine(theTitle);
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.fontRenderer.getStringWidth(REQUIRED_TEXT);
label = new GuiLabel(this.fontRenderer, ID_PRESET_FILENAME, X, Y, LABEL_WIDTH, BUTTON_HEIGHT, labelColor);
label.addLine(FILENAME_LABEL);
this.labelList.add(label);
this.fileNameRequired = new GuiLabel(this.fontRenderer, 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.fontRenderer, X, Y, entryWidth, BUTTON_HEIGHT);
this.fileName.setMaxStringLength(32);
this.fileName.setText(this.info.getFilename());
this.fileName.setValidator(input -> !input.matches(FILENAME_VALIDATION_REGEX));
Y += BUTTON_HEIGHT + INSET;
label = new GuiLabel(this.fontRenderer, ID_PRESET_FILENAME, X, Y, LABEL_WIDTH, BUTTON_HEIGHT, labelColor);
label.addLine(PRESET_TITLE_LABEL);
this.labelList.add(label);
this.presetTitleRequired = new GuiLabel(this.fontRenderer, 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.fontRenderer, X, Y, entryWidth, BUTTON_HEIGHT);
this.presetTitle.setMaxStringLength(48);
this.presetTitle.setText(this.info.getTitle());
Y += BUTTON_HEIGHT + INSET;
label = new GuiLabel(this.fontRenderer, 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.fontRenderer, 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;
final 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);
doneEnableCheck();
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project Logistical-Automation by Zundrel.
the class GuiFilter method initGui.
@Override
public void initGui() {
super.initGui();
buttonList.add(new GuiButtonExt(1000, guiLeft - 162, guiTop + 20, 30, 12, ""));
buttonList.add(new GuiButtonExt(1001, guiLeft - 129, guiTop + 20, 30, 12, ""));
buttonList.add(new GuiButtonExt(1002, guiLeft - 96, guiTop + 20, 46, 12, ""));
buttonList.add(new GuiButtonExt(1003, guiLeft - 47, guiTop + 20, 47, 12, ""));
buttonList.add(new GuiButtonExt(2000, guiLeft - 162, guiTop + 52, 30, 12, ""));
buttonList.add(new GuiButtonExt(2001, guiLeft - 129, guiTop + 52, 30, 12, ""));
buttonList.add(new GuiButtonExt(2002, guiLeft - 96, guiTop + 52, 46, 12, ""));
buttonList.add(new GuiButtonExt(2003, guiLeft - 47, guiTop + 52, 47, 12, ""));
buttonList.add(new GuiButtonExt(3000, guiLeft - 162, guiTop + 84, 30, 12, ""));
buttonList.add(new GuiButtonExt(3001, guiLeft - 129, guiTop + 84, 30, 12, ""));
buttonList.add(new GuiButtonExt(3002, guiLeft - 96, guiTop + 84, 46, 12, ""));
buttonList.add(new GuiButtonExt(3003, guiLeft - 47, guiTop + 84, 47, 12, ""));
buttonList.add(new GuiButtonExt(4000, (guiLeft + (xSize / 2)) - (76 / 2), guiTop + 100, 76, 12, ""));
if (!showConfig) {
for (GuiButton configButton : buttonList) {
if (configButton.id != 4000) {
configButton.visible = false;
}
}
} else {
for (GuiButton configButton : buttonList) {
if (configButton.id != 4000) {
configButton.visible = true;
}
}
}
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project Minestuck by mraof.
the class GuiCrockerMachine method initGui.
@Override
public void initGui() {
super.initGui();
if (!te.isAutomatic()) {
goButton = new GuiButtonExt(1, (width - xSize) / 2 + goX, (height - ySize) / 2 + goY, 30, 12, te.overrideStop ? "STOP" : "GO");
buttonList.add(goButton);
if (type == MachineType.GRIST_WIDGET && MinestuckConfig.clientDisableGristWidget)
goButton.enabled = false;
}
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project Minestuck by mraof.
the class GuiGristSelector method initGui.
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
@Override
public void initGui() {
super.initGui();
int xOffset = (width - guiWidth) / 2;
int yOffset = (height - guiHeight) / 2;
this.previousButton = new GuiButtonExt(1, (this.width) + 8, yOffset + 8, 16, 16, "<");
this.nextButton = new GuiButtonExt(2, xOffset + guiWidth - 24, yOffset + 8, 16, 16, ">");
if (GristType.REGISTRY.getValues().size() > rows * columns) {
this.buttonList.add(this.nextButton);
}
}
Aggregations