|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.assets.AssetManager
public class AssetManager
Loads and stores assets like textures, bitmapfonts, tile maps, sounds, music and so on.
Constructor Summary | |
---|---|
AssetManager()
Creates a new AssetManager with all default loaders. |
|
AssetManager(FileHandleResolver resolver)
Creates a new AssetManager with all default loaders. |
Method Summary | ||
---|---|---|
void |
clear()
Clears and disposes all assets and the preloading queue. |
|
|
containsAsset(T asset)
|
|
void |
dispose()
Disposes all assets in the manager and stops all asynchronous loading. |
|
void |
finishLoading()
blocks until all assets are loaded. |
|
|
get(java.lang.String fileName,
java.lang.Class<T> type)
|
|
|
getAssetFileName(T asset)
|
|
java.lang.String |
getDiagnostics()
|
|
int |
getLoadedAssets()
|
|
Logger |
getLogger()
|
|
float |
getProgress()
|
|
int |
getQueuedAssets()
|
|
int |
getReferenceCount(java.lang.String fileName)
Returns the reference count of an asset. |
|
boolean |
isLoaded(java.lang.String fileName)
|
|
boolean |
isLoaded(java.lang.String fileName,
java.lang.Class type)
|
|
void |
load(AssetDescriptor desc)
Adds the given asset to the loading queue of the AssetManager. |
|
|
load(java.lang.String fileName,
java.lang.Class<T> type)
Adds the given asset to the loading queue of the AssetManager. |
|
|
load(java.lang.String fileName,
java.lang.Class<T> type,
AssetLoaderParameters<T> parameter)
Adds the given asset to the loading queue of the AssetManager. |
|
void |
setErrorListener(AssetErrorListener listener)
Sets an AssetErrorListener to be invoked in case loading an asset failed. |
|
|
setLoader(java.lang.Class<T> type,
AssetLoader<T,P> loader)
Sets a new AssetLoader for the given type. |
|
void |
setReferenceCount(java.lang.String fileName,
int refCount)
Sets the reference count of an asset. |
|
void |
unload(java.lang.String fileName)
Removes the asset and all its dependencies if they are not used by other assets. |
|
boolean |
update()
Updates the AssetManager, keeping it loading any assets in the preload queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AssetManager()
public AssetManager(FileHandleResolver resolver)
Method Detail |
---|
public <T> T get(java.lang.String fileName, java.lang.Class<T> type)
fileName
- the asset file nametype
- the asset type
public void unload(java.lang.String fileName)
fileName
- the file namepublic <T> boolean containsAsset(T asset)
asset
- the asset
public <T> java.lang.String getAssetFileName(T asset)
asset
- the asset
public boolean isLoaded(java.lang.String fileName)
fileName
- the file name of the asset
public boolean isLoaded(java.lang.String fileName, java.lang.Class type)
fileName
- the file name of the asset
public <T> void load(java.lang.String fileName, java.lang.Class<T> type)
fileName
- the file name (interpretation depends on AssetLoader
)type
- the type of the asset.public <T> void load(java.lang.String fileName, java.lang.Class<T> type, AssetLoaderParameters<T> parameter)
fileName
- the file name (interpretation depends on AssetLoader
)type
- the type of the asset.parameter
- parameters for the AssetLoader.public void load(AssetDescriptor desc)
desc
- the AssetDescriptor
public boolean update()
public void finishLoading()
public <T,P extends AssetLoaderParameters<T>> void setLoader(java.lang.Class<T> type, AssetLoader<T,P> loader)
AssetLoader
for the given type.
type
- the type of the assetloader
- the loaderpublic int getLoadedAssets()
public int getQueuedAssets()
public float getProgress()
public void setErrorListener(AssetErrorListener listener)
AssetErrorListener
to be invoked in case loading an asset failed.
listener
- the listener or nullpublic void dispose()
dispose
in interface Disposable
public void clear()
public Logger getLogger()
Logger
used by the AssetManager
public int getReferenceCount(java.lang.String fileName)
fileName
- public void setReferenceCount(java.lang.String fileName, int refCount)
fileName
- public java.lang.String getDiagnostics()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |