use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class GuideConfigEditor method createPageConfig.
private DraggableScrollableWidgetGroup createPageConfig() {
DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10).setBackground(TerminalTheme.COLOR_B_3).setYScrollBarWidth(4).setYBarStyle(null, TerminalTheme.COLOR_F_1);
group.addWidget(new LabelWidget(5, 5, "section", -1).setShadow(true));
group.addWidget(new TextFieldWidget(5, 15, 116, 20, new ColorRectTexture(0x9f000000), null, null).setTextResponder(s -> {
if (pageEditor != null) {
pageEditor.setSection(s);
}
}, true).setTextSupplier(() -> getPageEditor().getSection(), true).setMaxStringLength(Integer.MAX_VALUE).setValidator(s -> true));
group.addWidget(new ImageWidget(5, 40, 116, 1, new ColorRectTexture(-1)));
group.addWidget(new LabelWidget(5, 45, "type", -1).setShadow(true));
group.addWidget(new SelectorWidget(30, 55, 91, 20, candidates, -1, () -> type, true).setIsUp(true).setOnChanged(type -> this.type = type).setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()).setBackground(TerminalTheme.COLOR_6));
group.addWidget(new PhantomSlotWidget(handler, 0, 6, 56).setBackgroundTexture(TerminalTheme.COLOR_B_2));
group.addWidget(new ImageWidget(5, 80, 116, 1, new ColorRectTexture(-1)));
group.addWidget(new LabelWidget(5, 85, "title", -1).setShadow(true));
titleEditor = new TextEditorWidget(5, 95, 116, 70, s -> {
if (pageEditor != null) {
pageEditor.setTitle(s);
}
}, true).setContent("Template").setBackground(new ColorRectTexture(0xA3FFFFFF));
group.addWidget(titleEditor);
return group;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class WorldProspectorARApp method initApp.
@Override
public AbstractApplication initApp() {
addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor())));
addWidget(new LabelWidget(15 + 150 / 2, 232 / 2, "terminal.world_prospector.radius", -1, new Object[] { getMaxRadius() }).setShadow(true).setYCentered(true).setXCentered(true));
int slotSize = (int) Math.pow(2, getAppTier());
int x = 250 - slotSize * 12;
int y = 232 / 2 - 18;
handlers = new SingleItemStackHandler[slotSize];
colors = new int[slotSize];
for (int i = 0; i < slotSize; i++) {
int index = i;
Tuple<ItemStack, Integer> stack = getSlotStack(i);
if (stack == null) {
handlers[i] = new SingleItemStackHandler(ItemStack.EMPTY);
colors[i] = 0;
} else {
handlers[i] = new SingleItemStackHandler(stack.getFirst());
colors[i] = stack.getSecond();
}
RectButtonWidget buttonWidget = new RectButtonWidget(x + i * 24, y + 18, 18, 18, 1);
addWidget(new PhantomSlotWidget(handlers[i], 0, x + i * 24, y) {
@Override
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (handlers[index].getStackInSlot(0).isEmpty() && isMouseOverElement(mouseX, mouseY)) {
writeClientAction(-1, buffer -> {
});
selectReference(index, buttonWidget);
return true;
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public void handleClientAction(int id, PacketBuffer buffer) {
if (id == -1) {
selectReference(index, buttonWidget);
} else {
super.handleClientAction(id, buffer);
}
}
}.setBackgroundTexture(new ColorRectTexture(0x4fffffff)));
addWidget(buttonWidget.setHoverText("terminal.world_prospector.color").setColors(0x4fffffff, -1, colors[i]).setClickListener(cd -> TerminalDialogWidget.showColorDialog(getOs(), "terminal.world_prospector.color", res -> {
if (res != null) {
buttonWidget.setFill(res | 0xff000000);
colors[index] = res | 0xff000000;
}
}, colors[index]).open()));
}
addWidget(new CircleButtonWidget(333 / 2, 200).setClickListener(cd -> openAR()).setHoverText("terminal.ar.open").setColors(0, -1, TerminalTheme.COLOR_B_3.getColor()).setIcon(new ItemStackTexture(MetaItems.CAMERA.getStackForm())));
return this;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class TextListConfigurator method init.
protected void init(int height) {
JsonElement element = config.get(name);
String initValue = "";
if (!element.isJsonNull()) {
List init = new Gson().fromJson(element, List.class);
initValue = String.join("\n", init);
}
editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue).setBackground(new ColorRectTexture(0xA3FFFFFF));
this.addWidget(editor);
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class SlotListWidget method initFixed.
@Override
public Widget initFixed() {
this.clearAllWidgets();
ItemStackHandler itemStackHandler = new ItemStackHandler(item_list.size());
IGuiTexture background = new ColorRectTexture(0x4f000000);
int size = item_list.size();
int maxXSize = getSize().width / 18;
int xPos;
if (maxXSize < 1) {
maxXSize = 1;
xPos = 0;
} else {
xPos = (getSize().width - (Math.min(size, maxXSize)) * 18) / 2;
}
int maxYSize = size / maxXSize + ((size % maxXSize) == 0 ? 0 : 1);
for (int y = 0; y <= size / maxXSize; y++) {
for (int x = 0; x < maxXSize; x++) {
int i = x + y * maxXSize;
if (i < size) {
itemStackHandler.setStackInSlot(i, item_list.get(i).getInstance());
SlotWidget widget = new SlotWidget(itemStackHandler, i, xPos + x * 18, y * 18, false, false);
widget.setBackgroundTexture(background);
this.addWidget(widget);
}
}
}
setSize(new Size(getSize().width / 18 > 0 ? getSize().width : 18, maxYSize * 18));
return this;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class TankListWidget method initFixed.
@Override
public Widget initFixed() {
this.clearAllWidgets();
IGuiTexture background = new ColorRectTexture(0x4f000000);
int size = fluid_list.size();
int maxXSize = getSize().width / 18;
int xPos;
if (maxXSize < 1) {
maxXSize = 1;
xPos = 0;
} else {
xPos = (getSize().width - (Math.min(size, maxXSize)) * 18) / 2;
}
int maxYSize = size / maxXSize + ((size % maxXSize) == 0 ? 0 : 1);
for (int y = 0; y <= size / maxXSize; y++) {
for (int x = 0; x < maxXSize; x++) {
int i = x + y * maxXSize;
if (i < size) {
FluidStack fluidStack = fluid_list.get(i).getInstance();
TankWidget widget = new TankWidget(new FluidTank(fluidStack, fluid_list.get(i).amount), xPos + x * 18, y * 18, 18, 18);
widget.setBackgroundTexture(background).setAlwaysShowFull(true).setClient();
this.addWidget(widget);
}
}
}
setSize(new Size(getSize().width / 18 > 0 ? getSize().width : 18, maxYSize * 18));
return this;
}
Aggregations