2015-12-05 113 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。

愚蠢的我。

相關問題