APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.assets

pack-priv Class AssetLoadingTask

extends Object
implements AsyncTask<Void>
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.async.AsyncTask
Imports
com.badlogic.gdx.assets.loaders.AssetLoader, .AsynchronousAssetLoader, .SynchronousAssetLoader, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .Logger, .TimeUtils, com.badlogic.gdx.utils.async.AsyncExecutor, .AsyncResult, .AsyncTask

Responsible for loading an asset through an AssetLoader based on an AssetDescriptor. Please don't forget to update the overriding emu file on GWT backend when changing this file!
Author
mzechner

Field Summary

Modifier and TypeField and Description
pack-priv volatile Object
pack-priv final AssetDescriptor<T>
pack-priv volatile boolean
pack-priv volatile boolean
pack-priv volatile Array<AssetDescriptor<T>>
pack-priv volatile boolean
pack-priv volatile AsyncResult<Void>
pack-priv final AsyncExecutor
pack-priv final AssetLoader<T, P extends AssetLoaderParameters<T>>
pack-priv volatile AsyncResult<Void>
pack-priv AssetManager
pack-priv final long

Constructor Summary

AccessConstructor and Description
public
AssetLoadingTask(AssetManager manager, AssetDescriptor<T> assetDesc, AssetLoader<T, P extends AssetLoaderParameters<T>> loader, AsyncExecutor threadPool)

Method Summary

Modifier and TypeMethod and Description
public Void
call()

Implements com.badlogic.gdx.utils.async.AsyncTask.call.

Loads parts of the asset asynchronously if the loader is an AsynchronousAssetLoader.

private void
private void
private void
private FileHandle
resolve(AssetLoader<T, P extends AssetLoaderParameters<T>> loader, AssetDescriptor<T> assetDesc)

public void
unload()

Called when this task is the task that is currently being processed and it is unloaded.

public boolean

Returns:

true in case the asset was fully loaded, false otherwise
update
()

Updates the loading of the asset.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

assetback to summary
pack-priv volatile Object asset
assetDescback to summary
pack-priv final AssetDescriptor<T> assetDesc
asyncDoneback to summary
pack-priv volatile boolean asyncDone
cancelback to summary
pack-priv volatile boolean cancel
dependenciesback to summary
pack-priv volatile Array<AssetDescriptor<T>> dependencies
dependenciesLoadedback to summary
pack-priv volatile boolean dependenciesLoaded
depsFutureback to summary
pack-priv volatile AsyncResult<Void> depsFuture
executorback to summary
pack-priv final AsyncExecutor executor
loaderback to summary
pack-priv final AssetLoader<T, P extends AssetLoaderParameters<T>> loader
loadFutureback to summary
pack-priv volatile AsyncResult<Void> loadFuture
managerback to summary
pack-priv AssetManager manager
startTimeback to summary
pack-priv final long startTime

Constructor Detail

AssetLoadingTaskback to summary
public AssetLoadingTask(AssetManager manager, AssetDescriptor<T> assetDesc, AssetLoader<T, P extends AssetLoaderParameters<T>> loader, AsyncExecutor threadPool)

Method Detail

callback to summary
public Void call() throws Exception

Implements com.badlogic.gdx.utils.async.AsyncTask.call.

Loads parts of the asset asynchronously if the loader is an AsynchronousAssetLoader.

Annotations
@Override
handleAsyncLoaderback to summary
private void handleAsyncLoader()
handleSyncLoaderback to summary
private void handleSyncLoader()
removeDuplicatesback to summary
private void removeDuplicates(Array<AssetDescriptor<T>> array)
resolveback to summary
private FileHandle resolve(AssetLoader<T, P extends AssetLoaderParameters<T>> loader, AssetDescriptor<T> assetDesc)
unloadback to summary
public void unload()

Called when this task is the task that is currently being processed and it is unloaded.

updateback to summary
public boolean update()

Updates the loading of the asset. In case the asset is loaded with an AsynchronousAssetLoader, the loaders AsynchronousAssetLoader#loadAsync(AssetManager, String, FileHandle, AssetLoaderParameters) method is first called on a worker thread. Once this method returns, the rest of the asset is loaded on the rendering thread via AsynchronousAssetLoader#loadSync(AssetManager, String, FileHandle, AssetLoaderParameters).

Returns:boolean

true in case the asset was fully loaded, false otherwise