Remove garbage
This commit is contained in:
parent
9b882cf237
commit
eb5dc92b5b
|
@ -9,9 +9,6 @@ import { sprites } from './shared/sprites'
|
||||||
export class Engine {
|
export class Engine {
|
||||||
ctx: ContextI
|
ctx: ContextI
|
||||||
element: HTMLElement
|
element: HTMLElement
|
||||||
background: PIXI.Container
|
|
||||||
midground: PIXI.Container
|
|
||||||
foreground: PIXI.Container
|
|
||||||
states: StateI[]
|
states: StateI[]
|
||||||
|
|
||||||
constructor(target: HTMLElement) {
|
constructor(target: HTMLElement) {
|
||||||
|
@ -28,7 +25,7 @@ export class Engine {
|
||||||
this.ctx = {
|
this.ctx = {
|
||||||
app: new PIXI.Application({
|
app: new PIXI.Application({
|
||||||
backgroundColor: 0x111111,
|
backgroundColor: 0x111111,
|
||||||
resizeTo: target,
|
resizeTo: window,
|
||||||
}),
|
}),
|
||||||
push: (state: StateI) => this.pushState(state),
|
push: (state: StateI) => this.pushState(state),
|
||||||
pop: () => this.popState(),
|
pop: () => this.popState(),
|
||||||
|
@ -38,25 +35,12 @@ export class Engine {
|
||||||
this.update(d)
|
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)
|
target.appendChild(this.ctx.app.view)
|
||||||
|
|
||||||
// Add our state!
|
// Add our state!
|
||||||
this.pushState(MenuState(this.ctx))
|
this.pushState(MenuState(this.ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
|
||||||
this.ctx.app.resize()
|
|
||||||
}
|
|
||||||
|
|
||||||
update(delta: number) {
|
update(delta: number) {
|
||||||
let top = this.states[this.states.length-1]
|
let top = this.states[this.states.length-1]
|
||||||
if (top) {
|
if (top) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user