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