public static AssetManager assets = new AssetManager();
should be avoided, however how do I handle an AssetManager in multiple screens? Is this a good solution?
public class myGame {
assetMananger manager = new AssetManager();
...
public assetManager getAssetMananger(){
return manager;
}
}
public class GameScreen implements Screen{
private AssetManager manager;
public GameScreen(myGame game){
manager = game.getManager();
}
public void render(){
manager.load(...);
}
Gdx.app.getApplicationListener()
returnApplicationListener
instance. You can typecast to your implemented class and then easily access any method or data member of that class.In this way :
ApplicationListener
implemented class :Assets
class that handle all assets/resources of GameEither load all resources in
create()
method and show splash screen while all your data are loading toAssetManager
. (best way for small project)else for big projects having lots of resources unload unnecessary resources -> load new resources, while loading show loading screen to user.