mirror of
https://github.com/wassname/phaser.git
synced 2026-07-16 01:20:13 +08:00
When Phaser loads images they are now added to the PIXI.BaseTextureCache. Also when it loads atlas data (regardless of the 3 formats) they are converted into PIXI TextureCache entries using UUIDs to avoid name clashes and to support index based atlases.
This commit is contained in:
+9
-3
@@ -71,6 +71,8 @@ Phaser.Cache.prototype = {
|
||||
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight };
|
||||
this._images[key].frameData = Phaser.Animation.Parser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax);
|
||||
|
||||
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -84,17 +86,19 @@ Phaser.Cache.prototype = {
|
||||
|
||||
this._images[key] = { url: url, data: data, spriteSheet: true };
|
||||
|
||||
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
|
||||
|
||||
if (format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY)
|
||||
{
|
||||
this._images[key].frameData = Phaser.Animation.Parser.JSONData(this.game, atlasData);
|
||||
this._images[key].frameData = Phaser.Animation.Parser.JSONData(this.game, atlasData, key);
|
||||
}
|
||||
else if (format == Phaser.Loader.TEXTURE_ATLAS_JSON_HASH)
|
||||
{
|
||||
this._images[key].frameData = Phaser.Animation.Parser.JSONDataHash(this.game, atlasData);
|
||||
this._images[key].frameData = Phaser.Animation.Parser.JSONDataHash(this.game, atlasData, key);
|
||||
}
|
||||
else if (format == Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)
|
||||
{
|
||||
this._images[key].frameData = Phaser.Animation.Parser.XMLData(this.game, atlasData, format);
|
||||
this._images[key].frameData = Phaser.Animation.Parser.XMLData(this.game, atlasData, key);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -109,6 +113,8 @@ Phaser.Cache.prototype = {
|
||||
|
||||
this._images[key] = { url: url, data: data, spriteSheet: false };
|
||||
|
||||
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user