Fixed SVG header.
[chise/kage.git] / engine / polygon.js
1 function Polygon(number){\r
2   // method\r
3   function push(x, y){ // void\r
4     var temp = new Object();\r
5     temp.x = Math.floor(x);\r
6     temp.y = Math.floor(y);\r
7     this.array.push(temp);\r
8   }\r
9   Polygon.prototype.push = push;\r
10   \r
11   function set(index, x, y){ // void\r
12     this.array[index].x = Math.floor(x);\r
13     this.array[index].y = Math.floor(y);\r
14   }\r
15   Polygon.prototype.set = set;\r
16   \r
17   function reverse(){ // void\r
18     this.array.reverse();\r
19   }\r
20   Polygon.prototype.reverse = reverse;\r
21   \r
22   function concat(poly){ // void\r
23     this.array = this.array.concat(poly.array);\r
24   }\r
25   Polygon.prototype.concat = concat;\r
26 \r
27   // property\r
28   this.array = new Array();\r
29   \r
30   // initialize\r
31   if(number){\r
32     for(var i = 0; i < number; i++){\r
33       this.push(0, 0);\r
34     }\r
35   }\r
36   \r
37   return this;\r
38 }\r