Example usage for org.lwjgl.opengl GL11 glColor3f

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

Introduction

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

Prototype

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

Source Link

Document

Float version of #glColor3b Color3b

Usage

From source file:de.sanandrew.mods.enderstuffp.client.gui.GuiBiomeChanger.java

License:Creative Commons License

@Override
public void drawScreen(int mouseX, int mouseY, float partTicks) {
    int currFlux = this.biomeChanger.getEnergyStored(ForgeDirection.UNKNOWN);
    int maxFlux = this.biomeChanger.getMaxEnergyStored(ForgeDirection.UNKNOWN);
    int fluxUsage = this.biomeChanger.getFluxUsage();
    int fluxScale = 40 - (int) (currFlux / (float) maxFlux * 40.0F);
    int bufferScale = fluxUsage > 0 ? 40 - (int) (this.biomeChanger.usedFlux / (fluxUsage * 20.0F) * 40.0F)
            : 40;/*from  ww  w  . ja v  a  2 s  .  c o  m*/

    this.drawDefaultBackground();

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

    GL11.glPushMatrix();
    GL11.glTranslatef(this.posX, this.posY, 0.0F);

    this.mc.renderEngine.bindTexture(EnumTextures.GUI_BIOMECHANGER.getResource());

    this.drawTexturedModalRect(0, 0, 0, 0, WIDTH, HEIGHT);

    this.drawTexturedModalRect(10, 20, 176, 0, 14, 42);
    this.drawTexturedModalRect(14, 21 + fluxScale, 194, 1 + fluxScale, 9, 40 - fluxScale);
    this.drawTexturedModalRect(11, 21 + bufferScale, 191, 1 + bufferScale, 3, 40 - bufferScale);
    this.drawTexturedModalRect(7, 75, 0, 240, 161, 5);
    this.drawTexturedModalRect(7, 75, 0, 245,
            Math.round(161.0F * (this.biomeChanger.getCurrRange() / (float) this.biomeChanger.getMaxRange())),
            5);

    this.mc.fontRenderer.drawString(SAPUtils.translate(this.biomeChanger.getInventoryName()), 8, 6, 0x404040);

    String unlocName = EspBlocks.biomeChanger.getUnlocalizedName() + ".gui.";

    this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.usage"), 28, 21, 0x707070);
    this.mc.fontRenderer.drawString(String.format("%d RF/t", fluxUsage), 33, 31, 0x000000);
    this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.stored"), 28, 43, 0x707070);
    this.mc.fontRenderer.drawString(String.format("%d %s(+%d)%s / %d RF", currFlux,
            EnumChatFormatting.DARK_GREEN, this.biomeChanger.usedFlux, EnumChatFormatting.RESET, maxFlux), 33,
            53, 0x000000);

    this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "progress"), 10, 66, 0x404040);
    String s = String.format("%d / %d", this.biomeChanger.getCurrRange(), this.biomeChanger.getMaxRange());
    GuiUtils.drawOutlinedString(numberFont, s, 7 + (161 - numberFont.getStringWidth(s)) / 2, 74, 0xA090FF,
            0x000000);

    s = SAPUtils.translate(unlocName + "perim");
    drawRect(14, 88, 17 + this.mc.fontRenderer.getStringWidth(s), 88 + this.mc.fontRenderer.FONT_HEIGHT,
            0xFFC6C6C6);
    this.mc.fontRenderer.drawString(s, 16, 88, 0x404040);

    s = SAPUtils.translatePostFormat(unlocName + "blockrepl",
            this.biomeChanger.isReplacingBlocks()
                    ? EnumChatFormatting.DARK_GREEN + SAPUtils.translate(unlocName + "blockrepl.label.enabled")
                    : EnumChatFormatting.DARK_RED + SAPUtils.translate(unlocName + "blockrepl.label.disabled"));
    this.mc.fontRenderer.drawString(s, 10, 179, 0x404040);

    GL11.glPopMatrix();

    this.buttons.get(BTN_DEACTIVATE).visible = this.biomeChanger.isActive();
    this.buttons.get(BTN_ACTIVATE).visible = !this.biomeChanger.isActive();

    this.buttons.get(BTN_BLOCKREPL_DISABLE).enabled = this.biomeChanger.isReplacingBlocks()
            && !this.biomeChanger.isActive();
    this.buttons.get(BTN_BLOCKREPL_ENABLE).enabled = !this.biomeChanger.isReplacingBlocks()
            && !this.biomeChanger.isActive();

    this.buttons.get(BTN_SLIDER_RANGE).enabled = !this.biomeChanger.isActive();

    this.buttons.get(BTN_PERIM_CIRCLE).enabled = this.biomeChanger.perimForm != EnumPerimForm.CIRCLE
            && !this.biomeChanger.isActive();
    this.buttons.get(BTN_PERIM_RHOMBUS).enabled = this.biomeChanger.perimForm != EnumPerimForm.RHOMBUS
            && !this.biomeChanger.isActive();
    this.buttons.get(BTN_PERIM_SQUARE).enabled = this.biomeChanger.perimForm != EnumPerimForm.SQUARE
            && !this.biomeChanger.isActive();

    super.drawScreen(mouseX, mouseY, partTicks);

    if (this.biomeChanger.isActive()) {
        drawRect(this.posX + 10, this.posY + 88, this.posX + 170, this.posY + 210, 0x80C6C6C6);
    }
}

