List of usage examples for com.badlogic.gdx.assets AssetManager getLoader
public <T> AssetLoader getLoader(final Class<T> type)
From source file:com.forerunnergames.peril.client.assets.MultiSourceAssetManager.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") public synchronized <T> void load(final String fileName, final Class<T> type, @Nullable final AssetLoaderParameters<T> parameters) { Arguments.checkIsNotNull(fileName, "fileName"); Arguments.checkIsNotNull(type, "type"); for (final com.badlogic.gdx.assets.AssetManager assetManager : libGdxAssetManagers) { String resolvedPathDescription = "?"; try {//from ww w .j a v a 2 s .co m final AssetLoader loader = assetManager.getLoader(type); if (loader == null) continue; final FileHandle fileHandle = loader.resolve(fileName); final File file = fileHandle.file(); if (fileHandle.type() == Files.FileType.Internal && !file.exists()) { resolvedPathDescription = "classpath:/" + fileHandle.path(); } else { resolvedPathDescription = file.getAbsolutePath(); } log.debug("Queuing asset [{}] for loading as [{}]...", fileName, resolvedPathDescription); if (!fileHandle.exists()) { log.debug("Failed (file doesn't exist)."); continue; } assetManager.load(fileName, type, parameters); fileNamesToManagers.put(fileName, assetManager); log.debug("Success."); return; } catch (final GdxRuntimeException e) { log.error("Cannot queue asset [{}] for loading as [{}]. Reason:\n\n{}", fileName, resolvedPathDescription, e); } } log.error(Strings.format("Failed to queue asset [{}] for loading.", fileName)); }