diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/src/core/settings.js b/src/core/settings.js index ac5df51..bb08cb0 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -119,7 +119,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.TRANSFORM_MODE} * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: 0, @@ -129,7 +129,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.GC_MODES} * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, @@ -159,7 +159,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.WRAP_MODES} * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 0, @@ -169,7 +169,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.SCALE_MODES} * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 0, @@ -179,7 +179,7 @@ * * @static * @memberof PIXI.settings - * @type {string} + * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ PRECISION: 'mediump', diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/src/core/settings.js b/src/core/settings.js index ac5df51..bb08cb0 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -119,7 +119,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.TRANSFORM_MODE} * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: 0, @@ -129,7 +129,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.GC_MODES} * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, @@ -159,7 +159,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.WRAP_MODES} * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 0, @@ -169,7 +169,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.SCALE_MODES} * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 0, @@ -179,7 +179,7 @@ * * @static * @memberof PIXI.settings - * @type {string} + * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ PRECISION: 'mediump', diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c678301..6368368 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -8,8 +8,6 @@ import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; - let TICK = 0; let TEXTURE_TICK = 0; @@ -50,7 +48,7 @@ * * @member {number} */ - this.size = SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop + this.size = settings.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop // the total number of bytes in our batch // let numVerts = this.size * 4 * this.vertByteSize; @@ -106,7 +104,7 @@ const gl = this.renderer.gl; // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SPRITE_MAX_TEXTURES); + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); @@ -362,7 +360,7 @@ currentGroup.size = i - currentGroup.start; - if (!CAN_UPLOAD_SAME_BUFFER) + if (!settings.CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. // it really does not like uploading to the same buffer in a single frame! @@ -435,7 +433,7 @@ { this.renderer.bindShader(this.shader); - if (CAN_UPLOAD_SAME_BUFFER) + if (settings.CAN_UPLOAD_SAME_BUFFER) { // bind buffer #0, we don't need others this.renderer.bindVao(this.vaos[this.vertexCount]); diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/src/core/settings.js b/src/core/settings.js index ac5df51..bb08cb0 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -119,7 +119,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.TRANSFORM_MODE} * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: 0, @@ -129,7 +129,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.GC_MODES} * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, @@ -159,7 +159,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.WRAP_MODES} * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 0, @@ -169,7 +169,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.SCALE_MODES} * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 0, @@ -179,7 +179,7 @@ * * @static * @memberof PIXI.settings - * @type {string} + * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ PRECISION: 'mediump', diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c678301..6368368 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -8,8 +8,6 @@ import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; - let TICK = 0; let TEXTURE_TICK = 0; @@ -50,7 +48,7 @@ * * @member {number} */ - this.size = SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop + this.size = settings.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop // the total number of bytes in our batch // let numVerts = this.size * 4 * this.vertByteSize; @@ -106,7 +104,7 @@ const gl = this.renderer.gl; // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SPRITE_MAX_TEXTURES); + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); @@ -362,7 +360,7 @@ currentGroup.size = i - currentGroup.start; - if (!CAN_UPLOAD_SAME_BUFFER) + if (!settings.CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. // it really does not like uploading to the same buffer in a single frame! @@ -435,7 +433,7 @@ { this.renderer.bindShader(this.shader); - if (CAN_UPLOAD_SAME_BUFFER) + if (settings.CAN_UPLOAD_SAME_BUFFER) { // bind buffer #0, we don't need others this.renderer.bindVao(this.vaos[this.vertexCount]); diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 7bdd125..4e94f6b 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -7,8 +7,6 @@ import settings from '../settings'; import TextStyle from './TextStyle'; -const { RESOLUTION } = settings; - const defaultDestroyOptions = { texture: true, children: false, @@ -67,7 +65,7 @@ * @member {number} * @default 1 */ - this.resolution = RESOLUTION; + this.resolution = settings.RESOLUTION; /** * Private tracker for the current text. @@ -501,7 +499,7 @@ * * @private * @param {object} style - The style. - * @param {string} lines - The lines of text. + * @param {string[]} lines - The lines of text. * @return {string|number|CanvasGradient} The fill style */ _generateFillStyle(style, lines) @@ -737,7 +735,7 @@ // build canvas api font setting from individual components. Convert a numeric style.fontSize to px const fontSizeString = (typeof style.fontSize === 'number') ? `${style.fontSize}px` : style.fontSize; - return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} ${style.fontFamily}`; + return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} "${style.fontFamily}"`; } /** diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/src/core/settings.js b/src/core/settings.js index ac5df51..bb08cb0 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -119,7 +119,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.TRANSFORM_MODE} * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: 0, @@ -129,7 +129,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.GC_MODES} * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, @@ -159,7 +159,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.WRAP_MODES} * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 0, @@ -169,7 +169,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.SCALE_MODES} * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 0, @@ -179,7 +179,7 @@ * * @static * @memberof PIXI.settings - * @type {string} + * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ PRECISION: 'mediump', diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c678301..6368368 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -8,8 +8,6 @@ import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; - let TICK = 0; let TEXTURE_TICK = 0; @@ -50,7 +48,7 @@ * * @member {number} */ - this.size = SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop + this.size = settings.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop // the total number of bytes in our batch // let numVerts = this.size * 4 * this.vertByteSize; @@ -106,7 +104,7 @@ const gl = this.renderer.gl; // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SPRITE_MAX_TEXTURES); + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); @@ -362,7 +360,7 @@ currentGroup.size = i - currentGroup.start; - if (!CAN_UPLOAD_SAME_BUFFER) + if (!settings.CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. // it really does not like uploading to the same buffer in a single frame! @@ -435,7 +433,7 @@ { this.renderer.bindShader(this.shader); - if (CAN_UPLOAD_SAME_BUFFER) + if (settings.CAN_UPLOAD_SAME_BUFFER) { // bind buffer #0, we don't need others this.renderer.bindVao(this.vaos[this.vertexCount]); diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 7bdd125..4e94f6b 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -7,8 +7,6 @@ import settings from '../settings'; import TextStyle from './TextStyle'; -const { RESOLUTION } = settings; - const defaultDestroyOptions = { texture: true, children: false, @@ -67,7 +65,7 @@ * @member {number} * @default 1 */ - this.resolution = RESOLUTION; + this.resolution = settings.RESOLUTION; /** * Private tracker for the current text. @@ -501,7 +499,7 @@ * * @private * @param {object} style - The style. - * @param {string} lines - The lines of text. + * @param {string[]} lines - The lines of text. * @return {string|number|CanvasGradient} The fill style */ _generateFillStyle(style, lines) @@ -737,7 +735,7 @@ // build canvas api font setting from individual components. Convert a numeric style.fontSize to px const fontSizeString = (typeof style.fontSize === 'number') ? `${style.fontSize}px` : style.fontSize; - return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} ${style.fontFamily}`; + return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} "${style.fontFamily}"`; } /** diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index d83c447..676dca3 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -7,8 +7,6 @@ import determineCrossOrigin from '../utils/determineCrossOrigin'; import bitTwiddle from 'bit-twiddle'; -const { RESOLUTION, MIPMAP_TEXTURES, SCALE_MODE, WRAP_MODE } = settings; - /** * A texture stores the information that represents an image. All textures have a base texture. * @@ -37,7 +35,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The width of the base texture set when the image has loaded @@ -79,7 +77,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Set to true once the base texture has successfully loaded. @@ -176,7 +174,7 @@ * @member {boolean} * @see PIXI.MIPMAP_TEXTURES */ - this.mipmap = MIPMAP_TEXTURES; + this.mipmap = settings.MIPMAP_TEXTURES; /** * @@ -185,7 +183,7 @@ * @member {number} * @see PIXI.WRAP_MODES */ - this.wrapMode = WRAP_MODE; + this.wrapMode = settings.WRAP_MODE; /** * A map of renderer IDs to webgl textures diff --git a/README.md b/README.md index b89e9fc..6af7251 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ **Your support helps us make Pixi.js even better. Make your pledge on [Patreon](https://www.patreon.com/user?u=2384552&ty=h&u=2384552) and we'll love you forever!** -[![gallery](http://www.pixijs.com/wp-content/uploads/2013/05/headerPanel_projects-898x342.jpg)](http://www.pixijs.com/gallery/) - ### What to Use Pixi.js for and When to Use It Pixi.js is a rendering library that will allow you to create rich, interactive graphics, cross platform applications, and games without having to dive into the WebGL API or deal with browser and device compatibility. @@ -187,22 +185,22 @@ Then, to build the source, run: ``` -$> npm run build +$> npm run dist ``` -This will create a minified version at `bin/pixi.min.js` and a non-minified version at `bin/pixi.js` +This will create a minified version at `dist/pixi.min.js` and a non-minified version at `dist/pixi.js` with all the plugins in the pixi.js project. If there are specific plugins you don't want, say "interaction" or "extras", you can exclude those: ``` -$> npm run build -- --exclude extras --exclude interaction +$> npm run dist -- --exclude extras --exclude interaction ``` You can also use the short-form `-e`: ``` -$> npm run build -- -e extras -e interaction -e filters +$> npm run dist -- -e extras -e interaction -e filters ``` ### How to generate the documentation ### diff --git a/bower.json b/bower.json index cf6f225..41b668c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "main": "bin/pixi.min.js", + "main": "dist/pixi.min.js", "ignore": [ "**/.*", "docs", diff --git a/src/core/const.js b/src/core/const.js index 6d09378..3425b41 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -4,6 +4,7 @@ * @static * @constant * @memberof PIXI + * @name VERSION * @type {string} */ export const VERSION = __VERSION__; @@ -44,6 +45,7 @@ * @static * @constant * @memberof PIXI + * @name RENDERER_TYPE * @type {object} * @property {number} UNKNOWN - Unknown render type. * @property {number} WEBGL - WebGL render type. @@ -64,6 +66,7 @@ * @static * @constant * @memberof PIXI + * @name BLEND_MODES * @type {object} * @property {number} NORMAL * @property {number} ADD @@ -110,6 +113,7 @@ * @static * @constant * @memberof PIXI + * @name DRAW_MODES * @type {object} * @property {number} POINTS * @property {number} LINES @@ -132,12 +136,13 @@ /** * The scale modes that are supported by pixi. * - * The PIXI.settings.SCALE_MODE scale mode affects the default scaling mode of future operations. + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. * * @static * @constant * @memberof PIXI + * @name SCALE_MODES * @type {object} * @property {number} LINEAR Smooth scaling * @property {number} NEAREST Pixelating scaling @@ -150,7 +155,7 @@ /** * The wrap modes that are supported by pixi. * - * The PIXI.settings.WRAP_MODE wrap mode affects the default wraping mode of future operations. + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wraping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. * If the texture is non power of two then clamp will be used regardless as webGL can * only use REPEAT if the texture is po2. @@ -159,6 +164,7 @@ * * @static * @constant + * @name WRAP_MODES * @memberof PIXI * @type {object} * @property {number} CLAMP - The textures uvs are clamped @@ -174,7 +180,7 @@ /** * The gc modes that are supported by pixi. * - * The PIXI.settings.GC_MODE Garbage Collection mode for pixi textures is AUTO + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for pixi textures is AUTO * If set to GC_MODE, the renderer will occasianally check textures usage. If they are not * used for a specified period of time they will be removed from the GPU. They will of course * be uploaded again when they are required. This is a silent behind the scenes process that @@ -185,6 +191,7 @@ * * @static * @constant + * @name GC_MODES * @memberof PIXI * @type {object} * @property {number} AUTO - Garbage collection will happen periodically automatically @@ -208,13 +215,14 @@ /** * Regexp for data URI. - * Based on: https://github.com/ragingwind/data-uri-regex + * Based on: {@link https://github.com/ragingwind/data-uri-regex} * * @static * @constant + * @name DATA_URI * @memberof PIXI * @type {RegExp|string} - * @example `data:image/png;base64` + * @example data:image/png;base64 */ export const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;(charset=[\w-]+|base64))?,(.*)/i; @@ -223,9 +231,10 @@ * * @static * @constant + * @name SVG_SIZE * @memberof PIXI * @type {RegExp|string} - * @example `` + * @example <svg width="100" height="100"></svg> */ export const SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len @@ -234,13 +243,14 @@ * * @static * @constant + * @name SHAPES * @memberof PIXI * @type {object} - * @property {number} POLY - * @property {number} RECT - * @property {number} CIRC - * @property {number} ELIP - * @property {number} RREC + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle */ export const SHAPES = { POLY: 0, @@ -255,6 +265,7 @@ * * @static * @constant + * @name PRECISION * @memberof PIXI * @type {object} * @property {string} LOW='lowp' @@ -272,6 +283,7 @@ * * @static * @constant + * @name TRANSFORM_MODE * @memberof PIXI * @type {object} * @property {number} STATIC @@ -287,10 +299,11 @@ * * @static * @constant + * @name TEXT_GRADIENT * @memberof PIXI * @type {object} - * @property {number} LINEAR_VERTICAL - * @property {number} LINEAR_HORIZONTAL + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient */ export const TEXT_GRADIENT = { LINEAR_VERTICAL: 0, diff --git a/src/core/index.js b/src/core/index.js index eba10a7..dcab8a6 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -14,6 +14,7 @@ export { default as glCore } from 'pixi-gl-core'; +export { default as Bounds } from './display/Bounds'; export { default as DisplayObject } from './display/DisplayObject'; export { default as Container } from './display/Container'; export { default as Transform } from './display/Transform'; diff --git a/src/core/renderers/SystemRenderer.js b/src/core/renderers/SystemRenderer.js index 5e0a3ca..0f1c817 100644 --- a/src/core/renderers/SystemRenderer.js +++ b/src/core/renderers/SystemRenderer.js @@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3'; const tempMatrix = new Matrix(); -const { RESOLUTION, RENDER_OPTIONS } = settings; /** * The SystemRenderer is the base for a Pixi Renderer. It is extended by the {@link PIXI.CanvasRenderer} @@ -47,17 +46,17 @@ // prepare options if (options) { - for (const i in RENDER_OPTIONS) + for (const i in settings.RENDER_OPTIONS) { if (typeof options[i] === 'undefined') { - options[i] = RENDER_OPTIONS[i]; + options[i] = settings.RENDER_OPTIONS[i]; } } } else { - options = RENDER_OPTIONS; + options = settings.RENDER_OPTIONS; } /** @@ -98,7 +97,7 @@ * @member {number} * @default 1 */ - this.resolution = options.resolution || RESOLUTION; + this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index 7047f2c..8a3be33 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,8 +1,6 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; -const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; - /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -21,9 +19,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = GC_MAX_IDLE; - this.checkCountMax = GC_MAX_CHECK_COUNT; - this.mode = GC_MODE; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; } /** diff --git a/src/core/renderers/webgl/utils/RenderTarget.js b/src/core/renderers/webgl/utils/RenderTarget.js index 1bfc4b6..afe51ab 100644 --- a/src/core/renderers/webgl/utils/RenderTarget.js +++ b/src/core/renderers/webgl/utils/RenderTarget.js @@ -3,8 +3,6 @@ import settings from '../../../settings'; import { GLFramebuffer } from 'pixi-gl-core'; -const { RESOLUTION, SCALE_MODE } = settings; - /** * @class * @memberof PIXI @@ -66,7 +64,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The projection matrix @@ -126,7 +124,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Whether this object is the root element or not diff --git a/src/core/settings.js b/src/core/settings.js index ac5df51..bb08cb0 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -119,7 +119,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.TRANSFORM_MODE} * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: 0, @@ -129,7 +129,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.GC_MODES} * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, @@ -159,7 +159,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.WRAP_MODES} * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 0, @@ -169,7 +169,7 @@ * * @static * @memberof PIXI.settings - * @type {number} + * @type {PIXI.SCALE_MODES} * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 0, @@ -179,7 +179,7 @@ * * @static * @memberof PIXI.settings - * @type {string} + * @type {PIXI.PRECISION} * @default PIXI.PRECISION.MEDIUM */ PRECISION: 'mediump', diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index c678301..6368368 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -8,8 +8,6 @@ import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; - let TICK = 0; let TEXTURE_TICK = 0; @@ -50,7 +48,7 @@ * * @member {number} */ - this.size = SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop + this.size = settings.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop // the total number of bytes in our batch // let numVerts = this.size * 4 * this.vertByteSize; @@ -106,7 +104,7 @@ const gl = this.renderer.gl; // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SPRITE_MAX_TEXTURES); + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); @@ -362,7 +360,7 @@ currentGroup.size = i - currentGroup.start; - if (!CAN_UPLOAD_SAME_BUFFER) + if (!settings.CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. // it really does not like uploading to the same buffer in a single frame! @@ -435,7 +433,7 @@ { this.renderer.bindShader(this.shader); - if (CAN_UPLOAD_SAME_BUFFER) + if (settings.CAN_UPLOAD_SAME_BUFFER) { // bind buffer #0, we don't need others this.renderer.bindVao(this.vaos[this.vertexCount]); diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 7bdd125..4e94f6b 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -7,8 +7,6 @@ import settings from '../settings'; import TextStyle from './TextStyle'; -const { RESOLUTION } = settings; - const defaultDestroyOptions = { texture: true, children: false, @@ -67,7 +65,7 @@ * @member {number} * @default 1 */ - this.resolution = RESOLUTION; + this.resolution = settings.RESOLUTION; /** * Private tracker for the current text. @@ -501,7 +499,7 @@ * * @private * @param {object} style - The style. - * @param {string} lines - The lines of text. + * @param {string[]} lines - The lines of text. * @return {string|number|CanvasGradient} The fill style */ _generateFillStyle(style, lines) @@ -737,7 +735,7 @@ // build canvas api font setting from individual components. Convert a numeric style.fontSize to px const fontSizeString = (typeof style.fontSize === 'number') ? `${style.fontSize}px` : style.fontSize; - return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} ${style.fontFamily}`; + return `${style.fontStyle} ${style.fontVariant} ${style.fontWeight} ${fontSizeString} "${style.fontFamily}"`; } /** diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index d83c447..676dca3 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -7,8 +7,6 @@ import determineCrossOrigin from '../utils/determineCrossOrigin'; import bitTwiddle from 'bit-twiddle'; -const { RESOLUTION, MIPMAP_TEXTURES, SCALE_MODE, WRAP_MODE } = settings; - /** * A texture stores the information that represents an image. All textures have a base texture. * @@ -37,7 +35,7 @@ * @member {number} * @default 1 */ - this.resolution = resolution || RESOLUTION; + this.resolution = resolution || settings.RESOLUTION; /** * The width of the base texture set when the image has loaded @@ -79,7 +77,7 @@ * @default PIXI.settings.SCALE_MODE * @see PIXI.SCALE_MODES */ - this.scaleMode = scaleMode || SCALE_MODE; + this.scaleMode = scaleMode || settings.SCALE_MODE; /** * Set to true once the base texture has successfully loaded. @@ -176,7 +174,7 @@ * @member {boolean} * @see PIXI.MIPMAP_TEXTURES */ - this.mipmap = MIPMAP_TEXTURES; + this.mipmap = settings.MIPMAP_TEXTURES; /** * @@ -185,7 +183,7 @@ * @member {number} * @see PIXI.WRAP_MODES */ - this.wrapMode = WRAP_MODE; + this.wrapMode = settings.WRAP_MODE; /** * A map of renderer IDs to webgl textures diff --git a/src/core/ticker/Ticker.js b/src/core/ticker/Ticker.js index 6aec195..d6b30e1 100644 --- a/src/core/ticker/Ticker.js +++ b/src/core/ticker/Ticker.js @@ -4,8 +4,6 @@ // Internal event used by composed emitter const TICK = 'tick'; -const { TARGET_FPMS } = settings; - /** * A Ticker class that runs an update loop that other objects listen to. * This class is composed around an EventEmitter object to add listeners @@ -73,7 +71,7 @@ * @member {number} * @default 1 / TARGET_FPMS */ - this.elapsedMS = 1 / TARGET_FPMS; // default to target frame time + this.elapsedMS = 1 / settings.TARGET_FPMS; // default to target frame time /** * The last time {@link PIXI.ticker.Ticker#update} was invoked. @@ -319,7 +317,7 @@ elapsedMS = this._maxElapsedMS; } - this.deltaTime = elapsedMS * TARGET_FPMS * this.speed; + this.deltaTime = elapsedMS * settings.TARGET_FPMS * this.speed; // Invoke listeners added to internal emitter this._emitter.emit(TICK, this.deltaTime); @@ -371,7 +369,7 @@ set minFPS(fps) { // Clamp: 0 to TARGET_FPMS - const minFPMS = Math.min(Math.max(0, fps) / 1000, TARGET_FPMS); + const minFPMS = Math.min(Math.max(0, fps) / 1000, settings.TARGET_FPMS); this._maxElapsedMS = 1 / minFPMS; }