Search in sources :

Example 31 with Area

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

the class TextureRenderer method preRender.

public final void preRender(final IWidget widget, int guiWidth, int guiHeight) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(widget.getPosition().xPos(), widget.getPosition().yPos(), 0.0f);
    RenderUtil.setColour(widget.getColor());
    if (widget.isCroppedWidet()) {
        final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
        final IPoint pos = cropRelative.getAbsolutePosition();
        final IArea cropZone = widget.getCroppedZone();
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        this.limitArea(new Area(pos.add(cropZone.pos()), cropZone.size()), guiWidth, guiHeight);
    }
    GlStateManager.disableDepth();
}
Also used : Area(binnie.core.gui.geometry.Area) IArea(binnie.core.api.gui.IArea) IArea(binnie.core.api.gui.IArea) IPoint(binnie.core.api.gui.IPoint) IWidget(binnie.core.api.gui.IWidget)

Example 32 with Area

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

the class ControlPunnett method setup.

public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) {
    deleteAllChildren();
    if (chromosome == null || ind1 == null || ind2 == null || root == null) {
        return;
    }
    IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
    IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
    IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
    IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
    int x = 1;
    int y = 1;
    for (IAllele allele1 : new IAllele[] { primary1, secondary1 }) {
        y = 1;
        for (IAllele allele2 : new IAllele[] { primary2, secondary2 }) {
            List<IAllele> alleles = new LinkedList<>();
            if (allele1.isDominant() && !allele2.isDominant()) {
                alleles.add(allele1);
            } else if (allele2.isDominant() && !allele1.isDominant()) {
                alleles.add(allele2);
            } else {
                alleles.add(allele1);
                if (allele1 != allele2) {
                    alleles.add(allele2);
                }
            }
            StringBuilder text = new StringBuilder();
            for (IAllele allele3 : alleles) {
                text.append(allele3.getAlleleName()).append(": ").append(25.0f / alleles.size()).append("%\n");
            }
            new ControlText(this, new Area(x * ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT * y, ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT), text.toString(), TextJustification.TOP_CENTER).setColor(11184810);
            ++y;
        }
        ++x;
    }
    new ControlText(this, new Area(ControlPunnett.BOX_WIDTH, 0, ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT), '\n' + primary1.getAlleleName(), TextJustification.TOP_CENTER).setColor(11184810);
    new ControlText(this, new Area(ControlPunnett.BOX_WIDTH * 2, 0, ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT), '\n' + secondary1.getAlleleName(), TextJustification.TOP_CENTER).setColor(11184810);
    new ControlText(this, new Area(0, ControlPunnett.BOX_HEIGHT, ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT), primary2.getAlleleName(), TextJustification.TOP_CENTER).setColor(11184810);
    new ControlText(this, new Area(0, ControlPunnett.BOX_HEIGHT * 2, ControlPunnett.BOX_WIDTH, ControlPunnett.BOX_HEIGHT), primary2.getAlleleName(), TextJustification.TOP_CENTER).setColor(11184810);
}
Also used : IAllele(forestry.api.genetics.IAllele) Area(binnie.core.gui.geometry.Area) ControlText(binnie.core.gui.controls.ControlText) LinkedList(java.util.LinkedList)

Example 33 with Area

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

the class ControlPunnett method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    RenderUtil.drawSolidRect(new Area(0, ControlPunnett.BOX_HEIGHT, ControlPunnett.BOX_WIDTH * 3, 1), 11184810);
    RenderUtil.drawSolidRect(new Area(ControlPunnett.BOX_WIDTH / 2, ControlPunnett.BOX_HEIGHT * 2, Math.round(ControlPunnett.BOX_WIDTH * 2.5f), 1), 11184810);
    RenderUtil.drawSolidRect(new Area(ControlPunnett.BOX_WIDTH, 0, 1, ControlPunnett.BOX_HEIGHT * 3), 11184810);
    RenderUtil.drawSolidRect(new Area(ControlPunnett.BOX_WIDTH * 2, ControlPunnett.BOX_HEIGHT / 2, 1, Math.round(ControlPunnett.BOX_HEIGHT * 2.5f)), 11184810);
}
Also used : Area(binnie.core.gui.geometry.Area) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 34 with Area

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

the class ControlBreweryProgress method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    CraftGUI.RENDER.texture(BREWERY, Point.ZERO);
    final BreweryLogic logic = Machine.getInterface(BreweryLogic.class, Window.get(this).getInventory());
    if (logic == null || logic.getCurrentCrafting() == null || logic.getCurrentCrafting().getInputFluid() == null) {
        return;
    }
    FluidStack output = BreweryRecipeManager.getOutput(logic.getCurrentCrafting());
    FluidStack input = logic.getCurrentCrafting().getInputFluid();
    final int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
    CraftGUI.RENDER.limitArea(new Area(new Point(1, 6).add(this.getAbsolutePosition()), new Point(32, 32 - fermentedHeight)), guiWidth, guiHeight);
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    RenderUtil.drawFluid(new Point(1, 6), input);
    RenderUtil.drawFluid(new Point(17, 6), input);
    RenderUtil.drawFluid(new Point(1, 22), input);
    RenderUtil.drawFluid(new Point(17, 22), input);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    CraftGUI.RENDER.limitArea(new Area(new Point(1, 38 - fermentedHeight).add(this.getAbsolutePosition()), new Point(32, fermentedHeight)), guiWidth, guiHeight);
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    RenderUtil.drawFluid(new Point(1, 6), output);
    RenderUtil.drawFluid(new Point(17, 6), output);
    RenderUtil.drawFluid(new Point(1, 22), output);
    RenderUtil.drawFluid(new Point(17, 22), output);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    final ItemStackSet stacks = new ItemStackSet();
    Collections.addAll(stacks, logic.getCurrentCrafting().getInputGrains());
    stacks.add(logic.getCurrentCrafting().getIngredient());
    int x = 1;
    int y = 6;
    for (final ItemStack stack : stacks) {
        RenderUtil.drawItem(new Point(x, y), stack);
        x += 16;
        if (x > 18) {
            x = 1;
            y += 16;
        }
    }
}
Also used : Area(binnie.core.gui.geometry.Area) BreweryLogic(binnie.extratrees.machines.brewery.BreweryLogic) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStackSet(binnie.core.util.ItemStackSet) Point(binnie.core.gui.geometry.Point) ItemStack(net.minecraft.item.ItemStack) 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