Ejemplo n.º 1
0
  public Sprite addItem(T item, int width, int height) {
    Rect r = mAtlas.getRegion(width, height);
    if (r == null) {
      // create new atlas
      return null;
    }
    Sprite sprite = new Sprite(item, mAtlas, r);

    items = Inlist.append(items, sprite);

    draw(item, r);

    return sprite;
  }
Ejemplo n.º 2
0
  private void addRoof(int startVertex, GeometryBuffer geom, int ipos, int ppos) {
    short[] index = geom.index;
    float[] points = geom.points;

    int len = 0;
    int rings = 0;

    /* get sum of points in polygon */
    for (int i = ipos, n = index.length; i < n && index[i] > 0; i++) {
      len += index[i];
      rings++;
    }

    sumIndices +=
        Tessellator.tessellate(
            points, ppos, len, index, ipos, rings, startVertex + 1, mCurIndices[IND_ROOF]);

    mCurIndices[IND_ROOF] = Inlist.last(mCurIndices[IND_ROOF]);
  }