Skip to main content

FlixelDefaultAsset

View source

class

org.flixelgdx.asset.FlixelDefaultAsset

public final class FlixelDefaultAsset<T> implements FlixelAsset<T>

Generic FlixelAsset handle for types whose libGDX raw type is the same as the content type (e.g. String for text files, FlixelSoundSource for audio).

Content is resolved lazily: the first FlixelDefaultAsset.get() call either fetches the value from the libGDX AssetManager once loading completes, or triggers a synchronous load if the asset was not queued first. Prefer FlixelAssetManager.load(String) in a loading state to avoid mid-frame stalls.

For image assets, use FlixelGraphic, which implements FlixelAsset<FlixelGraphic> directly.

Constructors

FlixelDefaultAsset(FlixelAssetManager, String, Class<?>)

public FlixelDefaultAsset(FlixelAssetManager assets, String path, Class<?> rawType)

Creates a new handle. Content is not fetched until FlixelDefaultAsset.get() is first called.

Parameters:

NameDescription
assetsThe owning asset manager.
pathNormalized asset path.
rawTypeThe libGDX raw type registered with the underlying AssetManager (e.g. String.class).

Methods

getPath()

public String getPath()

get()

public T get()

Returns the content for this asset, loading it synchronously if not yet ready.

When the asset was queued via FlixelAssetManager.load(String) and FlixelAssetManager.update() has finished, this returns immediately. Otherwise it blocks the current thread to load the asset.


isLoaded()

public boolean isLoaded()

getLoaded()

public boolean getLoaded()

Returns whether this asset has been loaded into memory.


isPersist()

public boolean isPersist()

getPersist()

public boolean getPersist()

Returns whether this asset is marked to persist across state transitions.


setPersist(boolean)

public FlixelDefaultAsset<T> setPersist(boolean persist)

getRefCount()

public int getRefCount()

retain()

public FlixelDefaultAsset<T> retain()

release()

public FlixelDefaultAsset<T> release()