File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module.exports = function (grunt) {
1818 'src/pixi/core/Matrix.js' ,
1919 'src/pixi/core/Point.js' ,
2020 'src/pixi/core/Rectangle.js' ,
21+ 'src/pixi/core/Polygon.js' ,
2122 'src/pixi/display/DisplayObject.js' ,
2223 'src/pixi/display/DisplayObjectContainer.js' ,
2324 'src/pixi/display/Sprite.js' ,
@@ -82,6 +83,7 @@ module.exports = function (grunt) {
8283 'src/geom/Circle.js' ,
8384 'src/geom/Point.js' ,
8485 'src/geom/Rectangle.js' ,
86+ 'src/geom/Polygon.js' ,
8587 'src/net/Net.js' ,
8688 'src/tween/TweenManager.js' ,
8789 'src/tween/Tween.js' ,
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ Phaser.Graphics.prototype.destroy = function() {
5050
5151}
5252
53+ /*
54+ * Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled
55+ */
56+ Phaser . Graphics . prototype . drawPolygon = function ( poly ) {
57+
58+ graphics . moveTo ( poly . points [ 0 ] . x , poly . points [ 0 ] . y ) ;
59+ for ( var i = 1 ; i < poly . points . length ; i += 1 ) {
60+ graphics . lineTo ( poly . points [ i ] . x , poly . points [ i ] . y ) ;
61+ }
62+ graphics . lineTo ( poly . points [ 0 ] . x , poly . points [ 0 ] . y ) ;
63+ }
64+
5365Object . defineProperty ( Phaser . Graphics . prototype , 'angle' , {
5466
5567 get : function ( ) {
Original file line number Diff line number Diff line change 1+ Phaser . Polygon = function ( points ) {
2+
3+ PIXI . Polygon . call ( this , points ) ;
4+
5+ /**
6+ * @property {Description } type - Description.
7+ */
8+ this . type = Phaser . POLYGON ;
9+
10+ } ;
11+
12+ Phaser . Polygon . prototype = Object . create ( PIXI . Polygon . prototype ) ;
13+ Phaser . Polygon . prototype . constructor = Phaser . Polygon ;
You can’t perform that action at this time.
0 commit comments