Llorx Posted April 3, 2016 Share Posted April 3, 2016 Hi, I'm testing some things with Phaser and I like it a lot. I have my own scaling model, where I do my calculations and after that I run this: var realwidth = 600; // Real game width, without scaling. I use this var to do my position calculations PTM = scaledwidth/realwidth; game.world.scale.set(PTM); game.scale.setGameSize(scaledwidth, scaledheight); This way, all my game is scaled perfectly. One problem is that elsewhere in my code I have this: game.world.setBounds(0, -1000000000000, realwidth, 2000000000000); // Infinite heigth. Whatever xD The problem is that when I do game.scale.setGameSize(scaledwidth, scaledheight); with a size higher that realwidth, the world bounds are increased altough they are actually scaled with game.world.scale.set(PTM); (saw looking at game.world.bounds) so, if I have world bounds with size 600, if the scaled width is 700, the world bounds are set to 700, but because all the world is also scaled with game.world.scale.set(PTM); (including bounds) then in reality I came up with bounds bigger than my realwidth. I can workaround this by calling game.world.setBounds each time after calling game.scale.setGameSize, but I don't think that this is the way to go. Maybe the engine should check if the world is scaled before touching the bounds and increase or decrease the bounds depending on the scaling factor. Or maybe check if the bounds are set manually and do not modify them if the user has touched them. Or maybe simply add a note on the wiki under setGameSize telling that the world bounds are touched. Got pissed off for 2 days looking why this was happening. PD: Don't know why, can't set first code block to JavaScript xD Link to comment Share on other sites More sharing options...
rich Posted April 4, 2016 Share Posted April 4, 2016 It's a behaviour, not a bug. Do a pull request to add it into the docs (not the wiki, no-one looks at the wiki). Link to comment Share on other sites More sharing options...
Llorx Posted April 4, 2016 Author Share Posted April 4, 2016 Don't see nothing here to edit: http://phaser.io/docs/2.4.6/Phaser.ScaleManager.html#setGameSize The docs is the commented section on GitHub, before each function? Link to comment Share on other sites More sharing options...
Recommended Posts