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