mirror of
https://github.com/photonstorm/phaser
synced 2024-09-21 06:51:55 +00:00
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:
parent
90eec97707
commit
f6935c01f8
2 changed files with 10 additions and 6 deletions
1
build/phaser.d.ts
vendored
1
build/phaser.d.ts
vendored
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue