use of mods.railcraft.common.gui.buttons.IButtonTextureSet in project Railcraft by Railcraft.
the class GuiMultiButton method drawButton.
@Override
public void drawButton(Minecraft minecraft, int x, int y) {
if (!visible) {
return;
}
FontRenderer fontrenderer = minecraft.fontRendererObj;
bindButtonTextures(minecraft);
OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
IMultiButtonState state = control.getButtonState();
IButtonTextureSet tex = state.getTextureSet();
int xOffset = tex.getX();
int yOffset = tex.getY();
int h = tex.getHeight();
int w = tex.getWidth();
boolean flag = x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + h;
int hoverState = getHoverState(flag);
drawTexturedModalRect(xPosition, yPosition, xOffset, yOffset + hoverState * h, width / 2, h);
drawTexturedModalRect(xPosition + width / 2, yPosition, xOffset + w - width / 2, yOffset + hoverState * h, width / 2, h);
mouseDragged(minecraft, x, y);
displayString = state.getLabel();
if (!Strings.isEmpty(displayString)) {
if (!enabled) {
drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xffa0a0a0);
} else if (flag) {
drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xffffa0);
} else {
drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xe0e0e0);
}
}
}
Aggregations