Package com.badlogic.gdx.files

Examples of com.badlogic.gdx.files.FileHandle


    }

    @Override
    protected void processFile (Entry entry) throws Exception {
      System.out.println("Processing " + entry.inputFile);
      Pixmap pixmap = new Pixmap(new FileHandle(entry.inputFile));
      if (pixmap.getFormat() != Format.RGB888 && pixmap.getFormat() != Format.RGB565) {
        System.out.println("Converting from " + pixmap.getFormat() + " to RGB888!");
        Pixmap tmp = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), Format.RGB888);
        tmp.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
        pixmap.dispose();
        pixmap = tmp;
      }
      ETC1.encodeImagePKM(pixmap).write(new FileHandle(entry.outputFile));
      pixmap.dispose();
    }
View Full Code Here


  static final String externalPath = appDir + "/Documents";
  static final String localPath = appDir + "/Library/local";
  static final String internalPath = NSBundle.getMainBundle().getBundlePath();

  public IOSFiles () {
    new FileHandle(externalPath).mkdirs();
    new FileHandle(localPath).mkdirs();
  }
View Full Code Here

public class HeaderFixer {
  static class HeaderFileProcessor extends FileProcessor {
    final String header;

    public HeaderFileProcessor () {
      header = new FileHandle("assets/licence-header.txt").readString();
      addInputSuffix(".java");
      setFlattenOutput(false);
      setRecursive(true);
    }
View Full Code Here

      setRecursive(true);
    }

    @Override
    protected void processFile (Entry inputFile) throws Exception {
      String content = new FileHandle(inputFile.inputFile).readString();
      content = content.trim();
      if (content.startsWith("package")) {
        System.out.println("File '" + inputFile.inputFile + "' header fixed");
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileHandle(inputFile.outputFile).write(false)));
        writer.write(header + "\n\n" + content);
        writer.close();
      }
    }
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)) {
View Full Code Here

    private void loadImage (ParticleEmitter emitter) {
      final String imagePath = emitter.getImagePath();
      String imageName = new File(imagePath.replace('\\', '/')).getName();
      try {
        FileHandle file;
        if (imagePath.equals("particle.png"))
          file = Gdx.files.classpath(imagePath);
        else
          file = Gdx.files.absolute(imagePath);
        emitter.setSprite(new Sprite(new Texture(file)));
View Full Code Here

    public String toString () {
      return name + "[" + x + "," + y + " " + width + "x" + height + "]";
    }

    static public String getAtlasName (String name, boolean flattenPaths) {
      return flattenPaths ? new FileHandle(name).name() : name;
    }
View Full Code Here

  static final String externalPath = appDir + "/Documents";
  static final String localPath = appDir + "/Library/local";
  static final String internalPath = NSBundle.getMainBundle().getBundlePath();
 
  public IOSFiles() {
    new FileHandle(externalPath).mkdirs();
    new FileHandle(localPath).mkdirs();
  }
View Full Code Here

      if (properties != null) {
        for (Element property : properties.getChildrenByName("property")) {
          String name = property.getAttribute("name");
          String value = property.getAttribute("value");
          if (name.startsWith("atlas")) {
            FileHandle atlasHandle = getRelativeFileHandle(tmxFile, value);
            dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class));
          }
        }
      }
    } catch (IOException e) {
View Full Code Here

        yUp = parameter.yUp;
      } else {
        yUp = true;
      }

      FileHandle tmxFile = resolve(fileName);
      root = xml.parse(tmxFile);
      ObjectMap<String, TextureAtlas> atlases = new ObjectMap<String, TextureAtlas>();
      FileHandle atlasFile = loadAtlas(root, tmxFile);
      if (atlasFile == null) {
        throw new GdxRuntimeException("Couldn't load atlas");
      }

      TextureAtlas atlas = new TextureAtlas(atlasFile);
      atlases.put(atlasFile.path(), atlas);

      AtlasResolver.DirectAtlasResolver atlasResolver = new AtlasResolver.DirectAtlasResolver(atlases);
      TiledMap map = loadMap(root, tmxFile, atlasResolver, parameter);
      map.setOwnedResources(atlases.values().toArray());
      setTextureFilters(parameter.textureMinFilter, parameter.textureMagFilter);
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.files.FileHandle

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.