@@ -294,8 +294,42 @@ Phaser.Cache.prototype = {
294294 * @param {object } data - Extra image data.
295295 * @return {object } The full image object that was added to the cache.
296296 */
297- addImage : function ( key , url , data ) {
297+ addImage : function ( key , url , data )
298+ {
299+ if ( this . checkImageKey ( key ) )
300+ {
301+ this . removeImage ( key ) ;
302+ }
303+
304+ console . log ( 'Cache.addImage' , key ) ;
305+
306+ var img = {
307+ key : key ,
308+ url : url ,
309+ data : data ,
310+ texture : this . game . textures . addImage ( key , data )
311+ } ;
312+
313+ this . _cache . image [ key ] = img ;
314+
315+ this . _resolveURL ( url , img ) ;
316+
317+ // Remove this
318+ if ( key === '__default' )
319+ {
320+ Phaser . Cache . DEFAULT = this . game . textures . getFrame ( '__default' ) ;
321+ }
322+ else if ( key === '__missing' )
323+ {
324+ Phaser . Cache . MISSING = this . game . textures . getFrame ( '__missing' ) ;
325+ }
326+
327+ return img ;
328+
329+ } ,
298330
331+ __addImage : function ( key , url , data )
332+ {
299333 if ( this . checkImageKey ( key ) )
300334 {
301335 this . removeImage ( key ) ;
@@ -347,10 +381,10 @@ Phaser.Cache.prototype = {
347381 var obj = this . addImage ( '__default' , null , img ) ;
348382
349383 // Because we don't want to invalidate the sprite batch for an invisible texture
350- obj . base . skipRender = true ;
384+ // obj.base.skipRender = true;
351385
352386 // Make it easily available within the rest of Phaser / Pixi
353- Phaser . Cache . DEFAULT = new PIXI . Texture ( obj . base ) ;
387+ // Phaser.Cache.DEFAULT = new PIXI.Texture(obj.base);
354388
355389 } ,
356390
@@ -372,7 +406,7 @@ Phaser.Cache.prototype = {
372406 var obj = this . addImage ( '__missing' , null , img ) ;
373407
374408 // Make it easily available within the rest of Phaser / Pixi
375- Phaser . Cache . MISSING = new PIXI . Texture ( obj . base ) ;
409+ // Phaser.Cache.MISSING = new PIXI.Texture(obj.base);
376410
377411 } ,
378412
0 commit comments