2015-12-05 112 views
0

我需要在我的项目中使用一个atlas文件。 但是,libgdx只给我一个文件找不到错误,即使我已经有资产文件夹内的图集。Libgdx file.internal file not found错误

这是代码:

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/gui/GUI.java

LoadAtlas.addListener(new InputListener() 
      { 
       @Override 
       public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { 
        character.AddAnimation(AtlasName.getText()); 
        return true; 
      } 
      }); 

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/gui/Chara.java

public void AddAnimation(String s) 
    { 
     chara_atlas.AddAnimation(s); 
    } 

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/character/Character_Atlas.java

public void AddAnimation(String name) 
    { 
     if (Gdx.files.internal(name).exists()) 
     { 
     TextureAtlas tmp = new TextureAtlas(Gdx.files.internal(name)); 
     texture_atlases.add(tmp); 
     animations.add(new Animation(1/15f, texture_atlases.get(texture_atlases.size()-1).getRegions())); 
     } 
     else 
     { 
      Gdx.app.log("File", "File Not found " + name); 
     } 
    } 

编辑:链T Ø我的项目的github回购: https://github.com/cristianceron/CharacterEditor

链接到资产的文件夹: https://github.com/cristianceron/CharacterEditor/tree/master/android/assets

错误代码: error file not found

+1

这是不够的信息。发布例外,平台。使用简单的文件进行测试,例如.png,以查看您的项目是否安装正确。 – PiotrJ

+0

这是桌面项目吗?您是否将工作目录设置为运行配置中的资产? – Tenfour04

+0

@PiotrJ很奇怪,甚至给简单的PNG带来错误。 –

回答

1

多亏了IRC的家伙,用Gdx.files.internal用我的错误而不是使用Gdx.files.local。

愚蠢的我。

相关问题