我有一個相當簡單的問題,那就是讓我把我的腦袋從我的桌子上撥開。我的項目使用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運行代碼。以下是我的創意設置的截圖。 沒有太多可以出錯的地方...