Phaser 2.4.7 RC1.

This commit is contained in:
photonstorm 2016-04-14 13:23:44 +01:00
parent ac4acfb912
commit 41add1b4bf
21 changed files with 6402 additions and 2624 deletions

View file

@ -350,14 +350,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* Camera.fade is a new function that makes the camera fade to the color given, over the course of the duration specified. This is great for things like transitioning from one State to another. You can listen for the Camera.onFadeComplete Signal.
* Camera.resetFX resets any active FX, such as a fade or flash and immediately clears it. Useful for calling after a fade in order to remove the fade from the Stage.
* Phaser.Camera.ENABLE_FX is a const that controls if the Camera FX are available or not. It's `true` by default, but if you set it to `false` before boot then it won't create the Graphics object required to process the effects.
### New Arcade Physics Features
* Body.setCircle allows you to define a Body as using a circle to collide with instead of a rectangle. You can set the radius of the collision circle and an offset.
* Body.render now renders both circle and rectangle body shapes to the Debug canvas.
* World.intersects has been updated to support both circle and rectangle body shapes, and supports quick-paths for circle vs. circle and rect vs. rect checks.
* World.circleBodyIntersects is a new method that checks for intersection between a Body that has been defined as a circle, and a normal rectangle based Body. This is used internally by World.intersects, but exposed for direct calls as well.
* Body has two new properties: `left` and `top`. These are the same as `Body.x` and `Body.y` but allow you to pass the Body to geometry level functions such as Circle.contains.
* The Arcade Physics Body has two new properties: `left` and `top`. These are the same as `Body.x` and `Body.y` but allow you to pass the Body to geometry level functions such as Circle.contains.
* World.separate has been optimized to cut down on the number of calls to `intersect` from 3 calls per Game Object collision check, to 2. So if you were colliding 50 sprites it will reduce the call count from 150 to 100 per frame. It also reduces the calls made to `seperateX` and `seperateY` by the same factor.
* Two immovable bodies would never set their overlap data, even if an overlap only check was being made. As this is useful data to have this has been changed. Two immovable bodies will still never separate from each other, but they _will_ have their `overlapX` and `overlapY` properties calculated now.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,13 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2015 Photon Storm Ltd.
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*
* @overview
*
* Phaser - http://phaser.io
*
* v2.4.6 "Baerlon" - Built: Thu Feb 18 2016 14:40:25
* v2.4.7 "Hinderstap" - Built: Thu Apr 14 2016 13:21:55
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -1227,9 +1227,10 @@ PIXI.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform = PI
*/
PIXI.DisplayObjectContainer.prototype.getBounds = function()
{
if(this.children.length === 0)return PIXI.EmptyRectangle;
// TODO the bounds have already been calculated this render session so return what we have
if (this.children.length === 0)
{
return PIXI.EmptyRectangle;
}
var minX = Infinity;
var minY = Infinity;
@ -1243,11 +1244,14 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
var childVisible = false;
for(var i=0,j=this.children.length; i<j; i++)
for (var i = 0; i < this.children.length; i++)
{
var child = this.children[i];
if(!child.visible)continue;
if (!child.visible)
{
continue;
}
childVisible = true;
@ -1263,8 +1267,10 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
maxY = maxY > childMaxY ? maxY : childMaxY;
}
if(!childVisible)
if (!childVisible)
{
return PIXI.EmptyRectangle;
}
var bounds = this._bounds;
@ -1273,9 +1279,6 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
bounds.width = maxX - minX;
bounds.height = maxY - minY;
// TODO: store a reference so that if this function gets called again in the render cycle we do not have to recalculate
//this._currentBounds = bounds;
return bounds;
};
@ -1291,7 +1294,7 @@ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function()
this.worldTransform = PIXI.identityMatrix;
for(var i=0,j=this.children.length; i<j; i++)
for (var i = 0; i < this.children.length; i++)
{
this.children[i].updateTransform();
}
@ -1299,6 +1302,11 @@ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function()
var bounds = this.getBounds();
this.worldTransform = matrixCache;
for (i = 0; i < this.children.length; i++)
{
this.children[i].updateTransform();
}
return bounds;
};
@ -1602,6 +1610,7 @@ PIXI.Sprite.prototype.setTexture = function(texture, destroyBase)
this.texture.baseTexture.skipRender = false;
this.texture = texture;
this.texture.valid = true;
this.cachedTint = -1;
};
/**
@ -1619,7 +1628,15 @@ PIXI.Sprite.prototype.onTextureUpdate = function()
};
/**
* Returns the bounds of the Sprite as a rectangle. The bounds calculation takes the worldTransform into account.
* Returns the bounds of the Sprite as a rectangle.
* The bounds calculation takes the worldTransform into account.
*
* It is important to note that the transform is not updated when you call this method.
* So if this Sprite is the child of a Display Object which has had its transform
* updated since the last render pass, those changes will not yet have been applied
* to this Sprites worldTransform. If you need to ensure that all parent transforms
* are factored into this getBounds operation then you should call `updateTransform`
* on the root most object in this Sprites display list first.
*
* @method getBounds
* @param matrix {Matrix} the transformation matrix of the sprite
@ -2212,7 +2229,7 @@ PIXI.isPowerOfTwo = function(width, height)
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2015 Photon Storm Ltd.
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@ -6581,10 +6598,6 @@ PIXI.CanvasRenderer = function (game) {
*/
this.refresh = true;
// This is already done in the Game.setUpRenderer method.
// this.view.width = this.width * this.resolution;
// this.view.height = this.height * this.resolution;
/**
* Internal var.
*
@ -6673,8 +6686,8 @@ PIXI.CanvasRenderer.prototype.render = function (stage) {
* @method destroy
* @param [removeView=true] {boolean} Removes the Canvas element from the DOM.
*/
PIXI.CanvasRenderer.prototype.destroy = function(removeView)
{
PIXI.CanvasRenderer.prototype.destroy = function (removeView) {
if (removeView === undefined) { removeView = true; }
if (removeView && this.view.parent)
@ -6696,8 +6709,8 @@ PIXI.CanvasRenderer.prototype.destroy = function(removeView)
* @param width {Number} the new width of the canvas view
* @param height {Number} the new height of the canvas view
*/
PIXI.CanvasRenderer.prototype.resize = function(width, height)
{
PIXI.CanvasRenderer.prototype.resize = function (width, height) {
this.width = width * this.resolution;
this.height = height * this.resolution;
@ -6709,6 +6722,12 @@ PIXI.CanvasRenderer.prototype.resize = function(width, height)
this.view.style.width = this.width / this.resolution + "px";
this.view.style.height = this.height / this.resolution + "px";
}
if (this.renderSession.smoothProperty)
{
this.context[this.renderSession.smoothProperty] = (this.renderSession.scaleMode === PIXI.scaleModes.LINEAR);
}
};
/**
@ -8871,10 +8890,8 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo, re
var texture = this.texture;
var frame = texture.frame;
console.log('generateTilingTexture', texture, frame);
var targetWidth = this._frame.sourceSizeW;
var targetHeight = this._frame.sourceSizeH;
var targetWidth = this._frame.sourceSizeW || this._frame.width;
var targetHeight = this._frame.sourceSizeH || this._frame.height;
var dx = 0;
var dy = 0;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

42
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -15,7 +15,7 @@ var Phaser = Phaser || {
* @constant
* @type {string}
*/
VERSION: '2.4.7-dev',
VERSION: '2.4.7 RC1',
/**
* An array of Phaser game instances.