При создании экземпляра Scene используется объект App

This commit is contained in:
Alexander Popov 2024-01-09 19:57:18 +03:00
parent 5d95cfff9f
commit 83ce5a2499
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
3 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ player.obj.ticker = () => {
player.obj.x = player.x; 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]); let layerInstances = new ujs.SceneLayer('Instances', [player.obj]);
firstScene.addLayer(layerInstances); firstScene.addLayer(layerInstances);
app.scene = firstScene; app.scene = firstScene;

View File

@ -30,7 +30,7 @@ export class App {
this.options.welcome = true; this.options.welcome = true;
} }
this.scene = new Scene(this.canvas, this.context, width, height); this.scene = new Scene(this, width, height);
const logStrings = [ const logStrings = [
'ujs engine', 'ujs engine',

View File

@ -5,9 +5,9 @@ export class Scene {
#context; #context;
#layers; #layers;
constructor(canvas, context, width, height) { constructor(app, width, height) {
this.#canvas = canvas; this.#canvas = app.canvas;
this.#context = context; this.#context = app.context;
this.#layers = Array(); this.#layers = Array();
this.setScreenSize(width, height); this.setScreenSize(width, height);