Remove garbage

This commit is contained in:
Ketchetwahmeegwun T. Southall 2022-01-30 08:19:55 -08:00
parent 9b882cf237
commit eb5dc92b5b

View File

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