Jippe joosten Posted August 26, 2014 Share Posted August 26, 2014 Hey guys, I made a minigame in Phaser.This game was working fine until you try to resize the browser.What i want is that the hole game is scaling to the browsers canvas. here is some code and the pictures of what is going wrong: When the games startup:window.addEventListener('load', function() { window.EMS.requestFullscreen(); setTimeout(function() { scale = Math.min(window.innerWidth / 1920, window.innerHeight / 1080); scaleWidth = scale;//(window.innerWidth / 1920); scaleHeight = scale;//(window.innerHeight / 1080); game = new Phaser.Game(1920, 1080, Phaser.AUTO, 'area', { preload: preload, create: create, update: update, render: render }); }, 1);});Then for the resize i used:function resizeGame() { scale = Math.min(window.innerWidth / 1920, window.innerHeight / 1080); scaleWidth = scale;//(window.innerWidth / 1920); scaleHeight = scale;//(window.innerHeight / 1080); // game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.maxWidth = window.innerWidth; game.scale.maxHeight = window.innerHeight; worldWidth = game.world.width * scale; worldHeight = game.world.height * scale; BG.width = worldWidth; BG.height = worldHeight; //game.stage.bounds.width = window.innerWidth; //game.stage.bounds.height = window.innerHeight; //game.renderer.resize(window.innerWidth, window.innerHeight); //game.camera.setSize(window.innerWidth, window.innerHeight);}This is what happend: http://puu.sh/b8CDC/09916cdfe9.pnghttp://puu.sh/b8CD8/8064a1140d.png I hope some of you understands what went wrong here and can help me out. Link to comment Share on other sites More sharing options...
Recommended Posts