Search in sources :

Example 1 with GuiIcon

use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.

the class GuidePageBase method renderPage.

protected void renderPage(int x, int y, int width, int height, int index) {
    // Even => first page, draw page back button and first page index
    if (index % 2 == 0) {
        // Back page button
        if (index != 0) {
            GuiIcon icon = GuiGuide.TURN_BACK;
            GuiRectangle turnBox = new GuiRectangle(x, y + height, icon.width, icon.height);
            if (turnBox.contains(gui.mouse)) {
                icon = GuiGuide.TURN_BACK_HOVERED;
            }
            icon.drawAt(turnBox);
        }
        // Page index
        String text = (index + 1) + " / " + numPages;
        double textX = x + GuiGuide.PAGE_LEFT_TEXT.width / 2 - getFontRenderer().getStringWidth(text) / 2;
        getFontRenderer().drawString(text, (int) textX, (int) (y + height) + 6, 0);
    } else {
        // Back page button
        if (index + 1 < numPages) {
            GuiIcon icon = GuiGuide.TURN_FORWARDS;
            GuiRectangle turnBox = new GuiRectangle(x + width - icon.width, y + height, icon.width, icon.height);
            if (turnBox.contains(gui.mouse)) {
                icon = GuiGuide.TURN_FORWARDS_HOVERED;
            }
            icon.drawAt(turnBox);
        }
        // Page index
        if (index + 1 <= numPages) {
            String text = (index + 1) + " / " + numPages;
            double textX = x + (GuiGuide.PAGE_RIGHT_TEXT.width - getFontRenderer().getStringWidth(text)) / 2;
            getFontRenderer().drawString(text, (int) textX, (int) (y + height) + 6, 0);
        }
    }
}
Also used : GuiRectangle(buildcraft.lib.gui.pos.GuiRectangle) GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 2 with GuiIcon

use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.

the class GuiElementStatementDrag method drawForeground.

@Override
public void drawForeground(float partialTicks) {
    if (isDragging) {
        boolean canPlace = false;
        for (IGuiElement element : gui.getElementsAt(gui.mouse.getX(), gui.mouse.getY())) {
            if (element instanceof IReference<?>) {
                if (checkCanSet((IReference<?>) element, dragging)) {
                    canPlace = true;
                    break;
                }
            }
        }
        GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
        if (!canPlace) {
            GlStateManager.color(1.0f, 0.7f, 0.7f);
        }
        double x = gui.mouse.getX() - 9;
        double y = gui.mouse.getY() - 9;
        if (dragging instanceof IStatementParameter) {
            ParameterRenderer.draw((IStatementParameter) dragging, x, y);
        } else {
            GuiIcon background = GuiElementStatement.SLOT_COLOUR;
            if (dragging instanceof StatementWrapper) {
                EnumPipePart part = ((StatementWrapper) dragging).sourcePart;
                if (part != EnumPipePart.CENTER) {
                    background = background.offset(0, (1 + part.getIndex()) * 18);
                }
            }
            background.drawAt(x, y);
            if (dragging != null) {
                ISprite sprite = dragging.getSprite();
                if (sprite != null) {
                    GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
                }
            }
        }
        GlStateManager.color(1, 1, 1);
    }
}
Also used : StatementWrapper(buildcraft.lib.statement.StatementWrapper) ISprite(buildcraft.api.core.render.ISprite) EnumPipePart(buildcraft.api.core.EnumPipePart) IGuiElement(buildcraft.lib.gui.IGuiElement) IStatementParameter(buildcraft.api.statements.IStatementParameter) IReference(buildcraft.lib.misc.data.IReference) GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 3 with GuiIcon

use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.

the class GuiElementStatementSource method drawGuiSlot.

public static void drawGuiSlot(@Nullable IGuiSlot guiSlot, double x, double y) {
    if (guiSlot instanceof IStatementParameter) {
        ParameterRenderer.draw((IStatementParameter) guiSlot, x, y);
        return;
    }
    GuiIcon background = GuiElementStatement.SLOT_COLOUR;
    if (guiSlot instanceof StatementWrapper) {
        EnumPipePart part = ((StatementWrapper) guiSlot).sourcePart;
        if (part != EnumPipePart.CENTER) {
            background = background.offset(0, (1 + part.getIndex()) * 18);
        }
    }
    background.drawAt(x, y);
    if (guiSlot != null) {
        ISprite sprite = guiSlot.getSprite();
        if (sprite != null) {
            GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
        }
    }
}
Also used : StatementWrapper(buildcraft.lib.statement.StatementWrapper) ISprite(buildcraft.api.core.render.ISprite) EnumPipePart(buildcraft.api.core.EnumPipePart) IStatementParameter(buildcraft.api.statements.IStatementParameter) GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 4 with GuiIcon

