List of usage examples for com.badlogic.gdx.assets AssetManager setErrorListener
public synchronized void setErrorListener(AssetErrorListener listener)
From source file:com.alma42.mapgen.game.Assets.java
License:Apache License
public void init(final AssetManager assetManager) { this.assetManager = assetManager; // set asset manager error handler assetManager.setErrorListener(this); // load texture atlas assetManager.load(Constants.TEXTURE_ATLAS_OBJECTS, TextureAtlas.class); // start loading assets and wait until finished assetManager.finishLoading();/*from w w w . j av a 2 s. c o m*/ Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (final String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } final TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS); // enable texture filtering for pixel smoothing for (final Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } // create game resource objects this.bunny = new AssetBunny(atlas); this.rock = new AssetRock(atlas); this.goldCoin = new AssetGoldCoin(atlas); this.feather = new AssetFeather(atlas); this.levelDecoration = new AssetLevelDecoration(atlas); }
From source file:com.forerunnergames.peril.client.assets.AssetManagerFactory.java
License:Open Source License
public static AssetManager create(final MBassador<Event> eventBus) { Arguments.checkIsNotNull(eventBus, "eventBus"); final FileHandleResolver externalResolver = new CustomExternalFileHandleResolver(); final com.badlogic.gdx.assets.AssetManager externalLibGdxAssetManager = new com.badlogic.gdx.assets.AssetManager( externalResolver);// w ww . j a v a 2s . co m externalLibGdxAssetManager.setErrorListener(new AssetErrorListener() { @Override @SuppressWarnings("rawtypes") public void error(final AssetDescriptor asset, final Throwable throwable) { eventBus.publish(new AssetLoadingErrorEvent(asset, throwable)); } }); externalLibGdxAssetManager.setLoader(Skin.class, new MultiAtlasSkinLoader(externalResolver)); externalLibGdxAssetManager.setLoader(ShaderProgram.class, new ShaderProgramLoader(externalResolver)); final FileHandleResolver internalResolver = new InternalFileHandleResolver(); final com.badlogic.gdx.assets.AssetManager internalLibGdxAssetManager = new com.badlogic.gdx.assets.AssetManager( internalResolver); internalLibGdxAssetManager.setLoader(Skin.class, new MultiAtlasSkinLoader(internalResolver)); internalLibGdxAssetManager.setLoader(ShaderProgram.class, new ShaderProgramLoader(internalResolver)); internalLibGdxAssetManager.setErrorListener(new AssetErrorListener() { @Override @SuppressWarnings("rawtypes") public void error(final AssetDescriptor asset, final Throwable throwable) { eventBus.publish(new AssetLoadingErrorEvent(asset, throwable)); } }); return new MultiSourceAssetManager(externalLibGdxAssetManager, internalLibGdxAssetManager); }
From source file:com.mrandmrsjian.freakingsum.Assets.java
License:Apache License
public void init(AssetManager assetManager) { this.assetManager = assetManager; // set asset manager error handler assetManager.setErrorListener(this); // load texture atlas assetManager.load("images.pack", TextureAtlas.class); // load sounds // load music // start loading assets and wait until finished assetManager.finishLoading();// w w w . j a v a 2 s . c o m Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } fonts = new AssetFonts(); atlas = assetManager.get("images.pack"); // enable texture filtering for pixel smoothing for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } }
From source file:com.ntr.prototype.game.Assets.java
public void init(AssetManager assetManager) { this.assetManager = assetManager; assetManager.setErrorListener(this); assetManager.load(Constants.ATLAS_OBJECT, TextureAtlas.class); //not completed assetManager.finishLoading();/* w w w.ja v a 2s . c o m*/ Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "assets : " + a); } TextureAtlas atlas = assetManager.get(Constants.ATLAS_OBJECT); for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } catcher = new AssetCatcher(atlas); decoration = new AssetDecoration(atlas); gas = new AssetGas(atlas); background = new AssetBackground(atlas); }
From source file:com.packtpub.libgdx.canyonbunny.game.Assets.java
License:Apache License
public void init(AssetManager assetManager) { this.assetManager = assetManager; // set asset manager error handler assetManager.setErrorListener(this); // load texture atlas assetManager.load(Constants.TEXTURE_ATLAS_OBJECTS, TextureAtlas.class); // start loading assets and wait until finished assetManager.finishLoading();/* w ww .j a v a2 s. c o m*/ Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS); // enable texture filtering for pixel smoothing for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } // create game resource objects fonts = new AssetFonts(); bunny = new AssetBunny(atlas); rock = new AssetRock(atlas); goldCoin = new AssetGoldCoin(atlas); feather = new AssetFeather(atlas); levelDecoration = new AssetLevelDecoration(atlas); }
From source file:core.september.foundation.Assets.java
License:Apache License
public void init(AssetManager assetManager) { this.assetManager = assetManager; // set asset manager error handler assetManager.setErrorListener(this); // load texture atlas assetManager.load(Constants.TEXTURE_ATLAS_OBJECTS, TextureAtlas.class); assetManager.load("sounds/engine_on.wav", Sound.class); assetManager.load("sounds/level_switch.wav", Sound.class); assetManager.load("sounds/push_button.wav", Sound.class); assetManager.load("music/soundtrack.mp3", Music.class); // start loading assets and wait until finished assetManager.finishLoading();//from w w w. j a v a2s. c o m Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS); // enable texture filtering for pixel smoothing for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } // create game resource objects sounds = new AssetSounds(assetManager); assetMusic = new AssetMusic(assetManager); button = new AssetButton(atlas); background = new AssetBackground(atlas); countdown = new AssetCountDown(atlas); powerButton = new AssetPowerButton(atlas); led = new AssetLed(atlas); assetUi = new AssetUi(atlas); knob = new AssetSoundKnob(atlas); assetHelp = new AssetHelp(atlas); assetSkin = new AssetSkin(atlas); fonts = new AssetFonts(); }
From source file:utils.Assets.java
License:Apache License
public void initGame(AssetManager assetManager) { this.assetManagerGame = assetManager; // set asset manager error handler assetManager.setErrorListener(this); // load texture atlas assetManager.load(Const.TEXTURE_ATLAS_GAME, TextureAtlas.class); // load sounds assetManager.load("mp3/jump.wav", Sound.class); assetManager.load("mp3/walk.wav", Sound.class); assetManager.load("mp3/l_booben.wav", Sound.class); assetManager.load("mp3/booben.wav", Sound.class); assetManager.load("mp3/musik.mp3", Music.class); // assetManager.load("mp3/fall.mp3", Sound.class); // assetManager.load("mp3/rocket.mp3", Sound.class); // assetManager.load("mp3/rocketLong.mp3", Sound.class); // assetManager.load("mp3/bonus.mp3", Sound.class); assetManager.finishLoading();//from w w w. j a v a 2s. c o m Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } TextureAtlas atlas = assetManager.get(Const.TEXTURE_ATLAS_GAME); // enable texture filtering for pixel smoothing for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } // create game resource objects fonts = new AssetFonts(); animation = new AssetAnimations(atlas); gameElements = new AssetGameElements(atlas); sounds = new AssetSounds(assetManager); sounds.getGameSounds(); music = new AssetMusic(assetManager); }