Merge pull request #17 from moufmouf/autoresize

Automatically resizing game when window is resized
This commit is contained in:
David Négrier 2020-04-03 18:42:11 +02:00 committed by GitHub
commit 214abc7a0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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