Package com.badlogic.gdx.files

Examples of com.badlogic.gdx.files.FileHandle


    return cell;
  }

  protected static FileHandle getRelativeFileHandle (FileHandle file, String path) {
    StringTokenizer tokenizer = new StringTokenizer(path, "\\/");
    FileHandle result = file.parent();
    while (tokenizer.hasMoreElements()) {
      String token = tokenizer.nextToken();
      if (token.equals(".."))
        result = result.parent();
      else {
        result = result.child(token);
      }
    }
    return result;
  }
View Full Code Here


  /**
   * Carga el nivel actual leyendo el fichero 'level' + currentLevel + '.txt'
   */
  public void loadCurrentLevel() {
   
    FileHandle file = Gdx.files.internal("levels/level" + currentLevel + ".txt");
    String levelInfo = file.readString();
   
    int x = 0, y = Constants.SCREEN_HEIGHT - Constants.BRICK_HEIGHT;
    String[] rows = levelInfo.split("\n");
    Brick brick = null;
    for (String row : rows) {
View Full Code Here

        if (!LwjglApplicationConfiguration.disableAudio)
          loader.extractFile(is64Bit ? "OpenAL64.dll" : "OpenAL32.dll", nativesDir.getName());
      } else if (isMac) {
        File extractedFile = loader.extractFile("liblwjgl.jnilib", null);
        nativesDir = extractedFile.getParentFile();
        new FileHandle(extractedFile).copyTo(new FileHandle(new File(nativesDir, "liblwjgl.dylib")));
        if (!LwjglApplicationConfiguration.disableAudio) loader.extractFile("openal.dylib", nativesDir.getName());
      } else if (isLinux) {
        nativesDir = loader.extractFile(is64Bit ? "liblwjgl64.so" : "liblwjgl.so", null).getParentFile();
        if (!LwjglApplicationConfiguration.disableAudio)
          loader.extractFile(is64Bit ? "libopenal64.so" : "libopenal.so", nativesDir.getName());
View Full Code Here

          String line = reader.readLine();
          if (line == null) break;
          if (line.trim().length() == 0)
            pageImage = null;
          else if (pageImage == null) {
            FileHandle file = imagesDir.child(line);

            Format format = Format.valueOf(readValue(reader));

            readTuple(reader);
            TextureFilter min = TextureFilter.valueOf(tuple[0]);
View Full Code Here

    pixmap.fill();
    final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
    pixmap.dispose();

    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

          fileDialog.setMode(FileDialog.LOAD);
          fileDialog.setVisible(true);
          String name = fileDialog.getFile();
          String dir = fileDialog.getDirectory();
          if (name == null || dir == null) return;
          loadSkeleton(new FileHandle(new File(dir, name).getAbsolutePath()), false);
        }
      });

      setupPoseButton.addListener(new ChangeListener() {
        public void changed (ChangeEvent event, Actor actor) {
View Full Code Here

      public BitmapFont read (Json json, Object jsonData, Class type) {
        if (jsonData instanceof String) return getResource((String)jsonData, BitmapFont.class);
        String path = json.readValue("file", String.class, jsonData);

        FileHandle fontFile = skinFile.parent().child(path);
        if (!fontFile.exists()) fontFile = Gdx.files.internal(path);
        if (!fontFile.exists()) throw new SerializationException("Font file not found: " + fontFile);

        // Use a region with the same name as the font, else use a PNG file in the same directory as the FNT file.
        String regionName = fontFile.nameWithoutExtension();
        try {
          if (skin.hasResource(regionName, TextureRegion.class))
            return new BitmapFont(fontFile, skin.getResource(regionName, TextureRegion.class), false);
          else {
            FileHandle imageFile = fontFile.parent().child(regionName + ".png");
            if (imageFile.exists())
              return new BitmapFont(fontFile, imageFile, false);
            else
              return new BitmapFont(fontFile, false);
          }
        } catch (RuntimeException ex) {
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.