use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class TextEditorWidget method initToolBox.
private void initToolBox() {
TextFormatting[] formatting = TextFormatting.values();
// palette
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
TextFormatting colorFormatting = formatting[y * 4 + x];
this.addWidget(new RectButtonWidget(x * 8, y * 8, 8, 8, 1).setToggleButton(PALETTE.getSubArea(0.5 + x * 0.125, y * 0.25, 0.125, 0.25), (cd, pressed) -> {
if (pressed) {
textPanelWidget.addFormatting(colorFormatting);
} else {
textPanelWidget.removeFormatting(colorFormatting);
}
}).setValueSupplier(true, () -> colorFormatting == textPanelWidget.getFrontColorFormatting()).setIcon(PALETTE.getSubArea(x * 0.125, y * 0.25, 0.125, 0.25)).setColors(0, -1, 0).setHoverText(colorFormatting.getFriendlyName()));
}
}
// style
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 3; x++) {
TextFormatting styleFormatting = formatting[16 + y * 3 + x];
if (styleFormatting == TextFormatting.RESET)
break;
this.addWidget(new RectButtonWidget(x * 16 + 32, y * 16, 16, 16, 1).setToggleButton(STYLE.getSubArea(0.5 + x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5), (cd, pressed) -> {
if (pressed) {
textPanelWidget.addFormatting(styleFormatting);
} else {
textPanelWidget.removeFormatting(styleFormatting);
}
}).setValueSupplier(true, () -> textPanelWidget.getFrontStyleFormatting().contains(styleFormatting)).setIcon(STYLE.getSubArea(x * 1.0 / 6, y * 0.5, 1.0 / 6, 0.5)).setColors(0, -1, 0).setHoverText(styleFormatting.getFriendlyName()));
}
}
this.addWidget(new RectButtonWidget(3 * 16 + 32, 0, 16, 16, 3).setToggleButton(new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor()), (c, p) -> textPanelWidget.allowMarkdown = !p).setValueSupplier(true, () -> !textPanelWidget.allowMarkdown).setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()).setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())).setHoverText("Check Markdown when Ctrl+V"));
this.addWidget(new RectButtonWidget(3 * 16 + 32, 16, 16, 16, 3).setClickListener(clickData -> textPanelWidget.pageSetCurrent("")).setColors(TerminalTheme.COLOR_B_3.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_3.getColor()).setIcon(new ColorRectTexture(TerminalTheme.COLOR_7.getColor())).setHoverText("Clean Up"));
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class PongApp method initApp.
@Override
public AbstractApplication initApp() {
if (isClient) {
paddles = new ArrayList<>();
solidObjects = new ArrayList<>();
this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2));
this.addWidget(new ImageWidget(333 / 2 - 4, 5, 6, 232 - 10, new ColorRectTexture(0xAAAAAAAA)));
this.setBall(new BallWidget(333 / 2 - 1, 232 / 2 - 1));
this.addWidget(new SimpleTextWidget(50, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(true)), true));
this.addWidget(new SimpleTextWidget(283, 20, "", 0xAAAAAA, () -> String.valueOf(this.getScore(false)), true));
this.initPaddles();
}
return this;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class MultiBlockPreviewARApp method initApp.
@Override
public AbstractApplication initApp() {
// 232 333
int bW = 120;
int bH = 120;
addWidget(new ImageWidget(10, 10, 313, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor())));
addWidget(new ImageWidget(333 / 2, 20, 1, 222 - 40, new ColorRectTexture(-1)));
addWidget(new LabelWidget(10 + 313 / 4, 35, "terminal.multiblock_ar.tier.0", -1).setXCentered(true).setYCentered(true));
addWidget(new RectButtonWidget(10 + (313 / 2 - bW) / 2, 50, bW, bH).setIcon(TextureArea.fullImage("textures/gui/terminal/multiblock_ar/profile.png")).setColors(-1, 0xff00ff00, 0).setHoverText("terminal.ar.open").setClickListener(clickData -> openAR()));
addWidget(new LabelWidget(333 / 2 + 313 / 4, 35, "terminal.multiblock_ar.tier.1", getAppTier() == 0 ? 0xffff0000 : -1).setXCentered(true).setYCentered(true));
addWidget(new RectButtonWidget(333 / 2 + (313 / 2 - bW) / 2, 50, bW, bH).setIcon(this::drawBuilderButton).setColors(getAppTier() == 0 ? 0xffff0000 : -1, getAppTier() == 0 ? 0xffff0000 : 0xff00ff00, 0).setHoverText(getAppTier() > 0 ? "terminal.multiblock_ar.builder.hover" : "terminal.multiblock_ar.unlock").setClickListener(clickData -> buildMode()));
return this;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class SettingsApp method initApp.
@Override
public AbstractApplication initApp() {
if (isClient) {
this.addWidget(new ImageWidget(5, 15, 323, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor())));
this.tabGroup = new TabGroup<>(5, 15, new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10));
this.addWidget(this.tabGroup);
this.tabGroup.setOnTabChanged(this::onPagesChanged);
addTab("terminal.settings.theme", new ThemeSettings(getOs()));
addTab("terminal.settings.home", new HomeButtonSettings(getOs()));
addTab("terminal.settings.os", new OsSettings(getOs()));
}
return this;
}
use of gregtech.api.gui.resources.ColorRectTexture in project GregTech by GregTechCEu.
the class ProspectorApp method initApp.
@Override
public AbstractApplication initApp() {
int chunkRadius = getAppTier() + 3;
int offset = (232 - 32 * 7 + 16) / 2;
background = new ColorRectTexture(0xA0000000);
this.addWidget(new ImageWidget(0, 0, 333, 232, background));
if (isClient) {
this.addWidget(new ImageWidget(0, 0, 333, offset, GuiTextures.UI_FRAME_SIDE_UP));
this.addWidget(new ImageWidget(0, 232 - offset, 333, offset, GuiTextures.UI_FRAME_SIDE_DOWN));
this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, 232 - 2 * offset);
this.addWidget(this.widgetOreList);
}
this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, this.widgetOreList, mode, 1);
if (isClient) {
persist = Tables.newCustomTable(Maps.newHashMap(), Maps::newHashMap);
widgetProspectingMap.setOnPacketReceived(packet -> persist.put(packet.chunkX, packet.chunkZ, packet));
}
this.addWidget(1, this.widgetProspectingMap);
loadLocalConfig(nbt -> {
this.widgetProspectingMap.setDarkMode(nbt.getBoolean("dark"));
background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff);
});
if (isClient) {
loadPacketLocalConfig();
}
return this;
}
Aggregations