Skip to content

Commit

Permalink
2.0.4 release build
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Apr 29, 2014
1 parent ba3f635 commit 1c92caa
Show file tree
Hide file tree
Showing 11 changed files with 10,081 additions and 2,281 deletions.
1,166 changes: 773 additions & 393 deletions build/custom/p2.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions build/custom/p2.min.js

Large diffs are not rendered by default.

3,281 changes: 2,820 additions & 461 deletions build/custom/phaser-arcade-physics.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions build/custom/phaser-arcade-physics.min.js

Large diffs are not rendered by default.

3,155 changes: 2,726 additions & 429 deletions build/custom/phaser-no-libs.js

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions build/custom/phaser-no-libs.min.js

Large diffs are not rendered by default.

77 changes: 46 additions & 31 deletions build/custom/pixi.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ PIXI.Polygon.prototype.constructor = PIXI.Polygon;
*
* @class Circle
* @constructor
* @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this circle
* @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this circle
* @param x {Number} The X coordinate of the center of this circle
* @param y {Number} The Y coordinate of the center of this circle
* @param radius {Number} The radius of the circle
*/
PIXI.Circle = function(x, y, radius)
Expand Down Expand Up @@ -540,7 +540,8 @@ PIXI.identityMatrix = new PIXI.Matrix();
*/

