module els{ export class ShapeRenderer extends Renderer{ private _shape: egret.Shape; color: number = 0xff0000; constructor() { super(); this._shape = new egret.Shape(); this._renderer.addChild(this._shape); } update() { if (this._shape) { this._shape.graphics.clear(); this._shape.graphics.beginFill(this.color); this._shape.graphics.drawRect(0, 0, this.gameobject.width, this.gameobject.height); this._shape.graphics.endFill(); } } onAwake() { let gameobject: GameObject = this.gameobject; this._shape.graphics.clear(); } clone(): ShapeRenderer { let component: ShapeRenderer = new ShapeRenderer(); component.enabled = this.enabled; component.color = this.color; return component; } } }