use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.
the class SchematicEditScreen method init.
@Override
protected void init() {
setWindowSize(background.width, background.height);
setWindowOffset(-6, 0);
super.init();
int x = guiLeft;
int y = guiTop;
xInput = new EditBox(font, x + 50, y + 26, 34, 10, TextComponent.EMPTY);
yInput = new EditBox(font, x + 90, y + 26, 34, 10, TextComponent.EMPTY);
zInput = new EditBox(font, x + 130, y + 26, 34, 10, TextComponent.EMPTY);
BlockPos anchor = handler.getTransformation().getAnchor();
if (handler.isDeployed()) {
xInput.setValue("" + anchor.getX());
yInput.setValue("" + anchor.getY());
zInput.setValue("" + anchor.getZ());
} else {
BlockPos alt = minecraft.player.blockPosition();
xInput.setValue("" + alt.getX());
yInput.setValue("" + alt.getY());
zInput.setValue("" + alt.getZ());
}
for (EditBox widget : new EditBox[] { xInput, yInput, zInput }) {
widget.setMaxLength(6);
widget.setBordered(false);
widget.setTextColor(0xFFFFFF);
widget.changeFocus(false);
widget.mouseClicked(0, 0, 0);
widget.setFilter(s -> {
if (s.isEmpty() || s.equals("-"))
return true;
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
});
}
StructurePlaceSettings settings = handler.getTransformation().toSettings();
Label labelR = new Label(x + 50, y + 48, TextComponent.EMPTY).withShadow();
rotationArea = new SelectionScrollInput(x + 45, y + 43, 118, 18).forOptions(rotationOptions).titled(rotationLabel.plainCopy()).setState(settings.getRotation().ordinal()).writingTo(labelR);
Label labelM = new Label(x + 50, y + 70, TextComponent.EMPTY).withShadow();
mirrorArea = new SelectionScrollInput(x + 45, y + 65, 118, 18).forOptions(mirrorOptions).titled(mirrorLabel.plainCopy()).setState(settings.getMirror().ordinal()).writingTo(labelM);
addRenderableWidgets(xInput, yInput, zInput);
addRenderableWidgets(labelR, labelM, rotationArea, mirrorArea);
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
onClose();
});
addRenderableWidget(confirmButton);
}
use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.
the class SchematicPromptScreen method init.
@Override
public void init() {
setWindowSize(background.width, background.height);
super.init();
int x = guiLeft;
int y = guiTop;
nameField = new EditBox(font, x + 49, y + 26, 131, 10, TextComponent.EMPTY);
nameField.setTextColor(-1);
nameField.setTextColorUneditable(-1);
nameField.setBordered(false);
nameField.setMaxLength(35);
nameField.changeFocus(true);
setFocused(nameField);
addRenderableWidget(nameField);
abort = new IconButton(x + 7, y + 53, AllIcons.I_TRASH);
abort.withCallback(() -> {
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.discard();
onClose();
});
abort.setToolTip(abortLabel);
addRenderableWidget(abort);
confirm = new IconButton(x + 158, y + 53, AllIcons.I_CONFIRM);
confirm.withCallback(() -> {
confirm(false);
});
confirm.setToolTip(confirmLabel);
addRenderableWidget(confirm);
convert = new IconButton(x + 180, y + 53, AllIcons.I_SCHEMATIC);
convert.withCallback(() -> {
confirm(true);
});
convert.setToolTip(convertLabel);
addRenderableWidget(convert);
}
use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.
the class SchematicannonScreen method init.
@Override
protected void init() {
setWindowSize(BG_TOP.width, BG_TOP.height + BG_BOTTOM.height + 2 + AllGuiTextures.PLAYER_INVENTORY.height);
setWindowOffset(-11, 0);
super.init();
int x = leftPos;
int y = topPos;
// Play Pause Stop
playButton = new IconButton(x + 75, y + 86, AllIcons.I_PLAY);
playButton.withCallback(() -> {
sendOptionUpdate(Option.PLAY, true);
});
playIndicator = new Indicator(x + 75, y + 79, TextComponent.EMPTY);
pauseButton = new IconButton(x + 93, y + 86, AllIcons.I_PAUSE);
pauseButton.withCallback(() -> {
sendOptionUpdate(Option.PAUSE, true);
});
pauseIndicator = new Indicator(x + 93, y + 79, TextComponent.EMPTY);
resetButton = new IconButton(x + 111, y + 86, AllIcons.I_STOP);
resetButton.withCallback(() -> {
sendOptionUpdate(Option.STOP, true);
});
resetIndicator = new Indicator(x + 111, y + 79, TextComponent.EMPTY);
resetIndicator.state = State.RED;
addRenderableWidgets(playButton, playIndicator, pauseButton, pauseIndicator, resetButton, resetIndicator);
confirmButton = new IconButton(x + 180, y + 117, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
minecraft.player.closeContainer();
});
addRenderableWidget(confirmButton);
showSettingsButton = new IconButton(x + 9, y + 117, AllIcons.I_PLACEMENT_SETTINGS);
showSettingsButton.withCallback(() -> {
showSettingsIndicator.state = placementSettingsHidden() ? State.GREEN : State.OFF;
initPlacementSettings();
});
showSettingsButton.setToolTip(Lang.translate(_showSettings));
addRenderableWidget(showSettingsButton);
showSettingsIndicator = new Indicator(x + 9, y + 111, TextComponent.EMPTY);
addRenderableWidget(showSettingsIndicator);
extraAreas = ImmutableList.of(new Rect2i(x + BG_TOP.width, y + BG_TOP.height + BG_BOTTOM.height - 62, 84, 92));
tick();
}
Aggregations