Sign in to follow this  
richpixel

Question about scale mode SHOW_ALL in 2.2

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.