From c47866f0dfb352ca77ec318bca02db2fa8a12db7 Mon Sep 17 00:00:00 2001 From: wulfdewolf Date: Mon, 11 Mar 2024 19:24:57 +0000 Subject: [PATCH] attempt at resize --- kaja_game/js/main.js | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/kaja_game/js/main.js b/kaja_game/js/main.js index 992ea216e8fb..c846ffdbbb59 100644 --- a/kaja_game/js/main.js +++ b/kaja_game/js/main.js @@ -4,29 +4,35 @@ import nightScene from "./nightScene.js" import endScene from "./endScene.js" -const config = { - type: Phaser.AUTO, - parent: "gameCanvas1", - backgroundColor: '#000001', - // scene: { - // preload: preload, - // create: create, - // update: update - // }, - physics: { - default: 'arcade', - arcade: { - debug: false, +window.onload = function() { + let parentElement = document.getElementById('gameCanvas1'); + + const config = { + type: Phaser.AUTO, + parent: "gameCanvas1", + width: parentElement.offsetWidth, + height: parentElement.offsetHeight, + backgroundColor: '#000001', + // scene: { + // preload: preload, + // create: create, + // update: update + // }, + physics: { + default: 'arcade', + arcade: { + debug: false, + } + }, + scale: { + mode: Phaser.Scale.RESIZE, + } } - }, - scale: { - mode: Phaser.Scale.RESIZE, - } -} -const game = new Phaser.Game(config); -game.scene.add('dayScene', dayScene); -game.scene.add('titleScene', titleScene); -game.scene.add('nightScene', nightScene); -game.scene.add('endScene', endScene); -game.scene.start('titleScene'); \ No newline at end of file + const game = new Phaser.Game(config); + game.scene.add('dayScene', dayScene); + game.scene.add('titleScene', titleScene); + game.scene.add('nightScene', nightScene); + game.scene.add('endScene', endScene); + game.scene.start('titleScene'); +} \ No newline at end of file