|
@@ -6,13 +6,53 @@
|
|
|
* @class
|
|
|
*/
|
|
|
function Object2D()
|
|
|
-{
|
|
|
- this.uuid =
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * UUID of the object.
|
|
|
+ */
|
|
|
+ this.uuid = UUID.generate();
|
|
|
|
|
|
+ /**
|
|
|
+ * List of children objects attached to the object.
|
|
|
+ */
|
|
|
this.children = [];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Parent object, the object position is affected by its parent position.
|
|
|
+ */
|
|
|
+ this.parent = null;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Position of the object.
|
|
|
+ */
|
|
|
+ this.position = new Vector2(0, 0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Scale of the object.
|
|
|
+ */
|
|
|
+ this.scale = new Vector2(1, 1);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Rotation of the object relative to its center.
|
|
|
+ */
|
|
|
+ this.rotation = 0.0;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Local transformation matrix applied to the object.
|
|
|
+ */
|
|
|
+ this.matrix = new Matrix3();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Global transformation matrix used to project the object to screen space.
|
|
|
+ */
|
|
|
+ this.globalMatrix = new Matrix3();
|
|
|
}
|
|
|
|
|
|
-Object2D.prototype.method_name = function()
|
|
|
+/**
|
|
|
+ * Attach a children to the object.
|
|
|
+ */
|
|
|
+Object2D.prototype.add = function(object)
|
|
|
{
|
|
|
- // body...
|
|
|
+ object.parent = this;
|
|
|
+ this.children.push(object);
|
|
|
};
|