Sprite.loadTexture will store the smoothed property of the Sprite and re-apply it once the new texture is loaded.

This commit is contained in:
photonstorm 2014-07-16 00:56:26 +01:00
parent 90eec97707
commit f6935c01f8
2 changed files with 10 additions and 6 deletions

1
build/phaser.d.ts vendored
View file

@ -1126,6 +1126,7 @@ declare module Phaser {
setFrame(frameId?: any, useLocalFrameIndex?: boolean): void;
stop(resetFrame?: boolean, dispatchComplete?: boolean): void;
update(): boolean;
updateFrameData(frameData: Phaser.FrameData): void;
}

View file

@ -361,9 +361,15 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
frame = frame || 0;
if (stopAnimation || typeof stopAnimation === 'undefined')
{
this.animations.stop();
}
this.key = key;
var setFrame = true;
var smoothed = this.smoothed;
if (key instanceof Phaser.RenderTexture)
{
@ -395,10 +401,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
{
this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key]));
if (this.animations)
{
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame);
}
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame);
}
}
@ -407,9 +410,9 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
this._frame = Phaser.Rectangle.clone(this.texture.frame);
}
if (stopAnimation || typeof stopAnimation === 'undefined')
if (!smoothed)
{
this.animations.stop();
this.smoothed = false;
}
};