Example usage for org.lwjgl.opengl GL11 glColor4f

List of usage examples for org.lwjgl.opengl GL11 glColor4f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glColor4f.

Prototype

public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:buildcraft.builders.urbanism.GuiUrbanist.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int cornerX = (width - TOOLBAR_TEXTURE_WIDTH) / 2;
    int cornerY = height - TOOLBAR_TEXTURE_HEIGHT;

    mc.renderEngine.bindTexture(TOOLBAR_TEXTURE);
    drawTexturedModalRect(cornerX, cornerY, 0, 0, TOOLBAR_TEXTURE_WIDTH, TOOLBAR_TEXTURE_HEIGHT);

    for (int i = 0; i < 10; ++i) {
        slots[i].x = cornerX + 8 + i * 18;
        slots[i].y = cornerY + 8;/*from  w  ww  . jav a 2  s  .co  m*/
    }

    if (selectedTool != -1) {
        tools[selectedTool].drawGuiContainerBackgroundLayer(this, f, x, y);
    }

    drawBackgroundSlots();

    if (selectedTool != -1) {
        tools[selectedTool].drawSelection(this, f, x, y);
    }

    if (selectedTool != -1) {
        mc.renderEngine.bindTexture(TOOLBAR_TEXTURE);
        drawTexturedModalRect(cornerX + 8 + selectedTool * 18, cornerY + 8, 194, 0, 18, 18);
    }
}

From source file:buildcraft.core.gui.buttons.GuiBetterButton.java

License:Minecraft Mod Public

@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
    if (!visible) {
        return;/*from   w w w.ja v  a2s. c  o  m*/
    }

    FontRenderer fontrenderer = minecraft.fontRenderer;
    bindButtonTextures(minecraft);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int xOffset = texture.getX();
    int yOffset = texture.getY();
    int h = texture.getHeight();
    int w = texture.getWidth();
    boolean mouseOver = isMouseOverButton(mouseX, mouseY);
    int hoverState = getHoverState(mouseOver);
    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, mouseX, mouseY);
    drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2,
            getTextColor(mouseOver));
}

From source file:buildcraft.core.gui.buttons.GuiImageButton.java

License:Minecraft Mod Public

@Override
public void drawButton(Minecraft minecraft, int x, int y) {

    if (!visible) {
        return;//from   w  w w .jav  a2  s. com
    }

    minecraft.renderEngine.bindTexture(ICON_BUTTON_TEXTURES);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    int buttonState = getButtonState(x, y);

    drawTexturedModalRect(xPosition, yPosition, buttonState * SIZE, 0, SIZE, SIZE);

    drawTexturedModalRect(xPosition + 1, yPosition + 1, image.getU(), image.getV(), SIZE - 2, SIZE - 2);

    mouseDragged(minecraft, x, y);
}

From source file:buildcraft.core.gui.buttons.GuiMultiButton.java

License:Minecraft Mod Public

@Override
public void drawButton(Minecraft minecraft, int x, int y) {
    if (!visible) {
        return;/*from ww w  .  j a  v  a2  s. c o m*/
    }

    FontRenderer fontrenderer = minecraft.fontRenderer;
    bindButtonTextures(minecraft);
    GL11.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 (!"".equals(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);
        }
    }
}

From source file:buildcraft.core.gui.GuiAdvancedInterface.java

License:Minecraft Mod Public

protected void drawBackgroundSlots() {
    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;

    RenderHelper.enableGUIStandardItemLighting();
    GL11.glPushMatrix();/*from  w w  w. jav a2 s  .c o m*/
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
    int i1 = 240;
    int k1 = 240;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    for (AdvancedSlot slot : slots) {
        if (slot != null) {
            slot.drawSprite(cornerX, cornerY);
        }
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.core.gui.GuiBuildCraft.java

License:Minecraft Mod Public

/**
 * Draws the screen and all the components in it.
 *///from   w  ww . j a  va 2  s  .co m
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
    super.drawScreen(mouseX, mouseY, par3);
    int left = this.guiLeft;
    int top = this.guiTop;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(left, top, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.disableStandardItemLighting();

    InventoryPlayer playerInv = this.mc.thePlayer.inventory;

    if (playerInv.getItemStack() == null) {
        drawToolTips(container.getWidgets(), mouseX, mouseY);
        drawToolTips(buttonList, mouseX, mouseY);
        drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY);
    }

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:buildcraft.core.gui.GuiBuildCraft.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(texture);// www  .  j av a 2  s  . c o  m
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

    int mX = mouseX - guiLeft;
    int mY = mouseY - guiTop;

    for (Widget widget : container.getWidgets()) {
        if (widget.hidden) {
            continue;
        }
        bindTexture(texture);
        widget.draw(this, x, y, mX, mY);
    }
}

From source file:buildcraft.core.lib.gui.AdvancedSlot.java

License:Minecraft Mod Public

public void drawStack(ItemStack item) {
    int cornerX = (gui.width - gui.getXSize()) / 2;
    int cornerY = (gui.height - gui.getYSize()) / 2;

    gui.drawStack(item, cornerX + x, cornerY + y);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:buildcraft.core.lib.gui.buttons.GuiImageButton.java

License:Minecraft Mod Public

@Override
public void drawButton(Minecraft minecraft, int x, int y) {
    if (!visible) {
        return;/*w w w.  ja  va 2s.  com*/
    }

    minecraft.renderEngine.bindTexture(texture);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);

    int buttonState = getButtonState(x, y);

    drawTexturedModalRect(xPosition, yPosition, baseU + buttonState * size, baseV, size, size);
    drawTexturedModalRect(xPosition + 1, yPosition + 1, u, v, size - 2, size - 2);

    mouseDragged(minecraft, x, y);
}

From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java

License:Minecraft Mod Public

protected void drawBackgroundSlots(int mouseX, int mouseY) {
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glPushMatrix();//from   ww  w .  j av  a2 s. c om
    GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    int i1 = 240;
    int k1 = 240;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if (slots != null) {
        for (AdvancedSlot slot : slots) {
            if (slot != null) {
                slot.drawSprite(guiLeft, guiTop);
                drawSlotHighlight(slot, mouseX, mouseY);
            }
        }
    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}