@Override public void draw() { int x = xPos; int y = yPos; int midW = width - borderLeft.w - borderRight.w; int midH = height - borderTop.h - borderBottom.h; // top row x += cornerTopLeft.draw(x, y); x += borderTop.drawScaledX(x, y, midW); cornerTopRight.draw(x, y); // center row x = xPos; y += borderTop.h; x += borderLeft.drawScaledY(x, y, midH); x += midW; borderRight.drawScaledY(x, y, midH); // bottom row x = xPos; y += midH; x += cornerBottomLeft.draw(x, y); x += borderBottom.drawScaledX(x, y, midW); cornerBottomRight.draw(x, y); } }
public int drawScaled(int xPos, int yPos, int width, int height) { // we draw full height row-wise int full = height / this.h; for(int i = 0; i < full; i++) { drawScaledX(xPos, yPos + i * this.h, width); } yPos += full * this.h; // and the remainder is drawn manually int yRest = height % this.h; // the same as drawScaledX but with the remaining height for(int i = 0; i < width / w; i++) { drawScaledY(xPos + i * w, yPos, yRest); } // remainder that doesn't fit total width int remainder = width % w; if(remainder > 0) { GuiScreen.drawModalRectWithCustomSizedTexture(xPos + width - remainder, yPos, x, y, remainder, yRest, texW, texH); } return width; }
@Override public void draw() { if(hidden) { return; } // slidebar background slideBarTop.draw(xPos, yPos); slideBar.drawScaledY(xPos, yPos + slideBarTop.h, getUsableSlidebarHeight()); slideBarBottom.draw(xPos, yPos + height - slideBarBottom.h); int x = xPos + sliderOffset; int y = yPos + getSliderTop(); // the slider depending on state if(enabled) { if(isScrolling) { sliderDisabled.draw(x, y); } else if(isHighlighted) { sliderHighlighted.draw(x, y); } else { slider.draw(x, y); } } else { sliderDisabled.draw(x, y); } }