FlixelDefaultAsset
View sourceclass
org.flixelgdx.asset.FlixelDefaultAsset
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<?>)
Creates a new handle. Content is not fetched until FlixelDefaultAsset.get() is first called.
Parameters:
| Name | Description |
|---|---|
assets | The owning asset manager. |
path | Normalized asset path. |
rawType | The libGDX raw type registered with the underlying AssetManager (e.g. String.class). |
Methods
getPath()
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()
getLoaded()
Returns whether this asset has been loaded into memory.
isPersist()
getPersist()
Returns whether this asset is marked to persist across state transitions.