set polygons to counter-clockwise
[chise/kage.git] / engine / polygon.js
index c232460..4d26b38 100755 (executable)
@@ -2,17 +2,25 @@ function Polygon(number){
   // resolution : 0.1\r
   \r
   // method\r
-  function push(x, y){ // void\r
+  function push(x, y, off){ // void\r
     var temp = new Object();\r
     temp.x = Math.floor(x*10)/10;\r
     temp.y = Math.floor(y*10)/10;\r
+    if(off != 1){\r
+      off = 0;\r
+    }\r
+    temp.off = off;\r
     this.array.push(temp);\r
   }\r
   Polygon.prototype.push = push;\r
   \r
-  function set(index, x, y){ // void\r
+  function set(index, x, y, off){ // void\r
     this.array[index].x = Math.floor(x*10)/10;\r
     this.array[index].y = Math.floor(y*10)/10;\r
+    if(off != 1){\r
+      off = 0;\r
+    }\r
+    this.array[index].off = off;\r
   }\r
   Polygon.prototype.set = set;\r
   \r
@@ -31,10 +39,14 @@ function Polygon(number){
   }\r
   Polygon.prototype.shift = shift;\r
        \r
-  function unshift(x, y){ // void\r
+  function unshift(x, y, off){ // void\r
     var temp = new Object();\r
     temp.x = Math.floor(x*10)/10;\r
     temp.y = Math.floor(y*10)/10;\r
+    if(off != 1){\r
+      off = 0;\r
+    }\r
+    temp.off = off;\r
     this.array.unshift(temp);\r
   }\r
   Polygon.prototype.unshift = unshift;\r
@@ -45,7 +57,7 @@ function Polygon(number){
   // initialize\r
   if(number){\r
     for(var i = 0; i < number; i++){\r
-      this.push(0, 0);\r
+      this.push(0, 0, 0);\r
     }\r
   }\r
   \r