java - Libgdx file.internal 文件未找到错误

标签 java libgdx

我需要在我的项目中使用图集文件。 但 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

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

错误代码: error file not found

最佳答案

感谢 IRC 人员,我的错误是使用带有变量的 Gdx.files.internal 而不是使用 Gdx.files.local。

我真傻。

关于java - Libgdx file.internal 文件未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34108184/

相关文章:

java - 如何让一个角色走主角路线? LIBGDX/Java

java - libGDX、Box2D、碰撞和禁止空中跳跃

java - Android 改进了取消所有请求后 'canceled' 中 'onFailure()' 标志的意外值

java - 使用 -Xlint 重新编译

java - 如何为 Collection 增值

java - Libgdx java,纹理更新方法困惑

java - SonarLint 不适用于覆盖和重复?

Java 的序列化对象表示

java - libGDX 性能 : best time for OrthographicCamera. 更新()

java - libGDX 渲染 TextureRegion 渲染太多