diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 313a716..e78a961 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -729,12 +729,13 @@ { if(!Graphics._SPRITE_TEXTURE) { - Graphics._SPRITE_TEXTURE = RenderTexture.create(10, 10); - - var currentRenderTarget = renderer._activeRenderTarget; - renderer.bindRenderTexture(Graphics._SPRITE_TEXTURE); - renderer.clear([1,1,1,1]); - renderer.bindRenderTarget(currentRenderTarget); + var canvas = document.createElement('canvas'); + canvas.width = 10; + canvas.height = 10; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + Graphics._SPRITE_TEXTURE = Texture.fromCanvas(canvas); } this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 313a716..e78a961 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -729,12 +729,13 @@ { if(!Graphics._SPRITE_TEXTURE) { - Graphics._SPRITE_TEXTURE = RenderTexture.create(10, 10); - - var currentRenderTarget = renderer._activeRenderTarget; - renderer.bindRenderTexture(Graphics._SPRITE_TEXTURE); - renderer.clear([1,1,1,1]); - renderer.bindRenderTarget(currentRenderTarget); + var canvas = document.createElement('canvas'); + canvas.width = 10; + canvas.height = 10; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + Graphics._SPRITE_TEXTURE = Texture.fromCanvas(canvas); } this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 989db92..9b1efda 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -50,6 +50,62 @@ Rectangle.prototype.constructor = Rectangle; module.exports = Rectangle; + +Object.defineProperties(Rectangle.prototype, { + /** + * returns the left edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle# + */ + left: { + get: function () + { + return this.x; + } + }, + + /** + * returns the right edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + right: { + get: function () + { + return this.x + this.width; + } + }, + + /** + * returns the top edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + top: { + get: function () + { + return this.y; + } + }, + + /** + * returns the bottom edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + bottom: { + get: function () + { + return this.y + this.height; + } + } + +}); + /** * A constant empty rectangle. * diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 313a716..e78a961 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -729,12 +729,13 @@ { if(!Graphics._SPRITE_TEXTURE) { - Graphics._SPRITE_TEXTURE = RenderTexture.create(10, 10); - - var currentRenderTarget = renderer._activeRenderTarget; - renderer.bindRenderTexture(Graphics._SPRITE_TEXTURE); - renderer.clear([1,1,1,1]); - renderer.bindRenderTarget(currentRenderTarget); + var canvas = document.createElement('canvas'); + canvas.width = 10; + canvas.height = 10; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + Graphics._SPRITE_TEXTURE = Texture.fromCanvas(canvas); } this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 989db92..9b1efda 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -50,6 +50,62 @@ Rectangle.prototype.constructor = Rectangle; module.exports = Rectangle; + +Object.defineProperties(Rectangle.prototype, { + /** + * returns the left edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle# + */ + left: { + get: function () + { + return this.x; + } + }, + + /** + * returns the right edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + right: { + get: function () + { + return this.x + this.width; + } + }, + + /** + * returns the top edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + top: { + get: function () + { + return this.y; + } + }, + + /** + * returns the bottom edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + bottom: { + get: function () + { + return this.y + this.height; + } + } + +}); + /** * A constant empty rectangle. * diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index 9d21162..ec52e32 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -88,23 +88,22 @@ if(filterData.stack[0].renderTarget.transform) {//jshint ignore:line - // TODO we should fit the rect around the transform.. + } else { - sourceFrame.fit(filterData.stack[0].destinationFrame); } - - destinationFrame.width = sourceFrame.width; - destinationFrame.height = sourceFrame.height; - - // lets pplay the padding After we fit the element to the screen. // this should stop the strange side effects that can occour when cropping to the edges sourceFrame.pad(padding); + + + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + var renderTarget = this.getPotRenderTarget(renderer.gl, sourceFrame.width, sourceFrame.height, resolution); currentState.target = target; diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 313a716..e78a961 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -729,12 +729,13 @@ { if(!Graphics._SPRITE_TEXTURE) { - Graphics._SPRITE_TEXTURE = RenderTexture.create(10, 10); - - var currentRenderTarget = renderer._activeRenderTarget; - renderer.bindRenderTexture(Graphics._SPRITE_TEXTURE); - renderer.clear([1,1,1,1]); - renderer.bindRenderTarget(currentRenderTarget); + var canvas = document.createElement('canvas'); + canvas.width = 10; + canvas.height = 10; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + Graphics._SPRITE_TEXTURE = Texture.fromCanvas(canvas); } this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 989db92..9b1efda 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -50,6 +50,62 @@ Rectangle.prototype.constructor = Rectangle; module.exports = Rectangle; + +Object.defineProperties(Rectangle.prototype, { + /** + * returns the left edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle# + */ + left: { + get: function () + { + return this.x; + } + }, + + /** + * returns the right edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + right: { + get: function () + { + return this.x + this.width; + } + }, + + /** + * returns the top edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + top: { + get: function () + { + return this.y; + } + }, + + /** + * returns the bottom edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + bottom: { + get: function () + { + return this.y + this.height; + } + } + +}); + /** * A constant empty rectangle. * diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index 9d21162..ec52e32 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -88,23 +88,22 @@ if(filterData.stack[0].renderTarget.transform) {//jshint ignore:line - // TODO we should fit the rect around the transform.. + } else { - sourceFrame.fit(filterData.stack[0].destinationFrame); } - - destinationFrame.width = sourceFrame.width; - destinationFrame.height = sourceFrame.height; - - // lets pplay the padding After we fit the element to the screen. // this should stop the strange side effects that can occour when cropping to the edges sourceFrame.pad(padding); + + + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + var renderTarget = this.getPotRenderTarget(renderer.gl, sourceFrame.width, sourceFrame.height, resolution); currentState.target = target; diff --git a/src/core/sprites/webgl/generateMultiTextureShader.js b/src/core/sprites/webgl/generateMultiTextureShader.js index 38b06e2..4186bb3 100644 --- a/src/core/sprites/webgl/generateMultiTextureShader.js +++ b/src/core/sprites/webgl/generateMultiTextureShader.js @@ -23,7 +23,7 @@ fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures); fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures)); - var shader = new Shader(gl, vertexSrc, fragmentSrc); + var shader = new Shader(gl, vertexSrc, fragmentSrc, {aVertexPosition:3, aColor:2, aTextureCoord:1, aTextureId:0}); var sampleValues = []; for (var i = 0; i < maxTextures; i++) diff --git a/LICENSE b/LICENSE index 912d9dd..7ca4d7c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The Pixi License -Copyright (c) 2013-2016 Mathew Groves +Copyright (c) 2013-2016 Mathew Groves, Chad Engler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 29f6a6d..1509ce4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.0.1", + "version": "4.0.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -9,7 +9,7 @@ "Chad Engler ", "Richard Davey " ], - "main": "./src/index.js", + "main": "./bin/pixi.min.js", "homepage": "http://goodboydigital.com/", "bugs": "https://github.com/pixijs/pixi.js/issues", "license": "MIT", diff --git a/src/accessibility/AccessibilityManager.js b/src/accessibility/AccessibilityManager.js index 24d8ad6..719f977 100644 --- a/src/accessibility/AccessibilityManager.js +++ b/src/accessibility/AccessibilityManager.js @@ -18,7 +18,7 @@ */ function AccessibilityManager(renderer) { - if(Device.tablet || Device.phone) + if((Device.tablet || Device.phone) && !navigator.isCocoonJS) { this.createTouchHook(); } diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 313a716..e78a961 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -729,12 +729,13 @@ { if(!Graphics._SPRITE_TEXTURE) { - Graphics._SPRITE_TEXTURE = RenderTexture.create(10, 10); - - var currentRenderTarget = renderer._activeRenderTarget; - renderer.bindRenderTexture(Graphics._SPRITE_TEXTURE); - renderer.clear([1,1,1,1]); - renderer.bindRenderTarget(currentRenderTarget); + var canvas = document.createElement('canvas'); + canvas.width = 10; + canvas.height = 10; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + Graphics._SPRITE_TEXTURE = Texture.fromCanvas(canvas); } this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 989db92..9b1efda 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -50,6 +50,62 @@ Rectangle.prototype.constructor = Rectangle; module.exports = Rectangle; + +Object.defineProperties(Rectangle.prototype, { + /** + * returns the left edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle# + */ + left: { + get: function () + { + return this.x; + } + }, + + /** + * returns the right edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + right: { + get: function () + { + return this.x + this.width; + } + }, + + /** + * returns the top edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + top: { + get: function () + { + return this.y; + } + }, + + /** + * returns the bottom edge of the rectangle + * + * @member {number} + * @memberof PIXI.Rectangle + */ + bottom: { + get: function () + { + return this.y + this.height; + } + } + +}); + /** * A constant empty rectangle. * diff --git a/src/core/renderers/webgl/managers/FilterManager.js b/src/core/renderers/webgl/managers/FilterManager.js index 9d21162..ec52e32 100644 --- a/src/core/renderers/webgl/managers/FilterManager.js +++ b/src/core/renderers/webgl/managers/FilterManager.js @@ -88,23 +88,22 @@ if(filterData.stack[0].renderTarget.transform) {//jshint ignore:line - // TODO we should fit the rect around the transform.. + } else { - sourceFrame.fit(filterData.stack[0].destinationFrame); } - - destinationFrame.width = sourceFrame.width; - destinationFrame.height = sourceFrame.height; - - // lets pplay the padding After we fit the element to the screen. // this should stop the strange side effects that can occour when cropping to the edges sourceFrame.pad(padding); + + + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + var renderTarget = this.getPotRenderTarget(renderer.gl, sourceFrame.width, sourceFrame.height, resolution); currentState.target = target; diff --git a/src/core/sprites/webgl/generateMultiTextureShader.js b/src/core/sprites/webgl/generateMultiTextureShader.js index 38b06e2..4186bb3 100644 --- a/src/core/sprites/webgl/generateMultiTextureShader.js +++ b/src/core/sprites/webgl/generateMultiTextureShader.js @@ -23,7 +23,7 @@ fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures); fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures)); - var shader = new Shader(gl, vertexSrc, fragmentSrc); + var shader = new Shader(gl, vertexSrc, fragmentSrc, {aVertexPosition:3, aColor:2, aTextureCoord:1, aTextureId:0}); var sampleValues = []; for (var i = 0; i < maxTextures; i++) diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 5b49553..1503f6b 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -691,6 +691,11 @@ } else { + // cocoon on canvas+ cannot generate textures, so use the first colour instead + if ( navigator.isCocoonJS ) { + return style.fill[0]; + } + // the gradient will be evenly spaced out according to how large the array is. // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 var i;