2013-08-28 06:02:55 +00:00
|
|
|
/**
|
|
|
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2014-11-15 19:53:38 +00:00
|
|
|
* The [pixi.js](http://www.pixijs.com/) module/namespace.
|
|
|
|
*
|
2013-08-28 06:02:55 +00:00
|
|
|
* @module PIXI
|
|
|
|
*/
|
2014-11-15 19:53:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Namespace-class for [pixi.js](http://www.pixijs.com/).
|
|
|
|
*
|
|
|
|
* Contains assorted static properties and enumerations.
|
|
|
|
*
|
|
|
|
* @class PIXI
|
|
|
|
* @static
|
|
|
|
*/
|
2013-08-28 06:02:55 +00:00
|
|
|
var PIXI = PIXI || {};
|
2014-02-06 00:19:46 +00:00
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* @property {Number} WEBGL_RENDERER
|
|
|
|
* @protected
|
|
|
|
* @static
|
|
|
|
*/
|
2014-02-06 00:19:46 +00:00
|
|
|
PIXI.WEBGL_RENDERER = 0;
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* @property {Number} CANVAS_RENDERER
|
|
|
|
* @protected
|
|
|
|
* @static
|
|
|
|
*/
|
2014-02-06 00:19:46 +00:00
|
|
|
PIXI.CANVAS_RENDERER = 1;
|
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* Version of pixi that is loaded.
|
|
|
|
* @property {String} VERSION
|
|
|
|
* @static
|
|
|
|
*/
|
2014-12-02 11:01:57 +00:00
|
|
|
PIXI.VERSION = "v2.2.0";
|
2014-07-10 19:10:01 +00:00
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* Various blend modes supported by pixi.
|
|
|
|
* @property {Object} blendModes
|
|
|
|
* @property {Number} blendModes.NORMAL
|
|
|
|
* @property {Number} blendModes.ADD
|
|
|
|
* @property {Number} blendModes.MULTIPLY
|
|
|
|
* @property {Number} blendModes.SCREEN
|
|
|
|
* @property {Number} blendModes.OVERLAY
|
|
|
|
* @property {Number} blendModes.DARKEN
|
|
|
|
* @property {Number} blendModes.LIGHTEN
|
|
|
|
* @property {Number} blendModes.COLOR_DODGE
|
|
|
|
* @property {Number} blendModes.COLOR_BURN
|
|
|
|
* @property {Number} blendModes.HARD_LIGHT
|
|
|
|
* @property {Number} blendModes.SOFT_LIGHT
|
|
|
|
* @property {Number} blendModes.DIFFERENCE
|
|
|
|
* @property {Number} blendModes.EXCLUSION
|
|
|
|
* @property {Number} blendModes.HUE
|
|
|
|
* @property {Number} blendModes.SATURATION
|
|
|
|
* @property {Number} blendModes.COLOR
|
|
|
|
* @property {Number} blendModes.LUMINOSITY
|
|
|
|
* @static
|
|
|
|
*/
|
2014-02-06 00:19:46 +00:00
|
|
|
PIXI.blendModes = {
|
|
|
|
NORMAL:0,
|
|
|
|
ADD:1,
|
|
|
|
MULTIPLY:2,
|
|
|
|
SCREEN:3,
|
|
|
|
OVERLAY:4,
|
|
|
|
DARKEN:5,
|
|
|
|
LIGHTEN:6,
|
|
|
|
COLOR_DODGE:7,
|
|
|
|
COLOR_BURN:8,
|
|
|
|
HARD_LIGHT:9,
|
|
|
|
SOFT_LIGHT:10,
|
|
|
|
DIFFERENCE:11,
|
|
|
|
EXCLUSION:12,
|
|
|
|
HUE:13,
|
|
|
|
SATURATION:14,
|
|
|
|
COLOR:15,
|
|
|
|
LUMINOSITY:16
|
|
|
|
};
|
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* The scale modes that are supported by pixi.
|
|
|
|
*
|
|
|
|
* The DEFAULT scale mode affects the default scaling mode of future operations.
|
|
|
|
* It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.
|
|
|
|
*
|
|
|
|
* @property {Object} scaleModes
|
|
|
|
* @property {Number} scaleModes.DEFAULT=LINEAR
|
|
|
|
* @property {Number} scaleModes.LINEAR Smooth scaling
|
|
|
|
* @property {Number} scaleModes.NEAREST Pixelating scaling
|
|
|
|
* @static
|
|
|
|
*/
|
2014-02-06 00:19:46 +00:00
|
|
|
PIXI.scaleModes = {
|
|
|
|
DEFAULT:0,
|
|
|
|
LINEAR:0,
|
|
|
|
NEAREST:1
|
|
|
|
};
|
|
|
|
|
2014-07-01 14:03:46 +00:00
|
|
|
// used to create uids for various pixi objects..
|
|
|
|
PIXI._UID = 0;
|
|
|
|
|
2014-07-11 17:02:24 +00:00
|
|
|
if(typeof(Float32Array) != 'undefined')
|
|
|
|
{
|
|
|
|
PIXI.Float32Array = Float32Array;
|
|
|
|
PIXI.Uint16Array = Uint16Array;
|
2014-12-02 11:01:57 +00:00
|
|
|
|
|
|
|
// Uint32Array and ArrayBuffer only used by WebGL renderer
|
|
|
|
// We can suppose that if WebGL is supported then typed arrays are supported too
|
|
|
|
// as they predate WebGL support for all browsers:
|
|
|
|
// see typed arrays support: http://caniuse.com/#search=TypedArrays
|
|
|
|
// see WebGL support: http://caniuse.com/#search=WebGL
|
|
|
|
PIXI.Uint32Array = Uint32Array;
|
|
|
|
PIXI.ArrayBuffer = ArrayBuffer;
|
2014-07-11 17:02:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PIXI.Float32Array = Array;
|
|
|
|
PIXI.Uint16Array = Array;
|
|
|
|
}
|
2014-07-01 14:03:46 +00:00
|
|
|
|
2014-03-31 10:04:02 +00:00
|
|
|
// interaction frequency
|
2014-02-06 00:19:46 +00:00
|
|
|
PIXI.INTERACTION_FREQUENCY = 30;
|
2014-02-12 01:25:36 +00:00
|
|
|
PIXI.AUTO_PREVENT_DEFAULT = true;
|
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* @property {Number} PI_2
|
|
|
|
* @static
|
|
|
|
*/
|
2014-10-10 19:36:04 +00:00
|
|
|
PIXI.PI_2 = Math.PI * 2;
|
2014-11-15 19:53:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @property {Number} RAD_TO_DEG
|
|
|
|
* @static
|
|
|
|
*/
|
2014-02-12 01:25:36 +00:00
|
|
|
PIXI.RAD_TO_DEG = 180 / Math.PI;
|
2014-11-15 19:53:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @property {Number} DEG_TO_RAD
|
|
|
|
* @static
|
|
|
|
*/
|
2014-07-01 14:03:46 +00:00
|
|
|
PIXI.DEG_TO_RAD = Math.PI / 180;
|
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* @property {String} RETINA_PREFIX
|
|
|
|
* @protected
|
|
|
|
* @static
|
|
|
|
*/
|
2014-10-10 19:36:04 +00:00
|
|
|
PIXI.RETINA_PREFIX = "@2x";
|
|
|
|
//PIXI.SCALE_PREFIX "@x%%";
|
2014-07-03 09:49:58 +00:00
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* If true the default pixi startup (console) banner message will be suppressed.
|
|
|
|
*
|
|
|
|
* @property {Boolean} dontSayHello
|
|
|
|
* @default false
|
|
|
|
* @static
|
|
|
|
*/
|
2014-07-03 09:49:58 +00:00
|
|
|
PIXI.dontSayHello = false;
|
|
|
|
|
2014-11-15 19:53:38 +00:00
|
|
|
/**
|
|
|
|
* The default render options if none are supplied to
|
|
|
|
* {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}.
|
|
|
|
*
|
|
|
|
* @property {Object} defaultRenderOptions
|
|
|
|
* @property {Object} defaultRenderOptions.view=null
|
|
|
|
* @property {Boolean} defaultRenderOptions.transparent=false
|
|
|
|
* @property {Boolean} defaultRenderOptions.antialias=false
|
|
|
|
* @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false
|
|
|
|
* @property {Number} defaultRenderOptions.resolution=1
|
|
|
|
* @property {Boolean} defaultRenderOptions.clearBeforeRender=true
|
|
|
|
* @property {Boolean} defaultRenderOptions.autoResize=false
|
|
|
|
* @static
|
|
|
|
*/
|
2014-10-10 19:36:04 +00:00
|
|
|
PIXI.defaultRenderOptions = {
|
2014-11-15 19:53:38 +00:00
|
|
|
view:null,
|
|
|
|
transparent:false,
|
2014-10-10 19:36:04 +00:00
|
|
|
antialias:false,
|
|
|
|
preserveDrawingBuffer:false,
|
|
|
|
resolution:1,
|
2014-11-11 23:02:57 +00:00
|
|
|
clearBeforeRender:true,
|
|
|
|
autoResize:false
|
2014-10-10 19:36:04 +00:00
|
|
|
}
|
|
|
|
|
2014-07-03 09:49:58 +00:00
|
|
|
PIXI.sayHello = function (type)
|
2014-07-01 14:03:46 +00:00
|
|
|
{
|
2014-07-03 09:49:58 +00:00
|
|
|
if(PIXI.dontSayHello)return;
|
|
|
|
|
2014-07-01 14:03:46 +00:00
|
|
|
if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 )
|
|
|
|
{
|
|
|
|
var args = [
|
2014-07-18 10:22:55 +00:00
|
|
|
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ ',
|
2014-07-03 09:49:58 +00:00
|
|
|
'background: #ff66a5',
|
|
|
|
'background: #ff66a5',
|
|
|
|
'color: #ff66a5; background: #030307;',
|
|
|
|
'background: #ff66a5',
|
|
|
|
'background: #ffc3dc',
|
|
|
|
'background: #ff66a5',
|
2014-07-01 14:03:46 +00:00
|
|
|
'color: #ff2424; background: #fff',
|
|
|
|
'color: #ff2424; background: #fff',
|
|
|
|
'color: #ff2424; background: #fff'
|
|
|
|
];
|
|
|
|
|
|
|
|
console.log.apply(console, args);
|
|
|
|
}
|
|
|
|
else if (window['console'])
|
|
|
|
{
|
2014-07-18 10:22:55 +00:00
|
|
|
console.log('Pixi.js ' + PIXI.VERSION + ' - http://www.pixijs.com/');
|
2014-07-01 14:03:46 +00:00
|
|
|
}
|
|
|
|
|
2014-07-03 09:49:58 +00:00
|
|
|
PIXI.dontSayHello = true;
|
|
|
|
};
|