Skip to content

Commit e7356fc

Browse files
committed
Pixi 2.1.1 merge.
1 parent 515dff3 commit e7356fc

11 files changed

Lines changed: 70 additions & 15 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ Version 2.2.0 - "Bethal" - in development
113113
supported via a non-exported reused wrapper object; WheelEventProxy.
114114
The proxy methods are generated one-time dynamically but only when needed.
115115

116-
117116
### Updates
118117

119118
* TypeScript definitions fixes and updates (thanks @clark-stevenson)

build/config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
echo <<<EOL
3838
39+
<script src="$path/src/polyfills.js"></script>
40+
3941
<script src="$path/src/pixi/Pixi.js"></script>
4042
<script src="$path/src/pixi/geom/Matrix.js"></script>
4143
<script src="$path/src/pixi/geom/Polygon.js"></script>

src/Phaser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
var Phaser = Phaser || {
1212

13-
VERSION: '2.2.0-RC4',
13+
VERSION: '2.2.0-RC5',
1414
GAMES: [],
1515

1616
AUTO: 0,

src/core/Game.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,13 @@ Phaser.Game.prototype = {
765765

766766
},
767767

768+
/**
769+
* Updates all logic subsystems in Phaser. Called automatically by Game.update.
770+
*
771+
* @method Phaser.Game#updateLogic
772+
* @protected
773+
* @param {number} timeStep - The current timeStep value as determined by Game.update.
774+
*/
768775
updateLogic: function (timeStep) {
769776

770777
if (!this._paused && !this.pendingStep)
@@ -811,6 +818,13 @@ Phaser.Game.prototype = {
811818
}
812819
},
813820

821+
/**
822+
* Renders the display list. Called automatically by Game.update.
823+
*
824+
* @method Phaser.Game#updateRender
825+
* @protected
826+
* @param {number} elapsedTime - The time elapsed since the last update.
827+
*/
814828
updateRender: function (elapsedTime) {
815829

816830
// update tweens once every frame along with the render logic (to keep them smooth in slowMotion scenarios)

src/pixi/display/DisplayObjectContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
4848

4949
if(width !== 0)
5050
{
51-
this.scale.x = value / ( width/this.scale.x );
51+
this.scale.x = value / width;
5252
}
5353
else
5454
{
@@ -76,7 +76,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
7676

7777
if(height !== 0)
7878
{
79-
this.scale.y = value / ( height/this.scale.y );
79+
this.scale.y = value / height ;
8080
}
8181
else
8282
{

src/pixi/extras/Strip.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ PIXI.Strip = function(texture)
4848
*/
4949
this.dirty = true;
5050

51-
51+
/**
52+
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
53+
*
54+
* @property blendMode
55+
* @type Number
56+
* @default PIXI.blendModes.NORMAL;
57+
*/
58+
this.blendMode = PIXI.blendModes.NORMAL;
59+
5260
/**
5361
* if you need a padding, not yet implemented
5462
*
@@ -119,7 +127,8 @@ PIXI.Strip.prototype._renderStrip = function(renderSession)
119127

120128
// gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mat4Real);
121129

122-
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
130+
renderSession.blendModeManager.setBlendMode(this.blendMode);
131+
123132

124133
// set uniforms
125134
gl.uniformMatrix3fv(shader.translationMatrix, false, this.worldTransform.toArray(true));

src/pixi/renderers/webgl/WebGLRenderer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,4 +539,3 @@ PIXI.WebGLRenderer.prototype.mapBlendModes = function()
539539
};
540540

541541
PIXI.WebGLRenderer.glContextId = 0;
542-
PIXI.WebGLRenderer.instances = [];

src/pixi/renderers/webgl/shaders/PixiShader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ PIXI.PixiShader.prototype.syncUniforms = function()
327327

328328
if(uniform.value.baseTexture._dirty[gl.id])
329329
{
330-
PIXI.WebGLRenderer.instances[gl.id].updateTexture(uniform.value.baseTexture);
330+
PIXI.instances[gl.id].updateTexture(uniform.value.baseTexture);
331331
}
332332
else
333333
{

src/pixi/renderers/webgl/utils/WebGLGraphics.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,25 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
147147
{
148148
if(data.points.length >= 6)
149149
{
150-
if(data.points.length > 5 * 2)
150+
if(data.points.length < 6 * 2)
151151
{
152-
webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1);
153-
PIXI.WebGLGraphics.buildComplexPoly(data, webGLData);
152+
webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0);
153+
154+
var canDrawUsingSimple = PIXI.WebGLGraphics.buildPoly(data, webGLData);
155+
// console.log(canDrawUsingSimple);
156+
157+
if(!canDrawUsingSimple)
158+
{
159+
// console.log("<>>>")
160+
webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1);
161+
PIXI.WebGLGraphics.buildComplexPoly(data, webGLData);
162+
}
163+
154164
}
155165
else
156166
{
157-
webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0);
158-
PIXI.WebGLGraphics.buildPoly(data, webGLData);
167+
webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1);
168+
PIXI.WebGLGraphics.buildComplexPoly(data, webGLData);
159169
}
160170
}
161171
}
@@ -803,6 +813,9 @@ PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
803813
var b = color[2] * alpha;
804814

805815
var triangles = PIXI.PolyK.Triangulate(points);
816+
817+
if(!triangles)return false;
818+
806819
var vertPos = verts.length / 6;
807820

808821
var i = 0;
@@ -822,6 +835,7 @@ PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
822835
r, g, b, alpha);
823836
}
824837

838+
return true;
825839
};
826840

827841
PIXI.WebGLGraphics.graphicsDataPool = [];

src/pixi/text/Text.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,24 @@ PIXI.Text.prototype.wordWrap = function(text)
489489
return result;
490490
};
491491

492+
/**
493+
* Returns the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.
494+
*
495+
* @method getBounds
496+
* @param matrix {Matrix} the transformation matrix of the Text
497+
* @return {Rectangle} the framing rectangle
498+
*/
499+
PIXI.Text.prototype.getBounds = function(matrix)
500+
{
501+
if(this.dirty)
502+
{
503+
this.updateText();
504+
this.dirty = false;
505+
}
506+
507+
return PIXI.Sprite.prototype.getBounds.call(this, matrix);
508+
};
509+
492510
/**
493511
* Destroys this text object.
494512
*

0 commit comments

Comments
 (0)