Jump to content

Question about scale mode SHOW_ALL in 2.2


richpixel
 Share

Recommended Posts

Pre v2.2 I always used scale mode SHOW_ALL like this:

 

    this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    this.scale.pageAlignHorizontally = true;
    this.scale.pageAlignVertically = false;
    this.scale.setScreenSize(true);
 

 

On a desktop browser, this always kept my entire game in view, regardless of how small I made the browser - either height or width.

 

Now my code looks like this:

 

    this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    this.scale.setMinMax(1024/2, 672/2, 1024*2, 672*2);
    this.scale.pageAlignHorizontally = true;
    this.scale.pageAlignVertically = false;
 

 

(The game parent is a div with no css attached to it)

 

Now the game fills the browser width - scaling it up usually, and in order to maintain aspect ratio the height is also scaled up, meaning I have to scroll down to see the bottom part of the game. Pre 2.2, it used the 'minimum scale' in order to scale the game - ie. the height was smaller so it used that to determine a scale to be applied to both width and height. It appears that now it uses the maximum scale...

 

When I resize the browser window width, the game rescales, but if I change the height it doesn't. Hoping there is a property or something easy to set to make it use the minimum scale again! Thanks a lot

 

Link to comment
Share on other sites

  • 1 month later...

Hi guys,

 

I have had the same problem as you with this issue, since upgrading to 2.2.2. After alot of headbanging (as I needed to keep the parent container too) I've finally found the change needed to make it work.

 

On your boot state, add the following line so the game knows to use the bottom of your screen as a contraint:-

game.scale.windowConstraints.bottom = "visual";

Hope this helps!

 

Cameron

Link to comment
Share on other sites

  • 6 months later...

Hi guys,

 

I have had the same problem as you with this issue, since upgrading to 2.2.2. After alot of headbanging (as I needed to keep the parent container too) I've finally found the change needed to make it work.

 

On your boot state, add the following line so the game knows to use the bottom of your screen as a contraint:-

game.scale.windowConstraints.bottom = "visual";

Hope this helps!

 

Cameron

 

Cameron, thank you! You are my rescuer :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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