2014-02-10 22:54:56 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2014 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A PointProxy is an internal class that allows for direct getter/setter style property access to Arrays and TypedArrays.
|
|
|
|
*
|
2014-03-05 02:36:08 +00:00
|
|
|
* @class Phaser.Physics.P2.PointProxy
|
2014-02-10 22:54:56 +00:00
|
|
|
* @classdesc PointProxy
|
|
|
|
* @constructor
|
2014-02-21 15:34:15 +00:00
|
|
|
* @param {Phaser.Game} game - A reference to the Phaser.Game instance.
|
2014-02-10 22:54:56 +00:00
|
|
|
* @param {any} destination - The object to bind to.
|
|
|
|
*/
|
2014-03-05 02:36:08 +00:00
|
|
|
Phaser.Physics.P2.PointProxy = function (game, destination) {
|
2014-02-10 22:54:56 +00:00
|
|
|
|
2014-02-21 15:34:15 +00:00
|
|
|
this.game = game;
|
2014-02-10 22:54:56 +00:00
|
|
|
this.destination = destination;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-03-05 02:36:08 +00:00
|
|
|
Phaser.Physics.P2.PointProxy.prototype.constructor = Phaser.Physics.P2.PointProxy;
|
2014-02-10 22:54:56 +00:00
|
|
|
|
|
|
|
/**
|
2014-03-05 02:36:08 +00:00
|
|
|
* @name Phaser.Physics.P2.PointProxy#x
|
2014-02-10 22:54:56 +00:00
|
|
|
* @property {number} x - The x property of this PointProxy.
|
|
|
|
*/
|
2014-03-05 02:36:08 +00:00
|
|
|
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "x", {
|
2014-02-10 22:54:56 +00:00
|
|
|
|
|
|
|
get: function () {
|
|
|
|
|
|
|
|
return this.destination[0];
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value) {
|
|
|
|
|
2014-02-21 15:34:15 +00:00
|
|
|
this.destination[0] = this.game.math.px2p(value);
|
2014-02-10 22:54:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2014-03-05 02:36:08 +00:00
|
|
|
* @name Phaser.Physics.P2.PointProxy#y
|
2014-02-10 22:54:56 +00:00
|
|
|
* @property {number} y - The y property of this PointProxy.
|
|
|
|
*/
|
2014-03-05 02:36:08 +00:00
|
|
|
Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "y", {
|
2014-02-10 22:54:56 +00:00
|
|
|
|
|
|
|
get: function () {
|
|
|
|
|
|
|
|
return this.destination[1];
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value) {
|
|
|
|
|
2014-02-21 15:34:15 +00:00
|
|
|
this.destination[1] = this.game.math.px2p(value);
|
2014-02-10 22:54:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|