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