FlixelDefaultAssetManager
View sourceclass
org.flixelgdx.asset.FlixelDefaultAssetManager
Default concrete asset manager for FlixelGDX.
Maintains a single ObjectMap<String, FlixelAsset<?>> cache as the source of truth. The underlying libGDX AssetManager is used only for async I/O; once a raw asset is available, game code works exclusively with the typed FlixelAsset handles returned by FlixelDefaultAssetManager.get(String).
Loaders are registered per file extension. The constructor registers defaults for images (.png, .jpg, .jpeg, .webp), audio (.mp3, .ogg, .wav, .flac), and text (.txt, .xml, .json). Add custom extensions via FlixelDefaultAssetManager.registerLoader(...).
Compressed textures: FlixelGame.create() calls FlixelDefaultAssetManager.enableCompressedTextures() automatically on every backend so .png requests transparently prefer a .ktx2 sibling when one exists.
Recommended usage: Access via Flixel.assets.
Web audio pre-decoding: any FlixelDefaultAssetManager.load(String) call for an audio path automatically triggers background audio decoding on the web platform (ApplicationType.WebGL). By the time the loading state finishes the decoded buffer is cached and FlixelSoundManager.play returns instantly. On desktop and Android this is a no-op.
// Inside of a loading state.
Flixel.assets.load("music/inst.mp3");
Flixel.assets.load("music/voices.mp3");
Flixel.assets.finishLoading();
// Game state, with buffers already decoded.
Flixel.sound.play("music/inst.mp3");
Flixel.sound.play("music/voices.mp3");
Experts: FlixelDefaultAssetManager.getManager() exposes the underlying AssetManager for custom loaders, asset descriptors, or raw APIs not wrapped here.
Constructors
FlixelDefaultAssetManager()
Constructs a new manager with default loaders for images, audio, and text.
Methods
load(String)
load(String, boolean)
get(String)
peek(String)
registerLoader(String, Class<?>, FlixelAssetLoader<T>)
unregisterLoader(String)
register(FlixelAsset<?>)
allocateSyntheticKey()
getManager()
enableCompressedTextures()
isCompressedTexturesEnabled()
getCompressedTexturesEnabled()
Returns whether KTX2/BasisU compressed texture loading is enabled.