use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.

the class GuiDiamondWoodPipe method drawForegroundLayer.

@Override
protected void drawForegroundLayer() {
    String title = LocaleUtil.localize("gui.pipes.emerald.title");
    double titleX = mainGui.rootElement.getX() + (xSize - fontRenderer.getStringWidth(title)) / 2;
    fontRenderer.drawString(title, (int) titleX, (int) mainGui.rootElement.getY() + 6, 0x404040);
    fontRenderer.drawString(LocaleUtil.localize("gui.inventory"), (int) mainGui.rootElement.getX() + 8, (int) mainGui.rootElement.getY() + ySize - 93, 0x404040);
    if (pipe.filterMode == FilterMode.ROUND_ROBIN) {
        GlStateManager.color(1, 1, 1, 1);
        GuiIcon icon = pipe.filterValid ? ICON_ROUND_ROBIN_INDEX : ICON_ROUND_ROBIN_NONE;
        int x = pipe.filterValid ? 18 * pipe.currentFilter : 0;
        icon.drawAt(mainGui.rootElement.getX() + 6 + x, mainGui.rootElement.getY() + 16);
    }
}
Also used : GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 5 with GuiIcon

use of buildcraft.lib.gui.GuiIcon in project BuildCraft by BuildCraft.

the class GuiAutoCraftItems method drawBackgroundLayer.

@Override
protected void drawBackgroundLayer(float partialTicks) {
    ICON_GUI.drawAt(mainGui.rootElement);
    double progress = container.tile.getProgress(partialTicks);
    drawProgress(RECT_PROGRESS, ICON_PROGRESS, progress, 1);
    if (hasFilters()) {
        RenderHelper.enableGUIStandardItemLighting();
        forEachFilter((slot, filterStack) -> {
            int x = slot.xPos + (int) mainGui.rootElement.getX();
            int y = slot.yPos + (int) mainGui.rootElement.getY();
            itemRender.renderItemAndEffectIntoGUI(mc.player, filterStack, x, y);
            itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, filterStack, x, y, null);
        });
        RenderHelper.disableStandardItemLighting();
        GlStateManager.disableDepth();
        forEachFilter((slot, filterStack) -> {
            ItemStack real = slot.getStack();
            final GuiIcon icon;
            if (real.isEmpty() || StackUtil.canMerge(real, filterStack)) {
                icon = ICON_FILTER_OVERLAY_SAME;
            } else {
                icon = ICON_FILTER_OVERLAY_DIFFERENT;
            }
            int x = slot.xPos + (int) mainGui.rootElement.getX();
            int y = slot.yPos + (int) mainGui.rootElement.getY();
            icon.drawAt(x - 1, y - 1);
        });
        GlStateManager.enableDepth();
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) GuiIcon(buildcraft.lib.gui.GuiIcon)

Aggregations

GuiIcon (buildcraft.lib.gui.GuiIcon)8 EnumPipePart (buildcraft.api.core.EnumPipePart)2 ISprite (buildcraft.api.core.render.ISprite)2 IStatementParameter (buildcraft.api.statements.IStatementParameter)2 GuiRectangle (buildcraft.lib.gui.pos.GuiRectangle)2 StatementWrapper (buildcraft.lib.statement.StatementWrapper)2 IFontRenderer (buildcraft.lib.client.guide.font.IFontRenderer)1 GuideChapter (buildcraft.lib.client.guide.parts.GuideChapter)1 Title (buildcraft.lib.client.guide.parts.contents.ContentsList.Title)1 SubHeader (buildcraft.lib.client.guide.parts.contents.ContentsList.Title.SubHeader)1 PageLink (buildcraft.lib.client.guide.parts.contents.ContentsList.Title.SubHeader.PageLink)1 IGuiElement (buildcraft.lib.gui.IGuiElement)1 IGuiArea (buildcraft.lib.gui.pos.IGuiArea)1 IReference (buildcraft.lib.misc.data.IReference)1 ItemStack (net.minecraft.item.ItemStack)1