我有一个相当简单的问题,那就是让我把我的脑袋从我的桌子上拨开。我的项目使用LibGdx框架,它试图加载一些资产。由于某种原因,它没有在正确的文件夹中看到资产。Libgdx - 无法加载资产依赖关系
这里是我的assetmanager类
public class LevelOneAssets {
public static final String EARTH_TEXTURE = "earth.png";
public static final String MARS_TEXTURE = "mars.png";
private static AssetManager am;
public static Class<Texture> TEXTURE = Texture.class;
public static AssetManager load(){
am = new AssetManager(new InternalFileHandleResolver());
am.load(EARTH_TEXTURE, TEXTURE);
am.load(MARS_TEXTURE, TEXTURE);
am.update();
return am;
}}
private void init(){
Gdx.app.log("GameScreen", "Initializing");
isInitialized = true;
am = LevelOneAssets.load();
world = new World(new Vector2(0f, -9.8f), true);
//Add Texture Component
engine = new PooledEngine();
RenderingSystem renderingSystem = new RenderingSystem(batch);
engine.addSystem(new AnimationSystem());
engine.addSystem(renderingSystem);
engine.addSystem(new PhysicsSystem(world));
engine.addSystem(new PhysicsDebugSystem(world, renderingSystem.getCamera()));
engine.addSystem(new UselessStateSwapSystem());
am.finishLoading();
Entity e = buildEarth(world); // error here
engine.addEntity(e);
e = buildMars(world);
engine.addEntity(e);
engine.addEntity(buildFloorEntity(world));
isInitialized = true;
}
所有资产都是LauchOff/android/assets
目录中。有任何想法吗?我正在使用Intellij和gdxVersion = '1.9.6
。
编辑----
我更新的代码,但我仍然得到Couldn't load dependencies of asset: earth.png
。我觉得这是我在Idea中设置的问题,因为我可以用gradle运行代码。以下是我的创意设置的截图。 没有太多可以出错的地方...