Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData$Page


    debugRenderer = new SkeletonRendererDebug();
    debugRenderer.setMeshTriangles(false);
    debugRenderer.setRegionAttachments(false);
    debugRenderer.setMeshHull(false);

    atlas = new TextureAtlas(Gdx.files.internal("raptor/raptor.atlas"));
    SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
    json.setScale(0.5f); // Load the skeleton at 50% the size it was in Spine.
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("raptor/raptor.json"));

    skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
View Full Code Here


    batch = new SpriteBatch();
    renderer = new ShapeRenderer();
    skeletonRenderer = new SkeletonRenderer();
    skeletonRenderer.setPremultipliedAlpha(true);

    atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));

    // This loader creates Box2dAttachments instead of RegionAttachments for an easy way to keep
    // track of the Box2D body for each attachment.
    AtlasAttachmentLoader atlasLoader = new AtlasAttachmentLoader(atlas) {
      public RegionAttachment newRegionAttachment (Skin skin, String name, String path) {
View Full Code Here

    String atlasFileName = skeletonFile.nameWithoutExtension();
    if (atlasFileName.endsWith(".json")) atlasFileName = new FileHandle(atlasFileName).nameWithoutExtension();
    FileHandle atlasFile = skeletonFile.sibling(atlasFileName + ".atlas");
    if (!atlasFile.exists()) atlasFile = skeletonFile.sibling(atlasFileName + ".atlas.txt");
    TextureAtlasData data = !atlasFile.exists() ? null : new TextureAtlasData(atlasFile, atlasFile.parent(), false);
    TextureAtlas atlas = new TextureAtlas(data) {
      public AtlasRegion findRegion (String name) {
        AtlasRegion region = super.findRegion(name);
        return region != null ? region : fake;
      }
    };
View Full Code Here

    batch = new PolygonSpriteBatch();
    renderer = new SkeletonRenderer();
    renderer.setPremultipliedAlpha(true);

    {
      TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));
      SkeletonJson json = new SkeletonJson(atlas);
      json.setScale(0.6f);
      SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json"));
      spineboy = new Skeleton(skeletonData);
      spineboy.setPosition(320, 20);

      AnimationStateData stateData = new AnimationStateData(skeletonData);
      stateData.setMix("walk", "jump", 0.2f);
      stateData.setMix("jump", "walk", 0.2f);
      spineboyState = new AnimationState(stateData);
      new AnimationStateAdapter() {
        public void start (int trackIndex) {
          spineboyState.addAnimation(0, "walk", true, 0);
          spineboyState.addAnimation(0, "jump", false, 3).setListener(this);
        }
      }.start(0);
    }

    {
      TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("goblins/goblins-ffd.atlas"));
      SkeletonJson json = new SkeletonJson(atlas);
      SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("goblins/goblins-ffd.json"));
      goblin = new Skeleton(skeletonData);
      goblin.setSkin("goblin");
      goblin.setSlotsToSetupPose();
View Full Code Here

    renderer.setPremultipliedAlpha(true);
    debugRenderer = new SkeletonRendererDebug();
    debugRenderer.setBoundingBoxes(false);
    debugRenderer.setRegionAttachments(false);

    atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));
    SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
    json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json"));

    skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
View Full Code Here

        placeRect(bestNode);
        rects.removeIndex(bestRectIndex);
      }

      Page result = getResult();
      result.remainingRects = rects;
      return result;
    }
View Full Code Here

      for (int i = 0; i < usedRectangles.size; i++) {
        Rect rect = usedRectangles.get(i);
        w = Math.max(w, rect.x + rect.width);
        h = Math.max(h, rect.y + rect.height);
      }
      Page result = new Page();
      result.outputRects = new Array(usedRectangles);
      result.occupancy = getOccupancy();
      result.width = w;
      result.height = h;
      return result;
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

    // Find the minimal page size that fits all rects.
    BinarySearch widthSearch = new BinarySearch(minWidth, settings.maxWidth, settings.fast ? 25 : 15, settings.pot);
    BinarySearch heightSearch = new BinarySearch(minHeight, settings.maxHeight, settings.fast ? 25 : 15, settings.pot);
    int width = widthSearch.reset(), height = heightSearch.reset(), i = 0;
    Page bestResult = null;
    while (true) {
      Page bestWidthResult = null;
      while (width != -1) {
        Page result = packAtSize(true, width - edgePaddingX, height - edgePaddingY, inputRects);
        if (++i % 70 == 0) System.out.println();
        System.out.print(".");
        bestWidthResult = getBest(bestWidthResult, result);
        width = widthSearch.next(result == null);
      }
View Full Code Here

  }

  /** @param fully If true, the only results that pack all rects will be considered. If false, all results are considered, not all
   *           rects may be packed. */
  private Page packAtSize (boolean fully, int width, int height, Array<Rect> inputRects) {
    Page bestResult = null;
    for (int i = 0, n = methods.length; i < n; i++) {
      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++) {
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData$Page

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.