Search in sources :

Example 1 with ColorRectTexture

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"));
}
Also used : java.util(java.util) IRenderContext(gregtech.api.gui.IRenderContext) Size(gregtech.api.util.Size) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) TextFormatting(net.minecraft.util.text.TextFormatting) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) ChatAllowedCharacters(net.minecraft.util.ChatAllowedCharacters) Consumer(java.util.function.Consumer) Position(gregtech.api.util.Position) GuiScreen(net.minecraft.client.gui.GuiScreen) Matcher(java.util.regex.Matcher) FontRenderer(net.minecraft.client.gui.FontRenderer) TextureArea(gregtech.api.gui.resources.TextureArea) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IGuiTexture(gregtech.api.gui.resources.IGuiTexture) Pattern(java.util.regex.Pattern) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) TextFormatting(net.minecraft.util.text.TextFormatting) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture)

Example 2 with ColorRectTexture

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;
}
Also used : ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) BallWidget(gregtech.common.terminal.app.game.pong.widget.BallWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget)

Example 3 with ColorRectTexture

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;
}
Also used : MultiblockShapeInfo(gregtech.api.pattern.MultiblockShapeInfo) java.util(java.util) IRenderContext(gregtech.api.gui.IRenderContext) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) TerminalDialogWidget(gregtech.api.terminal.os.TerminalDialogWidget) RenderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent) ImageWidget(gregtech.api.gui.widgets.ImageWidget) ConfigHolder(gregtech.common.ConfigHolder) MachineSceneWidget(gregtech.api.terminal.gui.widgets.MachineSceneWidget) ShaderTexture(gregtech.api.gui.resources.ShaderTexture) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) RenderUtil(gregtech.client.utils.RenderUtil) MultiblockControllerBase(gregtech.api.metatileentity.multiblock.MultiblockControllerBase) GL13(org.lwjgl.opengl.GL13) GL11(org.lwjgl.opengl.GL11) Shaders(gregtech.client.shader.Shaders) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) GLAllocation(net.minecraft.client.renderer.GLAllocation) Entity(net.minecraft.entity.Entity) World(net.minecraft.world.World) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) GlStateManager(net.minecraft.client.renderer.GlStateManager) TextureMap(net.minecraft.client.renderer.texture.TextureMap) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) BlockPos(net.minecraft.util.math.BlockPos) LabelWidget(gregtech.api.gui.widgets.LabelWidget) MultiblockPreviewRenderer(gregtech.client.renderer.handler.MultiblockPreviewRenderer) GuiTextures(gregtech.api.gui.GuiTextures) ARApplication(gregtech.api.terminal.app.ARApplication) AbstractApplication(gregtech.api.terminal.app.AbstractApplication) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) TextureArea(gregtech.api.gui.resources.TextureArea) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TileEntity(net.minecraft.tileentity.TileEntity) LabelWidget(gregtech.api.gui.widgets.LabelWidget) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) ImageWidget(gregtech.api.gui.widgets.ImageWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Example 4 with ColorRectTexture

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;
}
Also used : OsSettings(gregtech.common.terminal.app.settings.widgets.OsSettings) CustomTabListRenderer(gregtech.api.terminal.gui.CustomTabListRenderer) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) ThemeSettings(gregtech.common.terminal.app.settings.widgets.ThemeSettings) ImageWidget(gregtech.api.gui.widgets.ImageWidget) HomeButtonSettings(gregtech.common.terminal.app.settings.widgets.HomeButtonSettings)

Example 5 with ColorRectTexture

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;
}
Also used : WidgetProspectingMap(gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) WidgetOreList(gregtech.common.terminal.app.prospector.widget.WidgetOreList) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Aggregations

ColorRectTexture (gregtech.api.gui.resources.ColorRectTexture)13 ImageWidget (gregtech.api.gui.widgets.ImageWidget)7 AbstractApplication (gregtech.api.terminal.app.AbstractApplication)5 TerminalTheme (gregtech.api.terminal.os.TerminalTheme)5 Size (gregtech.api.util.Size)5 IRenderContext (gregtech.api.gui.IRenderContext)4 IGuiTexture (gregtech.api.gui.resources.IGuiTexture)4 LabelWidget (gregtech.api.gui.widgets.LabelWidget)4 List (java.util.List)4 GuiTextures (gregtech.api.gui.GuiTextures)3 Widget (gregtech.api.gui.Widget)3 TextureArea (gregtech.api.gui.resources.TextureArea)3 CircleButtonWidget (gregtech.api.terminal.gui.widgets.CircleButtonWidget)3 TerminalDialogWidget (gregtech.api.terminal.os.TerminalDialogWidget)3 Position (gregtech.api.util.Position)3 ItemStack (net.minecraft.item.ItemStack)3 ShaderTexture (gregtech.api.gui.resources.ShaderTexture)2 TextTexture (gregtech.api.gui.resources.TextTexture)2 gregtech.api.gui.widgets (gregtech.api.gui.widgets)2 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)2