Package com.badlogic.gdx.graphics.g2d.TextureAtlas

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


    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
    pixmap.dispose();
    FileHandle atlasFile = Gdx.files.internal(name + ".atlas");
    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


  }

  private void writePackFile (File packFile, Array<Page> pages) throws IOException {
    if (packFile.exists()) {
      // Make sure there aren't duplicate names.
      TextureAtlasData textureAtlasData = new TextureAtlasData(new FileHandle(packFile), new FileHandle(packFile), false);
      for (Page page : pages) {
        for (Rect rect : page.outputRects) {
          String rectName = Rect.getAtlasName(rect.name, settings.flattenPaths);
          for (Region region : textureAtlasData.getRegions()) {
            if (region.name.equals(rectName)) {
              throw new GdxRuntimeException("A region with the name \"" + rectName + "\" has already been packed: "
                + rect.name);
            }
          }
View Full Code Here

    // Set the directory variables to a default when they weren't given in the variables
    if (imageDir == null) imageDir = atlasParentPath;
    if (outputDir == null) outputDir = (new File(atlasParentPath, DEFAULT_OUTPUT_PATH)).getAbsolutePath();

    // Opens the atlas file from the specified filename
    TextureAtlasData atlas = new TextureAtlasData(new FileHandle(atlasFile), new FileHandle(imageDir), false);
    unpacker.splitAtlas(atlas, outputDir);
  }
View Full Code Here

  private void writePackFile (File outputDir, Array<Page> pages, String packFileName) throws IOException {
    File packFile = new File(outputDir, packFileName);

    if (packFile.exists()) {
      // Make sure there aren't duplicate names.
      TextureAtlasData textureAtlasData = new TextureAtlasData(new FileHandle(packFile), new FileHandle(packFile), false);
      for (Page page : pages) {
        for (Rect rect : page.outputRects) {
          String rectName = Rect.getAtlasName(rect.name, settings.flattenPaths);
          for (Region region : textureAtlasData.getRegions()) {
            if (region.name.equals(rectName)) {
              throw new GdxRuntimeException("A region with the name \"" + rectName + "\" has already been packed: "
                + rect.name);
            }
          }
View Full Code Here

  }

  private void writePackFile (File packFile, Array<Page> pages) throws IOException {
    if (packFile.exists()) {
      // Make sure there aren't duplicate names.
      TextureAtlasData textureAtlasData = new TextureAtlasData(new FileHandle(packFile), new FileHandle(packFile), false);
      for (Page page : pages) {
        for (Rect rect : page.outputRects) {
          String rectName = Rect.getAtlasName(rect.name, settings.flattenPaths);
          for (Region region : textureAtlasData.getRegions()) {
            if (region.name.equals(rectName)) {
              throw new GdxRuntimeException("A region with the name \"" + rectName + "\" has already been packed: "
                + rect.name);
            }
          }
View Full Code Here

    // Set the directory variables to a default when they weren't given in the variables
    if (imageDir == null) imageDir = atlasParentPath;
    if (outputDir == null) outputDir = (new File(atlasParentPath, DEFAULT_OUTPUT_PATH)).getAbsolutePath();

    // Opens the atlas file from the specified filename
    TextureAtlasData atlas = new TextureAtlasData(new FileHandle(atlasFile), new FileHandle(imageDir), false);
    unpacker.splitAtlas(atlas, outputDir);
  }
View Full Code Here

        outputFile.mkdir();
      }
      output = outputFile.getAbsolutePath();
    }

    TextureAtlasData atlasData = new TextureAtlasData(inputFileHandle, inputFileHandle.parent(), false);

    process(atlasData, output);
  }
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

TOP

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

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.