dist/melonjs.js
function setShape(x, y, w, h) {
         var points = w; // assume w is an array by default

         if (arguments.length === 4) {
           points = this.points;
           points[0].set(0, 0); // 0, 0

           points[1].set(w, 0); // 1, 0

           points[2].set(w, h); // 1, 1

           points[3].set(0, h); // 0, 1
         }

         this._super(me.Polygon, "setShape", [x, y, points]); // private properties to cache width & height


         this._width = this.points[2].x; // w

         this._height = this.points[2].y; // h

         return this;
       }
function setShape(x, y, w, h) {
         var points = w; // assume w is an array by default

         if (arguments.length === 4) {
           points = this.points;
           points[0].set(0, 0); // 0, 0

           points[1].set(w, 0); // 1, 0

           points[2].set(w, h); // 1, 1

           points[3].set(0, h); // 0, 1
         }

         this._super(me.Polygon, "setShape", [x, y, points]); // private properties to cache width & height


         this._width = this.points[2].x; // w

         this._height = this.points[2].y; // h

         return this;
       }
function setShape ( x , y , w , h ) { var points = w ; // assume w is an array by default if ( arguments . length === 4 ) { points = this . points ; points [ 0 ] . set ( 0 , 0 ) ; // 0, 0 points [ 1 ] . set ( w , 0 ) ; // 1, 0 points [ 2 ] . set ( w , h ) ; // 1, 1 points [ 3 ] . set ( 0 , h ) ; // 0, 1 } this . _super ( me . Polygon , "setShape" , [ x , y , points ] ) ; // private properties to cache width & height this . _width = this . points [ 2 ] . x ; // w this . _height = this . points [ 2 ] . y ; // h return this ; }
set new value to the rectangle shape
@name setShape
@memberOf me.Rect.prototype
@function
@param {Number} x position of the Rectangle
@param {Number} y position of the Rectangle
@param {Number|Array} w|points width of the rectangle, or an array of vector defining the rectangle
@param {Number} [h] height of the rectangle, if a numeral width parameter is specified
@return {me.Rect} this rectangle
set new value to the rectangle shape