From 9290dfd6c5471819175b552498ad7e7d48f2394b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 3 Apr 2020 18:41:06 +0200 Subject: [PATCH] Automatically resizing game when window is resized --- front/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/front/src/index.ts b/front/src/index.ts index 4a1c3031..ace0fa36 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); +}