Search in sources :

Example 1 with Position

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

the class TextureArea method transformRect.

public static PositionedRect transformRect(Transformation transformation, PositionedRect positionedRect) {
    Position pos1 = transformPos(transformation, positionedRect.position);
    Position pos2 = transformPos(transformation, positionedRect.position.add(positionedRect.size));
    return new PositionedRect(pos1, pos2);
}
Also used : Position(gregtech.api.util.Position) PositionedRect(gregtech.api.util.PositionedRect)

Example 2 with Position

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

the class ItemListSlotWidget method drawInBackground.

@Override
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    super.drawInBackground(mouseX, mouseY, context);
    Position position = getPosition();
    GuiTextures.SLOT.draw(position.x, position.y, 18, 18);
    IItemInfo itemInfo = gridWidget.getItemInfoAt(index);
    int stackX = position.x + 1;
    int stackY = position.y + 1;
    if (itemInfo != null) {
        ItemStack itemStack = itemInfo.getItemStackKey().getItemStackRaw();
        String itemAmountStr = formatItemAmount(itemInfo.getTotalItemAmount());
        drawItemStack(itemStack, stackX, stackY, null);
        drawStringFixedCorner(itemAmountStr, stackX + 17, stackY + 17, 16777215, true, 0.5f);
    }
    if (isMouseOverElement(mouseX, mouseY)) {
        drawSelectionOverlay(stackX, stackY, 16, 16);
    }
}
Also used : IItemInfo(gregtech.common.inventory.IItemInfo) Position(gregtech.api.util.Position) ItemStack(net.minecraft.item.ItemStack)

Example 3 with Position

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

the class AbstractWidgetGroup method onPositionUpdate.

@Override
protected void onPositionUpdate() {
    Position selfPosition = getPosition();
    for (Widget widget : widgets) {
        widget.setParentPosition(selfPosition);
    }
    recomputeSize();
}
Also used : Position(gregtech.api.util.Position) INativeWidget(gregtech.api.gui.INativeWidget) Widget(gregtech.api.gui.Widget)

Example 4 with Position

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

the class ClickButtonWidget method drawInBackground.

@Override
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    super.drawInBackground(mouseX, mouseY, context);
    Position position = getPosition();
    Size size = getSize();
    if (buttonTexture instanceof SizedTextureArea) {
        ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(position.x, position.y, size.width, size.height, 0.0, 1.0);
    } else {
        buttonTexture.drawSubArea(position.x, position.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
    }
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String text = I18n.format(displayText);
    fontRenderer.drawString(text, position.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, position.y + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, textColor);
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) SizedTextureArea(gregtech.api.gui.resources.SizedTextureArea) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 5 with Position

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

the class CycleButtonWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    Position pos = getPosition();
    Size size = getSize();
    if (buttonTexture instanceof SizedTextureArea) {
        ((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, 0.0, 1.0);
    } else {
        buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, 0.0, 1.0, 1.0);
    }
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    String text = I18n.format(optionNames[currentOption]);
    fontRenderer.drawString(text, pos.x + size.width / 2 - fontRenderer.getStringWidth(text) / 2, pos.y + size.height / 2 - fontRenderer.FONT_HEIGHT / 2 + 1, textColor);
    GlStateManager.color(1.0f, 1.0f, 1.0f);
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) SizedTextureArea(gregtech.api.gui.resources.SizedTextureArea) 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