При создании экземпляра 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;
};
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;

View File

@ -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',

View File

@ -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);