Jump to content

2.0.0 - this.game.stage.scale.setScreenSize is not a function


Recommended Posts

The code below worked in previous version and it allowed me to re-size the canvas when the window re-sizes but it isn't working in 2.0.0?




this.game.stage.scale.setScreenSize is not a function


If i comment it out it works but the screen doesn't re-size. It doesn't look like it has changed in library and the function setScreenSize doesnt appear on the console log too. 


anyways here is the rest of the code.


 if (this.game.device.desktop){
            this.game.stage.scaleMode = Phaser.ScaleManager.SHOW_ALL;
            this.game.stage.scale.minWidth = 480;
            this.game.stage.scale.minHeight = 260;
            this.game.stage.scale.maxWidth = 1024;
            this.game.stage.scale.maxHeight = 768;
            this.game.stage.scale.pageAlignHorizontally = true;
            this.game.stage.scale.pageAlignVertically = true;
Any ideas how it would work in 2.0.0? and thanks for the help.
Link to comment
Share on other sites

I think you just need to remove 'stage' in the 2.0 api

 this.game.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.scale.minWidth = 480; this.game.scale.minHeight = 260; this.game.scale.maxWidth = 1024; this.game.scale.maxHeight = 768; this.game.scale.pageAlignHorizontally = true; this.game.scale.pageAlignVertically = true; this.game.scale.setScreenSize(true);
Link to comment
Share on other sites

Paste in the code you're using, but before doing that please look at the resources/Project Templates folder and the Boot.js files in there, as they show the updated way to do it. Also this bit from above:

this.game.scaleMode = Phaser.ScaleManager.SHOW_ALL;

Should be:

this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;

Or if you're using proper States you can just do it like this:

this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;this.scale.minWidth = 480;this.scale.minHeight = 260;this.scale.maxWidth = 1024;this.scale.maxHeight = 768;this.scale.forceLandscape = true;this.scale.pageAlignHorizontally = true;this.scale.setScreenSize(true);
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...