Search the Community
Showing results for tags 'strech'.
-
hi, it's a subject that appears also often but i can't find a solution who work for me, especially with the new Phaser. I have a portrait game and i want that my game is stretched like that : width = width of the device height is stretched to the height of the device i want no black borders visibles i have try many things without success, i have follow these links : https://phaser.io/examples/v2/input/game-scale http://www.emanueleferonato.com/2015/03/25/quick-tip-how-to-scale-your-html5-endless-runner-game-to-play-it-on-mobile-devices/ http://www.html5gamedevs.com/topic/8441-stretch-game-to-fit-window/ http://www.html5gamedevs.com/topic/13177-canvas-resize-how-to-always-make-entire-game-visible/ these solution appears to be fine but that don't work at 100% , see my capture screen : var innerWidth =window.innerWidth var innerHeight=window.innerHeight var gameRatio =innerWidth/innerHeight var game = new Phaser.Game(640,Math.ceil(640*gameRatio), Phaser.CANVAS, '', { preload: preload, create: create, update: update }) function preload() { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL //doesnt work with the new phaser > it appears that i must use game.scale.refresh() but that doesnt work // game.scale.setScreenSize(true) game.scale.pageAlignHorizontally = true game.scale.pageAlignVertically = true game.load.image("test","https://s21.postimg.org/ohfa30zhj/test.jpg") } function create(){ var ech=game.add.sprite(0,0,'test') //resize() } function update(){} https://jsfiddle.net/espace3d/s1poyaas/ have you a an advice to do that ?