1

这是我的代码:-

manager = new AssetManager();   

fps =new FPSLogger();

Resolution[] resolutions = {new Resolution(320, 480, ".320480"), new Resolution(480,    800, ".480800"),
new Resolution(480, 856, ".480854")};

 ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);

manager.setLoader(Texture.class, new TextureLoader(resolver));


 manager.load( "images/flash.png" , Texture.class);
 Texture.setAssetManager(manager);
tex =  manager.get("images/flash.png" ,Texture.class);


tex = new Texture(Gdx.files.internal("images/a.png")); 
flsh = new Texture(Gdx.files.internal("images/flash.png"));   
tex2 = new Texture(Gdx.files.internal("images/space.jpg")); 
ear = new Texture(Gdx.files.internal("images/earth.png")); 
newgame=new Texture(Gdx.files.internal("images/shockwave.png")); 

并且出现的错误是

 Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Asset not loaded: images/flash.png
at com.badlogic.gdx.assets.AssetManager.get(AssetManager.java:119)
at main.assets.loading(assets.java:53)
at main.game.create(game.java:43)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:132)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:112)

我的图像布局是

/main(项目名称)/assets/images/a.png

请帮我纠正这个错误

4

1 回答 1

5

在 manager.load() 和 manager.get 语句之间使用 manager.finishloading()。

于 2013-10-15T05:59:23.047 回答