List of usage examples for com.badlogic.gdx.assets AssetManager isLoaded
public synchronized boolean isLoaded(String fileName, Class type)
From source file:com.forerunnergames.peril.client.assets.MultiSourceAssetManager.java
License:Open Source License
@Override public synchronized boolean isLoaded(final String fileName, final Class<?> type) { Arguments.checkIsNotNull(fileName, "fileName"); Arguments.checkIsNotNull(type, "type"); final com.badlogic.gdx.assets.AssetManager manager = fileNamesToManagers.get(fileName); return manager != null && manager.isLoaded(fileName, type); }
From source file:com.sidereal.dolphinoes.architecture.core.Assets.java
License:Apache License
public <T> void load(String filepath, Class<T> classType, Class<? extends FileHandleResolver> resolver, AssetLoaderParameters<T> loadParameters) { if (getResolver(filepath) != null) return;// w ww .j ava2s. c om AssetManager assetManager = managers.get(resolver); DolphinOES.debug.log("Loading " + filepath); if (!assetManager.isLoaded(filepath, classType)) { if (loadParameters != null) assetManager.load(filepath, classType, loadParameters); else assetManager.load(filepath, classType); } }
From source file:com.sidereal.dolphinoes.architecture.core.Assets.java
License:Apache License
@SuppressWarnings("unchecked") /** Returns an asset if existent at the specificied path. If the asset does not exist, it will load a default * file found in the framework ( currently available for textures and bitmap fonts). * // w w w . j a va2 s .co m * * @param filepath * @param classType * @param resolver * @return */ public <T> T get(String filepath, Class<T> classType, Class<? extends FileHandleResolver> resolver) { AssetManager assetManager = managers.get(resolver); if (assetManager.isLoaded(filepath, classType)) { return assetManager.get(filepath, classType); } else { assetManager.load(filepath, classType); assetManager.finishLoading(); } if (classType.equals(Texture.class)) return (T) get(DolphinOES.assets.frameworkAssetsFolder + "noClip.png", Texture.class); if (classType.equals(BitmapFont.class)) return (T) get(DolphinOES.assets.frameworkAssetsFolder + "Blocks4.fnt", BitmapFont.class); return null; }
From source file:dk.sidereal.lumm.architecture.core.Assets.java
License:Apache License
public <T> void load(String filepath, Class<T> classType, Class<? extends FileHandleResolver> resolver, AssetLoaderParameters<T> loadParameters) { if (getResolver(filepath) != null) return;//from w ww . j ava2 s .c o m AssetManager assetManager = managers.get(resolver); Lumm.debug.log("System is now loading file at " + filepath, null); if (!assetManager.isLoaded(filepath, classType)) { if (loadParameters != null) assetManager.load(filepath, classType, loadParameters); else assetManager.load(filepath, classType); } }
From source file:dk.sidereal.lumm.architecture.core.Assets.java
License:Apache License
/** * Returns an asset if existent at the specificied path. If the asset does * not exist, it will load a default file found in the framework ( currently * available for textures and bitmap fonts). * * * @param filepath/*from w ww. jav a 2s . com*/ * @param classType * @param resolver * @return */ public <T> T get(String filepath, Class<T> classType, Class<? extends FileHandleResolver> resolver) { AssetManager assetManager = managers.get(resolver); if (assetManager.isLoaded(filepath, classType)) { return assetManager.get(filepath, classType); } else { Lumm.debug.logDebug("Asset at path " + filepath + " of type " + classType + " is loaded on demand", null); assetManager.load(filepath, classType); assetManager.finishLoading(); return assetManager.get(filepath, classType); } }
From source file:managers.MapManager.java
public void loadMap(AssetManager assetManager, GameData gameData) { if (!assetManager.isLoaded("assets/shrinkingmap.tmx", TiledMap.class)) { assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver())); assetManager.load("assets/shrinkingmap.tmx", TiledMap.class); assetManager.finishLoading();/*from w ww .j a v a 2 s .c o m*/ } map = assetManager.get("assets/shrinkingmap.tmx", TiledMap.class); initializeMapLayers(gameData); }