JoseDu Posted December 14, 2013 Share Posted December 14, 2013 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/ Thanks a lot! Michel (Starnut) 1 Link to comment Share on other sites More sharing options...
Michel (Starnut) Posted December 15, 2013 Share Posted December 15, 2013 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? JoseDu 1 Link to comment Share on other sites More sharing options...
rich Posted December 15, 2013 Share Posted December 15, 2013 You could pass in window.innerHeight as the height value (and 320 for the width). Just understand it will be different for everyone playing. Link to comment Share on other sites More sharing options...
JoseDu Posted December 16, 2013 Author Share Posted December 16, 2013 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 More sharing options...
KrishnaMv Posted April 15, 2014 Share Posted April 15, 2014 Even i have the same need...!! did u found out the ans..??? Link to comment Share on other sites More sharing options...
george Posted April 15, 2014 Share Posted April 15, 2014 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 More sharing options...
Recommended Posts