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();
}
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);
}
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);
}
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;
}
}
}
Aggregations