From source file:de.sanandrew.mods.enderstuffp.client.gui.GuiOreGenerator.java

License:Creative Commons License

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    int currFlux = this.oreGenerator.getEnergyStored(ForgeDirection.UNKNOWN);
    int maxFlux = this.oreGenerator.getMaxEnergyStored(ForgeDirection.UNKNOWN);
    int fluxScale = 40 - (int) (currFlux / (float) maxFlux * 40.0F);

    int ticksRemain = this.oreGenerator.ticksGenRemain;
    int maxTicksRemain = this.oreGenerator.maxTicksGenRemain;
    int ticksScale = Math.max(14 - (int) (ticksRemain / (float) maxTicksRemain * 14.0F), 0);

    this.mc.fontRenderer.drawString(SAPUtils.translate(this.oreGenerator.getInventoryName()), 8, 6, 0x404040);
    this.mc.fontRenderer.drawString(SAPUtils.translate("container.inventory"), 8, this.ySize - 96 + 2,
            0x404040);//from   w w w . j a  v  a  2  s .com

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

    this.mc.renderEngine.bindTexture(EnumTextures.GUI_ORE_GENERATOR.getResource());

    this.drawTexturedModalRect(10, 20, 176, 0, 14, 42);
    this.drawTexturedModalRect(11, 21 + fluxScale, 191, 1 + fluxScale, 12, 40 - fluxScale);

    this.drawTexturedModalRect(98, 70, 176, 42, 16, 16);
    this.drawTexturedModalRect(98, 70 + ticksScale, 192, 42 + ticksScale, 16, 16 - ticksScale);

    String unlocName = EspBlocks.oreGenerator.getUnlocalizedName() + ".gui.";

    this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.generating"), 28, 21, 0x707070);
    this.mc.fontRenderer.drawString(
            String.format("%d RF/t (%s)", this.oreGenerator.fluxGenerated, getTimeFromTicks(ticksRemain)), 33,
            31, 0x000000);
    this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.stored"), 28, 43, 0x707070);
    this.mc.fontRenderer.drawString(String.format("%d / %d RF", currFlux, maxFlux), 33, 53, 0x000000);
}

From source file:de.sanandrew.mods.enderstuffp.client.render.ItemRendererBiomeDataCrystal.java

