Automatically resizing game when window is resized

This commit is contained in:
David Négrier 2020-04-03 18:41:06 +02:00
parent 20c525c3a6
commit 9290dfd6c5

View File

@ -14,3 +14,7 @@ const config: GameConfig = {
}; };
let game = new Phaser.Game(config); let game = new Phaser.Game(config);
window.addEventListener('resize', function (event) {
game.scale.resize(window.innerWidth / resolution, window.innerHeight / resolution);
}