Package ru.snake.spritepacker.core.packer

Examples of ru.snake.spritepacker.core.packer.ImagePacker


        for (Sprite eachSprite : eachAnimation.getSprites()) {
          allTextures.add(eachSprite.texture);
        }

        ImagePacker packer = new ImagePacker(margin, padding);

        for (Texture eachTexture : allTextures) {
          ImageData data = new ImageData(animationIndex, eachTexture);

          packer.addItem(data);
        }

        output.setNameFormat(eachAnimation.name + "-", null);

        packer.setOutput(output);
        packer.process(maxWidth, maxHeight, true);

        animationIndex++;
      }
    } else {
      Set<Texture> allTextures = new HashSet<Texture>();

      for (Animation eachAnimation : animations.getList()) {
        for (Sprite eachSprite : eachAnimation.getSprites()) {
          allTextures.add(eachSprite.texture);
        }
      }

      ImagePacker packer = new ImagePacker(margin, padding);

      for (Texture eachTexture : allTextures) {
        ImageData data = new ImageData(eachTexture);

        packer.addItem(data);
      }

      output.setNameFormat("atlas-", null);

      packer.setOutput(output);
      packer.process(maxWidth, maxHeight, true);
    }

    return output;
  }
View Full Code Here

TOP

Related Classes of ru.snake.spritepacker.core.packer.ImagePacker

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.