Added UROKO design function(size adjustment).
[chise/kage.git] / engine / polygon.js
index b64edc7..e89ea72 100755 (executable)
@@ -1,16 +1,18 @@
-function Polygon(_index){\r
+function Polygon(number){\r
+  // resolution : 0.1\r
+  \r
   // method\r
-  function push(_x, _y){ // void\r
+  function push(x, y){ // void\r
     var temp = new Object();\r
-    temp.x = _x;\r
-    temp.y = _y;\r
+    temp.x = Math.floor(x*10)/10;\r
+    temp.y = Math.floor(y*10)/10;\r
     this.array.push(temp);\r
   }\r
   Polygon.prototype.push = push;\r
   \r
-  function set(_index, _x, _y){ // void\r
-    this.array[_index].x = _x;\r
-    this.array[_index].y = _y;\r
+  function set(index, x, y){ // void\r
+    this.array[index].x = Math.floor(x*10)/10;\r
+    this.array[index].y = Math.floor(y*10)/10;\r
   }\r
   Polygon.prototype.set = set;\r
   \r
@@ -19,17 +21,17 @@ function Polygon(_index){
   }\r
   Polygon.prototype.reverse = reverse;\r
   \r
-  function concat(_poly){ // void\r
-    this.array = this.array.concat(_poly.array);\r
+  function concat(poly){ // void\r
+    this.array = this.array.concat(poly.array);\r
   }\r
   Polygon.prototype.concat = concat;\r
-  \r
+\r
   // property\r
   this.array = new Array();\r
   \r
   // initialize\r
-  if(_index){\r
-    for(var i = 0; i < _index; i++){\r
+  if(number){\r
+    for(var i = 0; i < number; i++){\r
       this.push(0, 0);\r
     }\r
   }\r