/**
* The base class for all objects that are rendered on the screen.
* The base class for all objects that are rendered on the screen.
* This is an abstract class and should not be used on its own rather it should be extended.
*
* @class DisplayObject
* @constructor
Expand Down Expand Up @@ -1035,7 +1036,7 @@ PIXI.DisplayObject.prototype.generateTexture = function(renderer)
var bounds = this.getLocalBounds();

var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0, renderer);
renderTexture.render(this);
renderTexture.render(this, new PIXI.Point(-bounds.x, -bounds.y) );

return renderTexture;
};
Expand Down Expand Up @@ -1079,7 +1080,11 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession)
this._filters = null;

this._cachedSprite.filters = tempFilters;
this._cachedSprite.texture.render(this);
this._cachedSprite.texture.render(this, new PIXI.Point(-bounds.x, -bounds.y) );

this._cachedSprite.anchor.x = -( bounds.x / bounds.width );
this._cachedSprite.anchor.y = -( bounds.y / bounds.height );


this._filters = tempFilters;

Expand Down Expand Up @@ -2449,7 +2454,7 @@ PIXI.Text.prototype.updateText = function()
var width = maxLineWidth + this.style.strokeThickness;
if(this.style.dropShadow)width += this.style.dropShadowDistance;

this.canvas.width = width;
this.canvas.width = width + this.context.lineWidth;
//calculate text height
var lineHeight = this.determineFontHeight('font: ' + this.style.font + ';') + this.style.strokeThickness;

Expand Down Expand Up @@ -2642,21 +2647,21 @@ PIXI.Text.prototype.wordWrap = function(text)
{
var wordWidth = this.context.measureText(words[j]).width;
var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width;
if(wordWidthWithSpace > spaceLeft)
if(j === 0 || wordWidthWithSpace > spaceLeft)
{
// Skip printing the newline if it's the first word of the line that is
// greater than the word wrap width.
if(j > 0)
{
result += '\n';
}
result += words[j] + ' ';
result += words[j];
spaceLeft = this.style.wordWrapWidth - wordWidth;
}
else
{
spaceLeft -= wordWidthWithSpace;
result += words[j] + ' ';
result += ' ' + words[j];
}
}

Expand Down Expand Up @@ -5385,7 +5390,7 @@ PIXI.WebGLMaskManager.prototype.pushMask = function(maskData, renderSession)

this.maskStack.push(maskData);

gl.colorMask(false, false, false, true);
gl.colorMask(false, false, false, false);
gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR);

PIXI.WebGLGraphics.renderGraphics(maskData, renderSession);
Expand Down Expand Up @@ -6531,11 +6536,11 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)

var filterArea = filterBlock._filterArea;// filterBlock.target.getBounds();///filterBlock.target.filterArea;

var padidng = filter.padding;
filterArea.x -= padidng;
filterArea.y -= padidng;
filterArea.width += padidng * 2;
filterArea.height += padidng * 2;
var padding = filter.padding;
filterArea.x -= padding;
filterArea.y -= padding;
filterArea.width += padding * 2;
filterArea.height += padding * 2;

// cap filter to screen size..
if(filterArea.x < 0)filterArea.x = 0;
Expand Down Expand Up @@ -6907,9 +6912,10 @@ PIXI.WebGLFilterManager.prototype.destroy = function()
* @param gl {WebGLContext} the current WebGL drawing context
* @param width {Number} the horizontal range of the filter
* @param height {Number} the vertical range of the filter
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
* @private
*/
PIXI.FilterTexture = function(gl, width, height)
PIXI.FilterTexture = function(gl, width, height, scaleMode)
{
/**
* @property gl
Expand All @@ -6921,16 +6927,23 @@ PIXI.FilterTexture = function(gl, width, height)
this.frameBuffer = gl.createFramebuffer();
this.texture = gl.createTexture();

scaleMode = scaleMode || PIXI.scaleModes.DEFAULT;

gl.bindTexture(gl.TEXTURE_2D, this.texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer );

gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer );
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture, 0);

// required for masking a mask??
this.renderBuffer = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer);

this.resize(width, height);
};

Expand Down Expand Up @@ -6966,6 +6979,9 @@ PIXI.FilterTexture.prototype.resize = function(width, height)
gl.bindTexture(gl.TEXTURE_2D, this.texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);

// update the stencil buffer width and height
gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);
};

/**
Expand Down Expand Up @@ -8009,7 +8025,7 @@ PIXI.Graphics = function()
/**
* the bounds' padding used for bounds calculation
*
* @property bounds
* @property boundsPadding
* @type Number
*/
this.boundsPadding = 10;
Expand Down Expand Up @@ -8390,28 +8406,24 @@ PIXI.Graphics.prototype.getBounds = function( matrix )
var x4 = a * w1 + c * h0 + tx;
var y4 = d * h0 + b * w1 + ty;

var maxX = -Infinity;
var maxY = -Infinity;
var maxX = x1;
var maxY = y1;

var minX = Infinity;
var minY = Infinity;
var minX = x1;
var minY = y1;

minX = x1 < minX ? x1 : minX;
minX = x2 < minX ? x2 : minX;
minX = x3 < minX ? x3 : minX;
minX = x4 < minX ? x4 : minX;

minY = y1 < minY ? y1 : minY;
minY = y2 < minY ? y2 : minY;
minY = y3 < minY ? y3 : minY;
minY = y4 < minY ? y4 : minY;

maxX = x1 > maxX ? x1 : maxX;
maxX = x2 > maxX ? x2 : maxX;
maxX = x3 > maxX ? x3 : maxX;
maxX = x4 > maxX ? x4 : maxX;

maxY = y1 > maxY ? y1 : maxY;
maxY = y2 > maxY ? y2 : maxY;
maxY = y3 > maxY ? y3 : maxY;
maxY = y4 > maxY ? y4 : maxY;
Expand Down Expand Up @@ -9101,7 +9113,7 @@ PIXI.BaseTexture = function(source, scaleMode)

if(!source)return;

if(this.source.complete || this.source.getContext)
if((this.source.complete || this.source.getContext) && this.source.width && this.source.height)
{
this.hasLoaded = true;
this.width = this.source.width;
Expand Down Expand Up @@ -9179,7 +9191,7 @@ PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin, scaleMode)
{
var baseTexture = PIXI.BaseTextureCache[imageUrl];

if(crossorigin === undefined)crossorigin = true;
if(crossorigin === undefined && imageUrl.indexOf('data:') === -1) crossorigin = true;

if(!baseTexture)
{
Expand Down Expand Up @@ -9508,8 +9520,9 @@ PIXI.TextureUvs = function()
* @constructor
* @param width {Number} The width of the render texture
* @param height {Number} The height of the render texture
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
*/
PIXI.RenderTexture = function(width, height, renderer)
PIXI.RenderTexture = function(width, height, renderer, scaleMode)
{
PIXI.EventTarget.call( this );

Expand Down Expand Up @@ -9547,6 +9560,8 @@ PIXI.RenderTexture = function(width, height, renderer)
this.baseTexture.height = this.height;
this.baseTexture._glTextures = [];

this.baseTexture.scaleMode = scaleMode || PIXI.scaleModes.DEFAULT;

this.baseTexture.hasLoaded = true;

// each render texture can only belong to one renderer at the moment if its webGL
Expand All @@ -9556,7 +9571,7 @@ PIXI.RenderTexture = function(width, height, renderer)
{
var gl = this.renderer.gl;

this.textureBuffer = new PIXI.FilterTexture(gl, this.width, this.height);
this.textureBuffer = new PIXI.FilterTexture(gl, this.width, this.height, this.baseTexture.scaleMode);
this.baseTexture._glTextures[gl.id] = this.textureBuffer.texture;

this.render = this.renderWebGL;
Expand Down
7 changes: 4 additions & 3 deletions build/custom/pixi.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 1c92caa

Please sign in to comment.