License:Creative Commons License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    int biomeId = item.hasTagCompound() ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_BIOME)
            : -1;//w w  w .  j  a v a 2s . c o  m
    int dataProgress = item.hasTagCompound()
            ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_DATAPROG)
            : 0;
    double minCore = 3.0D / 16.0D;
    double maxCore = 13.0D / 16.0D;

    switch (type) {
    case ENTITY:
        GL11.glTranslatef(-0.5F, -0.508F, -0.5F);
        break;
    case INVENTORY:
        GL11.glTranslatef(0.0F, -0.1F, 0.0F);
        break;
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glDepthMask(false);

    if (dataProgress > 0 && biomeId >= 0) {
        double yMax = (10.0D - dataProgress) / 16.0F;
        double tessVMax = dataProgress / 10.0F * 0.5F;
        float[] color = SAPUtils.getRgbaFromColorInt(BiomeGenBase.getBiome(biomeId).color).getColorFloatArray();

        GL11.glColor3f(color[0], color[1], color[2]);
        Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_CORE.getResource());
        SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore - yMax, 0.25D, 0.0D,
                0.5D, 0.5D);
        SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.5D, 0.0D, 0.75D,
                0.5D);
        SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore - yMax, maxCore, maxCore, 0.25D,
                1.0D - tessVMax, 0.5D, 1.0D);
        SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore - yMax, maxCore, minCore, 0.75D,
                1.0D - tessVMax, 1.0D, 1.0D);
        SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore - yMax, maxCore, 0.0D,
                1.0D - tessVMax, 0.25D, 1.0D);
        SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore - yMax, minCore, 0.5D,
                1.0D - tessVMax, 0.75D, 1.0D);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }

    minCore -= 0.0001D;
    maxCore += 0.0001D;
    Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.GLASS_TEXTURE);
    SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);

    Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_BLOCKTEXTURE);
    SAPClientUtils.drawTexturedSquareYPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareYNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);

    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:de.sanandrew.mods.enderstuffp.client.render.tileentity.RenderTileEntityBiomeDataCrystal.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partTicks) {
    TileEntityBiomeDataCrystal crystalTile = (TileEntityBiomeDataCrystal) tile;
    double minCore = 3.0D / 16.0D;
    double maxCore = 13.0D / 16.0D;

    if (crystalTile.dataProgress > 0) {
        double yMax = (10.0D - crystalTile.dataProgress) / 16.0F;
        double tessVMax = crystalTile.dataProgress / 10.0F * 0.5F;
        float[] color = SAPUtils.getRgbaFromColorInt(BiomeGenBase.getBiome(crystalTile.getBiomeID()).color)
                .getColorFloatArray();/*w  w  w .ja v  a 2s  .co  m*/
        float prevBrightX = OpenGlHelper.lastBrightnessX;
        float prevBrightY = OpenGlHelper.lastBrightnessY;
        int bright = 0xF0;
        int brightX = bright % 65536;
        int brightY = bright / 65536;

        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);
        GL11.glColor3f(color[0], color[1], color[2]);
        Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_CORE.getResource());
        SAPClientUtils.drawTexturedSquareYPos(x + minCore, z + minCore, x + maxCore, z + maxCore,
                y + maxCore - yMax, 0.25D, 0.0D, 0.5D, 0.5D);
        SAPClientUtils.drawTexturedSquareYNeg(x + minCore, z + minCore, x + maxCore, z + maxCore, y + minCore,
                0.5D, 0.0D, 0.75D, 0.5D);
        SAPClientUtils.drawTexturedSquareXPos(y + minCore, z + minCore, y + maxCore - yMax, z + maxCore,
                x + maxCore, 0.25D, 1.0D - tessVMax, 0.5D, 1.0D);
        SAPClientUtils.drawTexturedSquareXNeg(y + minCore, z + minCore, y + maxCore - yMax, z + maxCore,
                x + minCore, 0.75D, 1.0D - tessVMax, 1.0D, 1.0D);
        SAPClientUtils.drawTexturedSquareZPos(x + minCore, y + minCore, x + maxCore, y + maxCore - yMax,
                z + maxCore, 0.0D, 1.0D - tessVMax, 0.25D, 1.0D);
        SAPClientUtils.drawTexturedSquareZNeg(x + minCore, y + minCore, x + maxCore, y + maxCore - yMax,
                z + minCore, 0.5D, 1.0D - tessVMax, 0.75D, 1.0D);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY);
    }

    minCore -= 0.01D;
    maxCore += 0.01D;
    Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.GLASS_TEXTURE);
    SAPClientUtils.drawTexturedSquareYPos(x + minCore, z + minCore, x + maxCore, z + maxCore, y + maxCore, 0.0D,
            0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareYNeg(x + minCore, z + minCore, x + maxCore, z + maxCore, y + minCore, 0.0D,
            0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXPos(y + minCore, z + minCore, y + maxCore, z + maxCore, x + maxCore, 0.0D,
            0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXNeg(y + minCore, z + minCore, y + maxCore, z + maxCore, x + minCore, 0.0D,
            0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZPos(x + minCore, y + minCore, x + maxCore, y + maxCore, z + maxCore, 0.0D,
            0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZNeg(x + minCore, y + minCore, x + maxCore, y + maxCore, z + minCore, 0.0D,
            0.0D, 1.0D, 1.0D);
}

From source file:de.sanandrew.mods.turretmod.client.gui.tcu.AGuiTurretControlUnit.java

License:Creative Commons License

@Override
public void drawScreen(int mouseX, int mouseY, float partTicks) {
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    this.drawDefaultBackground();

    this.drawScreenPostBkg(mouseX, mouseY, partTicks);

    String pageName = "";
    if (!this.pageInfo.enabled) {
        pageName = "info";
    } else if (!this.pageTargets.enabled) {
        pageName = "targets";
    } else if (!this.pageUpgrades.enabled) {
        pageName = "upgrades";
    }// w w w . j a  v a  2 s .c o m
    pageName = SAPUtils.translatePreFormat("gui.%s.tcu.page.%s.title", TurretMod.MOD_ID, pageName);
    this.fontRendererObj.drawString(pageName, this.guiLeft + 8, this.guiTop + 6, 0x404040);

    String turretName = SAPUtils.translatePreFormat("entity.%s.%s.name", TurretMod.MOD_ID,
            TurretRegistry.getTurretInfo(this.myTurret.getClass()).getName());
    this.fontRendererObj.drawString(turretName,
            this.guiLeft + (this.xSize - this.fontRendererObj.getStringWidth(turretName)) / 2,
            this.guiTop + this.ySize - 15, 0x00FF00, false);

    super.drawScreen(mouseX, mouseY, partTicks);
}

From source file:de.sanandrew.mods.turretmod.client.gui.tcu.GuiTcuInfo.java

License:Creative Commons License

@Override
public void drawScreenPostBkg(int mouseX, int mouseY, float partTicks) {
    this.mc.renderEngine.bindTexture(Textures.GUI_TCU_INFO.getResource());

    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

    if (this.specOwnerHead >= 0) {
        this.drawTexturedModalRect(this.guiLeft + 7, this.guiTop + 95, this.xSize, this.specOwnerHead * 8, 10,
                8);//from  w w  w.  j  a  v  a 2s  .com
    }

    String value = this.myTurret.hasCustomNameTag() ? this.myTurret.getCustomNameTag() : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 23, 0x000000);

    value = String.format("%.1f / %.1f HP", this.myTurret.getHealth(), this.myTurret.getMaxHealth());
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 35, 0x000000);

    value = String.format("%d", this.myTurret.getAmmo());

    if (this.myTurret.getAmmoType() != null) {
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        GuiUtils.drawGuiStack(this.myTurret.getAmmoType().getTypeItem(), this.guiLeft + 21, this.guiTop + 49);
        GL11.glTranslated(0.0D, 0.0D, 300.0D);
        this.frAmmoItem.drawStringWithShadow(value, this.guiLeft + 38 - this.frAmmoItem.getStringWidth(value),
                this.guiTop + 58, 0xFFFFFFFF);
        GL11.glTranslated(0.0D, 0.0D, -300.0D);
    }
    this.zLevel = 0.0F;
    value = this.myTurret.getAmmoType() != null ? this.myTurret.getAmmoType().getTypeItem().getDisplayName()
            : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 42, this.guiTop + 48, 0x000000);

    value = this.myTurret.getTargetHandler().hasTarget(this.myTurret)
            ? SAPUtils.translatePreFormat("entity.%s.name",
                    this.myTurret.getTargetHandler().getTargetName(this.myTurret))
            : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 71, 0x000000);

    value = this.myTurret.getOwnerName();
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 95, 0x000000);
}

