Skip to content

Commit ff2caee

Browse files
committed
Some quick Image tests (will need to move to Sprite soon)
1 parent c5088d4 commit ff2caee

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/gameobjects/image/Image.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Phaser.GameObject.Image = function (game, x, y, key, frame)
3535

3636
this.frame = this.texture.get(frame);
3737

38+
this.children = new Phaser.Component.Children(this);
39+
3840
// Allows you to turn off a GO from rendering, but still render its children
3941
this.skipRender = (key === undefined);
4042

@@ -60,7 +62,8 @@ Phaser.GameObject.Image.prototype.constructor = Phaser.GameObject.Image;
6062
*/
6163
Phaser.GameObject.Image.prototype.preUpdate = function ()
6264
{
63-
// this.transform.update();
65+
this.transform.update();
66+
// this.children.update();
6467
};
6568

6669
Phaser.GameObject.Image.prototype.update = function ()

src/gameobjects/image/ImageCanvasRenderer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ Phaser.Renderer.Canvas.GameObjects.Image = {
7373

7474
renderer.context.drawImage(source.image, frame.cutX, frame.cutY, cw, ch, dx, dy, cw / resolution, ch / resolution);
7575

76+
// TEMP TEST!
77+
for (var i = 0; i < src.children.list.length; i++)
78+
{
79+
var child = src.children.list[i];
80+
81+
child.render(renderer, child);
82+
}
83+
7684
/*
7785
// Move this to either the Renderer, or the Texture Manager, but not here (as it's repeated all over the place)
7886
if (src.texture.rotated)

src/renderer/canvas/CanvasRenderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ Phaser.Renderer.Canvas.prototype = {
183183
*/
184184
render: function (stage)
185185
{
186+
// this first setTransform, alpha, etc could all be set direct
187+
// from the Stage values - as they're the basis really
188+
186189
this.context.setTransform(1, 0, 0, 1, 0, 0);
187190
this.context.globalAlpha = 1;
188191
this.context.globalCompositeOperation = 'source-over';

0 commit comments

Comments
 (0)