Constructor
new SpriteRegistry()
Create a new sprite registry.
Methods
get(id) → {LayeredSprite|null}
Get a sprite with specified identifier.
Parameters:
Name | Type | Description |
---|---|---|
id | string | Identifier 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:
Name | Type | Default | Description |
---|---|---|---|
id | string | The unique ID of the Sprite | |
src | string | The image src of the Sprite | |
configs | Object.<string, Object> | Custom partition configurations | |
width | number | | null | Default width of the Sprite (optional) |
height | number | | null | Default height of the Sprite (optional) |
path(p)
Set the working directory for importing sprites.
Parameters:
Name | Type | Description |
---|---|---|
p | string | New working path |