Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.Array


  }

  /** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method
   * uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */
  public Array<AtlasRegion> findRegions (String name) {
    Array<AtlasRegion> matched = new Array();
    for (int i = 0, n = regions.size; i < n; i++) {
      AtlasRegion region = regions.get(i);
      if (region.name.equals(name)) matched.add(new AtlasRegion(region));
    }
    return matched;
  }
View Full Code Here


  /** Returns all regions in the atlas as sprites. This method creates a new sprite for each region, so the result should be
   * stored rather than calling this method multiple times.
   * @see #createSprite(String) */
  public Array<Sprite> createSprites () {
    Array sprites = new Array(regions.size);
    for (int i = 0, n = regions.size; i < n; i++)
      sprites.add(newSprite(regions.get(i)));
    return sprites;
  }
View Full Code Here

  /** Returns all regions with the specified name as sprites, ordered by smallest to largest {@link AtlasRegion#index index}. This
   * method uses string comparison to find the regions and constructs new sprites, so the result should be cached rather than
   * calling this method multiple times.
   * @see #createSprite(String) */
  public Array<Sprite> createSprites (String name) {
    Array<Sprite> matched = new Array();
    for (int i = 0, n = regions.size; i < n; i++) {
      AtlasRegion region = regions.get(i);
      if (region.name.equals(name)) matched.add(newSprite(region));
    }
    return matched;
  }
View Full Code Here

  private final Array<ParticleEmitter> emitters;
  private BoundingBox bounds;
  private boolean ownsTexture;

  public ParticleEffect () {
    emitters = new Array(8);
  }
View Full Code Here

  public ParticleEffect () {
    emitters = new Array(8);
  }

  public ParticleEffect (ParticleEffect effect) {
    emitters = new Array(true, effect.emitters.size);
    for (int i = 0, n = effect.emitters.size; i < n; i++)
      emitters.add(new ParticleEmitter(effect.emitters.get(i)));
  }
View Full Code Here

    cellWidth += settings.paddingX;
    cellHeight += settings.paddingY;

    inputRects.reverse();

    Array<Page> pages = new Array();
    while (inputRects.size > 0) {
      Page result = packPage(inputRects, cellWidth, cellHeight);
      pages.add(result);
    }
    return pages;
  }
View Full Code Here

    return pages;
  }

  private Page packPage (Array<Rect> inputRects, int cellWidth, int cellHeight) {
    Page page = new Page();
    page.outputRects = new Array();

    int maxWidth = settings.maxWidth, maxHeight = settings.maxHeight;
    if (settings.edgePadding) {
      maxWidth -= settings.paddingX;
      maxHeight -= settings.paddingY;
View Full Code Here

          }
        });
      }
    }

    Array<Page> pages = new Array();
    while (inputRects.size > 0) {
      Page result = packPage(inputRects);
      pages.add(result);
      inputRects = result.remainingRects;
    }
    return pages;
  }
View Full Code Here

      maxRects.init(width, height);
      Page result;
      if (!settings.fast) {
        result = maxRects.pack(inputRects, methods[i]);
      } else {
        Array<Rect> remaining = new Array();
        for (int ii = 0, nn = inputRects.size; ii < nn; ii++) {
          Rect rect = inputRects.get(ii);
          if (maxRects.insert(rect, methods[i]) == null) {
            while (ii < nn)
              remaining.add(inputRects.get(ii++));
          }
        }
        result = maxRects.getResult();
        result.remainingRects = remaining;
      }
View Full Code Here

      return bestNode;
    }

    /** For each rectangle, packs each one then chooses the best and packs that. Slow! */
    public Page pack (Array<Rect> rects, FreeRectChoiceHeuristic method) {
      rects = new Array(rects);
      while (rects.size > 0) {
        int bestRectIndex = -1;
        Rect bestNode = new Rect();
        bestNode.score1 = Integer.MAX_VALUE;
        bestNode.score2 = Integer.MAX_VALUE;
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.utils.Array

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.