JSON Posted June 5, 2017 Share Posted June 5, 2017 Hey, so I almost finished my game, and I'm encountering a problem in scaling. I first used Window.Innerheight and Window.innerwidth for the game size The problem is that when I start the game on browser that is not maximized, and then maximize it after loading the game, the sprites scale up too big. I used game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.refresh(); So I decided to just load the game in maximized innerheight and innerwidth. But I do not know how to do that or if it's possible. Is there any way to find the window.innerheight and window.innerwidth when the browser is MAXIMIZED or FULLSCREEN? THANKS Link to comment Share on other sites More sharing options...
JSON Posted June 5, 2017 Author Share Posted June 5, 2017 For now, I'm using window.availheight and window.availwidth, which is always constant and does not change when the browser size changes. It's not 100% on the point because it does not take into consideration of taskbar size and stuff. So I think I need to offset the position of the sprites? Please let me know if there is any better solution Link to comment Share on other sites More sharing options...
Abhishek Singhal Posted June 8, 2017 Share Posted June 8, 2017 I am not sure , if I understood your problem clearly. in place of using window.availheight and window.availwidth, we may check for window.innerHeight and window.innerWidth. these properties would provide the updated values if browser is resized. Link to comment Share on other sites More sharing options...
aapo Posted June 8, 2017 Share Posted June 8, 2017 On 6/5/2017 at 4:57 PM, JSON said: Hey, so I almost finished my game, and I'm encountering a problem in scaling. I first used Window.Innerheight and Window.innerwidth for the game size The problem is that when I start the game on browser that is not maximized, and then maximize it after loading the game, the sprites scale up too big. Like @Abhishek Singhal said, you definitely can use window.innerWidth and window.innerHeight for your scaling calculations, just make sure to add an event listener to window.onresize and recalculate things when the browser is resized. Scaling definitely isn't a trivial problem to solve, though, so I totally feel your pain in trying to get things perfect. Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts