Skip to content

Commit 0cc24d0

Browse files
photonstormclark-stevenson
authored andcommitted
Restored old Image object.
1 parent 0632e87 commit 0cc24d0

4 files changed

Lines changed: 205 additions & 99 deletions

File tree

src/animation/AnimationParser.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ Phaser.AnimationParser = {
7575
// uuid needed?
7676
data.addFrame(new Phaser.Frame(i, x, y, frameWidth, frameHeight, '', uuid));
7777

78+
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[key], {
79+
x: x,
80+
y: y,
81+
width: frameWidth,
82+
height: frameHeight
83+
});
84+
7885
x += frameWidth + spacing;
7986

8087
if (x + frameWidth > width)
@@ -127,6 +134,13 @@ Phaser.AnimationParser = {
127134
uuid
128135
));
129136

137+
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
138+
x: frames[i].frame.x,
139+
y: frames[i].frame.y,
140+
width: frames[i].frame.w,
141+
height: frames[i].frame.h
142+
});
143+
130144
if (frames[i].trimmed)
131145
{
132146
newFrame.setTrim(
@@ -185,6 +199,13 @@ Phaser.AnimationParser = {
185199
uuid
186200
));
187201

202+
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
203+
x: frames[key].frame.x,
204+
y: frames[key].frame.y,
205+
width: frames[key].frame.w,
206+
height: frames[key].frame.h
207+
});
208+
188209
if (frames[key].trimmed)
189210
{
190211
newFrame.setTrim(
@@ -264,7 +285,13 @@ Phaser.AnimationParser = {
264285

265286
newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
266287

267-
// Trimmed?
288+
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
289+
x: x,
290+
y: y,
291+
width: width,
292+
height: height
293+
});
294+
// Trimmed?
268295
if (frameX !== null || frameY !== null)
269296
{
270297
newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight);

src/gameobjects/Button.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You can set a unique texture frame and Sound for any of these states.
1818
*
1919
* @constructor
20-
* @extends Phaser.Sprite
20+
* @extends Phaser.Image
2121
*
2222
* @param {Phaser.Game} game Current game instance.
2323
* @param {number} [x=0] - X position of the Button.
@@ -38,7 +38,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
3838
callback = callback || null;
3939
callbackContext = callbackContext || this;
4040

41-
Phaser.Sprite.call(this, game, x, y, key, outFrame);
41+
Phaser.Image.call(this, game, x, y, key, outFrame);
4242

4343
/**
4444
* @property {number} type - The Phaser Object Type.
@@ -206,7 +206,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
206206

207207
};
208208

209-
Phaser.Button.prototype = Object.create(Phaser.Sprite.prototype);
209+
Phaser.Button.prototype = Object.create(Phaser.Image.prototype);
210210
Phaser.Button.prototype.constructor = Phaser.Button;
211211

212212
/**

0 commit comments

Comments
 (0)