public LoadingStage() { initViewport(); // Get our textureatlas from the manager, then get assets TextureAtlas atlas = Game.GDXVars().getTextureAtlas(Paths.loadingPack); font = Game.GDXVars().getFont(Paths.defaultFont); // Create actors background = new Image(Game.GDXVars().getTexture(Paths.splashBackground)); background.setSize(getWidth(), getHeight()); loadingBar = new LoadingBar(atlas); loadingBar.setPosition(getWidth() / 2 - loadingBar.getWidth() / 2, loadingBar.getHeight() / 2f); // Add actors addActor(background); addActor(loadingBar); // Selection group selector = new AtlasSelector( Game.GDXVars().getTextureAtlas(Paths.charactersPack), Game.Save().characters); addActor(selector); selector.setPosition(getWidth() / 2f - selector.getWidth() / 2f, 130); progress = 0f; // Start the work startLoadingWork(); }
@Override public void act(float delta) { Game.GDXVars().assetManager.update(); progress = Game.GDXVars().assetManager.getProgress(); loadingBar.setProgress(progress); loadingBar.setMessage((progress == 1) ? "Tap to continue..." : "Loading textures ..."); selector.setSelectable(Game.Save().characters); super.act(delta); }