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