Package com.badlogic.gdx.files

Examples of com.badlogic.gdx.files.FileHandle


        json.writeValue(font.getData().getFontFile().toString().replace('\\', '/'));
      }

      public BitmapFont read (Json json, Object jsonData, Class type) {
        String path = json.readValue(String.class, jsonData);
        FileHandle file = skinFile.parent().child(path);
        if (!file.exists()) file = Gdx.files.internal(path);
        return new BitmapFont(file, false);
      }
    });

    json.setSerializer(NinePatch.class, new Serializer<NinePatch>() {
View Full Code Here


   * @param map The tiled map
   * @param inputDir The directory containing all the files created by TiledMapPacker */
  public TileAtlas (TiledMap map, FileHandle inputDir) {
    // TODO: Create a constructor that doesn't take a tmx map,
    for (TileSet set : map.tileSets) {
      FileHandle packfile = getRelativeFileHandle(inputDir, removeExtension(set.imageName) + " packfile");
      TextureAtlas textureAtlas = new TextureAtlas(packfile, packfile.parent(), false);
      List<AtlasRegion> atlasRegions = textureAtlas.findRegions(removeExtension(removePath(set.imageName)));

      for (AtlasRegion reg : atlasRegions) {
        regionsMap.put(reg.index + set.firstgid, reg);
        if (!textures.contains(reg.getTexture())) {
View Full Code Here

  private static FileHandle getRelativeFileHandle (FileHandle path, String relativePath) {
    if (relativePath.trim().length() == 0) {
      return path;
    }

    FileHandle child = path;

    StringTokenizer tokenizer = new StringTokenizer(relativePath, "\\/");
    while (tokenizer.hasMoreTokens()) {
      String token = tokenizer.nextToken();
      if (token.equals("..")) {
        child = child.parent();
      } else {
        child = child.child(token);
      }
    }

    return child;
  }
View Full Code Here

     * the tileset will be output to "C:\mydir\" and the maps will be in
     * "C:\mydir\maps".
     * @param settings the settings used in the TexturePacker
     */
    public void processMap(File inputDir, File outputDir, Settings settings) throws IOException {
        FileHandle inputDirHandle = Gdx.files.absolute(inputDir.getAbsolutePath());
        File[] files = inputDir.listFiles(new TmxFilter());

        for (File file : files) {
            map = TiledLoader.createMap(Gdx.files.absolute(file.getAbsolutePath()));

View Full Code Here

*/
public class ParticleEffectGDX {

    public ParticleEffectGDX(String effectFile, String imageDir) {
        m_particleEffect = new ParticleEffect();
        FileHandle ef = Gdx.files.absolute(new File(effectFile).getAbsolutePath());
        FileHandle id = Gdx.files.absolute(new File(imageDir).getAbsolutePath());
        m_particleEffect.load(ef, id);
    }
View Full Code Here

        super();

        m_stage = stage;
        m_path = path;

        FileHandle mapHandle = Gdx.files.internal(m_path);
        FileHandle baseDir = Gdx.files.internal(new File(m_path).getAbsolutePath());

        m_map = TiledLoader.createMap(mapHandle);
        m_atlas = new TileAtlas(m_map, mapHandle.parent());

        m_tileMapRenderer = new TileMapRenderer(m_map, m_atlas, 64, 64, 64, 64);
View Full Code Here

     * @param path path to the sprite
     * @param frame frame of the sprite
     */
    public SpriteGDX(String path, Rectangle rectangle, int frame) {
        m_path = new File(path).getAbsolutePath();
        FileHandle f = Gdx.files.absolute(m_path);
        m_texture = new Texture(f);
        m_region = new TextureRegion(m_texture, rectangle.x, rectangle.y, rectangle.width, rectangle.height);
        m_rectangle = rectangle;
        m_frame = frame;
    }
View Full Code Here

                Element e = (Element) n;
                String name = e.getAttribute("name");
                String entityPath = e.getAttribute("path");
                switch (type) {
                    case "music": {
                        FileHandle f = new FileHandle(new File(entityPath));
                        Music m = Gdx.audio.newMusic(f);
                        m_musicList.put(name, m);
                        break;
                    }
                    case "sound": {
                        FileHandle f = new FileHandle(new File(entityPath));
                        Sound s = Gdx.audio.newSound(f);
                        m_soundList.put(name, s);
                        break;
                    }
                    case "playlist":
View Full Code Here

   * @param parameters specifies whether to use y-up, generate mip maps etc.
   * @return the TiledMap */
  public TiledMap load (String fileName, TmxMapLoader.Parameters parameters) {
    try {
      this.convertObjectToTileSpace = parameters.convertObjectToTileSpace;
      FileHandle tmxFile = resolve(fileName);
      root = xml.parse(tmxFile);
      ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>();
      for (FileHandle textureFile : loadTilesets(root, tmxFile)) {
        Texture texture = new Texture(textureFile, parameters.generateMipMaps);
        texture.setFilter(parameters.textureMinFilter, parameters.textureMagFilter);
View Full Code Here

   * @throws IOException */
  protected Array<FileHandle> loadTilesets (Element root, FileHandle tmxFile) throws IOException {
    Array<FileHandle> images = new Array<FileHandle>();
    for (Element tileset : root.getChildrenByName("tileset")) {
      String source = tileset.getAttribute("source", null);
      FileHandle image = null;
      if (source != null) {
        FileHandle tsx = getRelativeFileHandle(tmxFile, source);
        tileset = xml.parse(tsx);
        String imageSource = tileset.getChildByName("image").getAttribute("source");
        image = getRelativeFileHandle(tsx, imageSource);
      } else {
        String imageSource = tileset.getChildByName("image").getAttribute("source");
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.