Package-level declarations

Types

Link copied to clipboard

Thrown by AssetStorage.add when attempting to add an asset with Identifier that is already present in the AssetStorage.

Link copied to clipboard
data class Asset<T>(val descriptor: AssetDescriptor<T>, val identifier: Identifier<T> = descriptor.toIdentifier(), val reference: CompletableDeferred<T> = CompletableDeferred(), val dependencies: List<Asset<*>>, val loader: Loader<T>, var referenceCount: Int = 0)

Container for a single asset of type T managed by AssetStorage.

Link copied to clipboard

Thrown by AssetStorage.load or AssetStorage.get when the asset failed to load due to an unexpected loading exception, usually thrown by the associated AssetLoader.

Link copied to clipboard
class AssetStorage(val asyncContext: CoroutineContext = newSingleThreadAsyncContext(threadName = "AssetStorage-Thread"), val fileResolver: FileHandleResolver = InternalFileHandleResolver(), useDefaultLoaders: Boolean = true, var silenceAssetManagerWarnings: Boolean = false) : Disposable

Asynchronous asset loader based on coroutines API. An AssetManager alternative.

Link copied to clipboard
open class AssetStorageException(message: String, cause: Throwable? = null) : GdxRuntimeException

Thrown by AssetStorage and related services. message describes the problem, while cause is the optional cause of the exception.

Link copied to clipboard
data class AssetStorageSnapshot(val assets: Map<Identifier<*>, Asset<*>>)

Stores a copy of state of an AssetStorage. For debugging purposes.

Link copied to clipboard
class AsyncAssetManager(fileResolver: FileHandleResolver = InternalFileHandleResolver(), useDefaultLoaders: Boolean = true) : AssetManager

An extension of the AssetManager providing asynchronous file loading methods compatible with the coroutine concurrency model.

Link copied to clipboard
typealias AsynchronousLoader<Asset> = AsynchronousAssetLoader<Asset, out AssetLoaderParameters<Asset>>

AsynchronousAssetLoader with improved generics.

Link copied to clipboard

This exception can be thrown when accessing Deferred instances returned by AsyncAssetManager. It occurs when an asset scheduled for asynchronous loading cannot be loaded due to the cause exception thrown during a dependency loading.

Link copied to clipboard
data class Identifier<T>(val path: String, val type: Class<T>)

Uniquely identifies a single asset stored in an AssetStorage by its type and path.

Link copied to clipboard

Thrown by AssetStorage.load or AssetStorage.get when the asset failed to load due to invalid loader implementation. Since loaders are pre-validated during registration, normally this exception is extremely rare and caused by invalid AssetStorage.setLoader usage.

Link copied to clipboard
typealias Loader<Asset> = AssetLoader<Asset, out AssetLoaderParameters<Asset>>

AssetLoader with improved generics.

Link copied to clipboard

Tracks the loading progress of the AssetStorage.

Link copied to clipboard

Thrown when the asset requested by an AssetStorage.get variant is not available in the AssetStorage at all or has not been loaded yet.

Link copied to clipboard

This exception can be thrown by AssetStorage.loadSync if dependencies of an asset were scheduled for asynchronous loading, but are not loaded yet. AssetStorage.loadSync will not wait for the assets and instead will throw this exception.

Link copied to clipboard

Thrown by AssetStorage.load when the AssetLoader for the requested asset type and path is unavailable. See AssetStorage.setLoader.

Link copied to clipboard
typealias SynchronousLoader<Asset> = SynchronousAssetLoader<Asset, out AssetLoaderParameters<Asset>>

SynchronousAssetLoader with improved generics.

Link copied to clipboard

Thrown by AssetStorage.load or AssetStorage.get variant when the requested asset was unloaded asynchronously.

Link copied to clipboard

Thrown when unsupported methods are called on the AssetManagerWrapper. It is typically only caused by AssetLoader instances or a AssetLoaderParameters.LoadedCallback.

Functions

Link copied to clipboard
fun Loader<*>.getDependencies(assetDescriptor: AssetDescriptor<*>): Array<AssetDescriptor<*>>

Allows to use AssetLoader.getDependencies method with AssetDescriptor. assetDescriptor contains asset data. Returns a com.badlogic.gdx.utils.Array with asset dependencies described with AssetDescriptor instances. Null if here are no dependencies.

Link copied to clipboard
fun <Asset> SynchronousLoader<Asset>.load(assetManager: AssetManager, assetDescriptor: AssetDescriptor<Asset>): Asset

Allows to use SynchronousAssetLoader.load method with AssetDescriptor. assetManager provides asset dependencies for the loader. assetDescriptor contains asset data. Returns fully loaded Asset instance.

Link copied to clipboard
fun <Asset> AsynchronousLoader<Asset>.loadAsync(assetManager: AssetManager, assetDescriptor: AssetDescriptor<Asset>)

Allows to use AsynchronousAssetLoader.loadAsync method with AssetDescriptor. Performs the asynchronous asset loading part without yielding results. assetManager provides asset dependencies for the loader. assetDescriptor contains asset data.

Link copied to clipboard
fun <Asset> AsynchronousLoader<Asset>.loadSync(assetManager: AssetManager, assetDescriptor: AssetDescriptor<Asset>): Asset

Allows to use AsynchronousAssetLoader.loadSync method with AssetDescriptor. Note that loadAsync must have been called first with the same asset data. assetManager provides asset dependencies for the loader. assetDescriptor contains asset data. Returns fully loaded Asset instance.