Events
assetFilesChange(newFiles:ReadOnlyMap<String, Float>, previousFiles:ReadOnlyMap<String, Float>):Void
Static variables
Static methods
Constructor
Variables
runtimeAssets:RuntimeAssets = null
If set, will be provided to each added asset in this Assets
instance.
parent:Assets = null
If provided, when requesting an asset, it will also check if the parent Assets
instance has it and return it if that's the case.
atlasPacker:TextureAtlasPacker = null
A shared texture atlas packer that can be used to merge smaller textures together.
Also required when loading some kind of assets, like .ase
/.aseprite
files.
Methods
addAll(?pathPattern:EReg):Void
Add all assets matching given path pattern (if provided)
Parameters:
null | pathPattern |
---|
ensure(id:AssetId<Dynamic>, ?variant:String, ?options:Null<AssetOptions>, done:Asset ‑> Void):Void
Ensures and asset is loaded and return it on the callback.
This will check if the requested asset is currently being loaded,
already loaded or should be added and loaded. In all cases, it will try
its best to deliver the requested asset or null
if something went wrong.
ensureImage(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:ImageAsset ‑> Void):Void
ensureFont(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:FontAsset ‑> Void):Void
ensureAtlas(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:AtlasAsset ‑> Void):Void
ensureText(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:TextAsset ‑> Void):Void
ensureSound(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:SoundAsset ‑> Void):Void
ensureDatabase(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:DatabaseAsset ‑> Void):Void
ensureShader(name:Either<String, AssetId<String>>, ?variant:String, ?options:Null<AssetOptions>, done:ShaderAsset ‑> Void):Void
watchDirectory(?path:String, hotReload:Bool = true):WatchDirectory
Watch the given asset directory. Any change will fire assetFilesChange
event.
If hotReload
is set to true
(its default), related assets will be hot reloaded
when their file changes on disk.
Behavior may differ depending on the platfom.
When using web target via electron, be sure to add ceramic_use_electron
define.
Parameters:
path | The assets path to watch. You could use |
---|---|
hotReload |
|
Returns:
WatchDirectory instance used internally