Initial revision
[chise/kage.git] / engine / polygon.js
1 function Polygon(_index){\r
2   // method\r
3   function push(_x, _y){ // void\r
4     var temp = new Object();\r
5     temp.x = _x;\r
6     temp.y = _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 = _x;\r
13     this.array[_index].y = _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(_index){\r
32     for(var i = 0; i < _index; i++){\r
33       this.push(0, 0);\r
34     }\r
35   }\r
36   \r
37   return this;\r
38 }\r