新增渲染接口

This commit is contained in:
yhh
2021-05-27 18:32:38 +08:00
parent 6c44d38c10
commit 26068aaf6f
29 changed files with 1301 additions and 96 deletions

View File

@@ -7,10 +7,13 @@ module es {
*
* @param radius
*/
constructor(radius: number) {
constructor(radius: number = 1) {
super();
this.shape = new Circle(radius);
if (radius == 1) {
this._colliderRequiresAutoSizing = true;
}
}
public get radius(): number {
@@ -40,6 +43,17 @@ module es {
return this;
}
public debugRender(batcher: IBatcher) {
batcher.drawHollowRect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height, new Color(76, 76, 76, 76), 2);
batcher.end();
batcher.drawCircle(this.shape.position, this.radius, new Color(139, 0, 0), 2);
batcher.end();
batcher.drawPixel(this.entity.transform.position, new Color(255, 255, 0), 4);
batcher.end();
batcher.drawPixel(this.shape.position, new Color(255, 0, 0), 2);
batcher.end();
}
public toString() {
return `[CircleCollider: bounds: ${this.bounds}, radius: ${(this.shape as Circle).radius}]`
}