A wrapper around openfl.utils.Assets which disallows access to the harmful functions.
Later we'll add Funkin-specific caching to this.
Static variables
Static methods
staticexists(path:String, ?type:AssetType):Bool
Determines whether the given asset of the given type exists.
Parameters:
path | The asset path to check |
|---|---|
type | The asset type to check |
Returns:
Whether the asset exists
staticgetBitmapData(path:String, useCache:Bool = true):BitmapData
Load a Bitmap from an asset May cause stutters or throw an error if the asset is not cached
Parameters:
path | The asset path to load from |
|---|
Returns:
The loaded Bitmap image
staticgetBytes(path:String):Bytes
Load bytes from an asset May cause stutters or throw an error if the asset is not cached
Parameters:
path | The asset path to load from |
|---|
Returns:
The byte contents of the file
staticgetLibrary(name:String):AssetLibrary
Retrieves a library with the given name.
Parameters:
name | The name of the library to get. |
|---|
Returns:
The library with the given name.
staticgetMusic(path:String):Sound
Load a Sound file from an asset, with optimizations specific to long-duration music May cause stutters or throw an error if the asset is not cached
Parameters:
path | The asset path to load from |
|---|
Returns:
The loaded sound
staticgetPath(path:String):String
Get the file system path for an asset
Parameters:
path | The asset path to load from, relative to the assets folder |
|---|
Returns:
The path to the asset on the file system
staticgetSound(path:String):Sound
Load a Sound file from an asset May cause stutters or throw an error if the asset is not cached
Parameters:
path | The asset path to load from |
|---|
Returns:
The loaded sound
staticgetText(path:String):String
Load text from an asset. May cause stutters or throw an error if the asset is not cached
Parameters:
path | The asset path to load from |
|---|
Returns:
The text contents of the file
statichasLibrary(name:String):Bool
Checks if a library with the given name exists.
Parameters:
name | The name to check. |
|---|
Returns:
Whether or not the library exists.
staticlist(?type:AssetType):Array<String>
Retrieve a list of all assets of the given type
Parameters:
type | The asset type to check |
|---|
Returns:
A list of asset paths
staticloadBitmapData(path:String):Future<BitmapData>
Load a Bitmap from an asset asynchronously
Parameters:
path | The asset path to load from |
|---|
Returns:
The future which promises to return the loaded Bitmap image
staticloadBytes(path:String):Future<ByteArray>
Load bytes from an asset asynchronously
Parameters:
path | The asset path to load from |
|---|
Returns:
A future which promises to return the byte contents of the file
staticloadLibrary(name:String):Future<AssetLibrary>
Loads a library with the given name.
Parameters:
name | The name of the library to load. |
|---|
Returns:
An AssetLibary object.
staticloadMusic(path:String):Future<Sound>
Load a Sound file from an asset asynchronously, with optimizations specific to long-duration music
Parameters:
path | The asset path to load from |
|---|
Returns:
A future which promises to return the loaded sound