SpriteRegistry

Global registry for sprites.

Constructor

new SpriteRegistry()

Create a new sprite registry.

Methods

get(id) → {LayeredSprite|null}

Get a sprite with specified identifier.
Parameters:
NameTypeDescription
idstringIdentifier of sprite
Returns:
Sprite with specified identifier, or null if it does not exist.
Type: 
LayeredSprite | null

load(id, src, configs, width, height)

Add a new Sprite to the registry.
Parameters:
NameTypeDefaultDescription
idstringThe unique ID of the Sprite
srcstringThe image src of the Sprite
configsObject.<string, Object>Custom partition configurations
widthnumber | nullnullDefault width of the Sprite (optional)
heightnumber | nullnullDefault height of the Sprite (optional)

path(p)

Set the working directory for importing sprites.
Parameters:
NameTypeDescription
pstringNew working path