[英]Libgdx file.internal file not found error
我需要在項目中使用圖集文件。 但是libgdx僅給我一個文件未找到錯誤,即使我已經在Assets文件夾中有圖集。
這是代碼:
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);
}
}
編輯:鏈接到我的項目github倉庫: https : //github.com/cristianceron/CharacterEditor
鏈接到資產文件夾: https : //github.com/cristianceron/CharacterEditor/tree/master/android/assets
多虧了IRC的家伙,我的錯誤是使用帶有變量的Gdx.files.internal而不是使用Gdx.files.local。
我真傻
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.