use of org.lwjgl.util.Rectangle in project Random-Things by lumien231.
the class GuiStringList method drawSlot.
@Override
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) {
GlStateManager.disableLighting();
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
int factor = scaledResolution.getScaleFactor();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(left * factor, Minecraft.getMinecraft().displayHeight - top * factor - listHeight * factor, listWidth * factor, listHeight * factor);
String string = stringList.get(var1);
int color = 0xFFFFFF;
Rectangle slotRect = new Rectangle(this.left + 3, var3, fontRenderer.getStringWidth(string), fontRenderer.FONT_HEIGHT);
if (slotRect.contains(mouseX, mouseY)) {
color = 0xFFD700;
}
fontRenderer.drawString(string, this.left + 3, var3, color);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GlStateManager.enableLighting();
}
use of org.lwjgl.util.Rectangle in project ConvenientAdditions by Necr0.
the class Slider method draw.
@Override
public <T extends GuiScreen & IGui> void draw(T guiScreen, float partialTicks, int mouseX, int mouseY) {
if (Mouse.isButtonDown(0) && isHovered(guiScreen, mouseX, mouseY)) {
if (new Rectangle(getX() + 1, getY() + 1, getWidth() - 2, getHeight() - 2).contains(mouseX, mouseY))
updateSlider(getRelativeXPosition(mouseX));
}
drawColoredRect(getX(), getY(), getWidth(), getHeight(), 0xaaaaaa);
drawColoredRect(getX() + 1, getY() + 1, getWidth() - 2, getHeight() - 2, 0x000000);
drawColoredRect(getX() + 1, getY() + 1, (int) ((getWidth() - 2) * (value - minValue) / (maxValue - minValue)), getHeight() - 2, 0x555555);
guiScreen.drawCenteredString(GuiHelper.getFontRenderer(), prefix + value + suffix, getX() + getWidth() / 2, getY() + getHeight() / 2 - 4, 0xffffff);
}
Aggregations