Package com.badlogic.gdx.assets.loaders
Class AsynchronousAssetLoader<T,P extends AssetLoaderParameters<T>>
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<T,P>
-
- Type Parameters:
T-P-
- Direct Known Subclasses:
BaseTmxMapLoader,BitmapFontLoader,CubemapLoader,I18NBundleLoader,ModelLoader,MusicLoader,ParticleEffectLoader,PixmapLoader,ShaderProgramLoader,SkinLoader,SoundLoader,TextureLoader
public abstract class AsynchronousAssetLoader<T,P extends AssetLoaderParameters<T>> extends AssetLoader<T,P>
Base class for asynchronousAssetLoaderinstances. Such loaders try to load parts of an OpenGL resource, like the Pixmap, on a separate thread to then load the actual resource on the thread the OpenGL context is active on.
-
-
Constructor Summary
Constructors Constructor Description AsynchronousAssetLoader(FileHandleResolver resolver)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidloadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.abstract TloadSync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)Loads the OpenGL part of the asset.voidunloadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)Called if this task is unloaded beforeloadSyncis called.-
Methods inherited from class com.badlogic.gdx.assets.loaders.AssetLoader
getDependencies, resolve
-
-
-
-
Constructor Detail
-
AsynchronousAssetLoader
public AsynchronousAssetLoader(FileHandleResolver resolver)
-
-
Method Detail
-
loadAsync
public abstract void loadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.- Parameters:
manager-fileName- the name of the asset to loadfile- the resolved file to loadparameter- the parameters to use for loading the asset
-
unloadAsync
public void unloadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)
Called if this task is unloaded beforeloadSyncis called. This method may be invoked on any thread, but will not be invoked during or afterloadSync. This method is not invoked when a task is cancelled because it threw an exception, only when the asset is unloaded before loading is complete.The default implementation does nothing. Subclasses should release any resources acquired in
loadAsync, which may or may not have been called before this method, but never during or after this method. Note thatloadAsyncmay still be executing when this method is called and must release any resources it allocated.
-
loadSync
public abstract T loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, P parameter)
Loads the OpenGL part of the asset.- Parameters:
manager-fileName-file- the resolved file to loadparameter-
-
-