Search in sources :

Example 1 with AutoGlScissor

use of buildcraft.lib.misc.GuiUtil.AutoGlScissor in project BuildCraft by BuildCraft.

the class GuidePartNote method renderIntoArea.

@Override
public PagePosition renderIntoArea(int x, int y, int width, int height, PagePosition current, int index) {
    current = current.guaranteeSpace(HEIGHT + 10, height);
    if (current.page == index) {
        timeSinceRender = 0;
        int _x = x + (width - WIDTH) / 2;
        int _y = y + current.pixel + 5;
        int _w = WIDTH;
        int _h = HEIGHT;
        float partialTicks = gui.getLastPartialTicks();
        if (partialTicks < 0)
            partialTicks = 0;
        if (partialTicks > 1)
            partialTicks = 1;
        int interpOpenStage = (int) ((openStage * partialTicks) + lastOpenStage * (1 - partialTicks));
        if (openStage == lastOpenStage) {
            interpOpenStage = openStage;
        }
        thisRect = new GuiRectangle(_x, _y - interpOpenStage, _w, _h + interpOpenStage);
        _x = x + (width - GuiGuide.NOTE_PAGE.width) / 2;
        _y = y + current.pixel + 5 - interpOpenStage;
        _w = GuiGuide.NOTE_PAGE.width;
        _h = HEIGHT + interpOpenStage - 5;
        try (AutoGlScissor scissor = GuiUtil.scissor(_x, _y, _w, _h)) {
            GuiGuide.NOTE_PAGE.drawAt(_x, _y);
        }
        _x += 8;
        _y += 4;
        _w -= 16;
        _h -= 4;
        try (AutoGlScissor scissor = GuiUtil.scissor(_x, _y, _w, _h)) {
            PagePosition innerPosition = new PagePosition(index, 4);
            for (GuidePart part : parts) {
                innerPosition = part.renderIntoArea(_x, _y, _w, 400, innerPosition, index);
            }
        }
    }
    return current.nextLine(HEIGHT, height);
}
Also used : AutoGlScissor(buildcraft.lib.misc.GuiUtil.AutoGlScissor) GuiRectangle(buildcraft.lib.gui.pos.GuiRectangle)

Example 2 with AutoGlScissor

use of buildcraft.lib.misc.GuiUtil.AutoGlScissor in project BuildCraft by BuildCraft.

the class Ledger_Neptune method drawBackground.

@Override
public void drawBackground(float partialTicks) {
    double startX = getX();
    double startY = getY();
    final SpriteNineSliced split;
    interpWidth = interp(lastWidth, currentWidth, partialTicks);
    interpHeight = interp(lastHeight, currentHeight, partialTicks);
    if (expandPositive) {
        split = SPRITE_SPLIT_POS;
    } else {
        split = SPRITE_SPLIT_NEG;
    }
    RenderUtil.setGLColorFromIntPlusAlpha(colour);
    split.draw(startX, startY, interpWidth, interpHeight);
    GlStateManager.color(1, 1, 1, 1);
    IGuiPosition pos2;
    if (expandPositive) {
        pos2 = positionLedgerIconStart;
    } else {
        pos2 = positionLedgerIconStart;
    }
    try (AutoGlScissor a = GuiUtil.scissor(pos2.getX(), pos2.getY(), interpWidth - 4, interpHeight - 8)) {
        for (IGuiElement element : closedElements) {
            element.drawBackground(partialTicks);
        }
        if (shouldDrawOpen()) {
            for (IGuiElement element : openElements) {
                element.drawBackground(partialTicks);
            }
        }
    }
}
Also used : AutoGlScissor(buildcraft.lib.misc.GuiUtil.AutoGlScissor) IGuiElement(buildcraft.lib.gui.IGuiElement) SpriteNineSliced(buildcraft.lib.client.sprite.SpriteNineSliced) IGuiPosition(buildcraft.lib.gui.pos.IGuiPosition)

Example 3 with AutoGlScissor

use of buildcraft.lib.misc.GuiUtil.AutoGlScissor in project BuildCraft by BuildCraft.

the class Ledger_Neptune method drawForeground.

@Override
public void drawForeground(float partialTicks) {
    double scissorX = positionLedgerIconStart.getX();
    double scissorY = positionLedgerIconStart.getY();
    double scissorWidth = interpWidth - 8;
    double scissorHeight = interpHeight - 8;
    try (AutoGlScissor a = GuiUtil.scissor(scissorX, scissorY, scissorWidth, scissorHeight)) {
        for (IGuiElement element : closedElements) {
            element.drawForeground(partialTicks);
        }
        if (shouldDrawOpen()) {
            for (IGuiElement element : openElements) {
                element.drawForeground(partialTicks);
            }
        }
    }
}
Also used : AutoGlScissor(buildcraft.lib.misc.GuiUtil.AutoGlScissor) IGuiElement(buildcraft.lib.gui.IGuiElement)

Aggregations

AutoGlScissor (buildcraft.lib.misc.GuiUtil.AutoGlScissor)3 IGuiElement (buildcraft.lib.gui.IGuiElement)2 SpriteNineSliced (buildcraft.lib.client.sprite.SpriteNineSliced)1 GuiRectangle (buildcraft.lib.gui.pos.GuiRectangle)1 IGuiPosition (buildcraft.lib.gui.pos.IGuiPosition)1