Example usage for com.badlogic.gdx.assets AssetManager unload

List of usage examples for com.badlogic.gdx.assets AssetManager unload

Introduction

In this page you can find the example usage for com.badlogic.gdx.assets AssetManager unload.

Prototype

public synchronized void unload(String fileName) 

Source Link

Document

Removes the asset and all its dependencies, if they are not used by other assets.

Usage

From source file:com.forerunnergames.peril.client.assets.MultiSourceAssetManager.java

License:Open Source License

@Override
public synchronized void unload(final String fileName) {
    Arguments.checkIsNotNull(fileName, "fileName");

    final com.badlogic.gdx.assets.AssetManager manager = fileNamesToManagers.get(fileName);

    if (manager == null) {
        throw new IllegalStateException(
                Strings.format("Cannot unload asset [{}] because it was not first loaded by {}.", fileName,
                        MultiSourceAssetManager.class.getSimpleName()));
    }// w  w  w . ja v a  2  s  .  c o m

    log.debug("Unloading asset [{}]...", fileName);

    manager.unload(fileName);

    if (!manager.isLoaded(fileName))
        fileNamesToManagers.remove(fileName);
}

From source file:com.sidereal.dolphinoes.architecture.core.Assets.java

License:Apache License

/** Unloads an asset from the memory. Finds the manager tied to the passed
 * FileHandleREsolver parameter and if that manager has the specified file
 * is loaded, unload it./*w ww .  j  a  va 2  s . co  m*/
 * 
 * @param filePath
 * @param resolver
 * @return */
public boolean unload(String filePath, Class<? extends FileHandleResolver> resolver) {

    AssetManager assetManager = managers.get(resolver);
    if (assetManager.isLoaded(filePath)) {
        assetManager.unload(filePath);
        return true;
    }

    return false;
}