Skip to main content
added 1 character in body
Source Link
sn8p
  • 156
  • 4

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be ladedloaded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be laded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be loaded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

deleted 26 characters in body
Source Link
sn8p
  • 156
  • 4

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); // load assets gradually public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be laded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); // load assets gradually public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be laded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be laded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets

Source Link
sn8p
  • 156
  • 4

In a nutshell you should use power of AssetManager instead of async thread.

 public static AssetManager manager = new AssetManager(); // load assets gradually public MyAppListener implements ApplicationListener { public void create() { loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png")))); loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2); loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2); loading.setZIndex(1); loading.addAction(rotateTo(1440, 20)); stage.addActor(loading); // add assets to queue (will be laded later) manager.load("data/mytexture.png", Texture.class); manager.load("data/myfont.fnt", BitmapFont.class); manager.load("data/mymusic.ogg", Music.class); } public void render() { // loads a part of assets step by step and let you show your loading screen if(manager.update()) { // we are done loading, let's move to another screen! game.setScreen(game.gameScreen); return; } // display loading information super.render(); } } 

Here is the wiki page - https://github.com/libgdx/libgdx/wiki/Managing-your-assets