PIXI.PI_2, PIXI.RAD_TO_DEG and PIXI.DEG_TO_RAD have all been removed, as they are no longer used internally, and are all available under Phaser.Math.

PIXI.VERSION has been removed, as it's no longer relevant and misleading.
This commit is contained in:
photonstorm 2016-09-28 16:57:08 +01:00
parent f9a2c2a79e
commit c836d4bfbd
8 changed files with 51 additions and 75 deletions

View file

@ -348,6 +348,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* PIXI.Rope and PIXI.Strip have been removed, and all functionality merged in to Phaser.Rope, to cut down on the number of internal classes and inheritance going on.
* PIXI.Graphics and PIXI.GraphicsData have been removed, and all functionality merged in to Phaser.Graphics, to cut down on the number of internal classes and inheritance going on.
* WebGLGraphics and CanvasGraphics have been updated so that it checks for Phaser Geometry shape types internally.
* PIXI.PI_2 has been removed, because it's available via Phaser.Math.PI2. The only place PI_2 was used has been updated to now use PI2.
### Bug Fixes
@ -375,6 +376,7 @@ Please note that Phaser uses a custom build of Pixi and always has done. The fol
* PIXI.AbstractFilter has been removed as it's no longer used internally. All functionality is now available via Phaser.Filter.
* PIXI.Strip and PIXI.Rope have been removed. All functionality is now available via Phaser.Rope.
* PIXI.Graphics and PIXI.GraphicsData have been removed. All functionality is now available via Phaser.Graphics. The respective renderers have been updated.
* PIXI.PI_2, PIXI.RAD_TO_DEG and PIXI.DEG_TO_RAD have all been removed, as they are no longer used internally, and are all available under Phaser.Math.
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).

View file

@ -734,7 +734,7 @@ Phaser.Game.prototype = {
}
else if (window['console'])
{
console.log('Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' | http://phaser.io');
console.log('Phaser v' + v + ' | Pixi.js | ' + r + ' | ' + a + ' | http://phaser.io');
}
},

View file

@ -83,7 +83,7 @@ Phaser.RenderTexture = function (game, width, height, key, scaleMode, resolution
*/
this.renderer = renderer;
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
var gl = this.renderer.gl;
this.baseTexture.textureIndex = textureUnit;
@ -136,7 +136,7 @@ Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear)
this._tempMatrix.tx = x;
this._tempMatrix.ty = y;
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
this._renderWebGL(displayObject, this._tempMatrix, clear);
}
@ -164,7 +164,7 @@ Phaser.RenderTexture.prototype.renderRawXY = function (displayObject, x, y, clea
this._tempMatrix.identity().translate(x, y);
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
this._renderWebGL(displayObject, this._tempMatrix, clear);
}
@ -201,7 +201,7 @@ Phaser.RenderTexture.prototype.render = function (displayObject, matrix, clear)
this._tempMatrix.copyFrom(matrix);
}
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
this._renderWebGL(displayObject, this._tempMatrix, clear);
}
@ -240,7 +240,7 @@ Phaser.RenderTexture.prototype.resize = function (width, height, updateBase) {
this.baseTexture.height = this.height * this.resolution;
}
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
this.projection.x = this.width / 2;
this.projection.y = -this.height / 2;
@ -267,7 +267,7 @@ Phaser.RenderTexture.prototype.clear = function () {
return;
}
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);
}
@ -416,7 +416,7 @@ Phaser.RenderTexture.prototype.getBase64 = function () {
*/
Phaser.RenderTexture.prototype.getCanvas = function () {
if (this.renderer.type === PIXI.WEBGL_RENDERER)
if (this.renderer.type === Phaser.WEBGL)
{
var gl = this.renderer.gl;
var width = this.textureBuffer.width;

View file

@ -23,6 +23,44 @@ Phaser.Math = {
*/
PI2: Math.PI * 2,
/**
* Degrees to Radians factor.
* @property {number} Phaser.Math#DEG_TO_RAD
*/
DEG_TO_RAD: Math.PI / 180,
/**
* Degrees to Radians factor.
* @property {number} Phaser.Math#RAD_TO_DEG
*/
RAD_TO_DEG: 180 / Math.PI,
/**
* Convert degrees to radians.
*
* @method Phaser.Math#degToRad
* @param {number} degrees - Angle in degrees.
* @return {number} Angle in radians.
*/
degToRad: function (degrees) {
return degrees * Phaser.Math.DEG_TO_RAD;
},
/**
* Convert radians to degrees.
*
* @method Phaser.Math#radToDeg
* @param {number} radians - Angle in radians.
* @return {number} Angle in degrees
*/
radToDeg: function (radians) {
return radians * Phaser.Math.RAD_TO_DEG;
},
/**
* Given a number, this function returns the closest number that is a power of two.
* This function is from the Starling Framework.
@ -1271,28 +1309,3 @@ Phaser.Math = {
}
};
var degreeToRadiansFactor = Math.PI / 180;
var radianToDegreesFactor = 180 / Math.PI;
/**
* Convert degrees to radians.
*
* @method Phaser.Math#degToRad
* @param {number} degrees - Angle in degrees.
* @return {number} Angle in radians.
*/
Phaser.Math.degToRad = function degToRad (degrees) {
return degrees * degreeToRadiansFactor;
};
/**
* Convert radians to degrees.
*
* @method Phaser.Math#radToDeg
* @param {number} radians - Angle in radians.
* @return {number} Angle in degrees
*/
Phaser.Math.radToDeg = function radToDeg (radians) {
return radians * radianToDegreesFactor;
};

View file

@ -25,27 +25,6 @@ var PIXI = PIXI || {};
*/
PIXI.game = null;
/**
* @property {Number} WEBGL_RENDERER
* @protected
* @static
*/
PIXI.WEBGL_RENDERER = 0;
/**
* @property {Number} CANVAS_RENDERER
* @protected
* @static
*/
PIXI.CANVAS_RENDERER = 1;
/**
* Version of pixi that is loaded.
* @property {String} VERSION
* @static
*/
PIXI.VERSION = "v2.2.9";
// used to create uids for various pixi objects.
PIXI._UID = 0;
@ -68,24 +47,6 @@ else
PIXI.Uint16Array = Array;
}
/**
* @property {Number} PI_2
* @static
*/
PIXI.PI_2 = Math.PI * 2;
/**
* @property {Number} RAD_TO_DEG
* @static
*/
PIXI.RAD_TO_DEG = 180 / Math.PI;
/**
* @property {Number} DEG_TO_RAD
* @static
*/
PIXI.DEG_TO_RAD = Math.PI / 180;
/**
* @property {String} RETINA_PREFIX
* @protected

View file

@ -331,7 +331,7 @@ PIXI.DisplayObject.prototype = {
var a, b, c, d, tx, ty;
// so if rotation is between 0 then we can simplify the multiplication process..
if (this.rotation % PIXI.PI_2)
if (this.rotation % Phaser.Math.PI_2)
{
// check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes
if (this.rotation !== this.rotationCache)

View file

@ -28,7 +28,7 @@ PIXI.CanvasRenderer = function (game) {
* @property type
* @type Number
*/
this.type = PIXI.CANVAS_RENDERER;
this.type = Phaser.CANVAS;
/**
* The resolution of the canvas.

View file

@ -34,7 +34,7 @@ PIXI.WebGLRenderer = function(game) {
* @property type
* @type Number
*/
this.type = PIXI.WEBGL_RENDERER;
this.type = Phaser.WEBGL;
/**
* The resolution of the renderer