feat: destroy renderables

This commit is contained in:
cha0s 2019-03-19 18:29:11 -05:00
parent 72459bc0a9
commit a02353f95a
2 changed files with 12 additions and 1 deletions

View File

@ -15,10 +15,17 @@ export class Container extends Renderable {
this.internal.addChild(child.internal); this.internal.addChild(child.internal);
} }
children() { get children() {
return this._children; return this._children;
} }
destroy() {
this.children.forEach((child) => {
child.destroy();
});
super.destroy();
}
removeChild(child) { removeChild(child) {
const index = this._children.indexOf(child); const index = this._children.indexOf(child);
if (-1 === index) { if (-1 === index) {

View File

@ -8,6 +8,10 @@ export class Renderable {
this.internal.alpha = alpha; this.internal.alpha = alpha;
} }
destroy() {
this.internal.destroy();
}
get position() { get position() {
return [this.internal.x, this.internal.y]; return [this.internal.x, this.internal.y];
} }