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:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    float f4 = ((col2 >> 24) & 0xFF) / 255F;
    float f5 = ((col2 >> 16) & 0xFF) / 255F;
    float f6 = ((col2 >> 8) & 0xFF) / 255F;
    float f7 = (col2 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);/*from   w w w . j a  va 2  s.  c  o m*/
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glPushMatrix();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);

    GL11.glColor4f(f5, f6, f7, f4);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glShadeModel(GL11.GL_FLAT);
}

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

public static void drawGBRect(double x, double y, double x2, double y2, float l1, int col1, int col2,
        int col3) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);//  w w w.j  av a 2  s . c om
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(1F);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    drawGradientRect(x, y, x2, y2, col2, col3);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:com.kodehawa.newgui.GuiBrewing.java

License:Open Source License

/**
 * Draw the background layer for the GuiContainer (everything behind the items)
 *//*from  w  w  w  .  j  a va2  s.  c om*/
public void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    drawDefaultBackground();
    //Tanto lio para PONER UNA TEXTURA ENSERIO? ._.
    mc.func_110434_K().func_110577_a(field_CP2_oi);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
    level.drawScreen(i, j, f);
    minutes.drawScreen(i, j, f);
    seconds.drawScreen(i, j, f);
}

From source file:com.kodehawa.newgui.GuiExperience.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *//*from w w  w. ja  v a 2 s.co  m*/
public void drawScreen(int i, int j, float f) {
    drawDefaultBackground();
    mc.func_110434_K().func_110577_a(field_CP2_oi);
    //mc.renderEngine.bindTexture("/CP2/resources/guiexperience.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int l = (width - 218) / 2;
    int i1 = (height - 124) / 2;
    drawTexturedModalRect(l, i1, 0, 0, 218, 124);
    level.drawScreen(i, j, f);
    percentage.drawScreen(i, j, f);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiExperience.LabelTitle"), width / 2, 20, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiExperience.LabelLevel"), width / 2, i1 + 9 + 5,
            0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiExperience.LabelPercentage"), width / 2,
            i1 + 35 + 5, 0xffffff);
    super.drawScreen(i, j, f);
}

From source file:com.kodehawa.newgui.GuiHealthFood.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *///w  ww.java  2 s  . c  o  m
public void drawScreen(int i, int j, float f) {
    drawDefaultBackground();
    mc.func_110434_K().func_110577_a(field_CP2_oi);
    //this.mc.renderEngine.bindTexture("/CP2/resources/guihealthfood.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int l = (width - 218) / 2;
    int i1 = (height - 150) / 2;
    drawTexturedModalRect(l, i1, 0, 0, 218, 150);
    healthlevel.drawScreen(i, j, f);
    foodlevel.drawScreen(i, j, f);
    saturation.drawScreen(i, j, f);
    exhaustion.drawScreen(i, j, f);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiHealthFood.LabelTitle"), width / 2, 20, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiHealthFood.LabelHealthLevel"), width / 2,
            i1 + 9 + 0 + 5, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiHealthFood.LabelFoodLevel"), width / 2,
            i1 + 9 + 26 + 5, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiHealthFood.LabelSaturation"), width / 2,
            i1 + 9 + 52 + 5, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiHealthFood.LabelExhaustion"), width / 2,
            i1 + 9 + 78 + 5, 0xffffff);
    super.drawScreen(i, j, f);
}

From source file:com.kodehawa.newgui.GuiImageButton.java

License:Open Source License

/**
 * Draws this button to the screen./* w  ww  .  ja v a  2s  . c  o  m*/
 */
public void drawButton(Minecraft minecraft, int i, int j) {
    if (!drawButton) {
        return;
    } else {
        mc.func_110434_K().func_110577_a(field_CP2_oi);
        //this.mc.renderEngine.bindTexture(texture);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        boolean flag = enabled && drawButton && i >= xPosition && j >= yPosition && i < xPosition
                && j < yPosition;
        int k = getHoverState(flag);
        drawTexturedModalRect(xPosition + imgxoffset, yPosition + imgyoffset, imgxpos, imgypos + k * imgheight,
                imgwidth, imgheight);
        mouseDragged(minecraft, i, j);
        return;
    }
}

