class Vec { constructor(){ this.x=0; this.y=0 } set(x,y){ this.x=x; this.y=(y===undefined?x:y); return this } } export class Texture { constructor(){ this.width=1; this.height=1 } } Texture.EMPTY = new Texture() export class Container { constructor(){ this.children=[]; this.parent=null; this.position=new Vec(); this.scale=new Vec(); this.scale.x=1; this.scale.y=1; this.anchor=new Vec(); this.rotation=0; this.visible=true; this.renderable=true; this.alpha=1 } addChild(child){ this.children.push(child); child.parent=this; return child } addChildAt(child,index){ this.children.splice(index,0,child); child.parent=this; return child } removeChild(child){ const index=this.children.indexOf(child); if(index>=0) this.children.splice(index,1); return child } removeFromParent(){ if(this.parent) this.parent.removeChild(this) } getChildIndex(child){ return this.children.indexOf(child) } destroy(){} } export class Sprite extends Container { constructor(texture){ super(); this.texture=texture; this.blendMode=0; this.tint=0xffffff; this.x=0; this.y=0 } } export class Graphics extends Container { clear(){} lineStyle(){} moveTo(){} lineTo(){} beginFill(){} endFill(){} drawCircle(){} drawPolygon(){} drawRect(){} bezierCurveTo(){} } export class SimpleMesh extends Container { constructor(texture,vertices,uvs,indices){ super(); this.texture=texture; this.vertices=vertices; this.uvs=uvs; this.indices=indices; this.blendMode=0; this.tint=0xffffff } }