Search in sources :

Example 1 with IMultiButtonState

use of mods.railcraft.common.gui.buttons.IMultiButtonState 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);
        }
    }
}
Also used : IButtonTextureSet(mods.railcraft.common.gui.buttons.IButtonTextureSet) IMultiButtonState(mods.railcraft.common.gui.buttons.IMultiButtonState) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 2 with IMultiButtonState

use of mods.railcraft.common.gui.buttons.IMultiButtonState in project Railcraft by Railcraft.

the class GuiMultiButton method drawButton.

@Override
public void drawButton(Minecraft minecraft, int x, int y, float partialTicks) {
    if (!visible) {
        return;
    }
    FontRenderer fontrenderer = minecraft.fontRenderer;
    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 >= this.x && y >= this.y && x < this.x + width && y < this.y + h;
    int hoverState = getHoverState(flag);
    drawTexturedModalRect(this.x, this.y, xOffset, yOffset + hoverState * h, width / 2, h);
    drawTexturedModalRect(this.x + width / 2, this.y, xOffset + w - width / 2, yOffset + hoverState * h, width / 2, h);
    mouseDragged(minecraft, x, y);
    displayString = state.getLabel();
    if (!Strings.isNullOrEmpty(displayString)) {
        if (!enabled) {
            drawCenteredString(fontrenderer, displayString, this.x + width / 2, this.y + (h - 8) / 2, 0xffa0a0a0);
        } else if (flag) {
            drawCenteredString(fontrenderer, displayString, this.x + width / 2, this.y + (h - 8) / 2, 0xffffa0);
        } else {
            drawCenteredString(fontrenderer, displayString, this.x + width / 2, this.y + (h - 8) / 2, 0xe0e0e0);
        }
    }
}
Also used : IButtonTextureSet(mods.railcraft.common.gui.buttons.IButtonTextureSet) IMultiButtonState(mods.railcraft.common.gui.buttons.IMultiButtonState) FontRenderer(net.minecraft.client.gui.FontRenderer)

Aggregations

IButtonTextureSet (mods.railcraft.common.gui.buttons.IButtonTextureSet)2 IMultiButtonState (mods.railcraft.common.gui.buttons.IMultiButtonState)2 FontRenderer (net.minecraft.client.gui.FontRenderer)2