绘制帮助类

This commit is contained in:
yhh
2020-07-09 16:16:04 +08:00
parent 817b703d4f
commit a80bb4b6f3
13 changed files with 484 additions and 2 deletions

22
source/src/Debug/Debug.ts Normal file
View File

@@ -0,0 +1,22 @@
class Debug {
private static _debugDrawItems: DebugDrawItem[] = [];
public static drawHollowRect(rectanle: Rectangle, color: number, duration = 0){
this._debugDrawItems.push(new DebugDrawItem(rectanle, color, duration));
}
public static render(){
if (this._debugDrawItems.length > 0){
let debugShape = new egret.Shape();
if (SceneManager.scene){
SceneManager.scene.addChild(debugShape);
}
for (let i = this._debugDrawItems.length - 1; i >= 0; i --){
let item = this._debugDrawItems[i];
if (item.draw(debugShape))
this._debugDrawItems.removeAt(i);
}
}
}
}