Skip to content

Class: PixiResourceManager ​

Defined in: packages/ssplayer-pixi/dist/index.d.ts:680

Implements ​

Constructors ​

Constructor ​

new PixiResourceManager(): PixiResourceManager

Returns ​

PixiResourceManager

Properties ​

beforeFree ​

beforeFree: (() => void) | null

Defined in: packages/ssplayer-pixi/dist/index.d.ts:685

Called before reset destroys textures, for whoever still draws from them.

Methods ​

bindTextureSource() ​

bindTextureSource(source, hash): void

Defined in: packages/ssplayer-pixi/dist/index.d.ts:701

Parameters ​

source ​

HTMLCanvasElement | ImageBitmap | HTMLImageElement

hash ​

number

Returns ​

void


clearOverrideTexture() ​

clearOverrideTexture(hash): void

Defined in: packages/ssplayer-pixi/dist/index.d.ts:712

Drop the override for hash, restoring the originally loaded texture.

Parameters ​

hash ​

number

Returns ​

void

Implementation of ​

IResourceManager.clearOverrideTexture


destroy() ​

destroy(): void

Defined in: packages/ssplayer-pixi/dist/index.d.ts:716

Frees all managed resources.

Returns ​

void

Implementation of ​

IResourceManager.destroy


getOverrideTexture() ​

getOverrideTexture(hash): Texture<TextureSource<any>> | undefined

Defined in: packages/ssplayer-pixi/dist/index.d.ts:714

The current override for hash (never the original), or undefined.

Parameters ​

hash ​

number

Returns ​

Texture<TextureSource<any>> | undefined

Implementation of ​

IResourceManager.getOverrideTexture


getTexture() ​

getTexture(hash): Texture<TextureSource<any>> | undefined

Defined in: packages/ssplayer-pixi/dist/index.d.ts:702

Gets a loaded texture by its hash.

Parameters ​

hash ​

number

The hash of the texture.

Returns ​

Texture<TextureSource<any>> | undefined

The engine-specific texture object (e.g. PIXI.Texture).

Implementation of ​

IResourceManager.getTexture


loadTexture() ​

loadTexture(url, hash): Promise<void>

Defined in: packages/ssplayer-pixi/dist/index.d.ts:692

Load url and bind it under hash. Cached in Pixi's global Assets under the URL, deliberately not under the hash: the hash is a cell-map name hash, unique only within one .ssab, so aliasing on it hands one project another project's atlas.

Parameters ​

url ​

string

hash ​

number

Returns ​

Promise<void>

Implementation of ​

IResourceManager.loadTexture


loadTextureFromBytes() ​

loadTextureFromBytes(bytes, hash): Promise<void>

Defined in: packages/ssplayer-pixi/dist/index.d.ts:700

Decode raw (encoded) image bytes — e.g. a PNG embedded in the SSAB via the converter's --embedded mode — into a texture under hash. Uses the same createImageBitmap + premultiply-alpha-on-upload (ImageSource default) as Pixi's own URL texture loader, so embedded and external textures render identically.

Parameters ​

bytes ​

Uint8Array

hash ​

number

Returns ​

Promise<void>

Implementation of ​

IResourceManager.loadTextureFromBytes


reset() ​

reset(): void

Defined in: packages/ssplayer-pixi/dist/index.d.ts:715

Optional: forget every texture bound for the previously bound pack, so the next one loads its own from scratch. Called by the core from bindResource; a manager that caches by hash must implement it. Must also drop any runtime texture overrides — they belong to the previous pack's hashes.

Returns ​

void

Implementation of ​

IResourceManager.reset


setOverrideTexture() ​

setOverrideTexture(hash, texture): void

Defined in: packages/ssplayer-pixi/dist/index.d.ts:710

Runtime texture replacement: bind texture for hash, shadowing the originally loaded texture. Caller-owned — not destroyed here. The pixi shader/mesh caches are keyed by the Texture object, so the new texture gets its own shader on the next draw and the swap is picked up automatically; the stale entry is dropped at the next pack load.

Parameters ​

hash ​

number

texture ​

Texture

Returns ​

void

Implementation of ​

IResourceManager.setOverrideTexture