コード例 #1
0
ファイル: DebugTheme.java プロジェクト: McSwede/XIV
  @Override
  public void renderSlider(
      String name,
      float value,
      float x,
      float y,
      float width,
      float height,
      float sliderX,
      boolean overElement,
      Element element) {
    if (Objects.isNull(font)) {
      font = new NahrFont("Comic Sans MS", 18);
    }

    element.setWidth(96);
    element.setHeight(this.getElementHeight());

    RenderUtils.drawBorderedRect(
        x, y + 1, x + element.getWidth(), y + height, 0x801E1E1E, 0xFF212121);
    RenderUtils.drawGradientRect(x, y + 1, x + sliderX, y + height, 0xFF5AACEB, 0xFF1466A5);

    font.drawString(name, x + 2, y - 1, NahrFont.FontType.SHADOW_THIN, 0xFFFFF0F0);
    font.drawString(
        value + "",
        x + element.getWidth() - font.getStringWidth(value + "") - 2,
        y - 1,
        NahrFont.FontType.SHADOW_THIN,
        0xFFFFF0F0);
  }
コード例 #2
0
ファイル: DebugTheme.java プロジェクト: McSwede/XIV
  @Override
  public void renderButton(
      String name,
      boolean enabled,
      float x,
      float y,
      float width,
      float height,
      boolean overElement,
      Element element) {
    if (Objects.isNull(font)) {
      font = new NahrFont("Comic Sans MS", 18);
    }

    element.setWidth(this.getElementWidth());
    element.setHeight(this.getElementHeight());

    RenderUtils.drawBorderedGradientRect(
        x,
        y,
        x + 96,
        y + getElementHeight(),
        0xFF000000,
        enabled ? 0xFF5AACEB : 0xFF232323,
        enabled ? 0xFF1466A5 : 0xFF212121);

    font.drawString(name, x + 2, y - 3, NahrFont.FontType.NORMAL, 0xFFFFFFFF);
    if (element instanceof ModButton) {
      ModButton butt = (ModButton) element;

      if (butt.elements.size() > 0) {
        font.drawString(
            butt.open ? "-" : "+",
            x + element.getWidth() - 8,
            y - 3,
            NahrFont.FontType.NORMAL,
            0xFFFFFFFF);

        if (butt.open) {
          float elementHeight = element.getHeight();

          for (Element elem : butt.elements) {
            elementHeight += elem.getHeight();
          }

          float elemY = y + 1;
          for (Element elem : butt.elements) {
            elem.setX(x);
            if (elem instanceof ValueSlider) {
              elem.setY(elemY += elem.getHeight());
              elemY += 1;
            } else {
              elem.setY(elemY += elem.getHeight());
            }

            elem.drawElement(MathUtils.getMouseX(), MathUtils.getMouseY());
          }

          element.setHeight(elementHeight + 1);
        }
      }
    }
  }