Search in sources :

Example 21 with Size

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

the class GridElementDef method createWidget.

public GridElementWidget createWidget(ElementOrientation orientation, int slotSize) {
    GridElementWidget elementWidget = supplier.apply(new Size(sizeHorizontal * slotSize, sizeVertical * slotSize), slotSize);
    elementWidget.setOrientation(orientation);
    return elementWidget;
}
Also used : Size(gregtech.api.util.Size)

Example 22 with Size

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

the class ScrollableListWidget method isOnScrollPane.

private boolean isOnScrollPane(int mouseX, int mouseY) {
    Position pos = getPosition();
    Size size = getSize();
    return isMouseOver(pos.x + size.width - scrollPaneWidth, pos.y, scrollPaneWidth, size.height, mouseX, mouseY);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size)

Example 23 with Size

use of gregtech.api.util.Size 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 24 with Size

use of gregtech.api.util.Size 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 25 with Size

use of gregtech.api.util.Size 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)

Aggregations

Size (gregtech.api.util.Size)30 Position (gregtech.api.util.Position)19 FontRenderer (net.minecraft.client.gui.FontRenderer)8 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 Vector3 (codechicken.lib.vec.Vector3)3 SizedTextureArea (gregtech.api.gui.resources.SizedTextureArea)3 Widget (gregtech.api.gui.Widget)2 TextureArea (gregtech.api.gui.resources.TextureArea)2 PositionedRect (gregtech.api.util.PositionedRect)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 Cuboid6 (codechicken.lib.vec.Cuboid6)1 Rotation (codechicken.lib.vec.Rotation)1 Transformation (codechicken.lib.vec.Transformation)1 Translation (codechicken.lib.vec.Translation)1 INativeWidget (gregtech.api.gui.INativeWidget)1 ArrayList (java.util.ArrayList)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1