From source file:com.kodehawa.newgui.GuiItemSelection.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *//*  www .  j a  v a 2 s .c om*/
public void drawScreen(int l, int i1, float f) {
    boolean flag = Mouse.isButtonDown(0);
    int j1 = guiLeft;
    int k1 = guiTop;
    int l1 = j1 + 155;
    int i2 = k1 + 17;
    int j2 = l1 + 14;
    int k2 = i2 + 160 + 2;

    if (!k && flag && l >= l1 && i1 >= i2 && l < j2 && i1 < k2) {
        j = true;
    }

    if (!flag) {
        j = false;
    }

    k = flag;

    if (j) {
        i = (float) (i1 - (i2 + 8)) / ((float) (k2 - i2) - 16F);

        if (i < 0.0F) {
            i = 0.0F;
        }

        if (i > 1.0F) {
            i = 1.0F;
        }

        ((ContainerItemSelection) inventorySlots).a(i);
    }

    super.drawScreen(l, i1, f);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
}

From source file:com.kodehawa.newgui.GuiItemSelection.java

License:Open Source License

/**
 * Draw the background layer for the GuiContainer (everything behind the items)
 *//*from ww w  . j  a v a2 s  . c om*/
protected void drawGuiContainerBackgroundLayer(float f, int l, int i1) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    //mc.renderEngine.bindTexture("/gui/allitems.png");
    mc.func_110434_K().func_110577_a(field_CP2_oi);

    int k1 = guiLeft;
    int l1 = guiTop;
    drawTexturedModalRect(k1, l1, 0, 0, xSize, ySize);
    int i2 = k1 + 155;
    int j2 = l1 + 17;
    int k2 = j2 + 160 + 2;
    drawTexturedModalRect(k1 + 154, l1 + 17 + (int) ((float) (k2 - j2 - 17) * i), 0, 208, 16, 16);
}

From source file:com.kodehawa.newgui.GuiMoreOptions.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *//*from   w ww . ja  va  2 s.c  om*/
public void drawScreen(int i, int j, float f) {
    drawDefaultBackground();
    mc.func_110434_K().func_110577_a(field_CP2_oi);
    //this.mc.renderEngine.bindTexture("/CP2/resources/guimoreoptions.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    drawTexturedModalRect((width - 256) / 2, (height - 116) / 2, 0, 0, 256, 116);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiMoreOptions.LabelTitle"), width / 2, 20, 0xffffff);
    super.drawScreen(i, j, f);
}

From source file:com.kodehawa.newgui.GuiPotionEffects.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *///w  ww  . ja va  2s . c om
public void drawScreen(int i, int j, float f) {
    drawDefaultBackground();
    //this.mc.renderEngine.bindTexture("/CP2/resources/guipotioneffects.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    int l = (width - 218) / 2;
    int i1 = (height - 148) / 2;
    drawTexturedModalRect(l, i1, 0, 0, 218, 148);
    level.drawScreen(i, j, f);
    minutes.drawScreen(i, j, f);
    seconds.drawScreen(i, j, f);
    //effect.setInfo(StringTranslate.getInstance().translateKey(Potion.potionTypes[effect.index].getName()));
    drawCenteredString(fontRenderer, CheatPack.translate("GuiPotionEffects.LabelTitle"), width / 2, 20,
            0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiPotionEffects.LabelLevel"), width / 2, i1 + 35 + 5,
            0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiPotionEffects.LabelMinutes"), width / 2,
            i1 + 61 + 5, 0xffffff);
    drawCenteredString(fontRenderer, CheatPack.translate("GuiPotionEffects.LabelSeconds"), width / 2,
            i1 + 87 + 5, 0xffffff);
    super.drawScreen(i, j, f);
}