use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class ControlEnergyBar method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.HELP));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
} else if (ControlEnergyBar.isError) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class ControlSlot method onRenderOverlay.
@Override
@SideOnly(Side.CLIENT)
public void onRenderOverlay() {
boolean highlighted = false;
for (final Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
if (highlight.getKey() == EnumHighlighting.SHIFT_CLICK && !ControlSlot.shiftClickActive) {
continue;
}
if (highlighted || !highlight.getValue().contains(this.slot.slotNumber)) {
continue;
}
highlighted = true;
final int c = highlight.getKey().getColour();
IArea area = this.getArea();
if (this.getParent() instanceof ControlSlotArray || this.getParent() instanceof ControlPlayerInventory) {
area = this.getParent().getArea();
area.setPosition(Point.ZERO.sub(this.getPosition()));
}
RenderUtil.setColour(c);
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class ControlLiquidTank method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
CraftGUI.RENDER.texture(this.horizontal ? CraftGUITexture.HORIZONTAL_LIQUID_TANK_OVERLAY : CraftGUITexture.LIQUID_TANK_OVERLAY, Point.ZERO);
GuiCraftGUI gui = Window.get(this).getGui();
if (this.isMouseOver() && gui.isHelpMode()) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.HELP));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
if (ControlLiquidTank.tankError.contains(this.tankID)) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class ControlSlide method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
if (this.label != null) {
final int lw = RenderUtil.getTextWidth(this.label) + 16;
final int lh = RenderUtil.getTextHeight() + 16;
final boolean hor = this.anchor.x() != 0;
final IArea ar = this.isSlideActive() ? this.expanded : this.shrunk;
IArea tabArea = new Area(hor ? (-lh / 2) : (-lw / 2), hor ? (-lw / 2) : (-lh / 2), hor ? lh : lw, hor ? lw : lh);
final Point shift = new Point(ar.width() * (1 - this.anchor.x()) / 2, ar.height() * (1 - this.anchor.y()) / 2);
tabArea = tabArea.shift(shift.xPos() - (-3 + lh / 2) * this.anchor.x(), shift.yPos() - (-3 + lh / 2) * this.anchor.y());
ITexture texture = CraftGUI.RENDER.getTexture(this.isSlideActive() ? CraftGUITexture.TAB : CraftGUITexture.TAB_DISABLED).crop(this.anchor.opposite(), 8);
CraftGUI.RENDER.texture(texture, tabArea);
texture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE).crop(this.anchor.opposite(), 8);
CraftGUI.RENDER.texture(texture, tabArea.inset(2));
final Area labelArea = new Area(-lw / 2, 0, lw, lh);
GlStateManager.pushMatrix();
GlStateManager.translate(shift.xPos() + this.anchor.x() * 2, shift.yPos() + this.anchor.y() * 2, 0);
if (this.anchor.x() != 0) {
GlStateManager.rotate(90.0f, 0.0f, 0.0f, this.anchor.x());
}
if (this.anchor.y() > 0) {
GlStateManager.translate(0.0f, -lh, 0.0f);
}
RenderUtil.drawText(labelArea, TextJustification.MIDDLE_CENTER, this.label, 16777215);
GlStateManager.popMatrix();
}
CraftGUI.RENDER.texture(CraftGUITexture.WINDOW, this.getArea());
final Object slideTexture = (this.anchor == Alignment.BOTTOM) ? CraftGUITexture.SLIDE_DOWN : ((this.anchor == Alignment.TOP) ? CraftGUITexture.SLIDE_UP : ((this.anchor == Alignment.LEFT) ? CraftGUITexture.SLIDE_LEFT : CraftGUITexture.SLIDE_RIGHT));
CraftGUI.RENDER.texture(slideTexture, new Point((this.anchor.x() + 1) * this.getWidth() / 2 - 8, (this.anchor.y() + 1) * this.getHeight() / 2 - 8));
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class TextureRenderer method texture.
public void texture(@Nullable final ITexture texture, final IArea area) {
if (texture == null) {
return;
}
this.setTexture(texture);
final IArea textureArea = texture.getArea().outset(texture.getBorder());
final IArea targetArea = area.outset(texture.getBorder());
if (textureArea.width() == targetArea.width() && textureArea.height() == targetArea.height()) {
final IPoint position = targetArea.pos();
GuiUtils.drawTexturedModalRect(position.xPos(), position.yPos(), textureArea.pos().xPos(), textureArea.pos().yPos(), textureArea.size().xPos(), textureArea.size().yPos(), 0);
} else {
renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
}
}
Aggregations