Search in sources :

Example 16 with Position

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

the class ModularUI method updateScreenSize.

public void updateScreenSize(int screenWidth, int screenHeight) {
    this.screenWidth = screenWidth;
    this.screenHeight = screenHeight;
    Position displayOffset = new Position(getGuiLeft(), getGuiTop());
    guiWidgets.values().forEach(widget -> widget.setParentPosition(displayOffset));
}
Also used : Position(gregtech.api.util.Position)

Example 17 with Position

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

the class Widget method isMouseOverElement.

public boolean isMouseOverElement(int mouseX, int mouseY) {
    Position position = getPosition();
    Size size = getSize();
    return isMouseOver(position.x, position.y, size.width, size.height, mouseX, mouseY);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size)

Example 18 with Position

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

the class Widget method toRectangleBox.

public Rectangle toRectangleBox() {
    Position pos = getPosition();
    Size size = getSize();
    return new Rectangle(pos.x, pos.y, size.width, size.height);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size)

Example 19 with Position

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

the class TextureArea method transformPos.

public static Position transformPos(Transformation transformation, Position position) {
    Vector3 vector = new Vector3(position.x, position.y, 0.0);
    transformation.apply(vector);
    return new Position((int) vector.x, (int) vector.y);
}
Also used : Position(gregtech.api.util.Position) Vector3(codechicken.lib.vec.Vector3)

Example 20 with Position

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

the class AdvancedTextWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    super.drawInBackground(mouseX, mouseY, context);
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    Position position = getPosition();
    for (int i = 0; i < displayText.size(); i++) {
        fontRenderer.drawString(displayText.get(i).getFormattedText(), position.x, position.y + i * (fontRenderer.FONT_HEIGHT + 2), color);
    }
}
Also used : Position(gregtech.api.util.Position) FontRenderer(net.minecraft.client.gui.FontRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

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