From: David NĂ©grier Date: Fri, 3 Apr 2020 16:41:06 +0000 (+0200) Subject: Automatically resizing game when window is resized X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9290dfd6c5471819175b552498ad7e7d48f2394b;p=libreadventure.git Automatically resizing game when window is resized --- diff --git a/front/src/index.ts b/front/src/index.ts index 4a1c303..ace0fa3 100644 --- a/front/src/index.ts +++ b/front/src/index.ts @@ -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); +}