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);
}
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);
}
}
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();
}
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);
}
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);
}
Aggregations