Search in sources :

Example 26 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class WindowDesigner method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
    new ControlText(this, new Area(190, 36, 114, 10), I18N.localise(new ResourceLocation(Constants.DESIGN_MOD_ID, "gui.design")), TextJustification.TOP_CENTER).setColor(4473924);
    new Panel(this, 188, 48, 118, 126, MinecraftGUI.PanelType.GRAY);
    this.textEdit = new ControlTextEdit(this, 188, 178, 118, 12);
    final ControlScrollableContent scroll = new ControlScrollableContent(this, 190, 50, 114, 122, 12);
    scroll.setScrollableContent(this.tileSelect = new ControlTileSelect(scroll, 0, 0));
    new ControlPlayerInventory(this).setPosition(new Point(14, 96));
    new ControlErrorState(this, 76, 65);
    if (this.getInventory() != null) {
        new ControlSlot.Builder(this, 22, 34).assign(DesignerSlots.DESIGN_SLOT_1);
        new ControlSlot.Builder(this, 62, 34).assign(DesignerSlots.DESIGN_SLOT_2);
        new ControlSlot.Builder(this, 42, 64).assign(DesignerSlots.ADHESIVE_SLOT);
        new ControlRecipeSlot(this, 112, 34);
    }
}
Also used : ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlText(binnie.core.gui.controls.ControlText) ControlTextEdit(binnie.core.gui.controls.ControlTextEdit) Point(binnie.core.gui.geometry.Point) Panel(binnie.core.gui.window.Panel) Area(binnie.core.gui.geometry.Area) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ResourceLocation(net.minecraft.util.ResourceLocation) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) ControlScrollableContent(binnie.core.gui.controls.scroll.ControlScrollableContent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 27 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlToleranceBar method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    RenderUtil.drawGradientRect(getArea(), -1431655766, -1431655766);
    int w = getArea().width() / fullSet.size();
    int t = 0;
    for (T value : fullSet) {
        int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(value);
        Border inset = new Border(tolerated.contains(value) ? 1 : 3);
        RenderUtil.drawGradientRect(new Area(w * t, 0, w, getHeight()).inset(inset), col, col);
        ++t;
    }
}
Also used : Area(binnie.core.gui.geometry.Area) Border(binnie.core.gui.geometry.Border) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 28 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlGenesisOption method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    super.onRenderBackground(guiWidth, guiHeight);
    RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
    RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
    RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + getColor());
}
Also used : Area(binnie.core.gui.geometry.Area) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 29 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlScrollableContent method setScrollableContent.

public void setScrollableContent(@Nullable final T child) {
    this.controlChild = child;
    if (child == null) {
        return;
    }
    child.setCroppedZone(this, new Area(1, 1, getSize().xPos() - 2 - this.scrollBarSize, getSize().yPos() - 2));
    child.addSelfEventHandler(EventWidget.ChangeSize.class, event -> {
        child.setOffset(new Point(0, Math.round(-ControlScrollableContent.this.percentageIndex * ControlScrollableContent.this.getMovementRange())));
        if (ControlScrollableContent.this.getMovementRange() == 0) {
            ControlScrollableContent.this.percentageIndex = 0;
        }
    });
}
Also used : EventWidget(binnie.core.gui.events.EventWidget) Area(binnie.core.gui.geometry.Area) Point(binnie.core.gui.geometry.Point)

Example 30 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlLiquidTank method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    CraftGUI.RENDER.texture(this.horizontal ? CraftGUITexture.HORIZONTAL_LIQUID_TANK : CraftGUITexture.LIQUID_TANK, Point.ZERO);
    GuiCraftGUI gui = Window.get(this).getGui();
    if (this.isMouseOver() && gui.isHelpMode()) {
        final int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.HELP);
        RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
    } else if (ControlLiquidTank.tankError.contains(this.tankID)) {
        final int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR);
        RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
    } else if (this.getTopParent().getMousedOverWidget() == this) {
        if (!gui.getDraggedItem().isEmpty()) {
            RenderUtil.drawGradientRect(this.getArea().inset(1), -1426089575, -1426089575);
        } else {
            RenderUtil.drawGradientRect(this.getArea().inset(1), -2130706433, -2130706433);
        }
    }
    if (this.isTankValid()) {
        final int height = this.horizontal ? 16 : 58;
        final int squaled = Math.round(height * (this.getTank().getAmount() / this.getTank().getCapacity()));
        final int yPos = height + 1;
        final Fluid fluid = this.getTank().getLiquid().getFluid();
        final int hex = fluid.getColor(this.getTank().getLiquid());
        final int r = (hex & 0xFF0000) >> 16;
        final int g = (hex & 0xFF00) >> 8;
        final int b = hex & 0xFF;
        GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
        GlStateManager.enableBlend();
        {
            GlStateManager.blendFunc(770, 771);
            final IPoint pos = this.getAbsolutePosition();
            final IPoint offset = new Point(0, height - squaled);
            final IArea limited = this.getArea().inset(1);
            if (this.horizontal) {
                limited.setSize(new Point(limited.width() - 1, limited.height()));
            }
            CraftGUI.RENDER.limitArea(new Area(limited.pos().add(pos).add(offset), limited.size().sub(offset)), guiWidth, guiHeight);
            GL11.glEnable(GL11.GL_SCISSOR_TEST);
            {
                BinnieCore.getBinnieProxy().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
                for (int y = 0; y < height; y += 16) {
                    for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16) {
                        final TextureAtlasSprite icon = BinnieCore.getBinnieProxy().getTextureAtlasSprite(fluid.getStill());
                        RenderUtil.drawSprite(new Point(1 + x, 1 + y), icon);
                    }
                }
            }
            GL11.glDisable(GL11.GL_SCISSOR_TEST);
        }
        GlStateManager.disableBlend();
        GlStateManager.color(1, 1, 1, 1);
    }
}
Also used : Area(binnie.core.gui.geometry.Area) IArea(binnie.core.api.gui.IArea) IArea(binnie.core.api.gui.IArea) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Fluid(net.minecraftforge.fluids.Fluid) GuiCraftGUI(binnie.core.gui.minecraft.GuiCraftGUI) IPoint(binnie.core.api.gui.IPoint) IPoint(binnie.core.api.gui.IPoint) Point(binnie.core.gui.geometry.Point) IPoint(binnie.core.api.gui.IPoint) Point(binnie.core.gui.geometry.Point) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Area (binnie.core.gui.geometry.Area)34 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)22 Point (binnie.core.gui.geometry.Point)14 ControlText (binnie.core.gui.controls.ControlText)10 IPoint (binnie.core.api.gui.IPoint)6 IArea (binnie.core.api.gui.IArea)5 ItemStack (net.minecraft.item.ItemStack)5 WindowAbstractDatabase (binnie.core.gui.database.WindowAbstractDatabase)4 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)4 IAllele (forestry.api.genetics.IAllele)4 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)3 ControlSpeciesBox (binnie.core.gui.database.ControlSpeciesBox)3 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)3 ControlSlot (binnie.core.gui.minecraft.control.ControlSlot)3 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)3 IFlower (binnie.botany.api.genetics.IFlower)2 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)2 Control (binnie.core.gui.controls.core.Control)2 Border (binnie.core.gui.geometry.Border)2 GuiCraftGUI (binnie.core.gui.minecraft.GuiCraftGUI)2