tentone 6 anni fa
parent
commit
ba8eda2d5f
2 ha cambiato i file con 45 aggiunte e 4 eliminazioni
  1. 44 4
      source/Object2D.js
  2. 1 0
      source/math/Box2.js

+ 44 - 4
source/Object2D.js

@@ -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);
 };

+ 1 - 0
source/math/Box2.js

@@ -1,3 +1,4 @@
+"use strict";
 
 function Box2(min, max)
 {