我需要在我的项目中使用一个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
这是不够的信息。发布例外,平台。使用简单的文件进行测试,例如.png,以查看您的项目是否安装正确。 – PiotrJ
这是桌面项目吗?您是否将工作目录设置为运行配置中的资产? – Tenfour04
@PiotrJ很奇怪,甚至给简单的PNG带来错误。 –