Search in sources :

Example 1 with IArea

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));
    }
}
Also used : IArea(binnie.core.api.gui.IArea) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with IArea

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));
    }
}
Also used : IArea(binnie.core.api.gui.IArea) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) EnumMap(java.util.EnumMap) Point(binnie.core.gui.geometry.Point) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with IArea

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));
    }
}
Also used : IArea(binnie.core.api.gui.IArea) GuiCraftGUI(binnie.core.gui.minecraft.GuiCraftGUI) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with IArea

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));
}
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) Point(binnie.core.gui.geometry.Point) IPoint(binnie.core.api.gui.IPoint) Point(binnie.core.gui.geometry.Point) CraftGUITexture(binnie.core.gui.resource.textures.CraftGUITexture) ITexture(binnie.core.api.gui.ITexture) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with IArea

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());
    }
}
Also used : IArea(binnie.core.api.gui.IArea) IPoint(binnie.core.api.gui.IPoint)

Aggregations

IArea (binnie.core.api.gui.IArea)14 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)8 IPoint (binnie.core.api.gui.IPoint)7 Point (binnie.core.gui.geometry.Point)6 Area (binnie.core.gui.geometry.Area)4 ITexture (binnie.core.api.gui.ITexture)2 IWidget (binnie.core.api.gui.IWidget)2 GuiCraftGUI (binnie.core.gui.minecraft.GuiCraftGUI)2 CraftGUITexture (binnie.core.gui.resource.textures.CraftGUITexture)2 ArrayList (java.util.ArrayList)2 Alignment (binnie.core.api.gui.Alignment)1 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)1 ControlTabIcon (binnie.core.gui.minecraft.control.ControlTabIcon)1 EnumMap (java.util.EnumMap)1 List (java.util.List)1 Map (java.util.Map)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 Fluid (net.minecraftforge.fluids.Fluid)1