mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 00:53:42 +00:00
Merged final Pixi v2.1.0 release.
This commit is contained in:
parent
7d0dc68a30
commit
1352b526c7
16 changed files with 219 additions and 64 deletions
27
README.md
27
README.md
|
@ -75,6 +75,7 @@ Version 2.2.0 - "Bethal" - in development
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
|
* Updated to Pixi v2.1.0 - see seprate change log entry below.
|
||||||
* Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
|
* Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
|
||||||
* Cache.autoResolveURL is a new boolean (default `false`) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to `true` *before* you load any assets to enable.
|
* Cache.autoResolveURL is a new boolean (default `false`) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to `true` *before* you load any assets to enable.
|
||||||
* You can now call Tween.to again on a Tween that has already completed. This will re-use the same tween, on the original object, without having to recreate the Tween again. This allows a single tween instance to be re-used multiple times, providing they are linked to the same object (thanks InsaneHero)
|
* You can now call Tween.to again on a Tween that has already completed. This will re-use the same tween, on the original object, without having to recreate the Tween again. This allows a single tween instance to be re-used multiple times, providing they are linked to the same object (thanks InsaneHero)
|
||||||
|
@ -142,7 +143,6 @@ Version 2.2.0 - "Bethal" - in development
|
||||||
* ArcadePhysics.skipQuadTree is now set to `true` by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via `game.physics.arcade.skipQuadTree = false`, but please only do so if you're sure your game benefits from this.
|
* ArcadePhysics.skipQuadTree is now set to `true` by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via `game.physics.arcade.skipQuadTree = false`, but please only do so if you're sure your game benefits from this.
|
||||||
* Phaser.DOM now houses new DOM functions. Some have been moved over from ScaleManager as appropriate.
|
* Phaser.DOM now houses new DOM functions. Some have been moved over from ScaleManager as appropriate.
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* Tilemaps in WebGL wouldn't update after the first frame due to a subtle change in how Pixi uploads new textures to the GPU.
|
* Tilemaps in WebGL wouldn't update after the first frame due to a subtle change in how Pixi uploads new textures to the GPU.
|
||||||
|
@ -161,6 +161,31 @@ Version 2.2.0 - "Bethal" - in development
|
||||||
* Lots of the Cache getters (such as `Cache.getbitmapData`) would return `undefined` if the asset couldn't be found. They now all consistently return `null` for missing entries (thanks @Matoking #1305)
|
* Lots of the Cache getters (such as `Cache.getbitmapData`) would return `undefined` if the asset couldn't be found. They now all consistently return `null` for missing entries (thanks @Matoking #1305)
|
||||||
* Phaser games should now work again from the CocoonJS Launcher.
|
* Phaser games should now work again from the CocoonJS Launcher.
|
||||||
|
|
||||||
|
### Pixi 2.1.0 New Features
|
||||||
|
|
||||||
|
* unloadFromGPU added to PIXI.BaseTexture
|
||||||
|
* PIXI.VideoTexture added
|
||||||
|
* PIXI.RoundedRectangle added
|
||||||
|
* Ensured all float32arrays use PIXI.Float32Array
|
||||||
|
* Removed the use of call in updateTransform (as its 10x faster to run the function directly)
|
||||||
|
* autoResize option added to renderer options (default is false). Pixi no longer automatically changes the style of the canvas.
|
||||||
|
* PIXI.RenderTexture.getCanvas optimized
|
||||||
|
|
||||||
|
### Pixi 2.1.0 Bug Fixes
|
||||||
|
|
||||||
|
* Fix destroy method of PIXI.WebGLRenderer
|
||||||
|
* Fixed Graphics.drawRoundedRectangle
|
||||||
|
* Fixed Graphics.arcTo issue
|
||||||
|
* Fixed Graphics.arc issue
|
||||||
|
* Fixed Graphics.cacheAsBitmap alpha issue
|
||||||
|
* Fixed PIXI.Strip alpha issue
|
||||||
|
* Fixed PIXI.DisplayObject.cacheAsBitmap alpha issue
|
||||||
|
* Fixed PIXI.RenderTexture Canvas Clear bug
|
||||||
|
* Fixed PIXI.DisplayObject.updateTransform issue
|
||||||
|
* Fixed webGL Shader textures issue
|
||||||
|
* Fixed PIXI.DisplayObject.getLocalPosition()
|
||||||
|
* Fixed CocoonJS crashing, when loading destroyed texture
|
||||||
|
* Fix eventTarget emit bug
|
||||||
|
|
||||||
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
|
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<script src="$path/src/pixi/Pixi.js"></script>
|
<script src="$path/src/pixi/Pixi.js"></script>
|
||||||
<script src="$path/src/pixi/geom/Matrix.js"></script>
|
<script src="$path/src/pixi/geom/Matrix.js"></script>
|
||||||
<script src="$path/src/pixi/geom/Polygon.js"></script>
|
<script src="$path/src/pixi/geom/Polygon.js"></script>
|
||||||
|
<script src="$path/src/pixi/geom/RoundedRectangle.js"></script>
|
||||||
<script src="$path/src/pixi/display/DisplayObject.js"></script>
|
<script src="$path/src/pixi/display/DisplayObject.js"></script>
|
||||||
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
|
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
|
||||||
<script src="$path/src/pixi/display/Sprite.js"></script>
|
<script src="$path/src/pixi/display/Sprite.js"></script>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
var Phaser = Phaser || {
|
var Phaser = Phaser || {
|
||||||
|
|
||||||
VERSION: '2.2.0-RC3',
|
VERSION: '2.2.0-RC4',
|
||||||
GAMES: [],
|
GAMES: [],
|
||||||
|
|
||||||
AUTO: 0,
|
AUTO: 0,
|
||||||
|
|
|
@ -776,6 +776,7 @@ Phaser.Input.prototype = {
|
||||||
for (var i = 0; i < this.pointers.length; i++)
|
for (var i = 0; i < this.pointers.length; i++)
|
||||||
{
|
{
|
||||||
var pointer = this.pointers[i];
|
var pointer = this.pointers[i];
|
||||||
|
|
||||||
if (pointer.pointerId === pointerId)
|
if (pointer.pointerId === pointerId)
|
||||||
{
|
{
|
||||||
return pointer;
|
return pointer;
|
||||||
|
|
|
@ -49,8 +49,8 @@ PIXI.InteractionData.prototype.getLocalPosition = function(displayObject, point)
|
||||||
var global = this.global;
|
var global = this.global;
|
||||||
|
|
||||||
// do a cheeky transform to get the mouse coords;
|
// do a cheeky transform to get the mouse coords;
|
||||||
var a00 = worldTransform.a, a01 = worldTransform.b, a02 = worldTransform.tx,
|
var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx,
|
||||||
a10 = worldTransform.c, a11 = worldTransform.d, a12 = worldTransform.ty,
|
a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty,
|
||||||
id = 1 / (a00 * a11 + a01 * -a10);
|
id = 1 / (a00 * a11 + a01 * -a10);
|
||||||
|
|
||||||
point = point || new PIXI.Point();
|
point = point || new PIXI.Point();
|
||||||
|
|
|
@ -16,7 +16,7 @@ PIXI.WEBGL_RENDERER = 0;
|
||||||
PIXI.CANVAS_RENDERER = 1;
|
PIXI.CANVAS_RENDERER = 1;
|
||||||
|
|
||||||
// useful for testing against if your lib is using pixi.
|
// useful for testing against if your lib is using pixi.
|
||||||
PIXI.VERSION = "v2.0.0";
|
PIXI.VERSION = "v2.1.0";
|
||||||
|
|
||||||
|
|
||||||
// the various blend modes supported by pixi
|
// the various blend modes supported by pixi
|
||||||
|
@ -81,7 +81,8 @@ PIXI.defaultRenderOptions = {
|
||||||
antialias:false,
|
antialias:false,
|
||||||
preserveDrawingBuffer:false,
|
preserveDrawingBuffer:false,
|
||||||
resolution:1,
|
resolution:1,
|
||||||
clearBeforeRender:true
|
clearBeforeRender:true,
|
||||||
|
autoResize:false
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXI.sayHello = function (type)
|
PIXI.sayHello = function (type)
|
||||||
|
|
|
@ -518,13 +518,14 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
||||||
// lets do the fast version as we know there is no rotation..
|
// lets do the fast version as we know there is no rotation..
|
||||||
a = this.scale.x;
|
a = this.scale.x;
|
||||||
d = this.scale.y;
|
d = this.scale.y;
|
||||||
tx = this.position.x - this.pivot.x * a;
|
|
||||||
ty = this.position.y - this.pivot.y * d;
|
|
||||||
|
|
||||||
wt.a = pt.a * a;
|
tx = this.position.x;
|
||||||
wt.b = pt.b * d;
|
ty = this.position.y;
|
||||||
wt.c = pt.c * a;
|
|
||||||
wt.d = pt.d * d;
|
wt.a = a * pt.a;
|
||||||
|
wt.b = a * pt.b;
|
||||||
|
wt.c = d * pt.c;
|
||||||
|
wt.d = d * pt.d;
|
||||||
wt.tx = tx * pt.a + ty * pt.c + pt.tx;
|
wt.tx = tx * pt.a + ty * pt.c + pt.tx;
|
||||||
wt.ty = tx * pt.b + ty * pt.d + pt.ty;
|
wt.ty = tx * pt.b + ty * pt.d + pt.ty;
|
||||||
}
|
}
|
||||||
|
@ -540,6 +541,9 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// performance increase to avoid using call.. (10x faster)
|
||||||
|
PIXI.DisplayObject.prototype.displayObjectUpdateTransform = PIXI.DisplayObject.prototype.updateTransform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the bounds of the displayObject as a rectangle object
|
* Retrieves the bounds of the displayObject as a rectangle object
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,12 +22,16 @@ PIXI.DisplayObjectContainer = function()
|
||||||
* @readOnly
|
* @readOnly
|
||||||
*/
|
*/
|
||||||
this.children = [];
|
this.children = [];
|
||||||
|
|
||||||
|
// fast access to update transform..
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
PIXI.DisplayObjectContainer.prototype = Object.create( PIXI.DisplayObject.prototype );
|
PIXI.DisplayObjectContainer.prototype = Object.create( PIXI.DisplayObject.prototype );
|
||||||
PIXI.DisplayObjectContainer.prototype.constructor = PIXI.DisplayObjectContainer;
|
PIXI.DisplayObjectContainer.prototype.constructor = PIXI.DisplayObjectContainer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
|
* The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
|
||||||
*
|
*
|
||||||
|
@ -280,7 +284,9 @@ PIXI.DisplayObjectContainer.prototype.updateTransform = function()
|
||||||
{
|
{
|
||||||
if(!this.visible)return;
|
if(!this.visible)return;
|
||||||
|
|
||||||
PIXI.DisplayObject.prototype.updateTransform.call( this );
|
this.displayObjectUpdateTransform();
|
||||||
|
|
||||||
|
//PIXI.DisplayObject.prototype.updateTransform.call( this );
|
||||||
|
|
||||||
if(this._cacheAsBitmap)return;
|
if(this._cacheAsBitmap)return;
|
||||||
|
|
||||||
|
@ -290,6 +296,9 @@ PIXI.DisplayObjectContainer.prototype.updateTransform = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// performance increase to avoid using call.. (10x faster)
|
||||||
|
PIXI.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform = PIXI.DisplayObjectContainer.prototype.updateTransform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration.
|
* Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration.
|
||||||
*
|
*
|
||||||
|
|
94
src/pixi/geom/RoundedRectangle.js
Normal file
94
src/pixi/geom/RoundedRectangle.js
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/**
|
||||||
|
* @author Mat Groves http://matgroves.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height.
|
||||||
|
*
|
||||||
|
* @class Rounded Rectangle
|
||||||
|
* @constructor
|
||||||
|
* @param x {Number} The X coordinate of the upper-left corner of the rounded rectangle
|
||||||
|
* @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle
|
||||||
|
* @param width {Number} The overall width of this rounded rectangle
|
||||||
|
* @param height {Number} The overall height of this rounded rectangle
|
||||||
|
* @param radius {Number} The overall radius of this corners of this rounded rectangle
|
||||||
|
*/
|
||||||
|
PIXI.RoundedRectangle = function(x, y, width, height, radius)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @property x
|
||||||
|
* @type Number
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
this.x = x || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property y
|
||||||
|
* @type Number
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
this.y = y || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property width
|
||||||
|
* @type Number
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
this.width = width || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property height
|
||||||
|
* @type Number
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
this.height = height || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property radius
|
||||||
|
* @type Number
|
||||||
|
* @default 20
|
||||||
|
*/
|
||||||
|
this.radius = radius || 20;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clone of this Rounded Rectangle
|
||||||
|
*
|
||||||
|
* @method clone
|
||||||
|
* @return {rounded Rectangle} a copy of the rounded rectangle
|
||||||
|
*/
|
||||||
|
PIXI.RoundedRectangle.prototype.clone = function()
|
||||||
|
{
|
||||||
|
return new PIXI.RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the x and y coordinates given are contained within this Rounded Rectangle
|
||||||
|
*
|
||||||
|
* @method contains
|
||||||
|
* @param x {Number} The X coordinate of the point to test
|
||||||
|
* @param y {Number} The Y coordinate of the point to test
|
||||||
|
* @return {Boolean} Whether the x/y coordinates are within this Rounded Rectangle
|
||||||
|
*/
|
||||||
|
PIXI.RoundedRectangle.prototype.contains = function(x, y)
|
||||||
|
{
|
||||||
|
if(this.width <= 0 || this.height <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var x1 = this.x;
|
||||||
|
if(x >= x1 && x <= x1 + this.width)
|
||||||
|
{
|
||||||
|
var y1 = this.y;
|
||||||
|
|
||||||
|
if(y >= y1 && y <= y1 + this.height)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
PIXI.RoundedRectangle.prototype.constructor = PIXI.RoundedRectangle;
|
||||||
|
|
|
@ -101,6 +101,8 @@ PIXI.Graphics = function()
|
||||||
*/
|
*/
|
||||||
this.boundsPadding = 0;
|
this.boundsPadding = 0;
|
||||||
|
|
||||||
|
this._localBounds = new PIXI.Rectangle(0,0,1,1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated.
|
* Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated.
|
||||||
*
|
*
|
||||||
|
@ -355,17 +357,17 @@ PIXI.Graphics.prototype.arcTo = function(x1, y1, x2, y2, radius)
|
||||||
{
|
{
|
||||||
if( this.currentPath )
|
if( this.currentPath )
|
||||||
{
|
{
|
||||||
if(this.currentPath.shape.points.length === 0)this.currentPath.shape.points = [x1, y1];
|
if(this.currentPath.shape.points.length === 0)
|
||||||
|
{
|
||||||
|
this.currentPath.shape.points.push(x1, y1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.moveTo(x1, y1);
|
this.moveTo(x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that path contains subpaths
|
var points = this.currentPath.shape.points;
|
||||||
if( this.currentPath.length === 0)this.moveTo(x1, y1);
|
|
||||||
|
|
||||||
var points = this.currentPath;
|
|
||||||
var fromX = points[points.length-2];
|
var fromX = points[points.length-2];
|
||||||
var fromY = points[points.length-1];
|
var fromY = points[points.length-1];
|
||||||
var a1 = fromY - y1;
|
var a1 = fromY - y1;
|
||||||
|
@ -374,9 +376,14 @@ PIXI.Graphics.prototype.arcTo = function(x1, y1, x2, y2, radius)
|
||||||
var b2 = x2 - x1;
|
var b2 = x2 - x1;
|
||||||
var mm = Math.abs(a1 * b2 - b1 * a2);
|
var mm = Math.abs(a1 * b2 - b1 * a2);
|
||||||
|
|
||||||
|
|
||||||
if (mm < 1.0e-8 || radius === 0)
|
if (mm < 1.0e-8 || radius === 0)
|
||||||
{
|
{
|
||||||
points.push(x1, y1);
|
if( points[points.length-2] !== x1 || points[points.length-1] !== y1)
|
||||||
|
{
|
||||||
|
//console.log(">>")
|
||||||
|
points.push(x1, y1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -423,11 +430,15 @@ PIXI.Graphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, ant
|
||||||
|
|
||||||
var points = this.currentPath.shape.points;
|
var points = this.currentPath.shape.points;
|
||||||
|
|
||||||
if(points.length !== 0 && points[points.length-2] !== startX || points[points.length-1] !== startY)
|
if(points.length === 0)
|
||||||
{
|
{
|
||||||
this.moveTo(startX, startY);
|
this.moveTo(startX, startY);
|
||||||
points = this.currentPath.shape.points;
|
points = this.currentPath.shape.points;
|
||||||
}
|
}
|
||||||
|
else if( points[points.length-2] !== startX || points[points.length-1] !== startY)
|
||||||
|
{
|
||||||
|
points.push(startX, startY);
|
||||||
|
}
|
||||||
|
|
||||||
if (startAngle === endAngle)return this;
|
if (startAngle === endAngle)return this;
|
||||||
|
|
||||||
|
@ -543,7 +554,7 @@ PIXI.Graphics.prototype.drawRect = function( x, y, width, height )
|
||||||
*/
|
*/
|
||||||
PIXI.Graphics.prototype.drawRoundedRect = function( x, y, width, height, radius )
|
PIXI.Graphics.prototype.drawRoundedRect = function( x, y, width, height, radius )
|
||||||
{
|
{
|
||||||
this.drawShape({ points:[x, y, width, height, radius], type:PIXI.Graphics.RREC });
|
this.drawShape(new PIXI.RoundedRectangle(x, y, width, height, radius));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -804,13 +815,13 @@ PIXI.Graphics.prototype.getBounds = function( matrix )
|
||||||
|
|
||||||
if(this.dirty)
|
if(this.dirty)
|
||||||
{
|
{
|
||||||
this.updateBounds();
|
this.updateLocalBounds();
|
||||||
this.webGLDirty = true;
|
this.webGLDirty = true;
|
||||||
this.cachedSpriteDirty = true;
|
this.cachedSpriteDirty = true;
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bounds = this._bounds;
|
var bounds = this._localBounds;
|
||||||
|
|
||||||
var w0 = bounds.x;
|
var w0 = bounds.x;
|
||||||
var w1 = bounds.width + bounds.x;
|
var w1 = bounds.width + bounds.x;
|
||||||
|
@ -861,21 +872,21 @@ PIXI.Graphics.prototype.getBounds = function( matrix )
|
||||||
maxY = y3 > maxY ? y3 : maxY;
|
maxY = y3 > maxY ? y3 : maxY;
|
||||||
maxY = y4 > maxY ? y4 : maxY;
|
maxY = y4 > maxY ? y4 : maxY;
|
||||||
|
|
||||||
bounds.x = minX;
|
this._bounds.x = minX;
|
||||||
bounds.width = maxX - minX;
|
this._bounds.width = maxX - minX;
|
||||||
|
|
||||||
bounds.y = minY;
|
this._bounds.y = minY;
|
||||||
bounds.height = maxY - minY;
|
this._bounds.height = maxY - minY;
|
||||||
|
|
||||||
return bounds;
|
return this._bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the bounds of the object
|
* Update the bounds of the object
|
||||||
*
|
*
|
||||||
* @method updateBounds
|
* @method updateLocalBounds
|
||||||
*/
|
*/
|
||||||
PIXI.Graphics.prototype.updateBounds = function()
|
PIXI.Graphics.prototype.updateLocalBounds = function()
|
||||||
{
|
{
|
||||||
var minX = Infinity;
|
var minX = Infinity;
|
||||||
var maxX = -Infinity;
|
var maxX = -Infinity;
|
||||||
|
@ -961,13 +972,12 @@ PIXI.Graphics.prototype.updateBounds = function()
|
||||||
}
|
}
|
||||||
|
|
||||||
var padding = this.boundsPadding;
|
var padding = this.boundsPadding;
|
||||||
var bounds = this._bounds;
|
|
||||||
|
|
||||||
bounds.x = minX - padding;
|
this._localBounds.x = minX - padding;
|
||||||
bounds.width = (maxX - minX) + padding * 2;
|
this._localBounds.width = (maxX - minX) + padding * 2;
|
||||||
|
|
||||||
bounds.y = minY - padding;
|
this._localBounds.y = minY - padding;
|
||||||
bounds.height = (maxY - minY) + padding * 2;
|
this._localBounds.height = (maxY - minY) + padding * 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1111,3 +1121,5 @@ PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
|
||||||
PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
|
PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
|
||||||
PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
|
PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
|
||||||
PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
|
PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
|
||||||
|
PIXI.RoundedRectangle.prototype.type = PIXI.Graphics.RREC;
|
||||||
|
|
||||||
|
|
|
@ -148,12 +148,11 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
||||||
}
|
}
|
||||||
else if (data.type === PIXI.Graphics.RREC)
|
else if (data.type === PIXI.Graphics.RREC)
|
||||||
{
|
{
|
||||||
var pts = shape.points;
|
var rx = shape.x;
|
||||||
var rx = pts[0];
|
var ry = shape.y;
|
||||||
var ry = pts[1];
|
var width = shape.width;
|
||||||
var width = pts[2];
|
var height = shape.height;
|
||||||
var height = pts[3];
|
var radius = shape.radius;
|
||||||
var radius = pts[4];
|
|
||||||
|
|
||||||
var maxRadius = Math.min(width, height) / 2 | 0;
|
var maxRadius = Math.min(width, height) / 2 | 0;
|
||||||
radius = radius > maxRadius ? maxRadius : radius;
|
radius = radius > maxRadius ? maxRadius : radius;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PIXI.glContexts = []; // this is where we store the webGL contexts for easy access.
|
PIXI.glContexts = []; // this is where we store the webGL contexts for easy access.
|
||||||
|
PIXI.instances = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WebGLRenderer draws the stage and all its content onto a webGL enabled canvas. This renderer
|
* The WebGLRenderer draws the stage and all its content onto a webGL enabled canvas. This renderer
|
||||||
|
@ -251,6 +252,8 @@ PIXI.WebGLRenderer.prototype.initContext = function()
|
||||||
|
|
||||||
PIXI.glContexts[this.glContextId] = gl;
|
PIXI.glContexts[this.glContextId] = gl;
|
||||||
|
|
||||||
|
PIXI.instances[this.glContextId] = this;
|
||||||
|
|
||||||
// set up the default pixi settings..
|
// set up the default pixi settings..
|
||||||
gl.disable(gl.DEPTH_TEST);
|
gl.disable(gl.DEPTH_TEST);
|
||||||
gl.disable(gl.CULL_FACE);
|
gl.disable(gl.CULL_FACE);
|
||||||
|
@ -536,3 +539,4 @@ PIXI.WebGLRenderer.prototype.mapBlendModes = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.WebGLRenderer.glContextId = 0;
|
PIXI.WebGLRenderer.glContextId = 0;
|
||||||
|
PIXI.WebGLRenderer.instances = [];
|
||||||
|
|
|
@ -327,7 +327,7 @@ PIXI.PixiShader.prototype.syncUniforms = function()
|
||||||
|
|
||||||
if(uniform.value.baseTexture._dirty[gl.id])
|
if(uniform.value.baseTexture._dirty[gl.id])
|
||||||
{
|
{
|
||||||
PIXI.defaultRenderer.updateTexture(uniform.value.baseTexture);
|
PIXI.WebGLRenderer.instances[gl.id].updateTexture(uniform.value.baseTexture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,12 +309,13 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
||||||
{
|
{
|
||||||
var points = graphicsData.shape.points;
|
var rrectData = graphicsData.shape;
|
||||||
var x = points[0];
|
var x = rrectData.x;
|
||||||
var y = points[1];
|
var y = rrectData.y;
|
||||||
var width = points[2];
|
var width = rrectData.width;
|
||||||
var height = points[3];
|
var height = rrectData.height;
|
||||||
var radius = points[4];
|
|
||||||
|
var radius = rrectData.radius;
|
||||||
|
|
||||||
var recPoints = [];
|
var recPoints = [];
|
||||||
recPoints.push(x, y + radius);
|
recPoints.push(x, y + radius);
|
||||||
|
|
|
@ -324,3 +324,6 @@ PIXI.TextureUvs = function()
|
||||||
this.x3 = 0;
|
this.x3 = 0;
|
||||||
this.y3 = 0;
|
this.y3 = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture());
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"src/pixi/Pixi.js",
|
"src/pixi/Pixi.js",
|
||||||
"src/pixi/geom/Polygon.js",
|
"src/pixi/geom/Polygon.js",
|
||||||
"src/pixi/geom/Matrix.js",
|
"src/pixi/geom/Matrix.js",
|
||||||
|
"src/pixi/geom/RoundedRectangle.js",
|
||||||
"src/pixi/display/DisplayObject.js",
|
"src/pixi/display/DisplayObject.js",
|
||||||
"src/pixi/display/DisplayObjectContainer.js",
|
"src/pixi/display/DisplayObjectContainer.js",
|
||||||
"src/pixi/display/Sprite.js",
|
"src/pixi/display/Sprite.js",
|
||||||
|
|
Loading…
Reference in a new issue