From 83ce5a24995dc188356c56b474d13926f47e2ea7 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 9 Jan 2024 19:57:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B8=20=D1=8D=D0=BA=D0=B7=D0=B5=D0=BC=D0=BF?= =?UTF-8?q?=D0=BB=D1=8F=D1=80=D0=B0=20Scene=20=D0=B8=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=8A=D0=B5=D0=BA=D1=82=20App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/simple_scene/game.js | 2 +- src/main.js | 2 +- src/scene.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/simple_scene/game.js b/examples/simple_scene/game.js index 5573f28..14a4163 100644 --- a/examples/simple_scene/game.js +++ b/examples/simple_scene/game.js @@ -14,7 +14,7 @@ player.obj.ticker = () => { player.obj.x = player.x; }; -let firstScene = new ujs.Scene(app.canvas, app.context, 400, 400); +let firstScene = new ujs.Scene(app, 400, 400); let layerInstances = new ujs.SceneLayer('Instances', [player.obj]); firstScene.addLayer(layerInstances); app.scene = firstScene; diff --git a/src/main.js b/src/main.js index 45675f2..691617a 100644 --- a/src/main.js +++ b/src/main.js @@ -30,7 +30,7 @@ export class App { this.options.welcome = true; } - this.scene = new Scene(this.canvas, this.context, width, height); + this.scene = new Scene(this, width, height); const logStrings = [ 'ujs engine', diff --git a/src/scene.js b/src/scene.js index 4bcf846..baca85c 100644 --- a/src/scene.js +++ b/src/scene.js @@ -5,9 +5,9 @@ export class Scene { #context; #layers; - constructor(canvas, context, width, height) { - this.#canvas = canvas; - this.#context = context; + constructor(app, width, height) { + this.#canvas = app.canvas; + this.#context = app.context; this.#layers = Array(); this.setScreenSize(width, height);