FlxAssets
Typed, explicitly asynchronous facade over PixiJS v8 Assets.
export declare class FlxAssetsConstructors
constructor(backend?: FlxAssetBackend)Constructs a new instance of the FlxAssets class
| Parameter | Type | Description |
|---|---|---|
backend | FlxAssetBackend | - |
Methods
add()
add(descriptor: FlxAssetDescriptor | FlxAssetDescriptor[]): thisParameters:
| Parameter | Type | Description |
|---|---|---|
descriptor | FlxAssetDescriptor | FlxAssetDescriptor[] | - |
Returns: this
addBundle()
addBundle(name: string, assets: FlxAssetDescriptor[]): thisParameters:
| Parameter | Type | Description |
|---|---|---|
name | string | - |
assets | FlxAssetDescriptor[] | - |
Returns: this
backgroundLoad()
backgroundLoad(ids: string | string[]): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
ids | string | string[] | - |
Returns: Promise<void>
backgroundLoadBundle()
backgroundLoadBundle(names: string | string[]): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
names | string | string[] | - |
Returns: Promise<void>
failureFor()
failureFor(id: string): FlxAssetLoadError | undefinedParameters:
| Parameter | Type | Description |
|---|---|---|
id | string | - |
Returns: FlxAssetLoadError | undefined
static fromContext()
static fromContext(context: FlxContext): FlxAssets | undefinedParameters:
| Parameter | Type | Description |
|---|---|---|
context | FlxContext | - |
Returns: FlxAssets | undefined
get()
get<T>(id: string): T | undefinedParameters:
| Parameter | Type | Description |
|---|---|---|
id | string | - |
Returns: T | undefined
getBitmapFont()
getBitmapFont(id: string): FlxBitmapFont | undefinedReturn an already-loaded Pixi bitmap font as a non-owning engine wrapper.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | - |
Returns: FlxBitmapFont | undefined
getGraphic()
getGraphic(id: string): FlxGraphic | undefinedParameters:
| Parameter | Type | Description |
|---|---|---|
id | string | - |
Returns: FlxGraphic | undefined
init()
init(options?: FlxAssetInitOptions): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
options | FlxAssetInitOptions | - |
Returns: Promise<void>
install()
install(context: FlxContext): thisParameters:
| Parameter | Type | Description |
|---|---|---|
context | FlxContext | - |
Returns: this
isLoaded()
isLoaded(id: string): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
id | string | - |
Returns: boolean
load()
load<T>(id: string | FlxAssetDescriptor, options?: FlxAssetLoadOptions): Promise<T>Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | FlxAssetDescriptor | - |
options | FlxAssetLoadOptions | - |
Returns: Promise<T>
loadBitmapFont()
loadBitmapFont(id: string | FlxAssetDescriptor, options?: FlxAssetLoadOptions): Promise<FlxBitmapFont>Load a .fnt/.xml bitmap font and every page it references. Page textures and the Pixi font remain owned by the asset cache.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | FlxAssetDescriptor | - |
options | FlxAssetLoadOptions | - |
Returns: Promise<FlxBitmapFont>
loadBundle()
loadBundle<T = Record<string, unknown>>(name: string | string[], onProgress?: (progress: number) => void): Promise<T>Parameters:
| Parameter | Type | Description |
|---|---|---|
name | string | string[] | - |
onProgress | (progress: number) => void | - |
Returns: Promise<T>
loadGraphic()
loadGraphic(id: string | FlxAssetDescriptor, options?: FlxAssetLoadOptions): Promise<FlxGraphic>Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | FlxAssetDescriptor | - |
options | FlxAssetLoadOptions | - |
Returns: Promise<FlxGraphic>
unload()
unload(id: string | string[]): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | string[] | - |
Returns: Promise<void>
unloadBundle()
unloadBundle(name: string | string[]): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
name | string | string[] | - |
Returns: Promise<void>