Skip to content

Commit d663d29

Browse files
committed
hasFrameData added and some LoadTexture updates.
1 parent 8dd3e06 commit d663d29

2 files changed

Lines changed: 594 additions & 546 deletions

File tree

src/gameobjects/components/LoadTexture.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Phaser.Component.LoadTexture.prototype = {
5050

5151
this.key = key;
5252
this.customRender = false;
53+
var cache = this.game.cache;
5354

5455
var setFrame = true;
5556
var smoothed = !this.texture.baseTexture.scaleMode;
@@ -63,12 +64,11 @@ Phaser.Component.LoadTexture.prototype = {
6364
{
6465
this.customRender = true;
6566

66-
// This works from a reference, which probably isn't what we need here
6767
this.setTexture(key.texture);
6868

69-
if (this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA))
69+
if (cache.hasFrameData(key.key, Phaser.Cache.BITMAPDATA))
7070
{
71-
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
71+
setFrame = !this.animations.loadFrameData(cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
7272
}
7373
}
7474
else if (Phaser.Video && key instanceof Phaser.Video)
@@ -93,7 +93,7 @@ Phaser.Component.LoadTexture.prototype = {
9393
this.key = '__default';
9494
this.setTexture(PIXI.TextureCache[this.key]);
9595
}
96-
else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
96+
else if (typeof key === 'string' && !cache.checkImageKey(key))
9797
{
9898
console.warn("Texture with key '" + key + "' not found.");
9999
this.key = '__missing';
@@ -103,7 +103,7 @@ Phaser.Component.LoadTexture.prototype = {
103103
{
104104
this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key]));
105105

106-
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame);
106+
setFrame = !this.animations.loadFrameData(cache.getFrameData(key), frame);
107107
}
108108
}
109109

0 commit comments

Comments
 (0)