diff --git a/Engine/src/engine.ts b/Engine/src/engine.ts index 9aed747..afea6b9 100644 --- a/Engine/src/engine.ts +++ b/Engine/src/engine.ts @@ -9,9 +9,6 @@ import { sprites } from './shared/sprites' export class Engine { ctx: ContextI element: HTMLElement - background: PIXI.Container - midground: PIXI.Container - foreground: PIXI.Container states: StateI[] constructor(target: HTMLElement) { @@ -28,7 +25,7 @@ export class Engine { this.ctx = { app: new PIXI.Application({ backgroundColor: 0x111111, - resizeTo: target, + resizeTo: window, }), push: (state: StateI) => this.pushState(state), pop: () => this.popState(), @@ -38,25 +35,12 @@ export class Engine { this.update(d) }) - this.ctx.app.stage.addChild(this.background = new PIXI.Container()) - this.ctx.app.stage.addChild(this.midground = new PIXI.Container()) - this.ctx.app.stage.addChild(this.foreground = new PIXI.Container()) - - window.addEventListener('resize', () => { - this.refresh() - }) - this.refresh() - target.appendChild(this.ctx.app.view) // Add our state! this.pushState(MenuState(this.ctx)) } - refresh() { - this.ctx.app.resize() - } - update(delta: number) { let top = this.states[this.states.length-1] if (top) {