Skip to content

Commit 02e8b1a

Browse files
committed
If you set Game.renderType to Phaser.HEADLESS it will no longer render the output to the canvas. The canvas is still created (although not added to the DOM), as it's required internally, but no rendering now takes place on it (thanks @ForgeableSum phaserjs#2464)
1 parent ac89d1a commit 02e8b1a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
358358
* Fixed an issue in the Arcade Physics overlap method where it would only detect overlaps up to the max bias threshold and no further (thanks @rgk #2441)
359359
* InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio #2466)
360360
* Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames #2470)
361+
* If you set Game.renderType to `Phaser.HEADLESS` it will no longer render the output to the canvas. The canvas is still created (although not added to the DOM), as it's required internally, but no rendering now takes place on it (thanks @ForgeableSum #2464)
361362

362363
### Pixi Updates
363364

src/core/Game.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,14 @@ Phaser.Game.prototype = {
950950

951951
this.state.preRender(elapsedTime);
952952

953-
this.renderer.render(this.stage);
953+
if (this.renderType !== Phaser.HEADLESS)
954+
{
955+
this.renderer.render(this.stage);
954956

955-
this.plugins.render(elapsedTime);
957+
this.plugins.render(elapsedTime);
956958

957-
this.state.render(elapsedTime);
959+
this.state.render(elapsedTime);
960+
}
958961

959962
this.plugins.postRender(elapsedTime);
960963

0 commit comments

Comments
 (0)