From source file:de.sanandrew.mods.turretmod.client.gui.tcu.GuiTcuTargets.java

License:Creative Commons License

@Override
public void drawScreenPostBkg(int mouseX, int mouseY, float partTicks) {
    boolean isLmbDown = Mouse.isButtonDown(0);
    int scrollMinX = this.guiLeft + 163;
    int scrollMaxX = this.guiLeft + 163 + 9;
    int scrollMinY = this.guiTop + 19;
    int scrollMaxY = this.guiTop + 134;

    if (!this.isScrolling && this.canScroll && isLmbDown && mouseX >= scrollMinX && mouseX < scrollMaxX
            && mouseY > scrollMinY && mouseY < scrollMaxY) {
        this.isScrolling = true;
    } else if (!isLmbDown) {
        this.isScrolling = false;
    }//from w  w w . j  a v a 2 s  .c  o  m

    if (this.isScrolling) {
        this.scroll = Math.max(0.0F, Math.min(1.0F, (mouseY - 2 - scrollMinY) / 109.0F));
    }

    this.mc.renderEngine.bindTexture(Textures.GUI_TCU_TARGETS.getResource());

    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    this.drawTexturedModalRect(this.guiLeft + 163, this.guiTop + 19 + MathHelper.floor_float(scroll * 109.0F),
            176, this.canScroll ? 0 : 6, 6, 6);

    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GuiUtils.doGlScissor(this.guiLeft + 6, this.guiTop + 19, this.xSize - 23, 115);

    int offsetY = Math.round(-this.scroll * (this.tempTargetList.size() - 11))
            * (this.fontRendererObj.FONT_HEIGHT + 1);
    Map<Class<? extends EntityLiving>, Boolean> newTargetStgs = Maps.newHashMap();
    for (Entry<Class<? extends EntityLiving>, Boolean> entry : this.tempTargetList.entrySet()) {
        int btnTexOffY = 12 + (entry.getValue() ? 16 : 0);
        int btnMinOffY = this.guiTop + 20;
        int btnMaxOffY = this.guiTop + 20 + 110;

        if (this.doSelectAll && !entry.getValue()) {
            newTargetStgs.put(entry.getKey(), true);
        } else if (this.doDeselectAll && entry.getValue()) {
            newTargetStgs.put(entry.getKey(), false);
        } else if (this.doSelectMobs && !entry.getValue() && IMob.class.isAssignableFrom(entry.getKey())) {
            newTargetStgs.put(entry.getKey(), true);
        } else if (this.doSelectAnimals && !entry.getValue() && IAnimals.class.isAssignableFrom(entry.getKey())
                && !IMob.class.isAssignableFrom(entry.getKey())) {
            newTargetStgs.put(entry.getKey(), true);
        } else if (this.doSelectOther && !entry.getValue() && !IMob.class.isAssignableFrom(entry.getKey())
                && !IAnimals.class.isAssignableFrom(entry.getKey())) {
            newTargetStgs.put(entry.getKey(), true);
        }

        if (mouseY >= btnMinOffY && mouseY < btnMaxOffY) {
            if (mouseX >= this.guiLeft + 10 && mouseX < this.guiLeft + 18
                    && mouseY >= this.guiTop + 20 + offsetY && mouseY < this.guiTop + 28 + offsetY) {
                btnTexOffY += 8;
                if (isLmbDown && !this.prevIsLmbDown) {
                    this.applyTarget(entry.getKey(), !entry.getValue());
                }
            }
        }

        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        this.mc.renderEngine.bindTexture(Textures.GUI_TCU_TARGETS.getResource());
        this.drawTexturedModalRect(this.guiLeft + 10, this.guiTop + 20 + offsetY, 176, btnTexOffY, 8, 8);

        int textColor = 0xFFFFFF;
        if (IMob.class.isAssignableFrom(entry.getKey())) {
            textColor = 0xFFAAAA;
        } else if (IAnimals.class.isAssignableFrom(entry.getKey())) {
            textColor = 0xAAFFAA;
        }

        this.fontRendererObj.drawString(getTranslatedEntityName(entry.getKey()), this.guiLeft + 20,
                this.guiTop + 20 + offsetY, textColor, false);

        offsetY += this.fontRendererObj.FONT_HEIGHT + 1;
    }

    GL11.glDisable(GL11.GL_SCISSOR_TEST);

    this.doSelectAll = false;
    this.doDeselectAll = false;
    this.doSelectMobs = false;
    this.doSelectAnimals = false;
    this.doSelectOther = false;

    if (newTargetStgs.size() > 0) {
        applyMultiTarget(newTargetStgs);
    }

    this.prevIsLmbDown = isLmbDown;
}

