diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/src/loaders/spritesheetParser.js b/src/loaders/spritesheetParser.js index 2c57452..f30032c 100644 --- a/src/loaders/spritesheetParser.js +++ b/src/loaders/spritesheetParser.js @@ -38,16 +38,16 @@ var trim = null; if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + size = new core.Rectangle(rect.x, rect.y, rect.h, rect.w); } else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + size = new core.Rectangle(rect.x, rect.y, rect.w, rect.h); } // Check to see if the sprite is trimmed if (frames[i].trimmed) { - trim = new core.math.Rectangle( + trim = new core.Rectangle( frames[i].spriteSourceSize.x / resolution, frames[i].spriteSourceSize.y / resolution, frames[i].sourceSize.w / resolution, diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/src/loaders/spritesheetParser.js b/src/loaders/spritesheetParser.js index 2c57452..f30032c 100644 --- a/src/loaders/spritesheetParser.js +++ b/src/loaders/spritesheetParser.js @@ -38,16 +38,16 @@ var trim = null; if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + size = new core.Rectangle(rect.x, rect.y, rect.h, rect.w); } else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + size = new core.Rectangle(rect.x, rect.y, rect.w, rect.h); } // Check to see if the sprite is trimmed if (frames[i].trimmed) { - trim = new core.math.Rectangle( + trim = new core.Rectangle( frames[i].spriteSourceSize.x / resolution, frames[i].spriteSourceSize.y / resolution, frames[i].sourceSize.w / resolution, diff --git a/src/mesh/Mesh.js b/src/mesh/Mesh.js index 51cc887..596230d 100644 --- a/src/mesh/Mesh.js +++ b/src/mesh/Mesh.js @@ -397,7 +397,7 @@ if (minX === -Infinity || maxY === Infinity) { - return core.math.Rectangle.EMPTY; + return core.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/src/loaders/spritesheetParser.js b/src/loaders/spritesheetParser.js index 2c57452..f30032c 100644 --- a/src/loaders/spritesheetParser.js +++ b/src/loaders/spritesheetParser.js @@ -38,16 +38,16 @@ var trim = null; if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + size = new core.Rectangle(rect.x, rect.y, rect.h, rect.w); } else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + size = new core.Rectangle(rect.x, rect.y, rect.w, rect.h); } // Check to see if the sprite is trimmed if (frames[i].trimmed) { - trim = new core.math.Rectangle( + trim = new core.Rectangle( frames[i].spriteSourceSize.x / resolution, frames[i].spriteSourceSize.y / resolution, frames[i].sourceSize.w / resolution, diff --git a/src/mesh/Mesh.js b/src/mesh/Mesh.js index 51cc887..596230d 100644 --- a/src/mesh/Mesh.js +++ b/src/mesh/Mesh.js @@ -397,7 +397,7 @@ if (minX === -Infinity || maxY === Infinity) { - return core.math.Rectangle.EMPTY; + return core.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/mesh/Rope.js b/src/mesh/Rope.js index 8ce30cd..842ae4b 100644 --- a/src/mesh/Rope.js +++ b/src/mesh/Rope.js @@ -85,8 +85,8 @@ var colors = this.colors; var textureUvs = this._texture._uvs; - var offset = new core.math.Point(textureUvs.x0, textureUvs.y0); - var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); + var offset = new core.Point(textureUvs.x0, textureUvs.y0); + var factor = new core.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); uvs[0] = 0 + offset.x; uvs[1] = 0 + offset.y; diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/src/loaders/spritesheetParser.js b/src/loaders/spritesheetParser.js index 2c57452..f30032c 100644 --- a/src/loaders/spritesheetParser.js +++ b/src/loaders/spritesheetParser.js @@ -38,16 +38,16 @@ var trim = null; if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + size = new core.Rectangle(rect.x, rect.y, rect.h, rect.w); } else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + size = new core.Rectangle(rect.x, rect.y, rect.w, rect.h); } // Check to see if the sprite is trimmed if (frames[i].trimmed) { - trim = new core.math.Rectangle( + trim = new core.Rectangle( frames[i].spriteSourceSize.x / resolution, frames[i].spriteSourceSize.y / resolution, frames[i].sourceSize.w / resolution, diff --git a/src/mesh/Mesh.js b/src/mesh/Mesh.js index 51cc887..596230d 100644 --- a/src/mesh/Mesh.js +++ b/src/mesh/Mesh.js @@ -397,7 +397,7 @@ if (minX === -Infinity || maxY === Infinity) { - return core.math.Rectangle.EMPTY; + return core.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/mesh/Rope.js b/src/mesh/Rope.js index 8ce30cd..842ae4b 100644 --- a/src/mesh/Rope.js +++ b/src/mesh/Rope.js @@ -85,8 +85,8 @@ var colors = this.colors; var textureUvs = this._texture._uvs; - var offset = new core.math.Point(textureUvs.x0, textureUvs.y0); - var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); + var offset = new core.Point(textureUvs.x0, textureUvs.y0); + var factor = new core.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); uvs[0] = 0 + offset.x; uvs[1] = 0 + offset.y; diff --git a/src/mesh/webgl/MeshRenderer.js b/src/mesh/webgl/MeshRenderer.js index e520b10..a5a8e44 100644 --- a/src/mesh/webgl/MeshRenderer.js +++ b/src/mesh/webgl/MeshRenderer.js @@ -1,5 +1,4 @@ -var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'), - WebGLRenderer = require('../../core/renderers/webgl/WebGLRenderer'), +var core = require('../../core'), Mesh = require('../Mesh'); /** @@ -23,7 +22,7 @@ */ function MeshRenderer(renderer) { - ObjectRenderer.call(this, renderer); + core.ObjectRenderer.call(this, renderer); /** @@ -45,11 +44,11 @@ } } -MeshRenderer.prototype = Object.create(ObjectRenderer.prototype); +MeshRenderer.prototype = Object.create(core.ObjectRenderer.prototype); MeshRenderer.prototype.constructor = MeshRenderer; module.exports = MeshRenderer; -WebGLRenderer.registerPlugin('mesh', MeshRenderer); +core.WebGLRenderer.registerPlugin('mesh', MeshRenderer); /** * Sets up the renderer context and necessary buffers. diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 50376c0..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -./src/spine/SpineRuntime.js -./src/core/utils/PolyK.js diff --git a/gulp/util/jsdoc.conf.json b/gulp/util/jsdoc.conf.json index 5456ae7..4069317 100644 --- a/gulp/util/jsdoc.conf.json +++ b/gulp/util/jsdoc.conf.json @@ -7,9 +7,7 @@ "./src/" ], "exclude": [ - "./src/polyfill/", - "./src/core/utils/PolyK.js", - "./src/spine/SpineRuntime.js" + "./src/polyfill/" ], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js deleted file mode 100644 index 8ffd74e..0000000 --- a/gulp/util/karma.conf.js +++ /dev/null @@ -1,87 +0,0 @@ -var path = require('path'); - -module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: path.join(__dirname, '..', '..'), - - frameworks: ['browserify', 'mocha', 'chai'], - - // list of files / patterns to load in the browser - files: [ - 'bin/pixi.js', - 'test/lib/**/*.js', - 'test/unit/{bin,src}/**/*.js', - // 'test/functional/**/*.js', - { - pattern: 'test/**/*.png', - watched: false, - included: false, - served: true - } - ], - - // list of files to exclude - //exclude: [], - - // use spec reporter - // possible values: 'dots', 'progress', 'junit', 'teamcity' - // CLI --reporters progress - reporters: ['spec'], - - // web server port - // CLI --port 9876 - port: 9876, - - // cli runner port - // CLI --runner-port 9100 - runnerPort: 9100, - - // enable / disable colors in the output (reporters and logs) - // CLI --colors --no-colors - colors: true, - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - // CLI --log-level debug - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - // CLI --auto-watch --no-auto-watch - autoWatch: false, - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - // CLI --browsers Chrome,Firefox,Safari - browsers: ['Firefox'], - - // If browser does not capture in given timeout [ms], kill it - // CLI --capture-timeout 60000 - captureTimeout: 60000, - - // report which specs are slower than 500ms - // CLI --report-slower-than 500 - reportSlowerThan: 500, - - preprocessors : { - 'test/unit/{bin,src}/**/*.js': ['browserify'] - }, - - // browserify configuration - browserify: { - debug: true, - transform: ['brfs'], - configure: function(bundle) { - bundle.on('prebundle', function() { - bundle.external('pixi.js'); - }); - } - } - }); -}; diff --git a/inch.json b/inch.json index 4b03d7c..a1b868b 100644 --- a/inch.json +++ b/inch.json @@ -4,8 +4,7 @@ "src/**/*.js" ], "excluded": [ - "src/spine/Spine.js", - "src/spine/SpineRuntime.js" + "src/polyfill/" ] } } diff --git a/package.json b/package.json index 23cf0dc..da1c012 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/GoodBoyDigital/pixi.js.git" }, "scripts": { + "start": "gulp && gulp watch", "test": "gulp && testem ci", "build": "gulp", "docs": "jsdoc -c ./gulp/util/jsdoc.conf.json -R README.md" diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 83eb0bc..3f34d51 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -384,7 +384,7 @@ this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints); - // this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item. + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. // TODO - fix this properly, this is not very elegant.. but it works for now. if (graphicsData.fill) diff --git a/src/core/index.js b/src/core/index.js index 1c020a6..61f003f 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -12,7 +12,6 @@ var core = module.exports = Object.assign(require('./const'), require('./math'), { // utils utils: require('./utils'), - math: require('./math'), ticker: require('./ticker'), // display @@ -54,6 +53,8 @@ // filters - webgl AbstractFilter: require('./renderers/webgl/filters/AbstractFilter'), + FXAAFilter: require('./renderers/webgl/filters/FXAAFilter'), + SpriteMaskFilter: require('./renderers/webgl/filters/SpriteMaskFilter'), /** * This helper function will automatically detect which renderer you should be using. diff --git a/src/core/math/index.js b/src/core/math/index.js index 22d9e87..fd0d9be 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -1,4 +1,14 @@ +/** + * Math classes and utilities mixed into PIXI namespace. + * + * @lends PIXI + */ module.exports = { + // These will be mixed to be made publicly available, + // while this module is used internally in core + // to avoid circular dependencies and cut down on + // internal module requires. + Point: require('./Point'), Matrix: require('./Matrix'), diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index d94b696..33439a6 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -473,7 +473,7 @@ // call base destroy SystemRenderer.prototype.destroy.call(this, removeView); - this.uuid = 0; + this.uid = 0; // destroy the managers this.shaderManager.destroy(); diff --git a/src/core/renderers/webgl/managers/ShaderManager.js b/src/core/renderers/webgl/managers/ShaderManager.js index 64112af..226552a 100644 --- a/src/core/renderers/webgl/managers/ShaderManager.js +++ b/src/core/renderers/webgl/managers/ShaderManager.js @@ -134,12 +134,12 @@ */ ShaderManager.prototype.setShader = function (shader) { - if (this._currentId === shader.uuid) + if (this._currentId === shader.uid) { return false; } - this._currentId = shader.uuid; + this._currentId = shader.uid; this.currentShader = shader; diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index ef8fca0..a33d7a8 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -22,7 +22,7 @@ * @member {number} * @readonly */ - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The current WebGL drawing context diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c2d6de5..ec3c2e0 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -323,7 +323,7 @@ nextShader = sprite.shader || this.shader; blendSwap = currentBlendMode !== nextBlendMode; - shaderSwap = currentShader !== nextShader; // should I use uuidS??? + shaderSwap = currentShader !== nextShader; // should I use uidS??? if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) { diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 30388c6..dc66e48 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -15,7 +15,7 @@ { EventEmitter.call(this); - this.uuid = utils.uuid(); + this.uid = utils.uid(); /** * The Resolution of the texture. @@ -416,7 +416,7 @@ { if (!canvas._pixiId) { - canvas._pixiId = 'canvas_' + utils.uuid(); + canvas._pixiId = 'canvas_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[canvas._pixiId]; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index d5bfdee..9297063 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -163,7 +163,7 @@ { if (!video._pixiId) { - video._pixiId = 'video_' + utils.uuid(); + video._pixiId = 'video_' + utils.uid(); } var baseTexture = utils.BaseTextureCache[video._pixiId]; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index b74608c..8c4ea72 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -11,11 +11,11 @@ async: require('async'), /** - * Gets the next uuid + * Gets the next unique identifier * - * @return {number} The next uuid to use. + * @return {number} The next unique identifier to use. */ - uuid: function () + uid: function () { return ++utils._uid; }, @@ -223,6 +223,15 @@ } }, + /** + * @todo Describe property usage + * @private + */ TextureCache: {}, + + /** + * @todo Describe property usage + * @private + */ BaseTextureCache: {} }; diff --git a/src/deprecation.js b/src/deprecation.js index bee8c7a..dc5b544 100644 --- a/src/deprecation.js +++ b/src/deprecation.js @@ -2,7 +2,7 @@ var core = require('./core'), mesh = require('./mesh'), extras = require('./extras'), - utils = require('./core/utils'); + filters = require('./filters'); /** * @class @@ -11,7 +11,8 @@ * @see {@link PIXI.ParticleContainer} * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. */ -core.SpriteBatch = function() { +core.SpriteBatch = function() +{ throw new ReferenceError('SpriteBatch does not exist any more, please use the new ParticleContainer instead.'); }; @@ -22,7 +23,8 @@ * @see {@link PIXI.loaders.Loader} * @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class. */ -core.AssetLoader = function() { +core.AssetLoader = function() +{ throw new ReferenceError('The loader system was overhauled in pixi v3, please see the new PIXI.loaders.Loader class.'); }; @@ -36,7 +38,8 @@ * @deprecated since version 3.0 */ Stage: { - get: function() { + get: function() + { console.warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); return core.Container; } @@ -50,7 +53,8 @@ * @deprecated since version 3.0 */ DisplayObjectContainer: { - get: function() { + get: function() + { console.warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); return core.Container; } @@ -64,7 +68,8 @@ * @deprecated since version 3.0 */ Strip: { - get: function() { + get: function() + { console.warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); return mesh.Mesh; } @@ -78,7 +83,8 @@ * @deprecated since version 3.0 */ Rope: { - get: function() { + get: function() + { console.warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); return mesh.Rope; } @@ -92,11 +98,13 @@ * @deprecated since version 3.0 */ MovieClip: { - get: function() { + get: function() + { console.warn('The MovieClip class has been moved to extras.MovieClip, please use extras.MovieClip from now on.'); return extras.MovieClip; } }, + /** * @class * @private @@ -105,11 +113,13 @@ * @deprecated since version 3.0 */ TilingSprite: { - get: function() { + get: function() + { console.warn('The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on.'); return extras.TilingSprite; } }, + /** * @class * @private @@ -118,11 +128,13 @@ * @deprecated since version 3.0 */ BitmapText: { - get: function() { + get: function() + { console.warn('The BitmapText class has been moved to extras.BitmapText, please use extras.BitmapText from now on.'); return extras.BitmapText; } }, + /** * @class * @private @@ -131,11 +143,13 @@ * @deprecated since version 3.0 */ blendModes: { - get: function() { + get: function() + { console.warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); return core.BLEND_MODES; } }, + /** * @class * @private @@ -144,11 +158,13 @@ * @deprecated since version 3.0 */ scaleModes: { - get: function() { + get: function() + { console.warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); return core.SCALE_MODES; } }, + /** * @class * @private @@ -157,11 +173,13 @@ * @deprecated since version 3.0 */ BaseTextureCache: { - get: function () { + get: function () + { console.warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, please use utils.BaseTextureCache from now on.'); - return utils.BaseTextureCache; + return core.utils.BaseTextureCache; } }, + /** * @class * @private @@ -170,9 +188,25 @@ * @deprecated since version 3.0 */ TextureCache: { - get: function () { + get: function () + { console.warn('The TextureCache class has been moved to utils.TextureCache, please use utils.TextureCache from now on.'); - return utils.TextureCache; + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name PIXI.math + * @see {@link PIXI} + * @deprecated since version 3.0.6 + */ + math: { + get: function () + { + console.warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + return core; } } }); @@ -184,7 +218,8 @@ * @see {@link PIXI.Sprite#texture} * @deprecated since version 3.0 */ -core.Sprite.prototype.setTexture = function(texture) { +core.Sprite.prototype.setTexture = function(texture) +{ this.texture = texture; console.warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); }; @@ -195,7 +230,8 @@ * @see {@link PIXI.BitmapText#text} * @deprecated since version 3.0 */ -extras.BitmapText.prototype.setText = function(text) { +extras.BitmapText.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); }; @@ -206,7 +242,8 @@ * @see {@link PIXI.Text#text} * @deprecated since version 3.0 */ -core.Text.prototype.setText = function(text) { +core.Text.prototype.setText = function(text) +{ this.text = text; console.warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); }; @@ -217,7 +254,8 @@ * @see {@link PIXI.Text#style} * @deprecated since version 3.0 */ -core.Text.prototype.setStyle = function(style) { +core.Text.prototype.setStyle = function(style) +{ this.style = style; console.warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); }; @@ -228,7 +266,68 @@ * @see {@link PIXI.Texture#setFrame} * @deprecated since version 3.0 */ -core.Texture.prototype.setFrame = function(frame) { +core.Texture.prototype.setFrame = function(frame) +{ this.frame = frame; console.warn('setFrame is now deprecated, please use the frame property, e.g : myTexture.frame = frame;'); }; + +Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see {@link PIXI.AbstractFilter} + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function() + { + console.warn('filters.AbstractFilter is an undocumented alias, please use AbstractFilter from now on.'); + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.FXAAFilter + * @see {@link PIXI.FXAAFilter} + * @deprecated since version 3.0.6 + */ + FXAAFilter: { + get: function() + { + console.warn('filters.FXAAFilter is an undocumented alias, please use FXAAFilter from now on.'); + return core.FXAAFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see {@link PIXI.SpriteMaskFilter} + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function() + { + console.warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + return core.SpriteMaskFilter; + } + } +}); + +/** + * @method + * @name PIXI.utils.uuid + * @see {@link PIXI.utils.uid} + * @deprecated since version 3.0.6 + */ +core.utils.uuid = function () +{ + console.warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + return core.utils.uid(); +}; diff --git a/src/extras/BitmapText.js b/src/extras/BitmapText.js index 0ebddfc..fd53f2b 100644 --- a/src/extras/BitmapText.js +++ b/src/extras/BitmapText.js @@ -216,7 +216,7 @@ BitmapText.prototype.updateText = function () { var data = BitmapText.fonts[this._font.name]; - var pos = new core.math.Point(); + var pos = new core.Point(); var prevCharCode = null; var chars = []; var lastLineWidth = 0; @@ -271,7 +271,7 @@ pos.x += charData.kerning[prevCharCode]; } - chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); + chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)}); lastLineWidth = pos.x + (charData.texture.width + charData.xOffset); pos.x += charData.xAdvance; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 7a37abf..7e72867 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -21,7 +21,7 @@ * * @member {Point} */ - this.tileScale = new core.math.Point(1,1); + this.tileScale = new core.Point(1,1); /** @@ -29,7 +29,7 @@ * * @member {Point} */ - this.tilePosition = new core.math.Point(0,0); + this.tilePosition = new core.Point(0,0); ///// private diff --git a/src/filters/displacement/DisplacementFilter.js b/src/filters/displacement/DisplacementFilter.js index fdb9422..6ffb10f 100644 --- a/src/filters/displacement/DisplacementFilter.js +++ b/src/filters/displacement/DisplacementFilter.js @@ -14,7 +14,7 @@ */ function DisplacementFilter(sprite) { - var maskMatrix = new core.math.Matrix(); + var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, @@ -34,7 +34,7 @@ this.maskMatrix = maskMatrix; - this.scale = new core.math.Point(20,20); + this.scale = new core.Point(20,20); } diff --git a/src/filters/index.js b/src/filters/index.js index 0b79c6d..3dba827 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -9,11 +9,6 @@ * @namespace PIXI.filters */ module.exports = { - // expose some internal filters... - AbstractFilter: require('../core/renderers/webgl/filters/AbstractFilter'), - FXAAFilter: require('../core/renderers/webgl/filters/FXAAFilter'), - SpriteMaskFilter: require('../core/renderers/webgl/filters/SpriteMaskFilter'), - // add the rest! AsciiFilter: require('./ascii/AsciiFilter'), BloomFilter: require('./bloom/BloomFilter'), BlurFilter: require('./blur/BlurFilter'), diff --git a/src/interaction/InteractionData.js b/src/interaction/InteractionData.js index c83532a..6c3188c 100644 --- a/src/interaction/InteractionData.js +++ b/src/interaction/InteractionData.js @@ -51,7 +51,7 @@ a10 = worldTransform.b, a11 = worldTransform.d, a12 = worldTransform.ty, id = 1 / (a00 * a11 + a01 * -a10); - point = point || new core.math.Point(); + point = point || new core.Point(); point.x = a11 * id * global.x + -a01 * id * global.x + (a12 * a01 - a02 * a11) * id; point.y = a00 * id * global.y + -a10 * id * global.y + (-a12 * a00 + a02 * a10) * id; diff --git a/src/loaders/bitmapFontParser.js b/src/loaders/bitmapFontParser.js index 5ffdf77..c6bc554 100644 --- a/src/loaders/bitmapFontParser.js +++ b/src/loaders/bitmapFontParser.js @@ -1,6 +1,5 @@ var Resource = require('resource-loader').Resource, core = require('../core'), - utils = require('../core/utils'), extras = require('../extras'), path = require('path'); @@ -22,7 +21,7 @@ { var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = new core.math.Rectangle( + var textureRect = new core.Rectangle( parseInt(letters[i].getAttribute('x'), 10) + texture.frame.x, parseInt(letters[i].getAttribute('y'), 10) + texture.frame.y, parseInt(letters[i].getAttribute('width'), 10), @@ -99,9 +98,9 @@ xmlUrl += '/'; } var textureUrl = xmlUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); - if (utils.TextureCache[textureUrl]) { + if (core.utils.TextureCache[textureUrl]) { //reuse existing texture - parse(resource, utils.TextureCache[textureUrl]); + parse(resource, core.utils.TextureCache[textureUrl]); next(); } else { diff --git a/src/loaders/spritesheetParser.js b/src/loaders/spritesheetParser.js index 2c57452..f30032c 100644 --- a/src/loaders/spritesheetParser.js +++ b/src/loaders/spritesheetParser.js @@ -38,16 +38,16 @@ var trim = null; if (frames[i].rotated) { - size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w); + size = new core.Rectangle(rect.x, rect.y, rect.h, rect.w); } else { - size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h); + size = new core.Rectangle(rect.x, rect.y, rect.w, rect.h); } // Check to see if the sprite is trimmed if (frames[i].trimmed) { - trim = new core.math.Rectangle( + trim = new core.Rectangle( frames[i].spriteSourceSize.x / resolution, frames[i].spriteSourceSize.y / resolution, frames[i].sourceSize.w / resolution, diff --git a/src/mesh/Mesh.js b/src/mesh/Mesh.js index 51cc887..596230d 100644 --- a/src/mesh/Mesh.js +++ b/src/mesh/Mesh.js @@ -397,7 +397,7 @@ if (minX === -Infinity || maxY === Infinity) { - return core.math.Rectangle.EMPTY; + return core.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/mesh/Rope.js b/src/mesh/Rope.js index 8ce30cd..842ae4b 100644 --- a/src/mesh/Rope.js +++ b/src/mesh/Rope.js @@ -85,8 +85,8 @@ var colors = this.colors; var textureUvs = this._texture._uvs; - var offset = new core.math.Point(textureUvs.x0, textureUvs.y0); - var factor = new core.math.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); + var offset = new core.Point(textureUvs.x0, textureUvs.y0); + var factor = new core.Point(textureUvs.x2 - textureUvs.x0, textureUvs.y2 - textureUvs.y0); uvs[0] = 0 + offset.x; uvs[1] = 0 + offset.y; diff --git a/src/mesh/webgl/MeshRenderer.js b/src/mesh/webgl/MeshRenderer.js index e520b10..a5a8e44 100644 --- a/src/mesh/webgl/MeshRenderer.js +++ b/src/mesh/webgl/MeshRenderer.js @@ -1,5 +1,4 @@ -var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'), - WebGLRenderer = require('../../core/renderers/webgl/WebGLRenderer'), +var core = require('../../core'), Mesh = require('../Mesh'); /** @@ -23,7 +22,7 @@ */ function MeshRenderer(renderer) { - ObjectRenderer.call(this, renderer); + core.ObjectRenderer.call(this, renderer); /** @@ -45,11 +44,11 @@ } } -MeshRenderer.prototype = Object.create(ObjectRenderer.prototype); +MeshRenderer.prototype = Object.create(core.ObjectRenderer.prototype); MeshRenderer.prototype.constructor = MeshRenderer; module.exports = MeshRenderer; -WebGLRenderer.registerPlugin('mesh', MeshRenderer); +core.WebGLRenderer.registerPlugin('mesh', MeshRenderer); /** * Sets up the renderer context and necessary buffers. diff --git a/test/unit/core/utils/util.test.js b/test/unit/core/utils/util.test.js index 30c63f3..3ea1155 100644 --- a/test/unit/core/utils/util.test.js +++ b/test/unit/core/utils/util.test.js @@ -1,12 +1,12 @@ describe('PIXI.utils', function () { - describe('.uuid', function () { + describe('.uid', function () { it('should exist', function () { - expect(PIXI.utils.uuid) + expect(PIXI.utils.uid) .to.be.a('function'); }); it('should return a number', function () { - expect(PIXI.utils.uuid()) + expect(PIXI.utils.uid()) .to.be.a('number'); }); });