77 lines
1.1 KiB
JavaScript
77 lines
1.1 KiB
JavaScript
export class Renderable {
|
|
|
|
constructor() {
|
|
this.parent = null;
|
|
this._zIndex = 0;
|
|
}
|
|
|
|
get alpha() {
|
|
return this.internal.alpha;
|
|
}
|
|
|
|
set alpha(alpha) {
|
|
this.internal.alpha = alpha;
|
|
}
|
|
|
|
destroy() {
|
|
if (this.internal) {
|
|
this.internal.destroy();
|
|
this.internal = undefined;
|
|
}
|
|
}
|
|
|
|
get position() {
|
|
return [this.internal.x, this.internal.y];
|
|
}
|
|
|
|
set position(position) {
|
|
this.internal.x = position[0];
|
|
this.internal.y = position[1];
|
|
}
|
|
|
|
get rotation() {
|
|
return this.internal.rotation;
|
|
}
|
|
|
|
set rotation(rotation) {
|
|
this.internal.rotation = rotation;
|
|
}
|
|
|
|
get visible() {
|
|
return this.internal.visible;
|
|
}
|
|
|
|
set visible(isVisible) {
|
|
this.internal.visible = isVisible;
|
|
}
|
|
|
|
get x() {
|
|
return this.internal.x;
|
|
}
|
|
|
|
set x(x) {
|
|
this.internal.x = x;
|
|
}
|
|
|
|
get y() {
|
|
return this.internal.y;
|
|
}
|
|
|
|
set y(y) {
|
|
this.internal.y = y;
|
|
}
|
|
|
|
get zIndex() {
|
|
return this._zIndex;
|
|
}
|
|
|
|
set zIndex(zIndex) {
|
|
if (this.parent) {
|
|
this.parent.isDirty = true;
|
|
}
|
|
this._zIndex = zIndex;
|
|
}
|
|
|
|
}
|
|
|