当前位置: 首页>>代码示例>>Java>>正文


Java ColorUtil.getRGB方法代码示例

本文整理汇总了Java中com.enderio.core.client.render.ColorUtil.getRGB方法的典型用法代码示例。如果您正苦于以下问题:Java ColorUtil.getRGB方法的具体用法?Java ColorUtil.getRGB怎么用?Java ColorUtil.getRGB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.enderio.core.client.render.ColorUtil的用法示例。


在下文中一共展示了ColorUtil.getRGB方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
@Override
public void render(float par1, int par2, int par3) {
  FontRenderer fr = gui.getFontRenderer();

  int rgb = ColorUtil.getRGB(Color.darkGray);
  int x = left;
  int y = gui.getGuiTop() + 13;
  gui.getFontRenderer().drawString(modeLabel, x, y, rgb);

  String modeString = con.getConnectionMode(gui.getDir()).getLocalisedName();
  x += gap + leftArrow.getWidth() + fr.getStringWidth(modeLabel) + gap;

  GlStateManager.color(1, 1, 1);
  IconEIO.MODE_BACKGROUND.getMap().render(IconEIO.MODE_BACKGROUND, x - gap, y - (fr.FONT_HEIGHT / 2) - 1, getLongestModeStringWidth() + gap * 2,
      leftArrow.getHeight(), 0, true);

  int move = (getLongestModeStringWidth() - fr.getStringWidth(modeString)) / 2;
  x += move;
  rgb = ColorUtil.getRGB(Color.white);
  gui.getFontRenderer().drawString(modeString, x, y, rgb);

  renderCustomOptions(y + gap + fr.FONT_HEIGHT + gap, par1, par2, par3);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:24,代码来源:BaseSettingsPanel.java

示例2: renderCustomOptions

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
@Override
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
  ConnectionMode mode = con.getConnectionMode(gui.getDir());
  if (mode == ConnectionMode.DISABLED) {
    return;
  }

  FontRenderer fr = gui.getFontRenderer();
  String heading = getHeading();
  int x = 0;
  int rgb = ColorUtil.getRGB(Color.darkGray);
  fr.drawString(heading, left + x, top, rgb);

  boolean outputActive = (mode == ConnectionMode.IN_OUT && !inOutShowIn) || (mode == ConnectionMode.OUTPUT);
  if (outputActive) {
    GL11.glColor3f(1, 1, 1);
    IconEIO.map.render(EnderWidget.BUTTON_DOWN, left + priLeft, top - 5, priWidth, 16, 0, true);
    String str = itemConduit.getOutputPriority(gui.getDir()) + "";
    int sw = fr.getStringWidth(str);
    fr.drawString(str, left + priLeft + priWidth - sw - gap, top, ColorUtil.getRGB(Color.black));
  }

  if (filterGui != null) {
    filterGui.renderCustomOptions(top, par1, par2, par3);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:27,代码来源:ItemSettings.java

示例3: drawTexts

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
protected void drawTexts(int sx, int sy) {
  int rgb = ColorUtil.getRGB(Color.white);
  switch (tab) {
  case 0:
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab0.modules"), sx + 34, sy + 7, rgb);
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab0.modulestorage"), sx + 34, sy + 35, rgb);
    break;
  case 1:
    if (getTileEntity().twoGhosts()) {
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.seed1"), sx + 34, sy + 7, rgb);
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.seed2"), sx + 88, sy + 7, rgb);
    } else {
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.nw"), sx + 34, sy + 7, rgb);
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.ne"), sx + 61, sy + 7, rgb);
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.se"), sx + 88, sy + 7, rgb);
      fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.sw"), sx + 115, sy + 7, rgb);
    }
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab1.seedstorage"), sx + 34, sy + 35, rgb);
    break;
  case 2:
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab2.output"), sx + 34, sy + 7, rgb);
    break;
  case 3:
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab3.cropsticks"), sx + 34, sy + 7, rgb);
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab3.tools"), sx + 34, sy + 35, rgb);
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab3.fertilizer"), sx + 88, sy + 35, rgb);
    fontRendererObj.drawStringWithShadow(EnderIOAddons.lang.localize("afarm.gui.tab3.till"), sx + 34 + 16 + 3, sy + 62 + 4, rgb);
    break;
  }
  RenderUtil.bindTexture(texture);
}
 
开发者ID:HenryLoenwind,项目名称:EnderIOAddons,代码行数:32,代码来源:GuiAfarm.java

示例4: drawGuiContainerBackgroundLayer

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
@Override
public void drawGuiContainerBackgroundLayer(float f, int i, int j) {
  GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  bindGuiTexture();
  int sx = (width - xSize) / 2;
  int sy = (height - ySize) / 2;

  drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);

  int col = ColorUtil.getRGB(Color.white);
  int x = sx;
  int y = sy + 38;

  FontRenderer fr = getFontRenderer();
  x = sx + col0x - fr.getStringWidth(privateStr) / 2;
  fr.drawStringWithShadow(privateStr, x, y, col);

  x = sx + col1x - fr.getStringWidth(protectedStr) / 2;
  fr.drawStringWithShadow(protectedStr, x, y, col);

  x = sx + col2x - fr.getStringWidth(publicStr) / 2;
  fr.drawStringWithShadow(publicStr, x, y, col);

  checkLabelForChange();

  super.drawGuiContainerBackgroundLayer(f, i, j);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:28,代码来源:GuiTravelAccessable.java

示例5: drawElement

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
@Override
protected void drawElement(int index, int xPosition, int yPosition, int rowHeight, @Nonnull VertexBuffer renderer) {
  if (index < 0 || index >= channels.size()) {
    return;
  }
  Channel c = getElementAt(index);
  int col = ColorUtil.getRGB(Color.white);
  parent.drawString(parent.getFontRenderer(), c.getName(), xPosition + margin, yPosition + margin / 2, col);
  if (!c.isPublic()) {
    IconEIO.map.render(IconEIO.LOCK_LOCKED, xPosition + width - 18, yPosition - 3, 16, 15, 0, true);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:13,代码来源:GuiChannelList.java

示例6: drawBackgroundLayer

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
@Override
protected void drawBackgroundLayer(float par3, int par1, int par2) {

  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  RenderUtil.bindTexture(GUI_BACKGROUND);
  drawTexturedModalRect(getGuiRootLeft(), getGuiRootTop(), 0, 0, this.xSize, this.ySize);

  checkLabelForChange();
  tf.drawTextBox();

  int col = ColorUtil.getRGB(Color.white);
  String txt;
  int midX = getGuiRootLeft() + xSize / 2;
  int y = getGuiRootTop() + 48;

  BlockPos loc = target.getLocation();
  txt = loc.getX() + " " + loc.getY() + " " + loc.getZ();
  int x = midX - fontRenderer.getStringWidth(txt) / 2;

  fontRenderer.drawStringWithShadow(txt, x, y, col);

  txt = TelepadTarget.getDimenionName(target.getDimension());
  y += fontRenderer.FONT_HEIGHT + 4;
  x = midX - fontRenderer.getStringWidth(txt) / 2;
  fontRenderer.drawStringWithShadow(txt, x, y, col);

}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:28,代码来源:GuiLocationPrintout.java

示例7: render

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
public static void render(@Nonnull Gui gui, int x, int y, int length, @Nonnull ExperienceContainer xpCont, int required) {

    String text = xpCont.getExperienceLevel() + "";
    int color = 8453920;
    boolean shadow = true;
    if (required > 0) {
      text += "/" + required;
      if (required > xpCont.getExperienceLevel()) {
        color = ColorUtil.getRGB(1f, 0, 0.1f);
        shadow = false;
      }
    }
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    int strX = x + length / 2 - fr.getStringWidth(text) / 2;
    fr.drawString(text, strX, y - 11, color, shadow);

    RenderUtil.bindTexture(IconEIO.TEXTURE);
    GlStateManager.color(1f, 1f, 1f, 1f);
    int xpScaled = xpCont.getXpBarScaled(length - 2);

    // x, y, u, v, width, height
    // start of 'slot'
    gui.drawTexturedModalRect(x, y, 0, 91, 1, 5);
    gui.drawTexturedModalRect(x + 1, y, 1, 91, length - 2, 5);
    gui.drawTexturedModalRect(x + length - 1, y, 125, 91, 1, 5);

    RenderUtil.renderQuad2D(x + 1, y + 1, 0, xpScaled, 3, ColorUtil.getRGB(0, 127, 14));
  }
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:29,代码来源:ExperienceBarRenderer.java

示例8: drawControls

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
private void drawControls(int sx, int sy) {
  FontRenderer fr = getFontRenderer();
  int textColor = ColorUtil.getRGB(engineControlEnabled.isSelected() ? Color.black : Color.darkGray);

  int x0 = sx + TEXT_MARGIN_LEFT;
  int y0 = sy + TEXT_MARGIN_TOP;

  String engineTxt1 = EnderIO.lang.localize("gui.power_monitor.engine_section1").trim(); // Emit signal when storage less
  String engineTxt2 = EnderIO.lang.localize("gui.power_monitor.engine_section2").trim(); // than
  String engineTxt3 = EnderIO.lang.localize("gui.power_monitor.engine_section3").trim(); // % full.
  String engineTxt4 = EnderIO.lang.localize("gui.power_monitor.engine_section4").trim(); // Stop when storage greater than
  String engineTxt5 = EnderIO.lang.localize("gui.power_monitor.engine_section5").trim(); // or equal to

  List<Object> elems = new ArrayList<Object>();
  elems.add(engineControlEnabled);
  elems.addAll(Arrays.asList(engineTxt1.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt2.split("(\\s+)")));
  elems.add(engineControlStart);
  elems.addAll(Arrays.asList(engineTxt3.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt4.split("(\\s+)")));
  elems.addAll(Arrays.asList(engineTxt5.split("(\\s+)")));
  elems.add(engineControlStop);
  elems.addAll(Arrays.asList(engineTxt3.split("(\\s+)")));

  int x = 0, y = 0;

  for (Object elem : elems) {
    int elemWidth = 0;
    if (elem instanceof String) {
      elemWidth = fr.getStringWidth((String) elem);
    } else if (elem instanceof CheckBox) {
      elemWidth = ((CheckBox) elem).width;
    } else if (elem instanceof TextFieldEnder) {
      elemWidth = ((TextFieldEnder) elem).width;
    }

    if (x + elemWidth > TEXT_WIDTH) {
      x = 0;
      y += CONTROL_LF_PX;
      if (" ".equals(elem)) {
        continue;
      }
    }

    if (elem instanceof String) {
      fr.drawString((String) elem, x0 + x, y0 + y + TEXT_Y_OFFSET, textColor);
    } else if (elem instanceof CheckBox) {
      ((CheckBox) elem).xPosition = x0 + x;
      ((CheckBox) elem).yPosition = y0 + y;
    } else if (elem instanceof TextFieldEnder) {
      ((TextFieldEnder) elem).xPosition = x0 + x;
      ((TextFieldEnder) elem).yPosition = y0 + y;
    }

    x += elemWidth + fr.getStringWidth(" ");
  }

}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:59,代码来源:GuiPowerMonitor.java

示例9: drawStats

import com.enderio.core.client.render.ColorUtil; //导入方法依赖的package包/类
private void drawStats(int sx, int sy) {
  FontRenderer fr = getFontRenderer();

  int valuesCol = ColorUtil.getRGB(Color.black);
  int errorCol = ColorUtil.getRGB(Color.red);
  int x = sx + TEXT_MARGIN_LEFT;
  int y = sy + TEXT_MARGIN_TOP;

  StatData statData = getTileEntity().getStatData();
  if (statData == null || statData.maxPowerInConduits == 0) {
    fr.drawSplitString(EnderIO.lang.localize("gui.power_monitor.no_network_error"), x, y, TEXT_WIDTH, errorCol);
    return;
  }

  RenderHelper.enableGUIStandardItemLighting();
  itemRender.renderItemIntoGUI(new ItemStack(ConduitObject.item_power_conduit.getItemNN(), 1, 2), x, y);
  tooltipConduitStorage.setBounds(new Rectangle(TEXT_MARGIN_LEFT, TEXT_MARGIN_TOP, TEXT_WIDTH, 16));

  ItemStack capBankStack = new ItemStack(PowerToolObject.block_cap_bank.getBlockNN(), 1, 3);
  if (statData.maxPowerInCapBanks > 0) {
    BlockItemCapBank.setStoredEnergyForItem(capBankStack, (int) (((BlockItemCapBank) capBankStack.getItem()).getMaxEnergyStored(capBankStack)
        * ((double) statData.powerInCapBanks / (double) statData.maxPowerInCapBanks)));
  }

  itemRender.renderItemIntoGUI(capBankStack, x, y + LINE_Y_OFFSET);
  tooltipCapacitorBankStorage.setBounds(new Rectangle(TEXT_MARGIN_LEFT, TEXT_MARGIN_TOP + LINE_Y_OFFSET, TEXT_WIDTH, 16));

  Block icon = Blocks.FURNACE;
  if (Block.REGISTRY.containsKey(new ResourceLocation(EnderIO.DOMAIN, "block_alloy_smelter"))) {
    icon = Block.REGISTRY.getObject(new ResourceLocation(EnderIO.DOMAIN, "block_alloy_smelter"));
  }

  itemRender.renderItemIntoGUI(new ItemStack(icon), x, y + 3 * LINE_Y_OFFSET);
  tooltipMachineBuffers.setBounds(new Rectangle(TEXT_MARGIN_LEFT, TEXT_MARGIN_TOP + 3 * LINE_Y_OFFSET, TEXT_WIDTH, 16));
  RenderHelper.disableStandardItemLighting();

  bindGuiTexture(1);
  drawTexturedModalRect(x, y + 2 * LINE_Y_OFFSET, 180, 31, 16, 16);
  tooltipAverageOutput.setBounds(new Rectangle(TEXT_MARGIN_LEFT, TEXT_MARGIN_TOP + 2 * LINE_Y_OFFSET, TEXT_WIDTH / 2, 16));

  drawTexturedModalRect(x + TEXT_WIDTH / 2, y + 2 * LINE_Y_OFFSET, 196, 31, 16, 16);
  tooltipAverageInput.setBounds(new Rectangle(TEXT_MARGIN_LEFT + TEXT_WIDTH / 2, TEXT_MARGIN_TOP + 2 * LINE_Y_OFFSET, TEXT_WIDTH / 2, 16));

  String s = LangPower.RF(statData.powerInConduits, statData.maxPowerInConduits);
  fr.drawString(s, x + TEXT_X_OFFSET, y + TEXT_Y_OFFSET, valuesCol, false);

  s = LangPower.RF(statData.powerInCapBanks, statData.maxPowerInCapBanks);
  fr.drawString(s, x + TEXT_X_OFFSET, y + TEXT_Y_OFFSET + LINE_Y_OFFSET, valuesCol, false);

  s = LangPower.RF(statData.powerInMachines, statData.maxPowerInMachines);
  fr.drawString(s, x + TEXT_X_OFFSET, y + TEXT_Y_OFFSET + 3 * LINE_Y_OFFSET, valuesCol, false);

  s = LangPower.RFt(statData.aveRfSent);
  fr.drawString(s, x + TEXT_X_OFFSET, y + TEXT_Y_OFFSET + 2 * LINE_Y_OFFSET, valuesCol, false);

  s = LangPower.RFt(statData.aveRfReceived);
  fr.drawString(s, x + TEXT_X_OFFSET + TEXT_WIDTH / 2, y + TEXT_Y_OFFSET + 2 * LINE_Y_OFFSET, valuesCol, false);

}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:60,代码来源:GuiPowerMonitor.java


注:本文中的com.enderio.core.client.render.ColorUtil.getRGB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。