List of usage examples for net.minecraftforge.fml.client.config GuiUtils drawGradientRect
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor)
From source file:code.elix_x.excore.utils.client.gui.elements.GuiElement.java
License:Apache License
public static void drawStandartTooltipBackground(Rectangle element) { final int zLevel = 300; final int backgroundColor = 0xF0100010; GuiUtils.drawGradientRect(zLevel, element.getX() - 3, element.getY() - 4, right(element) + 3, element.getY() - 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, element.getX() - 3, bottom(element) + 3, right(element) + 3, bottom(element) + 4, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, element.getX() - 3, element.getY() - 3, right(element) + 3, bottom(element) + 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, element.getX() - 4, element.getY() - 3, element.getX() - 3, bottom(element) + 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, right(element) + 3, element.getY() - 3, right(element) + 4, bottom(element) + 3, backgroundColor, backgroundColor); final int borderColorStart = 0x505000FF; final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000; GuiUtils.drawGradientRect(zLevel, element.getX() - 3, element.getY() - 3 + 1, element.getX() - 3 + 1, bottom(element) + 3 - 1, borderColorStart, borderColorEnd); GuiUtils.drawGradientRect(zLevel, right(element) + 2, element.getY() - 3 + 1, right(element) + 3, bottom(element) + 3 - 1, borderColorStart, borderColorEnd); GuiUtils.drawGradientRect(zLevel, element.getX() - 3, element.getY() - 3, right(element) + 3, element.getY() - 3 + 1, borderColorStart, borderColorStart); GuiUtils.drawGradientRect(zLevel, element.getX() - 3, bottom(element) + 2, right(element) + 3, bottom(element) + 3, borderColorEnd, borderColorEnd); }
From source file:de.kitsunealex.projectx.client.render.item.RenderColorScanner.java
License:Open Source License
private void renderDisplay(int lastBrightness, int storedColor) { GlStateManager.pushMatrix();/*from w w w.jav a 2s .com*/ GlStateManager.disableLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 220F, 220F); GlStateManager.translate(0.135D, 0.135D, -0.06D); GlStateManager.translate(0.5D, 0.5D, 0.5D); GlStateManager.rotate(180F, 0F, 0F, 1F); GlStateManager.scale(0.00625D, 0.00625D, 0.00625D); GlStateManager.translate(-0.5D, -0.5D, -0.5D); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; int[] colorArray = Colour.unpack(storedColor); for (int i = 0; i < 3; i++) { fontRenderer.drawString(String.format(TEXT[i], colorArray[i]), 0, i * 9, 0xFFFFFFFF); Colour barColor = EnumColour.values()[COLOR_MAPPING[i]].getColour(); int barColorT = barColor.copy().argb(); int barColorB = barColor.copy().multiplyC(0.25D).argb(); GuiUtils.drawGradientRect(0, 31, i * 9, 31 + (int) (((float) colorArray[i] / 255F) * 15F), i * 9 + 7, barColorT, barColorB); } GlStateManager.enableLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightness & 0xFFFF, lastBrightness >>> 16); GlStateManager.popMatrix(); }
From source file:net.thegaminghuskymc.futopia.client.gui.TRBuilder.java
License:MIT License
public void drawMultiEnergyBar(GuiBase gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, int mouseY, int buttonID, GuiBase.Layer layer) { if (layer == GuiBase.Layer.BACKGROUND) { x += gui.width;// www . java 2 s .co m y += gui.height; } if (layer == GuiBase.Layer.FOREGROUND) { mouseX -= gui.width; mouseY -= gui.height; } Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); gui.drawTexturedModalRect(x, y, PowerSystem.getDisplayPower().xBar - 15, PowerSystem.getDisplayPower().yBar - 1, 14, 50); int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48)); if (energyStored > maxEnergyStored) { draw = (int) ((double) maxEnergyStored / (double) maxEnergyStored * (48)); } gui.drawTexturedModalRect(x + 1, y + 49 - draw, PowerSystem.getDisplayPower().xBar, 48 + PowerSystem.getDisplayPower().yBar - draw, 12, draw); int percentage = percentage(maxEnergyStored, energyStored); if (isInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) { GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.colorMask(true, true, true, false); GuiUtils.drawGradientRect(0, x + 1, y + 1, x + 13, y + 49, 0x80FFFFFF, 0x80FFFFFF); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableDepth(); List<String> list = new ArrayList<>(); TextFormatting powerColour = TextFormatting.GOLD; list.add(powerColour + PowerSystem.getLocaliszedPowerFormattedNoSuffix(energyStored) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxEnergyStored) + " " + PowerSystem.getDisplayPower().abbreviation); list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Charged"); net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRendererObj); GlStateManager.disableLighting(); GlStateManager.color(1, 1, 1, 1); } gui.addPowerButton(x, y, buttonID, layer); }
From source file:net.thegaminghuskymc.futopia.client.gui.TRBuilder.java
License:MIT License
public void drawMultiblockMissingBar(GuiBase gui, GuiBase.Layer layer) { int x = 0;//from ww w .j ava2s . c om int y = 4; if (layer == GuiBase.Layer.BACKGROUND) { x += gui.width; y += gui.height; } gui.mc.getTextureManager().bindTexture(GUI_SHEET); GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.colorMask(true, true, true, false); GuiUtils.drawGradientRect(0, x, y, x + 176, y + 20, 0x000000, 0xC0000000); GuiUtils.drawGradientRect(0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000); GuiUtils.drawGradientRect(0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableDepth(); gui.drawCentredString(I18n.translateToLocal("techreborn.message.missingmultiblock"), 43, 0xFFFFFF, layer); }
From source file:therogue.storehouse.client.gui.GuiHelper.java
License:Open Source License
/** * Draws a slightly rounded box around the specified area (leave 4 pixels around the area) * /*from w ww .ja va 2 s. c o m*/ * Will fade the colours together * * @param x - the x co-ordinate of the space inside the box * @param y - the y co-ordinate of the space inside the box * @param z - the z level to draw at * @param width - the width of the space inside the box * @param height - the x height of the space inside the box * @param startBackgroundColor - the background colour for the top of the box * @param endBackgroundColor - the background colour for the bottom of the box * @param startBorderColor - the border colour for the top of the box * @param endBorderColor - the border colour for the bottom of the box */ public static void drawRoundedBorderedBox(int x, int y, int z, int width, int height, int startBackgroundColor, int endBackgroundColor, int startBorderColor, int endBorderColor) { GuiUtils.drawGradientRect(z, x - 3, y - 4, x + width + 3, y - 3, startBackgroundColor, endBackgroundColor); GuiUtils.drawGradientRect(z, x - 3, y + height + 3, x + width + 3, y + height + 4, endBackgroundColor, endBackgroundColor); GuiUtils.drawGradientRect(z, x - 3, y - 3, x + width + 3, y + height + 3, startBackgroundColor, endBackgroundColor); GuiUtils.drawGradientRect(z, x - 4, y - 3, x - 3, y + height + 3, startBackgroundColor, endBackgroundColor); GuiUtils.drawGradientRect(z, x + width + 3, y - 3, x + width + 4, y + height + 3, startBackgroundColor, startBackgroundColor); GuiUtils.drawGradientRect(z, x - 3, y - 3 + 1, x - 3 + 1, y + height + 3 - 1, startBorderColor, endBorderColor); GuiUtils.drawGradientRect(z, x + width + 2, y - 3 + 1, x + width + 3, y + height + 3 - 1, startBorderColor, endBorderColor); GuiUtils.drawGradientRect(z, x - 3, y - 3, x + width + 3, y - 3 + 1, startBorderColor, startBorderColor); GuiUtils.drawGradientRect(z, x - 3, y + height + 2, x + width + 3, y + height + 3, endBorderColor, endBorderColor); }