При создании экземпляра Scene используется объект App
This commit is contained in:
parent
5d95cfff9f
commit
83ce5a2499
@ -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;
|
||||
|
@ -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',
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user