Esempio n. 1
0
 private final void step(GLEx g, Progress e, int index, int frame, GLColor color, float alpha) {
   switch (stepType) {
     case 0:
       g.fillOval(
           x() + e.x - blockHalfWidth, y() + e.y - blockHalfHeight, blockWidth, blockHeight);
       break;
     case 1:
       g.fillRect(
           x() + e.x - blockHalfWidth, y() + e.y - blockHalfHeight, blockWidth, blockHeight);
       break;
     case 2:
       if (last != null) {
         float[] xs = {x() + last.x, x() + e.x};
         float[] ys = {y() + last.y, y() + e.y};
         g.drawPolygon(xs, ys, 2);
       }
       last = e;
       break;
     case 3:
       if (last != null) {
         g.drawLine(x() + last.x, y() + last.y, x() + e.x, y() + e.y);
       }
       last = e;
       break;
     case 4:
       step(g, e.x, e.y, e.progress, index, frame, color, alpha);
       break;
   }
 }
Esempio n. 2
0
 public void draw(GLEx g, float x, float y, float w, float h) {
   if (isClose) {
     return;
   }
   update();
   g.drawTexture(texture, x, y, w, h);
 }
Esempio n. 3
0
 public void draw(
     GLEx g, float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
   if (isClose) {
     return;
   }
   update();
   g.drawTexture(texture, x1, y1, w1, h1, x2, y2, w2, h2);
 }
Esempio n. 4
0
 public void createUI(GLEx g) {
   if (visible) {
     LFont oldFont = g.getFont();
     int oldColor = g.getColorRGB();
     g.setFont(font);
     g.setColor(color);
     this.width = font.stringWidth(label);
     this.height = font.getSize();
     if (alpha > 0 && alpha < 1) {
       g.setAlpha(alpha);
       g.drawEastString(label, x(), y());
       g.setAlpha(1.0F);
     } else {
       g.drawEastString(label, x(), y());
     }
     g.setFont(oldFont);
     g.setColor(oldColor);
   }
 }
Esempio n. 5
0
  public void createUI(GLEx g) {
    if (!isVisible) {
      return;
    }

    this.setup();

    int pointsLength = points.size();

    Progress point;
    int index;
    int frameD;
    int indexD;

    float size = (pointsLength * this.trailLength);

    for (float i = -1, l = size; ++i < l && !this.stopped; ) {

      index = (int) (frame + i);
      if (index < pointsLength) {
        point = points.get(index);
      } else {
        point = points.get(index - pointsLength);
      }
      this.alpha = (i / (l - 1));
      frameD = frame / (pointsLength - 1);
      indexD = (int) alpha;
      if (lineWidth > 0) {
        g.setLineWidth(lineWidth);
      }
      if (scaleX != 1 || scaleY != 1) {
        g.scale(scaleX, scaleY);
      }
      if (alpha > 0 && alpha < 1) {
        g.setAlpha(alpha);
      }
      g.setColor(color);
      step(g, point, indexD, frameD, color, alpha);
      g.resetColor();
      if (alpha > 0 && alpha < 1) {
        g.setAlpha(1);
      }
      if (lineWidth > 0) {
        g.resetLineWidth();
      }
      if (scaleX != 1 || scaleY != 1) {
        g.restore();
      }
    }
  }
Esempio n. 6
0
  /**
   * 创建UI图像
   *
   * @param g
   */
  public void createUI(final GLEx g, final int x, final int y) {
    if (!visible) {
      return;
    }
    int minX, minY, maxX, maxY;
    int clipWidth = g.getClipWidth();
    int clipHeight = g.getClipHeight();
    if (this.isViewWindowSet) {
      g.setClip(x, y, this.width, this.height);
      minX = this.viewX;
      maxX = minX + this.width;
      minY = this.viewY;
      maxY = minY + this.height;
    } else {
      minX = x;
      maxX = x + clipWidth;
      minY = y;
      maxY = y + clipHeight;
    }
    g.translate(x - this.viewX, y - this.viewY);
    for (int i = 0; i < this.size; i++) {

      ISprite spr = sprites[i];
      if (spr.isVisible()) {

        int layerX = spr.x();
        int layerY = spr.y();

        int layerWidth = spr.getWidth();
        int layerHeight = spr.getHeight();

        if (layerX + layerWidth < minX
            || layerX > maxX
            || layerY + layerHeight < minY
            || layerY > maxY) {
          continue;
        }

        spr.createUI(g);
      }
    }
    g.translate(-(x - this.viewX), -(y - this.viewY));
    if (this.isViewWindowSet) {
      g.clearClip();
    }
  }
Esempio n. 7
0
 public void createUI(GLEx g) {
   if (isVisible) {
     g.drawTexture(animation.getSpriteImage(), x(), y());
   }
 }
Esempio n. 8
0
 public void draw(GLEx g, float x, float y, int sx, int sy) {
   checkImage(sx, sy);
   g.drawTexture(subImages[sx][sy], x, y);
 }