craidencool Posted June 19, 2016 Share Posted June 19, 2016 Hi guuys! can you help me, I have read a lot of tutorial regarding scaling game sizes in different mobile screens but none is seems to work for me. can you help me how to scale game in portrait mode to different screen sizes? thank you so much! Link to comment Share on other sites More sharing options...
kikemx78 Posted June 19, 2016 Share Posted June 19, 2016 Don't know if this can help.... Go check out my code on www.e-sant.com/EA/fullScreen/ www.e-sant.com/EA/fullScreen/mobile/ thefootballguy 1 Link to comment Share on other sites More sharing options...
craidencool Posted June 19, 2016 Author Share Posted June 19, 2016 1 minute ago, kikemx78 said: Don't know if this can help.... Go check out my code on www.e-sant.com/EA/fullScreen/ www.e-sant.com/EA/fullScreen/mobile/ thank you sir! Link to comment Share on other sites More sharing options...
craidencool Posted June 20, 2016 Author Share Posted June 20, 2016 18 hours ago, kikemx78 said: Don't know if this can help.... Go check out my code on www.e-sant.com/EA/fullScreen/ www.e-sant.com/EA/fullScreen/mobile/ sir in your boot state var w = screen.width; var h = screen.height; var gW = 0; var gH = 0; var mW = 0; var mH = 0; var displaySize = ""; if ( w <= 599 ){ gW = 568; gH = 320; mW = 599; mH = 399; displaySize = "SM"; } if ( w >= 600 && w < 839 ){ gW = 736; gH = 414; mW = 839; mH = 560; displaySize = "NL"; } if ( w >= 840 && w < 1199 ){ gW = 960; gH = 541; mW = 1199; mH = 675; displaySize = "LG"; } if ( w >= 1200 && w < 1921){ gW = 1770; gH = 948; mW = 1921; mH = 1055; displaySize = "XXL"; } if ( w == 1024 && h == 768 ){ gW = w; gH = h; mW = w; mH = h; displaySize = "iPad"; } what does this code do? thank you so much! Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted June 20, 2016 Share Posted June 20, 2016 var configuration = { 'canvas_width_max' : 2048, 'canvas_width' : 1000, 'canvas_height_max' : 2048, 'canvas_height' : 650, 'scale_ratio' : 1, 'aspect_ratio' : 1, }; configuration.canvas_width = window.screen.availWidth * window.devicePixelRatio; configuration.canvas_height = window.screen.availHeight * window.devicePixelRatio; configuration.aspect_ratio = configuration.canvas_width / configuration.canvas_height; if (configuration.aspect_ratio < 1) configuration.scale_ratio = configuration.canvas_height / configuration.canvas_height_max; else configuration.scale_ratio = configuration.canvas_width / configuration.canvas_width_max; game = new Phaser.Game(configuration.canvas_width, configuration.canvas_height, options.render, 'gamewindow'); this.game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.scale.refresh(); sprite.scale.set(configuration.scale_ratio); Link to comment Share on other sites More sharing options...
kikemx78 Posted June 21, 2016 Share Posted June 21, 2016 Newbie_HelpMe I did that to detect display's resolution as I need to load a different set of assets depending on that: screen's resolution. Link to comment Share on other sites More sharing options...
Recommended Posts