fkkcloud Posted April 21, 2016 Share Posted April 21, 2016 Note5 or Galaxy S6 has devicePixelRatio of 4, how do you guys handle different image to be responsive to all the different device aspect ratio and devicePixelRatio? Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted April 21, 2016 Share Posted April 21, 2016 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, Phaser.CANVAS, 'gamewindow'); game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.refresh(); loadImage = this.add.image(this.world.centerX, this.world.centerY, 'loadsplash'); loadImage.anchor.set(0.5); loadImage.scale.set(configuration.scale_ratio); Link to comment Share on other sites More sharing options...
Recommended Posts