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:
Richard Davey
2013-08-30 01:50:17 +01:00
parent 4c1dacfa02
commit 559d75eba1
5 changed files with 123 additions and 35 deletions
+9 -3
View File
@@ -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);
},
/**