From source file:de.sanandrew.mods.turretmod.client.gui.tcu.GuiTcuUpgrades.java

License:Creative Commons License

@Override
public void drawScreenPostBkg(int mouseX, int mouseY, float partTicks) {
    boolean isLmbDown = Mouse.isButtonDown(0);

    this.mc.renderEngine.bindTexture(Textures.GUI_TCU_UPGRADES.getResource());

    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

    int col;//from ww  w. ja va2 s  . c  o m
    int row;
    ItemStack currStack;

    int maxSlots = MathHelper
            .ceiling_double_int(TurretAttributes.MAX_UPGRADE_SLOTS.clampValue(Double.MAX_VALUE));
    int maxActiveUpg = this.tempUpgradeList.size();
    for (int i = 0; i < maxSlots; i++) {
        col = i % COL_COUNT;
        row = i / COL_COUNT;
        if (i < maxActiveUpg) {
            TurretUpgrade upgrade = this.tempUpgradeList.get(i);
            currStack = TmrItems.turretUpgrade.getStackWithUpgrade(upgrade, 1);

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

            GuiUtils.drawGuiIcon(TmrItems.turretUpgrade.getIcon(currStack, 0), this.guiLeft + 7 + col * 18,
                    this.guiTop + 25 + row * 26);
            GuiUtils.drawGuiIcon(TmrItems.turretUpgrade.getIcon(currStack, 1), this.guiLeft + 7 + col * 18,
                    this.guiTop + 25 + row * 26);

            GL11.glEnable(GL11.GL_BLEND);
            this.mc.renderEngine.bindTexture(Textures.GUI_TCU_UPGRADES.getResource());
            boolean isHoveringOverEject = GuiUtils.isMouseInRect(mouseX, mouseY, this.guiLeft + 6 + col * 18,
                    this.guiTop + 18 + row * 26, 5, 6);
            this.drawTexturedModalRect(this.guiLeft + 6 + col * 18, this.guiTop + 18 + row * 26, 176,
                    (isHoveringOverEject ? 0 : 6), 5, 6);
            if (isHoveringOverEject && isLmbDown && !this.prevIsLmbDown) {
                this.ejectUpgrade(this.tempUpgradeList.get(i));
            }
            if (GuiUtils.isMouseInRect(mouseX, mouseY, this.guiLeft + 6 + col * 18, this.guiTop + 24 + row * 26,
                    18, 18)) {
                GL11.glTranslatef(0.0F, 0.0F, 300.0F);
                drawRect(this.guiLeft + 7 + col * 18, this.guiTop + 25 + row * 26, this.guiLeft + 23 + col * 18,
                        this.guiTop + 41 + row * 16, 0x80FFFFFF);
                GL11.glTranslatef(0.0F, 0.0F, 1.0F);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                drawHoveringText(currStack, this.guiLeft + 15 + col * 18, this.guiTop + 32 + row * 26,
                        this.fontRendererObj, col / 5 > 0);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glTranslatef(0.0F, 0.0F, -301.0F);
            }
            GL11.glDisable(GL11.GL_BLEND);
        }

        if (col == 0) {
            if (row >= this.rowsVisible) {
                GL11.glEnable(GL11.GL_BLEND);
                this.mc.renderEngine.bindTexture(Textures.GUI_TCU_UPGRADES.getResource());
                this.drawTexturedModalRect(this.guiLeft + 6, this.guiTop + 18 + row * 26, 0, 222, 162, 24);
                GL11.glDisable(GL11.GL_BLEND);
            }
        }

    }

    this.prevIsLmbDown = isLmbDown;
}

From source file:displayexample.Entities.Box2D.java

@Override
public void draw() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // set the color of the quad (R,G,B,A)
    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    // draw quad/*from  www  .  j a v a  2s.  c  o m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + size, y);
    GL11.glVertex2f(x + size, y + size);
    GL11.glVertex2f(x, y + size);
    GL11.glEnd();
}

From source file:effects.Projectile.java

License:Open Source License

public void draw() {
    GL11.glDisable(GL11.GL_LIGHTING);//  w  w w.jav a2s  . c  o m
    material.bind();
    GL11.glColor3f(1.0f, 1.0f, 1.0f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(pos.x, pos.y, pos.z);
    GL11.glVertex3f(pos.x + vel.x / 10, pos.y + vel.y / 10, pos.z + vel.z / 10);
    GL11.glEnd();
    GL11.glEnable(GL11.GL_LIGHTING);
}