mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
|
/**
|
||
|
* Note that 'this' in all functions here refer to the owning object.
|
||
|
* For example the Group, Stage, Sprite, etc. because the render function
|
||
|
* here is mapped to the prototype for the game object.
|
||
|
*/
|
||
|
Phaser.Renderer.WebGL.GameObjects.Container = {
|
||
|
|
||
|
render: function (renderer)
|
||
|
{
|
||
|
if (this.visible === false || this.alpha === 0 || this.children.length === 0)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (this._cacheAsBitmap)
|
||
|
{
|
||
|
return this.renderCachedSprite(renderer);
|
||
|
}
|
||
|
|
||
|
var i;
|
||
|
|
||
|
if (this._mask || this._filters)
|
||
|
{
|
||
|
// push filter first as we need to ensure the stencil buffer is correct for any masking
|
||
|
if (this._filters)
|
||
|
{
|
||
|
renderer.spriteBatch.flush();
|
||
|
renderer.filterManager.pushFilter(this._filterBlock);
|
||
|
}
|
||
|
|
||
|
if (this._mask)
|
||
|
{
|
||
|
renderer.spriteBatch.stop();
|
||
|
renderer.pushMask(this.mask);
|
||
|
renderer.spriteBatch.start();
|
||
|
}
|
||
|
|
||
|
// simple render children!
|
||
|
for (i = 0; i < this.children.length; i++)
|
||
|
{
|
||
|
this.children[i].render(renderer);
|
||
|
}
|
||
|
|
||
|
renderer.spriteBatch.stop();
|
||
|
|
||
|
if (this._mask)
|
||
|
{
|
||
|
renderer.popMask(this._mask);
|
||
|
}
|
||
|
|
||
|
if (this._filters)
|
||
|
{
|
||
|
renderer.filterManager.popFilter();
|
||
|
}
|
||
|
|
||
|
renderer.spriteBatch.start();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// simple render children!
|
||
|
for (i = 0; i < this.children.length; i++)
|
||
|
{
|
||
|
this.children[i].render(renderer);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
|
||
|
renderCachedSprite: function (renderer)
|
||
|
{
|
||
|
// TODO
|
||
|
return renderer;
|
||
|
}
|
||
|
|
||
|
};
|