Jump to content

Exact fit with variable height


JoseDu
 Share

Recommended Posts

Hi everyone,

I really want to use whole browser window but keep my game correctly scaled.

 

Is there any easy way how to make game height variable with fixed width using current scale modes? I've tried several approaches without any luck.

 

Same resize method but horizontal (which doesn't really matter) can be seen for example on http://www.goodboydigital.com/runpixierun/

 

que.jpg

 

Thanks a lot!

 

 

Link to comment
Share on other sites

Hi JoseDu,

 

Here's a +1 for your inquiry, since I need the same behavior for one of my games (I'd like to make full use of the screen without distorting anything, as well), but from all I can see there is no such scale mode that handles what you ask for all by itself.

 

It'd be great, if that were possible from somewhere within Phaser since it provides all those handy utilities for detecting devices, OSs and stuff. A scale mode that would take care of this all by itself would be brilliant, but I'd already be happy, if I could simply adjust canvas/game size after setting stage scaling to NO_SCALE.

 

Looking at the code, though, everything seems to be pretty much set in stone once the game and its Pixi based renderer have been initialized. Is that correct or have I overlooked something?

 

So, I'm asking a slightly different question: Is there a simple way to set the size of a non-scaled game canvas from within Phaser?

Link to comment
Share on other sites

Thanks Rich!

 

If I understand it correctly, this can be helpful only during game initialisation. But I need to be able to update canvas/game/stage (sorry, I'm little bit confused how to call rendered area) dimensions even during window resize or device rotation as Starnut mentioned. Is there any easy way how to do it?

Link to comment
Share on other sites

  • 3 months later...

Please see my feature request regarding real resizing. Maybe Rich will integrate it some day. 

https://github.com/photonstorm/phaser/issues/642

 

You could also try it yourself.

Attach a window resize handler, use the method game.renderer.resize and update the settings of the phaser world like world bounds and the input bounds. Unfortunately you can't simply use my example in the github issue. There are some missing parts.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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