Search in sources :

Example 26 with Position

use of gregtech.api.util.Position in project GregTech by GregTechCE.

the class ScrollableListWidget method isWidgetOverlapsScissor.

private boolean isWidgetOverlapsScissor(Widget widget) {
    final Position position = widget.getPosition();
    final Size size = widget.getSize();
    final int x0 = position.x;
    final int y0 = position.y;
    final int x1 = position.x + size.width - 1;
    final int y1 = position.y + size.height - 1;
    return isPositionInsideScissor(x0, y0) || isPositionInsideScissor(x0, y1) || isPositionInsideScissor(x1, y0) || isPositionInsideScissor(x1, y1);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size)

Example 27 with Position

use of gregtech.api.util.Position in project GregTech by GregTechCE.

the class ScrollableListWidget method updateElementPositions.

private void updateElementPositions() {
    Position position = getPosition();
    int currentPosY = position.y - scrollOffset;
    int totalListHeight = 0;
    for (Widget widget : widgets) {
        Position childPosition = new Position(position.x, currentPosY);
        widget.setParentPosition(childPosition);
        currentPosY += widget.getSize().getHeight();
        totalListHeight += widget.getSize().getHeight();
        final Size size = getSize();
        widget.applyScissor(position.x, position.y, size.width - scrollPaneWidth, size.height);
    }
    this.totalListHeight = totalListHeight;
    this.slotHeight = widgets.isEmpty() ? 0 : totalListHeight / widgets.size();
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) Widget(gregtech.api.gui.Widget)

Example 28 with Position

use of gregtech.api.util.Position in project GregTech by GregTechCE.

the class SlotWidget method onPositionUpdate.

@Override
protected void onPositionUpdate() {
    if (slotReference != null && sizes != null) {
        Position position = getPosition();
        this.slotReference.xPos = position.x + 1 - sizes.getGuiLeft();
        this.slotReference.yPos = position.y + 1 - sizes.getGuiTop();
    }
}
Also used : Position(gregtech.api.util.Position)

Example 29 with Position

use of gregtech.api.util.Position in project GregTech by GregTechCE.

the class SlotWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    if (isEnabled() && backgroundTexture != null) {
        Position pos = getPosition();
        Size size = getSize();
        for (TextureArea backgroundTexture : this.backgroundTexture) {
            backgroundTexture.draw(pos.x, pos.y, size.width, size.height);
        }
    }
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) TextureArea(gregtech.api.gui.resources.TextureArea) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 30 with Position

use of gregtech.api.util.Position in project GregTech by GregTechCE.

the class PhantomFluidWidget method drawInBackground.

@Override
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    Position pos = getPosition();
    Size size = getSize();
    if (backgroundTexture != null) {
        backgroundTexture.draw(pos.x, pos.y, size.width, size.height);
    }
    if (lastFluidStack != null) {
        GlStateManager.disableBlend();
        RenderUtil.drawFluidForGui(lastFluidStack, lastFluidStack.amount, pos.x + 1, pos.y + 1, size.width - 1, size.height - 1);
        GlStateManager.enableBlend();
        GlStateManager.color(1.0f, 1.0f, 1.0f);
    }
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size)

Aggregations

Position (gregtech.api.util.Position)35 Size (gregtech.api.util.Size)19 FontRenderer (net.minecraft.client.gui.FontRenderer)9 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 Widget (gregtech.api.gui.Widget)4 PositionedRect (gregtech.api.util.PositionedRect)4 SizedTextureArea (gregtech.api.gui.resources.SizedTextureArea)3 Vector3 (codechicken.lib.vec.Vector3)2 INativeWidget (gregtech.api.gui.INativeWidget)2 TextureArea (gregtech.api.gui.resources.TextureArea)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 Cuboid6 (codechicken.lib.vec.Cuboid6)1 Transformation (codechicken.lib.vec.Transformation)1 IItemInfo (gregtech.common.inventory.IItemInfo)1 ArrayList (java.util.ArrayList)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 ItemStack (net.minecraft.item.ItemStack)1