diff --git a/dist/phaser-arcade-physics.js b/dist/phaser-arcade-physics.js index 5efb03e9ee..f3daf08fef 100644 --- a/dist/phaser-arcade-physics.js +++ b/dist/phaser-arcade-physics.js @@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 997); +/******/ return __webpack_require__(__webpack_require__.s = 1005); /******/ }) /************************************************************************/ /******/ ([ @@ -572,12 +572,13 @@ var GameObject = new Class({ * * @param {any} [shape] - A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. * @param {function} [callback] - A callback to be invoked when the Game Object is interacted with. + * @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target? * * @return {Phaser.GameObjects.GameObject} This GameObject. */ - setInteractive: function (shape, callback) + setInteractive: function (shape, callback, dropZone) { - this.scene.sys.input.enable(this, shape, callback); + this.scene.sys.input.enable(this, shape, callback, dropZone); return this; }, @@ -636,6 +637,12 @@ var GameObject = new Class({ */ destroy: function () { + // This Game Object had already been destroyed + if (!this.scene) + { + return; + } + if (this.preDestroy) { this.preDestroy.call(this); @@ -673,6 +680,8 @@ var GameObject = new Class({ this.scene = undefined; + this.emit('destroy'); + this.removeAllListeners(); } @@ -1517,9 +1526,9 @@ module.exports = FileTypesManager; var Class = __webpack_require__(0); var Contains = __webpack_require__(33); -var GetPoint = __webpack_require__(106); -var GetPoints = __webpack_require__(184); -var Random = __webpack_require__(107); +var GetPoint = __webpack_require__(107); +var GetPoints = __webpack_require__(185); +var Random = __webpack_require__(108); /** * @classdesc @@ -1875,12 +1884,13 @@ var Rectangle = new Class({ if (value >= this.bottom) { this.height = 0; - this.y = value; } else { this.height = (this.bottom - value); } + + this.y = value; } }, @@ -2228,25 +2238,25 @@ module.exports = GetAdvancedValue; module.exports = { - Alpha: __webpack_require__(381), - Animation: __webpack_require__(364), - BlendMode: __webpack_require__(382), - ComputedSize: __webpack_require__(383), - Depth: __webpack_require__(384), - Flip: __webpack_require__(385), - GetBounds: __webpack_require__(386), - MatrixStack: __webpack_require__(387), - Origin: __webpack_require__(388), - Pipeline: __webpack_require__(186), - ScaleMode: __webpack_require__(389), - ScrollFactor: __webpack_require__(390), - Size: __webpack_require__(391), - Texture: __webpack_require__(392), - Tint: __webpack_require__(393), - ToJSON: __webpack_require__(394), - Transform: __webpack_require__(395), - TransformMatrix: __webpack_require__(187), - Visible: __webpack_require__(396) + Alpha: __webpack_require__(392), + Animation: __webpack_require__(366), + BlendMode: __webpack_require__(393), + ComputedSize: __webpack_require__(394), + Depth: __webpack_require__(395), + Flip: __webpack_require__(396), + GetBounds: __webpack_require__(397), + MatrixStack: __webpack_require__(398), + Origin: __webpack_require__(399), + Pipeline: __webpack_require__(187), + ScaleMode: __webpack_require__(400), + ScrollFactor: __webpack_require__(401), + Size: __webpack_require__(402), + Texture: __webpack_require__(403), + Tint: __webpack_require__(404), + ToJSON: __webpack_require__(405), + Transform: __webpack_require__(406), + TransformMatrix: __webpack_require__(188), + Visible: __webpack_require__(407) }; @@ -3014,7 +3024,7 @@ module.exports = GetTilesWithin; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RND = __webpack_require__(380); +var RND = __webpack_require__(391); var MATH_CONST = { @@ -3269,9 +3279,9 @@ module.exports = FILE_CONST; var Class = __webpack_require__(0); var CONST = __webpack_require__(17); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(149); -var MergeXHRSettings = __webpack_require__(150); -var XHRLoader = __webpack_require__(314); +var GetURL = __webpack_require__(148); +var MergeXHRSettings = __webpack_require__(149); +var XHRLoader = __webpack_require__(316); var XHRSettings = __webpack_require__(90); /** @@ -3327,7 +3337,7 @@ var File = new Class({ { this.url = GetFastValue(fileConfig, 'path', '') + this.key + '.' + GetFastValue(fileConfig, 'extension', ''); } - else + else if (typeof(this.url) !== 'function') { this.url = GetFastValue(fileConfig, 'path', '').concat(this.url); } @@ -3380,7 +3390,7 @@ var File = new Class({ * @type {integer} * @since 3.0.0 */ - this.state = CONST.FILE_PENDING; + this.state = typeof(this.url) === 'function' ? CONST.FILE_POPULATED : CONST.FILE_PENDING; /** * The total size of this file. @@ -3706,194 +3716,6 @@ module.exports = File; /* 19 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var BlendModes = __webpack_require__(45); -var GetAdvancedValue = __webpack_require__(10); -var ScaleModes = __webpack_require__(62); - -/** - * Builds a Game Object using the provided configuration object. - * - * @function Phaser.Gameobjects.BuildGameObject - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.GameObject} gameObject - [description] - * @param {object} config - [description] - * - * @return {Phaser.GameObjects.GameObject} The built Game Object. - */ -var BuildGameObject = function (scene, gameObject, config) -{ - // Position - - gameObject.x = GetAdvancedValue(config, 'x', 0); - gameObject.y = GetAdvancedValue(config, 'y', 0); - gameObject.depth = GetAdvancedValue(config, 'depth', 0); - - // Flip - - gameObject.flipX = GetAdvancedValue(config, 'flipX', false); - gameObject.flipY = GetAdvancedValue(config, 'flipY', false); - - // Scale - // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} - - var scale = GetAdvancedValue(config, 'scale', null); - - if (typeof scale === 'number') - { - gameObject.setScale(scale); - } - else if (scale !== null) - { - gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); - gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); - } - - // ScrollFactor - // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} - - var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); - - if (typeof scrollFactor === 'number') - { - gameObject.setScrollFactor(scrollFactor); - } - else if (scrollFactor !== null) - { - gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); - gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); - } - - // Rotation - - gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - - var angle = GetAdvancedValue(config, 'angle', null); - - if (angle !== null) - { - gameObject.angle = angle; - } - - // Alpha - - gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); - - // Origin - // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - - var origin = GetAdvancedValue(config, 'origin', null); - - if (typeof origin === 'number') - { - gameObject.setOrigin(origin); - } - else if (origin !== null) - { - var ox = GetAdvancedValue(origin, 'x', 0.5); - var oy = GetAdvancedValue(origin, 'y', 0.5); - - gameObject.setOrigin(ox, oy); - } - - // ScaleMode - - gameObject.scaleMode = GetAdvancedValue(config, 'scaleMode', ScaleModes.DEFAULT); - - // BlendMode - - gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - - // Visible - - gameObject.visible = GetAdvancedValue(config, 'visible', true); - - // Add to Scene - - var add = GetAdvancedValue(config, 'add', true); - - if (add) - { - scene.sys.displayList.add(gameObject); - } - - if (gameObject.preUpdate) - { - scene.sys.updateList.add(gameObject); - } - - return gameObject; -}; - -module.exports = BuildGameObject; - - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Tilemaps.Formats - */ - -module.exports = { - - /** - * CSV Map Type - * - * @name Phaser.Tilemaps.Formats.CSV - * @type {number} - * @since 3.0.0 - */ - CSV: 0, - - /** - * Tiled JSON Map Type - * - * @name Phaser.Tilemaps.Formats.TILED_JSON - * @type {number} - * @since 3.0.0 - */ - TILED_JSON: 1, - - /** - * 2D Array Map Type - * - * @name Phaser.Tilemaps.Formats.ARRAY_2D - * @type {number} - * @since 3.0.0 - */ - ARRAY_2D: 2, - - /** - * Weltmeister (Impact.js) Map Type - * - * @name Phaser.Tilemaps.Formats.WELTMEISTER - * @type {number} - * @since 3.0.0 - */ - WELTMEISTER: 3 - -}; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -3901,7 +3723,7 @@ module.exports = { */ var CONST = __webpack_require__(22); -var Smoothing = __webpack_require__(120); +var Smoothing = __webpack_require__(121); // The pool into which the canvas elements are placed. var pool = []; @@ -4135,6 +3957,194 @@ var CanvasPool = function () module.exports = CanvasPool(); +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BlendModes = __webpack_require__(45); +var GetAdvancedValue = __webpack_require__(10); +var ScaleModes = __webpack_require__(63); + +/** + * Builds a Game Object using the provided configuration object. + * + * @function Phaser.Gameobjects.BuildGameObject + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.GameObject} The built Game Object. + */ +var BuildGameObject = function (scene, gameObject, config) +{ + // Position + + gameObject.x = GetAdvancedValue(config, 'x', 0); + gameObject.y = GetAdvancedValue(config, 'y', 0); + gameObject.depth = GetAdvancedValue(config, 'depth', 0); + + // Flip + + gameObject.flipX = GetAdvancedValue(config, 'flipX', false); + gameObject.flipY = GetAdvancedValue(config, 'flipY', false); + + // Scale + // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} + + var scale = GetAdvancedValue(config, 'scale', null); + + if (typeof scale === 'number') + { + gameObject.setScale(scale); + } + else if (scale !== null) + { + gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); + gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); + } + + // ScrollFactor + // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} + + var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); + + if (typeof scrollFactor === 'number') + { + gameObject.setScrollFactor(scrollFactor); + } + else if (scrollFactor !== null) + { + gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); + gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); + } + + // Rotation + + gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); + + var angle = GetAdvancedValue(config, 'angle', null); + + if (angle !== null) + { + gameObject.angle = angle; + } + + // Alpha + + gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); + + // Origin + // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} + + var origin = GetAdvancedValue(config, 'origin', null); + + if (typeof origin === 'number') + { + gameObject.setOrigin(origin); + } + else if (origin !== null) + { + var ox = GetAdvancedValue(origin, 'x', 0.5); + var oy = GetAdvancedValue(origin, 'y', 0.5); + + gameObject.setOrigin(ox, oy); + } + + // ScaleMode + + gameObject.scaleMode = GetAdvancedValue(config, 'scaleMode', ScaleModes.DEFAULT); + + // BlendMode + + gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); + + // Visible + + gameObject.visible = GetAdvancedValue(config, 'visible', true); + + // Add to Scene + + var add = GetAdvancedValue(config, 'add', true); + + if (add) + { + scene.sys.displayList.add(gameObject); + } + + if (gameObject.preUpdate) + { + scene.sys.updateList.add(gameObject); + } + + return gameObject; +}; + +module.exports = BuildGameObject; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tilemaps.Formats + */ + +module.exports = { + + /** + * CSV Map Type + * + * @name Phaser.Tilemaps.Formats.CSV + * @type {number} + * @since 3.0.0 + */ + CSV: 0, + + /** + * Tiled JSON Map Type + * + * @name Phaser.Tilemaps.Formats.TILED_JSON + * @type {number} + * @since 3.0.0 + */ + TILED_JSON: 1, + + /** + * 2D Array Map Type + * + * @name Phaser.Tilemaps.Formats.ARRAY_2D + * @type {number} + * @since 3.0.0 + */ + ARRAY_2D: 2, + + /** + * Weltmeister (Impact.js) Map Type + * + * @name Phaser.Tilemaps.Formats.WELTMEISTER + * @type {number} + * @since 3.0.0 + */ + WELTMEISTER: 3 + +}; + + /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { @@ -4154,11 +4164,11 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.1.2', + VERSION: '3.2.0', BlendModes: __webpack_require__(45), - ScaleModes: __webpack_require__(62), + ScaleModes: __webpack_require__(63), /** * AUTO Detect Renderer. @@ -4266,7 +4276,7 @@ module.exports = CONST; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsPlainObject = __webpack_require__(167); +var IsPlainObject = __webpack_require__(168); // @param {boolean} deep - Perform a deep copy? // @param {object} target - The target object to copy to. @@ -4773,8 +4783,8 @@ module.exports = DegToRad; */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(116); -var GetColor32 = __webpack_require__(201); +var GetColor = __webpack_require__(117); +var GetColor32 = __webpack_require__(202); /** * @classdesc @@ -5289,7 +5299,7 @@ module.exports = Color; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var SpriteRender = __webpack_require__(447); +var SpriteRender = __webpack_require__(458); /** * @classdesc @@ -5399,7 +5409,7 @@ var Sprite = new Class({ * @param {boolean} ignoreIfPlaying - [description] * @param {integer|string} startFrame - [description] * - * @return {[type]} [description] + * @return {Phaser.GameObjects.Sprite} This Game Object. */ play: function (key, ignoreIfPlaying, startFrame) { @@ -5537,40 +5547,6 @@ module.exports = WorldToTileY; /* 41 */ /***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Math.Distance.Between - * @since 3.0.0 - * - * @param {number} x1 - [description] - * @param {number} y1 - [description] - * @param {number} x2 - [description] - * @param {number} y2 - [description] - * - * @return {number} [description] - */ -var DistanceBetween = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; - - return Math.sqrt(dx * dx + dy * dy); -}; - -module.exports = DistanceBetween; - - -/***/ }), -/* 42 */ -/***/ (function(module, exports) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -5698,6 +5674,40 @@ module.exports = { }; +/***/ }), +/* 42 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Math.Distance.Between + * @since 3.0.0 + * + * @param {number} x1 - [description] + * @param {number} y1 - [description] + * @param {number} x2 - [description] + * @param {number} y2 - [description] + * + * @return {number} [description] + */ +var DistanceBetween = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; + + return Math.sqrt(dx * dx + dy * dy); +}; + +module.exports = DistanceBetween; + + /***/ }), /* 43 */ /***/ (function(module, exports) { @@ -5745,7 +5755,7 @@ module.exports = SetTileCollision; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Rectangle = __webpack_require__(306); +var Rectangle = __webpack_require__(308); /** * @classdesc @@ -7676,129 +7686,6 @@ module.exports = Vector3; /***/ }), /* 52 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Shallow Object Clone. Will not clone nested objects. - * - * @function Phaser.Utils.Object.Clone - * @since 3.0.0 - * - * @param {object} obj - [description] - * - * @return {object} [description] - */ -var Clone = function (obj) -{ - var clone = {}; - - for (var key in obj) - { - if (Array.isArray(obj[key])) - { - clone[key] = obj[key].slice(0); - } - else - { - clone[key] = obj[key]; - } - } - - return clone; -}; - -module.exports = Clone; - - -/***/ }), -/* 53 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// http://www.blackpawn.com/texts/pointinpoly/ - -/** - * [description] - * - * @function Phaser.Geom.Triangle.Contains - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {boolean} [description] - */ -var Contains = function (triangle, x, y) -{ - var v0x = triangle.x3 - triangle.x1; - var v0y = triangle.y3 - triangle.y1; - - var v1x = triangle.x2 - triangle.x1; - var v1y = triangle.y2 - triangle.y1; - - var v2x = x - triangle.x1; - var v2y = y - triangle.y1; - - var dot00 = (v0x * v0x) + (v0y * v0y); - var dot01 = (v0x * v1x) + (v0y * v1y); - var dot02 = (v0x * v2x) + (v0y * v2y); - var dot11 = (v1x * v1x) + (v1y * v1y); - var dot12 = (v1x * v2x) + (v1y * v2y); - - // Compute barycentric coordinates - var b = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (b === 0) ? 0 : (1 / b); - var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - - return (u >= 0 && v >= 0 && (u + v < 1)); -}; - -module.exports = Contains; - - -/***/ }), -/* 54 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Geom.Line.Angle - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - [description] - * - * @return {number} [description] - */ -var Angle = function (line) -{ - return Math.atan2(line.y2 - line.y1, line.x2 - line.x1); -}; - -module.exports = Angle; - - -/***/ }), -/* 55 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -7808,402 +7695,561 @@ module.exports = Angle; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(53); -var GetPoint = __webpack_require__(308); -var GetPoints = __webpack_require__(309); -var Random = __webpack_require__(111); +var FromPoints = __webpack_require__(122); +var Rectangle = __webpack_require__(8); +var Vector2 = __webpack_require__(6); /** * @classdesc - * A triangle is a plane created by connecting three points. - * The first two arguments specify the first point, the middle two arguments - * specify the second point, and the last two arguments specify the third point. + * A Base Curve class, which all other curve types extend. * - * @class Triangle - * @memberOf Phaser.Geom + * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + * + * @class Curve + * @memberOf Phaser.Curves * @constructor * @since 3.0.0 * - * @param {number} [x1=0] - [description] - * @param {number} [y1=0] - [description] - * @param {number} [x2=0] - [description] - * @param {number} [y2=0] - [description] - * @param {number} [x3=0] - [description] - * @param {number} [y3=0] - [description] + * @param {string} type - [description] */ -var Triangle = new Class({ +var Curve = new Class({ initialize: - function Triangle (x1, y1, x2, y2, x3, y3) + function Curve (type) { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - if (x3 === undefined) { x3 = 0; } - if (y3 === undefined) { y3 = 0; } + /** + * String based identifier for the type of curve. + * + * @name Phaser.Curves.Curve#type + * @type {string} + * @since 3.0.0 + */ + this.type = type; /** - * [description] + * The default number of divisions within the curve. * - * @name Phaser.Geom.Triangle#x1 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#defaultDivisions + * @type {integer} + * @default 5 * @since 3.0.0 */ - this.x1 = x1; + this.defaultDivisions = 5; /** - * [description] + * The quantity of arc length divisions within the curve. * - * @name Phaser.Geom.Triangle#y1 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#arcLengthDivisions + * @type {integer} + * @default 100 * @since 3.0.0 */ - this.y1 = y1; + this.arcLengthDivisions = 100; /** - * [description] + * An array of cached arc length values. * - * @name Phaser.Geom.Triangle#x2 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#cacheArcLengths + * @type {array} + * @default [] * @since 3.0.0 */ - this.x2 = x2; + this.cacheArcLengths = []; /** - * [description] + * Does the data of this curve need updating? * - * @name Phaser.Geom.Triangle#y2 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#needsUpdate + * @type {boolean} + * @default true * @since 3.0.0 */ - this.y2 = y2; + this.needsUpdate = true; /** * [description] * - * @name Phaser.Geom.Triangle#x3 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#active + * @type {boolean} + * @default true * @since 3.0.0 */ - this.x3 = x3; + this.active = true; /** - * [description] + * A temporary calculation Vector. * - * @name Phaser.Geom.Triangle#y3 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.y3 = y3; + this._tmpVec2A = new Vector2(); + + /** + * A temporary calculation Vector. + * + * @name Phaser.Curves.Curve#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2B = new Vector2(); }, /** - * [description] + * Draws this curve on the given Graphics object. + * + * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. + * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. * - * @method Phaser.Geom.Triangle#contains + * @method Phaser.Curves.Curve#draw * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. + * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. * - * @return {[type]} [description] + * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. */ - contains: function (x, y) + draw: function (graphics, pointsTotal) { - return Contains(this, x, y); + if (pointsTotal === undefined) { pointsTotal = 32; } + + // So you can chain graphics calls + return graphics.strokePoints(this.getPoints(pointsTotal)); }, /** - * [description] + * Returns a Rectangle where the position and dimensions match the bounds of this Curve. * - * @method Phaser.Geom.Triangle#getPoint + * You can control the accuracy of the bounds. The value given is used to work out how many points + * to plot across the curve. Higher values are more accurate at the cost of calculation speed. + * + * @method Phaser.Curves.Curve#getBounds * @since 3.0.0 * - * @param {[type]} position - [description] - * @param {[type]} output - [description] + * @param {Phaser.Geom.Rectangle} out - The Rectangle to store the bounds in. If falsey a new object will be created. + * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. * - * @return {[type]} [description] + * @return {Phaser.Geom.Rectangle} A Rectangle containing the bounds values of this Curve. */ - getPoint: function (position, output) + getBounds: function (out, accuracy) { - return GetPoint(this, position, output); + if (!out) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } + + var len = this.getLength(); + + if (accuracy > len) + { + accuracy = len / 2; + } + + // The length of the curve in pixels + // So we'll have 1 spaced point per 'accuracy' pixels + + var spaced = Math.max(1, Math.round(len / accuracy)); + + return FromPoints(this.getSpacedPoints(spaced), out); }, /** - * [description] + * Returns an array of points, spaced out X distance pixels apart. + * The smaller the distance, the larger the array will be. * - * @method Phaser.Geom.Triangle#getPoints + * @method Phaser.Curves.Curve#getDistancePoints * @since 3.0.0 * - * @param {[type]} quantity - [description] - * @param {[type]} stepRate - [description] - * @param {[type]} output - [description] + * @param {integer} distance - The distance, in pixels, between each point along the curve. * - * @return {[type]} [description] + * @return {Phaser.Geom.Point[]} An Array of Point objects. */ - getPoints: function (quantity, stepRate, output) + getDistancePoints: function (distance) { - return GetPoints(this, quantity, stepRate, output); + var len = this.getLength(); + + var spaced = Math.max(1, len / distance); + + return this.getSpacedPoints(spaced); }, /** * [description] * - * @method Phaser.Geom.Triangle#getRandomPoint + * @method Phaser.Curves.Curve#getEndPoint * @since 3.0.0 * - * @param {[type]} point - [description] + * @param {Phaser.Math.Vector2} out - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector2} [description] */ - getRandomPoint: function (point) + getEndPoint: function (out) { - return Random(this, point); + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(1, out); }, + // Get total curve arc length + /** * [description] * - * @method Phaser.Geom.Triangle#setTo + * @method Phaser.Curves.Curve#getLength * @since 3.0.0 * - * @param {[type]} x1 - [description] - * @param {[type]} y1 - [description] - * @param {[type]} x2 - [description] - * @param {[type]} y2 - [description] - * @param {[type]} x3 - [description] - * @param {[type]} y3 - [description] + * @return {number} [description] + */ + getLength: function () + { + var lengths = this.getLengths(); + + return lengths[lengths.length - 1]; + }, + + // Get list of cumulative segment lengths + + /** + * [description] * - * @return {Phaser.Geom.Triangle} This Triangle object. + * @method Phaser.Curves.Curve#getLengths + * @since 3.0.0 + * + * @param {integer} [divisions] - [description] + * + * @return {number[]} [description] */ - setTo: function (x1, y1, x2, y2, x3, y3) + getLengths: function (divisions) { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - if (x3 === undefined) { x3 = 0; } - if (y3 === undefined) { y3 = 0; } + if (divisions === undefined) { divisions = this.arcLengthDivisions; } - this.x1 = x1; - this.y1 = y1; + if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) + { + return this.cacheArcLengths; + } - this.x2 = x2; - this.y2 = y2; + this.needsUpdate = false; - this.x3 = x3; - this.y3 = y3; + var cache = []; + var current; + var last = this.getPoint(0, this._tmpVec2A); + var sum = 0; - return this; + cache.push(0); + + for (var p = 1; p <= divisions; p++) + { + current = this.getPoint(p / divisions, this._tmpVec2B); + + sum += current.distance(last); + + cache.push(sum); + + last.copy(current); + } + + this.cacheArcLengths = cache; + + return cache; // { sums: cache, sum:sum }; Sum is in the last element. }, + // Get point at relative position in curve according to arc length + + // - u [0 .. 1] + /** * [description] * - * @method Phaser.Geom.Triangle#getLineA + * @method Phaser.Curves.Curve#getPointAt * @since 3.0.0 * - * @return {[type]} [description] + * @param {float} u - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - getLineA: function () + getPointAt: function (u, out) { - return { x1: this.x1, y1: this.y1, x2: this.x2, y2: this.y2 }; + var t = this.getUtoTmapping(u); + + return this.getPoint(t, out); }, + // Get sequence of points using getPoint( t ) + /** * [description] * - * @method Phaser.Geom.Triangle#getLineB + * @method Phaser.Curves.Curve#getPoints * @since 3.0.0 * - * @return {[type]} [description] + * @param {integer} [divisions] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] */ - getLineB: function () + getPoints: function (divisions) { - return { x1: this.x2, y1: this.y2, x2: this.x3, y2: this.y3 }; + if (divisions === undefined) { divisions = this.defaultDivisions; } + + var points = []; + + for (var d = 0; d <= divisions; d++) + { + points.push(this.getPoint(d / divisions)); + } + + return points; }, /** * [description] * - * @method Phaser.Geom.Triangle#getLineC + * @method Phaser.Curves.Curve#getRandomPoint * @since 3.0.0 * - * @return {[type]} [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - getLineC: function () + getRandomPoint: function (out) { - return { x1: this.x3, y1: this.y3, x2: this.x1, y2: this.y1 }; + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); }, + // Get sequence of points using getPointAt( u ) + /** * [description] - * - * @name Phaser.Geom.Triangle#left - * @type {number} + * + * @method Phaser.Curves.Curve#getSpacedPoints * @since 3.0.0 - */ - left: { - - get: function () - { - return Math.min(this.x1, this.x2, this.x3); - }, + * + * @param {integer} [divisions] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] + */ + getSpacedPoints: function (divisions) + { + if (divisions === undefined) { divisions = this.defaultDivisions; } - set: function (value) - { - var diff = 0; + var points = []; - if (this.x1 <= this.x2 && this.x1 <= this.x3) - { - diff = this.x1 - value; - } - else if (this.x2 <= this.x1 && this.x2 <= this.x3) - { - diff = this.x2 - value; - } - else - { - diff = this.x3 - value; - } + for (var d = 0; d <= divisions; d++) + { + var t = this.getUtoTmapping(d / divisions, null, divisions); - this.x1 -= diff; - this.x2 -= diff; - this.x3 -= diff; + points.push(this.getPoint(t)); } + return points; }, /** * [description] - * - * @name Phaser.Geom.Triangle#right - * @type {number} + * + * @method Phaser.Curves.Curve#getStartPoint * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - right: { + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - get: function () - { - return Math.max(this.x1, this.x2, this.x3); - }, + return this.getPointAt(0, out); + }, - set: function (value) - { - var diff = 0; + // Returns a unit vector tangent at t + // In case any sub curve does not implement its tangent derivation, + // 2 points a small delta apart will be used to find its gradient + // which seems to give a reasonable approximation - if (this.x1 >= this.x2 && this.x1 >= this.x3) - { - diff = this.x1 - value; - } - else if (this.x2 >= this.x1 && this.x2 >= this.x3) - { - diff = this.x2 - value; - } - else - { - diff = this.x3 - value; - } + /** + * [description] + * + * @method Phaser.Curves.Curve#getTangent + * @since 3.0.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getTangent: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - this.x1 -= diff; - this.x2 -= diff; - this.x3 -= diff; + var delta = 0.0001; + var t1 = t - delta; + var t2 = t + delta; + + // Capping in case of danger + + if (t1 < 0) + { + t1 = 0; + } + + if (t2 > 1) + { + t2 = 1; } + this.getPoint(t1, this._tmpVec2A); + this.getPoint(t2, out); + + return out.subtract(this._tmpVec2A).normalize(); }, /** * [description] - * - * @name Phaser.Geom.Triangle#top - * @type {number} + * + * @method Phaser.Curves.Curve#getTangentAt * @since 3.0.0 + * + * @param {float} u - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - top: { + getTangentAt: function (u, out) + { + var t = this.getUtoTmapping(u); - get: function () - { - return Math.min(this.y1, this.y2, this.y3); - }, + return this.getTangent(t, out); + }, - set: function (value) + // Given a distance in pixels, get a t to find p. + /** + * [description] + * + * @method Phaser.Curves.Curve#getTFromDistance + * @since 3.0.0 + * + * @param {integer} distance - [description] + * @param {integer} [divisions] - [description] + * + * @return {float} [description] + */ + getTFromDistance: function (distance, divisions) + { + if (distance <= 0) { - var diff = 0; - - if (this.y1 <= this.y2 && this.y1 <= this.y3) - { - diff = this.y1 - value; - } - else if (this.y2 <= this.y1 && this.y2 <= this.y3) - { - diff = this.y2 - value; - } - else - { - diff = this.y3 - value; - } - - this.y1 -= diff; - this.y2 -= diff; - this.y3 -= diff; + return 0; } + return this.getUtoTmapping(0, distance, divisions); }, + // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant + /** * [description] - * - * @name Phaser.Geom.Triangle#bottom - * @type {number} + * + * @method Phaser.Curves.Curve#getUtoTmapping * @since 3.0.0 + * + * @param {float} u - [description] + * @param {integer} distance - [description] + * @param {integer} [divisions] - [description] + * + * @return {number} [description] */ - bottom: { + getUtoTmapping: function (u, distance, divisions) + { + var arcLengths = this.getLengths(divisions); - get: function () + var i = 0; + var il = arcLengths.length; + + var targetArcLength; // The targeted u distance value to get + + if (distance) { - return Math.max(this.y1, this.y2, this.y3); - }, + // Cannot overshoot the curve + targetArcLength = Math.min(distance, arcLengths[il - 1]); + } + else + { + targetArcLength = u * arcLengths[il - 1]; + } - set: function (value) + // binary search for the index with largest value smaller than target u distance + + var low = 0; + var high = il - 1; + var comparison; + + while (low <= high) { - var diff = 0; + i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - if (this.y1 >= this.y2 && this.y1 >= this.y3) + comparison = arcLengths[i] - targetArcLength; + + if (comparison < 0) { - diff = this.y1 - value; + low = i + 1; } - else if (this.y2 >= this.y1 && this.y2 >= this.y3) + else if (comparison > 0) { - diff = this.y2 - value; + high = i - 1; } else { - diff = this.y3 - value; + high = i; + break; } + } - this.y1 -= diff; - this.y2 -= diff; - this.y3 -= diff; + i = high; + + if (arcLengths[i] === targetArcLength) + { + return i / (il - 1); } + // we could get finer grain at lengths, or use simple interpolation between two points + + var lengthBefore = arcLengths[i]; + var lengthAfter = arcLengths[i + 1]; + + var segmentLength = lengthAfter - lengthBefore; + + // determine where we are between the 'before' and 'after' points + + var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; + + // add that fractional amount to t + + return (i + segmentFraction) / (il - 1); + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#updateArcLengths + * @since 3.0.0 + */ + updateArcLengths: function () + { + this.needsUpdate = true; + + this.getLengths(); } }); -module.exports = Triangle; +module.exports = Curve; /***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { +/* 53 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -8211,114 +8257,121 @@ module.exports = Triangle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(17); -var File = __webpack_require__(18); -var FileTypesManager = __webpack_require__(7); -var GetFastValue = __webpack_require__(2); - /** - * @classdesc - * [description] + * Shallow Object Clone. Will not clone nested objects. * - * @class JSONFile - * @extends Phaser.Loader.File - * @memberOf Phaser.Loader.FileTypes - * @constructor + * @function Phaser.Utils.Object.Clone * @since 3.0.0 * - * @param {string} key - [description] - * @param {string} url - [description] - * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {object} obj - [description] + * + * @return {object} [description] */ -var JSONFile = new Class({ +var Clone = function (obj) +{ + var clone = {}; - Extends: File, + for (var key in obj) + { + if (Array.isArray(obj[key])) + { + clone[key] = obj[key].slice(0); + } + else + { + clone[key] = obj[key]; + } + } - initialize: + return clone; +}; - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object +module.exports = Clone; - function JSONFile (key, url, path, xhrSettings) - { - var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); - var fileConfig = { - type: 'json', - extension: GetFastValue(key, 'extension', 'json'), - responseType: 'text', - key: fileKey, - url: GetFastValue(key, 'file', url), - path: path, - xhrSettings: GetFastValue(key, 'xhr', xhrSettings) - }; +/***/ }), +/* 54 */ +/***/ (function(module, exports) { - File.call(this, fileConfig); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (typeof fileConfig.url === 'object') - { - // Object provided instead of a URL, so no need to actually load it (populate data with value) - this.data = fileConfig.url; +// http://www.blackpawn.com/texts/pointinpoly/ - this.state = CONST.FILE_POPULATED; - } - }, +/** + * [description] + * + * @function Phaser.Geom.Triangle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {boolean} [description] + */ +var Contains = function (triangle, x, y) +{ + var v0x = triangle.x3 - triangle.x1; + var v0y = triangle.y3 - triangle.y1; - onProcess: function (callback) - { - this.state = CONST.FILE_PROCESSING; + var v1x = triangle.x2 - triangle.x1; + var v1y = triangle.y2 - triangle.y1; - this.data = JSON.parse(this.xhrLoader.responseText); + var v2x = x - triangle.x1; + var v2y = y - triangle.y1; - this.onComplete(); + var dot00 = (v0x * v0x) + (v0y * v0y); + var dot01 = (v0x * v1x) + (v0y * v1y); + var dot02 = (v0x * v2x) + (v0y * v2y); + var dot11 = (v1x * v1x) + (v1y * v1y); + var dot12 = (v1x * v2x) + (v1y * v2y); - callback(this); - } + // Compute barycentric coordinates + var b = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (b === 0) ? 0 : (1 / b); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; -}); + return (u >= 0 && v >= 0 && (u + v < 1)); +}; + +module.exports = Contains; + + +/***/ }), +/* 55 */ +/***/ (function(module, exports) { /** - * Adds a JSON file to the current load queue. - * - * Note: This method will only be available if the JSON File type has been built into Phaser. - * - * The file is **not** loaded immediately after calling this method. - * Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] * - * @method Phaser.Loader.LoaderPlugin#json + * @function Phaser.Geom.Line.Angle * @since 3.0.0 * - * @param {string} key - [description] - * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * - * @return {Phaser.Loader.LoaderPlugin} The Loader. + * @param {Phaser.Geom.Line} line - [description] + * + * @return {number} [description] */ -FileTypesManager.register('json', function (key, url, xhrSettings) +var Angle = function (line) { - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new JSONFile(key[i], url, this.path, xhrSettings)); - } - } - else - { - this.addFile(new JSONFile(key, url, this.path, xhrSettings)); - } - - // For method chaining - return this; -}); + return Math.atan2(line.y2 - line.y1, line.x2 - line.x1); +}; -module.exports = JSONFile; +module.exports = Angle; /***/ }), -/* 57 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8328,296 +8381,401 @@ module.exports = JSONFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(17); -var File = __webpack_require__(18); -var FileTypesManager = __webpack_require__(7); -var GetFastValue = __webpack_require__(2); +var Contains = __webpack_require__(54); +var GetPoint = __webpack_require__(310); +var GetPoints = __webpack_require__(311); +var Random = __webpack_require__(112); /** * @classdesc - * [description] + * A triangle is a plane created by connecting three points. + * The first two arguments specify the first point, the middle two arguments + * specify the second point, and the last two arguments specify the third point. * - * @class ImageFile - * @extends Phaser.Loader.File - * @memberOf Phaser.Loader.FileTypes + * @class Triangle + * @memberOf Phaser.Geom * @constructor * @since 3.0.0 * - * @param {string} key - [description] - * @param {string} url - [description] - * @param {string} path - [description] - * @param {object} xhrSettings - [description] - * @param {object} config - [description] + * @param {number} [x1=0] - [description] + * @param {number} [y1=0] - [description] + * @param {number} [x2=0] - [description] + * @param {number} [y2=0] - [description] + * @param {number} [x3=0] - [description] + * @param {number} [y3=0] - [description] */ -var ImageFile = new Class({ - - Extends: File, +var Triangle = new Class({ initialize: - // this.load.image('pic', 'assets/pics/taikodrummaster.jpg'); - // this.load.image({ key: 'pic', file: 'assets/pics/taikodrummaster.jpg' }); - // this.load.image({ - // key: 'bunny', - // file: 'assets/sprites/bunny.png', - // xhr: { - // user: 'root', - // password: 'th3G1bs0n', - // timeout: 30, - // header: 'Content-Type', - // headerValue: 'text/xml' - // } - // }); - // this.load.image({ key: 'bunny' }); - // this.load.image({ key: 'bunny', extension: 'jpg' }); - - function ImageFile (key, url, path, xhrSettings, config) + function Triangle (x1, y1, x2, y2, x3, y3) { - var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } + if (x3 === undefined) { x3 = 0; } + if (y3 === undefined) { y3 = 0; } - var fileConfig = { - type: 'image', - extension: GetFastValue(key, 'extension', 'png'), - responseType: 'blob', - key: fileKey, - url: GetFastValue(key, 'file', url), - path: path, - xhrSettings: GetFastValue(key, 'xhr', xhrSettings), - config: GetFastValue(key, 'config', config) - }; + /** + * [description] + * + * @name Phaser.Geom.Triangle#x1 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x1 = x1; - File.call(this, fileConfig); - }, + /** + * [description] + * + * @name Phaser.Geom.Triangle#y1 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y1 = y1; - onProcess: function (callback) - { - this.state = CONST.FILE_PROCESSING; - - this.data = new Image(); - - this.data.crossOrigin = this.crossOrigin; - - var _this = this; - - this.data.onload = function () - { - File.revokeObjectURL(_this.data); - - _this.onComplete(); - - callback(_this); - }; - - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); - - _this.state = CONST.FILE_ERRORED; - - callback(_this); - }; + /** + * [description] + * + * @name Phaser.Geom.Triangle#x2 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x2 = x2; - File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); - } + /** + * [description] + * + * @name Phaser.Geom.Triangle#y2 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y2 = y2; -}); + /** + * [description] + * + * @name Phaser.Geom.Triangle#x3 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x3 = x3; -/** - * Adds an Image file to the current load queue. - * - * Note: This method will only be available if the Image File type has been built into Phaser. - * - * The file is **not** loaded immediately after calling this method. - * Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts. - * - * @method Phaser.Loader.LoaderPlugin#image - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {string} url - [description] - * @param {object} xhrSettings - [description] - * - * @return {Phaser.Loader.LoaderPlugin} The Loader. - */ -FileTypesManager.register('image', function (key, url, xhrSettings) -{ - var urls; - var fileA; - var fileB; + /** + * [description] + * + * @name Phaser.Geom.Triangle#y3 + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y3 = y3; + }, - if (Array.isArray(key)) + /** + * [description] + * + * @method Phaser.Geom.Triangle#contains + * @since 3.0.0 + * + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * + * @return {[type]} [description] + */ + contains: function (x, y) { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - urls = GetFastValue(key[i], 'file', url); - - if (Array.isArray(urls) && urls.length === 2) - { - fileA = this.addFile(new ImageFile(key[i], urls[0], this.path, xhrSettings)); - fileB = this.addFile(new ImageFile(key[i], urls[1], this.path, xhrSettings)); + return Contains(this, x, y); + }, - fileA.setLinkFile(fileB, 'dataimage'); - } - else - { - this.addFile(new ImageFile(key[i], url, this.path, xhrSettings)); - } - } - } - else + /** + * [description] + * + * @method Phaser.Geom.Triangle#getPoint + * @since 3.0.0 + * + * @param {[type]} position - [description] + * @param {[type]} output - [description] + * + * @return {[type]} [description] + */ + getPoint: function (position, output) { - urls = GetFastValue(key, 'file', url); - - if (Array.isArray(urls) && urls.length === 2) - { - fileA = this.addFile(new ImageFile(key, urls[0], this.path, xhrSettings)); - fileB = this.addFile(new ImageFile(key, urls[1], this.path, xhrSettings)); - - fileA.setLinkFile(fileB, 'dataimage'); - } - else - { - this.addFile(new ImageFile(key, url, this.path, xhrSettings)); - } - } - - // For method chaining - return this; -}); - -module.exports = ImageFile; - - -/***/ }), -/* 58 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return GetPoint(this, position, output); + }, -module.exports = { + /** + * [description] + * + * @method Phaser.Geom.Triangle#getPoints + * @since 3.0.0 + * + * @param {[type]} quantity - [description] + * @param {[type]} stepRate - [description] + * @param {[type]} output - [description] + * + * @return {[type]} [description] + */ + getPoints: function (quantity, stepRate, output) + { + return GetPoints(this, quantity, stepRate, output); + }, /** * [description] - * - * @name Phaser.Physics.Arcade.DYNAMIC_BODY - * @type {number} + * + * @method Phaser.Geom.Triangle#getRandomPoint * @since 3.0.0 + * + * @param {[type]} point - [description] + * + * @return {[type]} [description] */ - DYNAMIC_BODY: 0, + getRandomPoint: function (point) + { + return Random(this, point); + }, /** * [description] - * - * @name Phaser.Physics.Arcade.STATIC_BODY - * @type {number} + * + * @method Phaser.Geom.Triangle#setTo * @since 3.0.0 + * + * @param {[type]} x1 - [description] + * @param {[type]} y1 - [description] + * @param {[type]} x2 - [description] + * @param {[type]} y2 - [description] + * @param {[type]} x3 - [description] + * @param {[type]} y3 - [description] + * + * @return {Phaser.Geom.Triangle} This Triangle object. */ - STATIC_BODY: 1, + setTo: function (x1, y1, x2, y2, x3, y3) + { + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } + if (x3 === undefined) { x3 = 0; } + if (y3 === undefined) { y3 = 0; } + + this.x1 = x1; + this.y1 = y1; + + this.x2 = x2; + this.y2 = y2; + + this.x3 = x3; + this.y3 = y3; + + return this; + }, /** * [description] - * - * @name Phaser.Physics.Arcade.GROUP - * @type {number} + * + * @method Phaser.Geom.Triangle#getLineA * @since 3.0.0 + * + * @return {[type]} [description] */ - GROUP: 2, + getLineA: function () + { + return { x1: this.x1, y1: this.y1, x2: this.x2, y2: this.y2 }; + }, /** * [description] - * - * @name Phaser.Physics.Arcade.TILEMAPLAYER - * @type {number} + * + * @method Phaser.Geom.Triangle#getLineB * @since 3.0.0 + * + * @return {[type]} [description] */ - TILEMAPLAYER: 3, + getLineB: function () + { + return { x1: this.x2, y1: this.y2, x2: this.x3, y2: this.y3 }; + }, /** * [description] - * - * @name Phaser.Physics.Arcade.FACING_NONE - * @type {number} + * + * @method Phaser.Geom.Triangle#getLineC * @since 3.0.0 + * + * @return {[type]} [description] */ - FACING_NONE: 10, + getLineC: function () + { + return { x1: this.x3, y1: this.y3, x2: this.x1, y2: this.y1 }; + }, /** * [description] * - * @name Phaser.Physics.Arcade.FACING_UP + * @name Phaser.Geom.Triangle#left * @type {number} * @since 3.0.0 */ - FACING_UP: 11, + left: { + + get: function () + { + return Math.min(this.x1, this.x2, this.x3); + }, + + set: function (value) + { + var diff = 0; + + if (this.x1 <= this.x2 && this.x1 <= this.x3) + { + diff = this.x1 - value; + } + else if (this.x2 <= this.x1 && this.x2 <= this.x3) + { + diff = this.x2 - value; + } + else + { + diff = this.x3 - value; + } + + this.x1 -= diff; + this.x2 -= diff; + this.x3 -= diff; + } + + }, /** * [description] * - * @name Phaser.Physics.Arcade.FACING_DOWN + * @name Phaser.Geom.Triangle#right * @type {number} * @since 3.0.0 */ - FACING_DOWN: 12, + right: { + + get: function () + { + return Math.max(this.x1, this.x2, this.x3); + }, + + set: function (value) + { + var diff = 0; + + if (this.x1 >= this.x2 && this.x1 >= this.x3) + { + diff = this.x1 - value; + } + else if (this.x2 >= this.x1 && this.x2 >= this.x3) + { + diff = this.x2 - value; + } + else + { + diff = this.x3 - value; + } + + this.x1 -= diff; + this.x2 -= diff; + this.x3 -= diff; + } + + }, /** * [description] * - * @name Phaser.Physics.Arcade.FACING_LEFT + * @name Phaser.Geom.Triangle#top * @type {number} * @since 3.0.0 */ - FACING_LEFT: 13, + top: { + + get: function () + { + return Math.min(this.y1, this.y2, this.y3); + }, + + set: function (value) + { + var diff = 0; + + if (this.y1 <= this.y2 && this.y1 <= this.y3) + { + diff = this.y1 - value; + } + else if (this.y2 <= this.y1 && this.y2 <= this.y3) + { + diff = this.y2 - value; + } + else + { + diff = this.y3 - value; + } + + this.y1 -= diff; + this.y2 -= diff; + this.y3 -= diff; + } + + }, /** * [description] * - * @name Phaser.Physics.Arcade.FACING_RIGHT + * @name Phaser.Geom.Triangle#bottom * @type {number} * @since 3.0.0 */ - FACING_RIGHT: 14 + bottom: { -}; + get: function () + { + return Math.max(this.y1, this.y2, this.y3); + }, + set: function (value) + { + var diff = 0; -/***/ }), -/* 59 */, -/* 60 */ -/***/ (function(module, exports) { + if (this.y1 >= this.y2 && this.y1 >= this.y3) + { + diff = this.y1 - value; + } + else if (this.y2 >= this.y1 && this.y2 >= this.y3) + { + diff = this.y2 - value; + } + else + { + diff = this.y3 - value; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.y1 -= diff; + this.y2 -= diff; + this.y3 -= diff; + } -/** - * Force a value within the boundaries by clamping it to the range `min`, `max`. - * - * @function Phaser.Math.Clamp - * @since 3.0.0 - * - * @param {number} value - The value to be clamped. - * @param {number} min - The minimum bounds. - * @param {number} max - The maximum bounds. - * - * @return {number} The clamped value. - */ -var Clamp = function (value, min, max) -{ - return Math.max(min, Math.min(max, value)); -}; + } -module.exports = Clamp; +}); + +module.exports = Triangle; /***/ }), -/* 61 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8627,74 +8785,489 @@ module.exports = Clamp; */ var Class = __webpack_require__(0); +var CONST = __webpack_require__(17); +var File = __webpack_require__(18); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(2); /** * @classdesc - * A Set is a collection of unique elements. + * [description] * - * @class Set - * @memberOf Phaser.Structs + * @class JSONFile + * @extends Phaser.Loader.File + * @memberOf Phaser.Loader.FileTypes * @constructor * @since 3.0.0 * - * @param {array} [elements] - [description] + * @param {string} key - [description] + * @param {string} url - [description] + * @param {string} path - [description] + * @param {object} xhrSettings - [description] */ -var Set = new Class({ +var JSONFile = new Class({ + + Extends: File, initialize: - function Set (elements) + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + + function JSONFile (key, url, path, xhrSettings) { - /** - * [description] - * - * @name Phaser.Structs.Set#entries - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.entries = []; + var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); - if (Array.isArray(elements)) + var fileConfig = { + type: 'json', + extension: GetFastValue(key, 'extension', 'json'), + responseType: 'text', + key: fileKey, + url: GetFastValue(key, 'file', url), + path: path, + xhrSettings: GetFastValue(key, 'xhr', xhrSettings) + }; + + File.call(this, fileConfig); + + if (typeof fileConfig.url === 'object') { - for (var i = 0; i < elements.length; i++) - { - this.set(elements[i]); - } + // Object provided instead of a URL, so no need to actually load it (populate data with value) + this.data = fileConfig.url; + + this.state = CONST.FILE_POPULATED; } }, - /** - * [description] - * - * @method Phaser.Structs.Set#set - * @since 3.0.0 - * - * @param {any} value - [description] - * - * @return {Phaser.Structs.Set} This Set object. - */ - set: function (value) + onProcess: function (callback) { - if (this.entries.indexOf(value) === -1) - { - this.entries.push(value); - } + this.state = CONST.FILE_PROCESSING; - return this; - }, + this.data = JSON.parse(this.xhrLoader.responseText); - /** - * [description] - * - * @method Phaser.Structs.Set#get - * @since 3.0.0 - * - * @param {string} property - [description] - * @param {any} value - [description] - * - * @return {any} [description] - */ + this.onComplete(); + + callback(this); + } + +}); + +/** + * Adds a JSON file to the current load queue. + * + * Note: This method will only be available if the JSON File type has been built into Phaser. + * + * The file is **not** loaded immediately after calling this method. + * Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts. + * + * @method Phaser.Loader.LoaderPlugin#json + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {string} url - [description] + * @param {object} xhrSettings - [description] + * + * @return {Phaser.Loader.LoaderPlugin} The Loader. + */ +FileTypesManager.register('json', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new JSONFile(key[i], url, this.path, xhrSettings)); + } + } + else + { + this.addFile(new JSONFile(key, url, this.path, xhrSettings)); + } + + // For method chaining + return this; +}); + +module.exports = JSONFile; + + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(17); +var File = __webpack_require__(18); +var FileTypesManager = __webpack_require__(7); +var GetFastValue = __webpack_require__(2); + +/** + * @classdesc + * [description] + * + * @class ImageFile + * @extends Phaser.Loader.File + * @memberOf Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {string} url - [description] + * @param {string} path - [description] + * @param {object} xhrSettings - [description] + * @param {object} config - [description] + */ +var ImageFile = new Class({ + + Extends: File, + + initialize: + + // this.load.image('pic', 'assets/pics/taikodrummaster.jpg'); + // this.load.image({ key: 'pic', file: 'assets/pics/taikodrummaster.jpg' }); + // this.load.image({ + // key: 'bunny', + // file: 'assets/sprites/bunny.png', + // xhr: { + // user: 'root', + // password: 'th3G1bs0n', + // timeout: 30, + // header: 'Content-Type', + // headerValue: 'text/xml' + // } + // }); + // this.load.image({ key: 'bunny' }); + // this.load.image({ key: 'bunny', extension: 'jpg' }); + + function ImageFile (key, url, path, xhrSettings, config) + { + var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); + + var fileConfig = { + type: 'image', + extension: GetFastValue(key, 'extension', 'png'), + responseType: 'blob', + key: fileKey, + url: GetFastValue(key, 'file', url), + path: path, + xhrSettings: GetFastValue(key, 'xhr', xhrSettings), + config: GetFastValue(key, 'config', config) + }; + + File.call(this, fileConfig); + }, + + onProcess: function (callback) + { + this.state = CONST.FILE_PROCESSING; + + this.data = new Image(); + + this.data.crossOrigin = this.crossOrigin; + + var _this = this; + + this.data.onload = function () + { + File.revokeObjectURL(_this.data); + + _this.onComplete(); + + callback(_this); + }; + + this.data.onerror = function () + { + File.revokeObjectURL(_this.data); + + _this.state = CONST.FILE_ERRORED; + + callback(_this); + }; + + File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); + } + +}); + +/** + * Adds an Image file to the current load queue. + * + * Note: This method will only be available if the Image File type has been built into Phaser. + * + * The file is **not** loaded immediately after calling this method. + * Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts. + * + * @method Phaser.Loader.LoaderPlugin#image + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {string} url - [description] + * @param {object} xhrSettings - [description] + * + * @return {Phaser.Loader.LoaderPlugin} The Loader. + */ +FileTypesManager.register('image', function (key, url, xhrSettings) +{ + var urls; + var fileA; + var fileB; + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + urls = GetFastValue(key[i], 'file', url); + + if (Array.isArray(urls) && urls.length === 2) + { + fileA = this.addFile(new ImageFile(key[i], urls[0], this.path, xhrSettings)); + fileB = this.addFile(new ImageFile(key[i], urls[1], this.path, xhrSettings)); + + fileA.setLinkFile(fileB, 'dataimage'); + } + else + { + this.addFile(new ImageFile(key[i], url, this.path, xhrSettings)); + } + } + } + else + { + urls = GetFastValue(key, 'file', url); + + if (Array.isArray(urls) && urls.length === 2) + { + fileA = this.addFile(new ImageFile(key, urls[0], this.path, xhrSettings)); + fileB = this.addFile(new ImageFile(key, urls[1], this.path, xhrSettings)); + + fileA.setLinkFile(fileB, 'dataimage'); + } + else + { + this.addFile(new ImageFile(key, url, this.path, xhrSettings)); + } + } + + // For method chaining + return this; +}); + +module.exports = ImageFile; + + +/***/ }), +/* 59 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +module.exports = { + + /** + * [description] + * + * @name Phaser.Physics.Arcade.DYNAMIC_BODY + * @type {number} + * @since 3.0.0 + */ + DYNAMIC_BODY: 0, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.STATIC_BODY + * @type {number} + * @since 3.0.0 + */ + STATIC_BODY: 1, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.GROUP + * @type {number} + * @since 3.0.0 + */ + GROUP: 2, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.TILEMAPLAYER + * @type {number} + * @since 3.0.0 + */ + TILEMAPLAYER: 3, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.FACING_NONE + * @type {number} + * @since 3.0.0 + */ + FACING_NONE: 10, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.FACING_UP + * @type {number} + * @since 3.0.0 + */ + FACING_UP: 11, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.FACING_DOWN + * @type {number} + * @since 3.0.0 + */ + FACING_DOWN: 12, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.FACING_LEFT + * @type {number} + * @since 3.0.0 + */ + FACING_LEFT: 13, + + /** + * [description] + * + * @name Phaser.Physics.Arcade.FACING_RIGHT + * @type {number} + * @since 3.0.0 + */ + FACING_RIGHT: 14 + +}; + + +/***/ }), +/* 60 */, +/* 61 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Force a value within the boundaries by clamping it to the range `min`, `max`. + * + * @function Phaser.Math.Clamp + * @since 3.0.0 + * + * @param {number} value - The value to be clamped. + * @param {number} min - The minimum bounds. + * @param {number} max - The maximum bounds. + * + * @return {number} The clamped value. + */ +var Clamp = function (value, min, max) +{ + return Math.max(min, Math.min(max, value)); +}; + +module.exports = Clamp; + + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A Set is a collection of unique elements. + * + * @class Set + * @memberOf Phaser.Structs + * @constructor + * @since 3.0.0 + * + * @param {array} [elements] - [description] + */ +var Set = new Class({ + + initialize: + + function Set (elements) + { + /** + * [description] + * + * @name Phaser.Structs.Set#entries + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.entries = []; + + if (Array.isArray(elements)) + { + for (var i = 0; i < elements.length; i++) + { + this.set(elements[i]); + } + } + }, + + /** + * [description] + * + * @method Phaser.Structs.Set#set + * @since 3.0.0 + * + * @param {any} value - [description] + * + * @return {Phaser.Structs.Set} This Set object. + */ + set: function (value) + { + if (this.entries.indexOf(value) === -1) + { + this.entries.push(value); + } + + return this; + }, + + /** + * [description] + * + * @method Phaser.Structs.Set#get + * @since 3.0.0 + * + * @param {string} property - [description] + * @param {any} value - [description] + * + * @return {any} [description] + */ get: function (property, value) { for (var i = 0; i < this.entries.length; i++) @@ -9012,7 +9585,7 @@ module.exports = Set; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports) { /** @@ -9058,7 +9631,7 @@ module.exports = { /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9069,9 +9642,9 @@ module.exports = { var Class = __webpack_require__(0); var Contains = __webpack_require__(32); -var GetPoint = __webpack_require__(181); -var GetPoints = __webpack_require__(182); -var Random = __webpack_require__(105); +var GetPoint = __webpack_require__(182); +var GetPoints = __webpack_require__(183); +var Random = __webpack_require__(106); /** * @classdesc @@ -9415,7 +9988,7 @@ module.exports = Circle; /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9424,7 +9997,7 @@ module.exports = Circle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(60); +var Clamp = __webpack_require__(61); /** * Return a value based on the range between `min` and `max` and the percentage given. @@ -9449,7 +10022,7 @@ module.exports = FromPercent; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports) { /** @@ -9477,759 +10050,1257 @@ module.exports = Length; /***/ }), -/* 66 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { -/** +/* WEBPACK VAR INJECTION */(function(process) {/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var FromPoints = __webpack_require__(121); -var Rectangle = __webpack_require__(8); -var Vector2 = __webpack_require__(6); - /** - * @classdesc - * A Base Curve class, which all other curve types extend. - * - * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - * - * @class Curve - * @memberOf Phaser.Curves - * @constructor + * Determines the operating system of the device running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.os` from within any Scene. + * + * @name Phaser.Device.OS * @since 3.0.0 * - * @param {string} type - [description] + * @type {object} + * @property {boolean} android - Is running on android? + * @property {boolean} chromeOS - Is running on chromeOS? + * @property {boolean} cocoonJS - Is the game running under CocoonJS? + * @property {boolean} cocoonJSApp - Is this game running with CocoonJS.App? + * @property {boolean} cordova - Is the game running under Apache Cordova? + * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? + * @property {boolean} desktop - Is running on a desktop? + * @property {boolean} ejecta - Is the game running under Ejecta? + * @property {boolean} electron - Is the game running under GitHub Electron? + * @property {boolean} iOS - Is running on iOS? + * @property {boolean} iPad - Is running on iPad? + * @property {boolean} iPhone - Is running on iPhone? + * @property {boolean} kindle - Is running on an Amazon Kindle? + * @property {boolean} linux - Is running on linux? + * @property {boolean} macOS - Is running on macOS? + * @property {boolean} node - Is the game running under Node.js? + * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? + * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView + * @property {boolean} windows - Is running on windows? + * @property {boolean} windowsPhone - Is running on a Windows Phone? + * @property {number} iOSVersion - If running in iOS this will contain the major version number. + * @property {number} pixelRatio - PixelRatio of the host device? */ -var Curve = new Class({ +var OS = { - initialize: + android: false, + chromeOS: false, + cocoonJS: false, + cocoonJSApp: false, + cordova: false, + crosswalk: false, + desktop: false, + ejecta: false, + electron: false, + iOS: false, + iOSVersion: 0, + iPad: false, + iPhone: false, + kindle: false, + linux: false, + macOS: false, + node: false, + nodeWebkit: false, + pixelRatio: 1, + webApp: false, + windows: false, + windowsPhone: false - function Curve (type) - { - /** - * String based identifier for the type of curve. - * - * @name Phaser.Curves.Curve#type - * @type {string} - * @since 3.0.0 - */ - this.type = type; +}; + +function init () +{ + var ua = navigator.userAgent; + + if (/Windows/.test(ua)) + { + OS.windows = true; + } + else if (/Mac OS/.test(ua)) + { + OS.macOS = true; + } + else if (/Linux/.test(ua)) + { + OS.linux = true; + } + else if (/Android/.test(ua)) + { + OS.android = true; + } + else if (/iP[ao]d|iPhone/i.test(ua)) + { + OS.iOS = true; + (navigator.appVersion).match(/OS (\d+)/); + OS.iOSVersion = parseInt(RegExp.$1, 10); + } + else if (/Kindle/.test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) + { + OS.kindle = true; + + // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... + // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" + } + else if (/CrOS/.test(ua)) + { + OS.chromeOS = true; + } + + if (/Windows Phone/i.test(ua) || (/IEMobile/i).test(ua)) + { + OS.android = false; + OS.iOS = false; + OS.macOS = false; + OS.windows = true; + OS.windowsPhone = true; + } + + var silk = (/Silk/).test(ua); + + if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) + { + OS.desktop = true; + } + + // Windows Phone / Table reset + if (OS.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua)))) + { + OS.desktop = false; + } + + // WebApp mode in iOS + if (navigator.standalone) + { + OS.webApp = true; + } + + if (window.cordova !== undefined) + { + OS.cordova = true; + } + + if ((typeof process !== 'undefined') && (typeof process.versions.node !== 'undefined')) + { + OS.node = true; + } + + if (OS.node && typeof process.versions === 'object') + { + OS.nodeWebkit = !!process.versions['node-webkit']; + + OS.electron = !!process.versions.electron; + } + + if (navigator.isCocoonJS) + { + OS.cocoonJS = true; + + try + { + OS.cocoonJSApp = (typeof CocoonJS !== 'undefined'); + } + catch (error) + { + OS.cocoonJSApp = false; + } + } + + if (window.ejecta !== undefined) + { + OS.ejecta = true; + } + + if ((/Crosswalk/).test(ua)) + { + OS.crosswalk = true; + } + + OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; + OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; + + OS.pixelRatio = window['devicePixelRatio'] || 1; + + return OS; +} + +module.exports = init(); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(507))) + +/***/ }), +/* 68 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Check to see if the Ellipse contains the given x / y coordinates. + * + * @function Phaser.Geom.Ellipse.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. + * @param {number} x - The x coordinate to check within the ellipse. + * @param {number} y - The y coordinate to check within the ellipse. + * + * @return {boolean} True if the coordinates are within the ellipse, otherwise false. + */ +var Contains = function (ellipse, x, y) +{ + if (ellipse.width <= 0 || ellipse.height <= 0) + { + return false; + } + + // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5 + var normx = ((x - ellipse.x) / ellipse.width); + var normy = ((y - ellipse.y) / ellipse.height); + + normx *= normx; + normy *= normy; + + return (normx + normy < 0.25); +}; + +module.exports = Contains; + + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Actions = __webpack_require__(169); +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var GetValue = __webpack_require__(4); +var Range = __webpack_require__(275); +var Set = __webpack_require__(62); +var Sprite = __webpack_require__(37); + +/** + * @classdesc + * [description] + * + * children can be either an array of children, or a config object + * config can be either a config object, or undefined if passed as the children argument instead + * + * @class Group + * @memberOf Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {array} children - [description] + * @param {object} config - [description] + */ +var Group = new Class({ + + initialize: + + function Group (scene, children, config) + { + if (config === undefined && !Array.isArray(children) && typeof children === 'object') + { + config = children; + children = null; + } /** - * The default number of divisions within the curve. + * [description] * - * @name Phaser.Curves.Curve#defaultDivisions - * @type {integer} - * @default 5 + * @name Phaser.GameObjects.Group#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.defaultDivisions = 5; + this.scene = scene; /** - * The quantity of arc length divisions within the curve. + * [description] * - * @name Phaser.Curves.Curve#arcLengthDivisions - * @type {integer} - * @default 100 + * @name Phaser.GameObjects.Group#children + * @type {Phaser.Structs.Set} * @since 3.0.0 */ - this.arcLengthDivisions = 100; + this.children = new Set(children); /** - * An array of cached arc length values. + * [description] * - * @name Phaser.Curves.Curve#cacheArcLengths - * @type {array} - * @default [] + * @name Phaser.GameObjects.Group#isParent + * @type {boolean} + * @default true * @since 3.0.0 */ - this.cacheArcLengths = []; + this.isParent = true; /** - * Does the data of this curve need updating? + * [description] * - * @name Phaser.Curves.Curve#needsUpdate + * @name Phaser.GameObjects.Group#classType + * @type {object} + * @since 3.0.0 + */ + this.classType = GetFastValue(config, 'classType', Sprite); + + /** + * [description] + * + * @name Phaser.GameObjects.Group#active * @type {boolean} - * @default true * @since 3.0.0 */ - this.needsUpdate = true; + this.active = GetFastValue(config, 'active', true); /** * [description] * - * @name Phaser.Curves.Curve#active + * @name Phaser.GameObjects.Group#maxSize + * @type {integer} + * @since 3.0.0 + */ + this.maxSize = GetFastValue(config, 'maxSize', -1); + + /** + * [description] + * + * @name Phaser.GameObjects.Group#defaultKey + * @type {string} + * @since 3.0.0 + */ + this.defaultKey = GetFastValue(config, 'defaultKey', null); + + /** + * [description] + * + * @name Phaser.GameObjects.Group#defaultFrame + * @type {string|integer} + * @since 3.0.0 + */ + this.defaultFrame = GetFastValue(config, 'defaultFrame', null); + + /** + * [description] + * + * @name Phaser.GameObjects.Group#runChildUpdate * @type {boolean} - * @default true + * @default false * @since 3.0.0 */ - this.active = true; + this.runChildUpdate = GetFastValue(config, 'runChildUpdate', false); /** - * A temporary calculation Vector. + * [description] * - * @name Phaser.Curves.Curve#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private + * @name Phaser.GameObjects.Group#createCallback + * @type {?function} * @since 3.0.0 */ - this._tmpVec2A = new Vector2(); + this.createCallback = GetFastValue(config, 'createCallback', null); /** - * A temporary calculation Vector. + * [description] * - * @name Phaser.Curves.Curve#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private + * @name Phaser.GameObjects.Group#removeCallback + * @type {?function} * @since 3.0.0 */ - this._tmpVec2B = new Vector2(); - }, + this.removeCallback = GetFastValue(config, 'removeCallback', null); - /** - * Draws this curve on the given Graphics object. - * - * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. - * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. - * - * @method Phaser.Curves.Curve#draw - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. - * - * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. - */ - draw: function (graphics, pointsTotal) - { - if (pointsTotal === undefined) { pointsTotal = 32; } + /** + * [description] + * + * @name Phaser.GameObjects.Group#createMultipleCallback + * @type {?function} + * @since 3.0.0 + */ + this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); - // So you can chain graphics calls - return graphics.strokePoints(this.getPoints(pointsTotal)); + if (config) + { + this.createMultiple(config); + } }, /** - * Returns a Rectangle where the position and dimensions match the bounds of this Curve. - * - * You can control the accuracy of the bounds. The value given is used to work out how many points - * to plot across the curve. Higher values are more accurate at the cost of calculation speed. + * [description] * - * @method Phaser.Curves.Curve#getBounds + * @method Phaser.GameObjects.Group#create * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} out - The Rectangle to store the bounds in. If falsey a new object will be created. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {boolean} [visible=true] - [description] * - * @return {Phaser.Geom.Rectangle} A Rectangle containing the bounds values of this Curve. + * @return {Phaser.GameObjects.GameObject} [description] */ - getBounds: function (out, accuracy) + create: function (x, y, key, frame, visible) { - if (!out) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } - - var len = this.getLength(); + if (key === undefined) { key = this.defaultKey; } + if (frame === undefined) { frame = this.defaultFrame; } + if (visible === undefined) { visible = true; } - if (accuracy > len) + // Pool? + if (this.isFull()) { - accuracy = len / 2; + return null; } - // The length of the curve in pixels - // So we'll have 1 spaced point per 'accuracy' pixels + var child = new this.classType(this.scene, x, y, key, frame); - var spaced = Math.max(1, Math.round(len / accuracy)); + this.scene.sys.displayList.add(child); - return FromPoints(this.getSpacedPoints(spaced), out); - }, + if (child.preUpdate) + { + this.scene.sys.updateList.add(child); + } - /** - * Returns an array of points, spaced out X distance pixels apart. - * The smaller the distance, the larger the array will be. - * - * @method Phaser.Curves.Curve#getDistancePoints - * @since 3.0.0 - * - * @param {integer} distance - The distance, in pixels, between each point along the curve. - * - * @return {Phaser.Geom.Point[]} An Array of Point objects. - */ - getDistancePoints: function (distance) - { - var len = this.getLength(); + child.visible = visible; - var spaced = Math.max(1, len / distance); + this.add(child); - return this.getSpacedPoints(spaced); + return child; }, /** * [description] * - * @method Phaser.Curves.Curve#getEndPoint + * @method Phaser.GameObjects.Group#createMultiple * @since 3.0.0 * - * @param {Phaser.Math.Vector2} out - [description] + * @param {object} config - [description] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.GameObjects.GameObject[]} [description] */ - getEndPoint: function (out) + createMultiple: function (config) { - if (out === undefined) { out = new Vector2(); } + if (!Array.isArray(config)) + { + config = [ config ]; + } - return this.getPointAt(1, out); - }, + var output = []; - // Get total curve arc length + for (var i = 0; i < config.length; i++) + { + var entries = this.createFromConfig(config[i]); - /** - * [description] - * - * @method Phaser.Curves.Curve#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lengths = this.getLengths(); + output = output.concat(entries); + } - return lengths[lengths.length - 1]; + return output; }, - // Get list of cumulative segment lengths - /** * [description] * - * @method Phaser.Curves.Curve#getLengths + * @method Phaser.GameObjects.Group#createFromConfig * @since 3.0.0 * - * @param {integer} [divisions] - [description] + * @param {object} options - [description] * - * @return {number[]} [description] + * @return {Phaser.GameObjects.GameObject[]} [description] */ - getLengths: function (divisions) + createFromConfig: function (options) { - if (divisions === undefined) { divisions = this.arcLengthDivisions; } + this.classType = GetFastValue(options, 'classType', this.classType); - if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) + var key = GetFastValue(options, 'key', undefined); + var frame = GetFastValue(options, 'frame', null); + var visible = GetFastValue(options, 'visible', true); + + var entries = []; + + // Can't do anything without at least a key + if (key === undefined) { - return this.cacheArcLengths; + return entries; } + else + { + if (!Array.isArray(key)) + { + key = [ key ]; + } - this.needsUpdate = false; + if (!Array.isArray(frame)) + { + frame = [ frame ]; + } + } - var cache = []; - var current; - var last = this.getPoint(0, this._tmpVec2A); - var sum = 0; + // Build an array of key frame pairs to loop through - cache.push(0); + var repeat = GetFastValue(options, 'repeat', 0); + var randomKey = GetFastValue(options, 'randomKey', false); + var randomFrame = GetFastValue(options, 'randomFrame', false); + var yoyo = GetFastValue(options, 'yoyo', false); + var quantity = GetFastValue(options, 'frameQuantity', 1); + var max = GetFastValue(options, 'max', 0); - for (var p = 1; p <= divisions; p++) + // If a grid is set we use that to override the quantity? + + var range = Range(key, frame, { + max: max, + qty: quantity, + random: randomKey, + randomB: randomFrame, + repeat: repeat, + yoyo: yoyo + }); + + for (var c = 0; c < range.length; c++) { - current = this.getPoint(p / divisions, this._tmpVec2B); + entries.push(this.create(0, 0, range[c].a, range[c].b, visible)); + } - sum += current.distance(last); + // Post-creation options (applied only to those items created in this call): - cache.push(sum); + var x = GetValue(options, 'setXY.x', 0); + var y = GetValue(options, 'setXY.y', 0); + var stepX = GetValue(options, 'setXY.stepX', 0); + var stepY = GetValue(options, 'setXY.stepY', 0); - last.copy(current); - } + Actions.SetXY(entries, x, y, stepX, stepY); - this.cacheArcLengths = cache; + var rotation = GetValue(options, 'setRotation.value', 0); + var stepRotation = GetValue(options, 'setRotation.step', 0); - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - }, + Actions.SetRotation(entries, rotation, stepRotation); - // Get point at relative position in curve according to arc length + var scaleX = GetValue(options, 'setScale.x', 1); + var scaleY = GetValue(options, 'setScale.y', scaleX); + var stepScaleX = GetValue(options, 'setScale.stepX', 0); + var stepScaleY = GetValue(options, 'setScale.stepY', 0); - // - u [0 .. 1] + Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY); - /** + var alpha = GetValue(options, 'setAlpha.value', 1); + var stepAlpha = GetValue(options, 'setAlpha.step', 0); + + Actions.SetAlpha(entries, alpha, stepAlpha); + + var hitArea = GetFastValue(options, 'hitArea', null); + var hitAreaCallback = GetFastValue(options, 'hitAreaCallback', null); + + if (hitArea) + { + Actions.SetHitArea(entries, hitArea, hitAreaCallback); + } + + var grid = GetFastValue(options, 'gridAlign', false); + + if (grid) + { + Actions.GridAlign(entries, grid); + } + + if (this.createMultipleCallback) + { + this.createMultipleCallback.call(this, entries); + } + + return entries; + }, + + /** * [description] * - * @method Phaser.Curves.Curve#getPointAt + * @method Phaser.GameObjects.Group#preUpdate * @since 3.0.0 * - * @param {float} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] + * @param {number} time - [description] + * @param {number} delta - [description] */ - getPointAt: function (u, out) + preUpdate: function (time, delta) { - var t = this.getUtoTmapping(u); + if (!this.runChildUpdate || this.children.size === 0) + { + return; + } - return this.getPoint(t, out); - }, + // Because a Group child may mess with the length of the Group during its update + var temp = this.children.entries.slice(); - // Get sequence of points using getPoint( t ) + for (var i = 0; i < temp.length; i++) + { + var item = temp[i]; + + if (item.active) + { + item.update(time, delta); + } + } + }, /** * [description] * - * @method Phaser.Curves.Curve#getPoints + * @method Phaser.GameObjects.Group#add * @since 3.0.0 * - * @param {integer} [divisions] - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {boolean} [addToScene=false] - [description] * - * @return {Phaser.Math.Vector2[]} [description] + * @return {Phaser.GameObjects.Group} This Group object. */ - getPoints: function (divisions) + add: function (child, addToScene) { - if (divisions === undefined) { divisions = this.defaultDivisions; } + if (addToScene === undefined) { addToScene = false; } - var points = []; + this.children.set(child); - for (var d = 0; d <= divisions; d++) + if (this.createCallback) { - points.push(this.getPoint(d / divisions)); + this.createCallback.call(this, child); } - return points; + if (addToScene) + { + this.scene.sys.displayList.add(child); + + if (child.preUpdate) + { + this.scene.sys.updateList.add(child); + } + } + + return this; }, /** * [description] * - * @method Phaser.Curves.Curve#getRandomPoint + * @method Phaser.GameObjects.Group#addMultiple * @since 3.0.0 * - * @param {Phaser.Math.Vector2} [out] - [description] + * @param {Phaser.GameObjects.GameObject[]} children - [description] + * @param {boolean} [addToScene=false] - [description] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.GameObjects.Group} This Group object. */ - getRandomPoint: function (out) + addMultiple: function (children, addToScene) { - if (out === undefined) { out = new Vector2(); } + if (addToScene === undefined) { addToScene = false; } - return this.getPoint(Math.random(), out); - }, + if (Array.isArray(children)) + { + for (var i = 0; i < children.length; i++) + { + this.add(children[i], addToScene); + } + } - // Get sequence of points using getPointAt( u ) + return this; + }, /** * [description] * - * @method Phaser.Curves.Curve#getSpacedPoints + * @method Phaser.GameObjects.Group#remove * @since 3.0.0 * - * @param {integer} [divisions] - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {boolean} [removeFromScene=false] - [description] * - * @return {Phaser.Math.Vector2[]} [description] + * @return {Phaser.GameObjects.Group} This Group object. */ - getSpacedPoints: function (divisions) + remove: function (child, removeFromScene) { - if (divisions === undefined) { divisions = this.defaultDivisions; } + if (removeFromScene === undefined) { removeFromScene = false; } - var points = []; + this.children.delete(child); - for (var d = 0; d <= divisions; d++) + if (removeFromScene) { - var t = this.getUtoTmapping(d / divisions, null, divisions); + this.scene.sys.displayList.remove(child); - points.push(this.getPoint(t)); + if (child.preUpdate) + { + this.scene.sys.updateList.remove(child); + } } - return points; + return this; }, /** * [description] * - * @method Phaser.Curves.Curve#getStartPoint + * @method Phaser.GameObjects.Group#clear * @since 3.0.0 * - * @param {Phaser.Math.Vector2} [out] - [description] + * @param {boolean} [removeFromScene=false] - [description] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.GameObjects.Group} This Group object. */ - getStartPoint: function (out) + clear: function (removeFromScene) { - if (out === undefined) { out = new Vector2(); } + if (removeFromScene === undefined) { removeFromScene = false; } - return this.getPointAt(0, out); + if (removeFromScene) + { + var children = this.children; + + for (var i = 0; i < children.length; i++) + { + var gameObject = children[i]; + + this.scene.sys.displayList.remove(gameObject); + + if (gameObject.preUpdate) + { + this.scene.sys.updateList.remove(gameObject); + } + } + } + + this.children.clear(); + + return this; }, - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation + /** + * [description] + * + * @method Phaser.GameObjects.Group#contains + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - [description] + * + * @return {boolean} [description] + */ + contains: function (child) + { + return this.children.contains(child); + }, /** * [description] * - * @method Phaser.Curves.Curve#getTangent + * @method Phaser.GameObjects.Group#getChildren * @since 3.0.0 * - * @param {number} t - [description] - * @param {Phaser.Math.Vector2} [out] - [description] + * @return {Phaser.GameObjects.GameObject[]} [description] + */ + getChildren: function () + { + return this.children.entries; + }, + + /** + * [description] * - * @return {Phaser.Math.Vector2} [description] + * @method Phaser.GameObjects.Group#getLength + * @since 3.0.0 + * + * @return {integer} [description] */ - getTangent: function (t, out) + getLength: function () { - if (out === undefined) { out = new Vector2(); } + return this.children.size; + }, - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; + /** + * [description] + * + * @method Phaser.GameObjects.Group#getFirst + * @since 3.0.0 + * + * @param {boolean} [state=false] - [description] + * @param {boolean} [createIfNull=false] - [description] + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {boolean} [visible] - [description] + * + * @return {Phaser.GameObjects.GameObject|null} [description] + */ + getFirst: function (state, createIfNull, x, y, key, frame, visible) + { + if (state === undefined) { state = false; } + if (createIfNull === undefined) { createIfNull = false; } - // Capping in case of danger + var gameObject; - if (t1 < 0) + var children = this.children.entries; + + for (var i = 0; i < children.length; i++) { - t1 = 0; + gameObject = children[i]; + + if (gameObject.active === state) + { + if (typeof(x) === 'number') + { + gameObject.x = x; + } + + if (typeof(y) === 'number') + { + gameObject.y = y; + } + + return gameObject; + } } - if (t2 > 1) + // Got this far? We need to create or bail + if (createIfNull) { - t2 = 1; + return this.create(x, y, key, frame, visible); + } + else + { + return null; } - - this.getPoint(t1, this._tmpVec2A); - this.getPoint(t2, out); - - return out.subtract(this._tmpVec2A).normalize(); }, /** * [description] * - * @method Phaser.Curves.Curve#getTangentAt + * @method Phaser.GameObjects.Group#get * @since 3.0.0 * - * @param {float} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {boolean} visible - [description] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.GameObjects.GameObject} [description] */ - getTangentAt: function (u, out) + get: function (x, y, key, frame, visible) { - var t = this.getUtoTmapping(u); - - return this.getTangent(t, out); + return this.getFirst(false, true, x, y, key, frame, visible); }, - // Given a distance in pixels, get a t to find p. /** * [description] * - * @method Phaser.Curves.Curve#getTFromDistance + * @method Phaser.GameObjects.Group#getFirstAlive * @since 3.0.0 * - * @param {integer} distance - [description] - * @param {integer} [divisions] - [description] + * @param {boolean} createIfNull - [description] + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {boolean} visible - [description] * - * @return {float} [description] + * @return {Phaser.GameObjects.GameObject} [description] */ - getTFromDistance: function (distance, divisions) + getFirstAlive: function (createIfNull, x, y, key, frame, visible) { - if (distance <= 0) - { - return 0; - } - - return this.getUtoTmapping(0, distance, divisions); + return this.getFirst(true, createIfNull, x, y, key, frame, visible); }, - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - /** * [description] * - * @method Phaser.Curves.Curve#getUtoTmapping + * @method Phaser.GameObjects.Group#getFirstDead * @since 3.0.0 * - * @param {float} u - [description] - * @param {integer} distance - [description] - * @param {integer} [divisions] - [description] + * @param {boolean} createIfNull - [description] + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {boolean} visible - [description] * - * @return {number} [description] + * @return {Phaser.GameObjects.GameObject} [description] */ - getUtoTmapping: function (u, distance, divisions) + getFirstDead: function (createIfNull, x, y, key, frame, visible) { - var arcLengths = this.getLengths(divisions); + return this.getFirst(false, createIfNull, x, y, key, frame, visible); + }, - var i = 0; - var il = arcLengths.length; + /** + * [description] + * + * @method Phaser.GameObjects.Group#playAnimation + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {string} startFrame - [description] + * + * @return {Phaser.GameObjects.Group} This Group object. + */ + playAnimation: function (key, startFrame) + { + Actions.PlayAnimation(this.children.entries, key, startFrame); - var targetArcLength; // The targeted u distance value to get + return this; + }, - if (distance) + /** + * [description] + * + * @method Phaser.GameObjects.Group#isFull + * @since 3.0.0 + * + * @return {boolean} [description] + */ + isFull: function () + { + if (this.maxSize === -1) { - // Cannot overshoot the curve - targetArcLength = Math.min(distance, arcLengths[il - 1]); + return false; } else { - targetArcLength = u * arcLengths[il - 1]; + return (this.children.size === this.maxSize); } + }, - // binary search for the index with largest value smaller than target u distance + /** + * [description] + * + * @method Phaser.GameObjects.Group#countActive + * @since 3.0.0 + * + * @param {boolean} [value=true] - [description] + * + * @return {integer} [description] + */ + countActive: function (value) + { + if (value === undefined) { value = true; } - var low = 0; - var high = il - 1; - var comparison; + var total = 0; - while (low <= high) + for (var i = 0; i < this.children.size; i++) { - i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[i] - targetArcLength; - - if (comparison < 0) - { - low = i + 1; - } - else if (comparison > 0) - { - high = i - 1; - } - else + if (this.children.entries[i].active === value) { - high = i; - break; + total++; } } - i = high; + return total; + }, - if (arcLengths[i] === targetArcLength) - { - return i / (il - 1); - } + /** + * [description] + * + * @method Phaser.GameObjects.Group#getTotalUsed + * @since 3.0.0 + * + * @return {integer} [description] + */ + getTotalUsed: function () + { + return this.countActive(); + }, - // we could get finer grain at lengths, or use simple interpolation between two points + /** + * [description] + * + * @method Phaser.GameObjects.Group#getTotalFree + * @since 3.0.0 + * + * @return {integer} [description] + */ + getTotalFree: function () + { + var used = this.getTotalUsed(); + var capacity = (this.maxSize === -1) ? 999999999999 : this.maxSize; - var lengthBefore = arcLengths[i]; - var lengthAfter = arcLengths[i + 1]; + return (capacity - used); + }, - var segmentLength = lengthAfter - lengthBefore; + /** + * [description] + * + * @method Phaser.GameObjects.Group#setDepth + * @since 3.0.0 + * + * @param {number} value - [description] + * @param {number} step - [description] + * + * @return {Phaser.GameObjects.Group} This Group object. + */ + setDepth: function (value, step) + { + Actions.SetDepth(this.children.entries, value, step); - // determine where we are between the 'before' and 'after' points + return this; + }, - var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; + /** + * [description] + * + * @method Phaser.GameObjects.Group#kill + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + */ + kill: function (gameObject) + { + if (this.children.contains(gameObject)) + { + gameObject.setActive(false); + } + }, - // add that fractional amount to t + /** + * [description] + * + * @method Phaser.GameObjects.Group#killAndHide + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + */ + killAndHide: function (gameObject) + { + if (this.children.contains(gameObject)) + { + gameObject.setActive(false); + gameObject.setVisible(false); + } + }, - return (i + segmentFraction) / (il - 1); + /** + * [description] + * + * @method Phaser.GameObjects.Group#toggleVisible + * @since 3.0.0 + * + * @return {Phaser.GameObjects.Group} This Group object. + */ + toggleVisible: function () + { + Actions.ToggleVisible(this.children.entries); + + return this; }, /** * [description] * - * @method Phaser.Curves.Curve#updateArcLengths + * @method Phaser.GameObjects.Group#destroy * @since 3.0.0 */ - updateArcLengths: function () + destroy: function () { - this.needsUpdate = true; + this.children.clear(); - this.getLengths(); + this.scene = undefined; + this.children = undefined; } }); -module.exports = Curve; +module.exports = Group; /***/ }), -/* 67 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {/** +/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(1); +var ImageRender = __webpack_require__(571); + /** - * Determines the operating system of the device running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.os` from within any Scene. + * @classdesc + * An Image Game Object. * - * @name Phaser.Device.OS + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * + * @class Image + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects + * @constructor * @since 3.0.0 * - * @type {object} - * @property {boolean} android - Is running on android? - * @property {boolean} chromeOS - Is running on chromeOS? - * @property {boolean} cocoonJS - Is the game running under CocoonJS? - * @property {boolean} cocoonJSApp - Is this game running with CocoonJS.App? - * @property {boolean} cordova - Is the game running under Apache Cordova? - * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? - * @property {boolean} desktop - Is running on a desktop? - * @property {boolean} ejecta - Is the game running under Ejecta? - * @property {boolean} electron - Is the game running under GitHub Electron? - * @property {boolean} iOS - Is running on iOS? - * @property {boolean} iPad - Is running on iPad? - * @property {boolean} iPhone - Is running on iPhone? - * @property {boolean} kindle - Is running on an Amazon Kindle? - * @property {boolean} linux - Is running on linux? - * @property {boolean} macOS - Is running on macOS? - * @property {boolean} node - Is the game running under Node.js? - * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? - * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView - * @property {boolean} windows - Is running on windows? - * @property {boolean} windowsPhone - Is running on a Windows Phone? - * @property {number} iOSVersion - If running in iOS this will contain the major version number. - * @property {number} pixelRatio - PixelRatio of the host device? + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var OS = { +var Image = new Class({ - android: false, - chromeOS: false, - cocoonJS: false, - cocoonJSApp: false, - cordova: false, - crosswalk: false, - desktop: false, - ejecta: false, - electron: false, - iOS: false, - iOSVersion: 0, - iPad: false, - iPhone: false, - kindle: false, - linux: false, - macOS: false, - node: false, - nodeWebkit: false, - pixelRatio: 1, - webApp: false, - windows: false, - windowsPhone: false + Extends: GameObject, -}; + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Origin, + Components.Pipeline, + Components.ScaleMode, + Components.ScrollFactor, + Components.Size, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + ImageRender + ], -function init () -{ - var ua = navigator.userAgent; + initialize: - if (/Windows/.test(ua)) - { - OS.windows = true; - } - else if (/Mac OS/.test(ua)) - { - OS.macOS = true; - } - else if (/Linux/.test(ua)) - { - OS.linux = true; - } - else if (/Android/.test(ua)) - { - OS.android = true; - } - else if (/iP[ao]d|iPhone/i.test(ua)) - { - OS.iOS = true; - (navigator.appVersion).match(/OS (\d+)/); - OS.iOSVersion = parseInt(RegExp.$1, 10); - } - else if (/Kindle/.test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) + function Image (scene, x, y, texture, frame) { - OS.kindle = true; + GameObject.call(this, scene, 'Image'); - // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... - // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" - } - else if (/CrOS/.test(ua)) - { - OS.chromeOS = true; + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOriginFromFrame(); + this.initPipeline('TextureTintPipeline'); } - if (/Windows Phone/i.test(ua) || (/IEMobile/i).test(ua)) - { - OS.android = false; - OS.iOS = false; - OS.macOS = false; - OS.windows = true; - OS.windowsPhone = true; - } +}); - var silk = (/Silk/).test(ua); +module.exports = Image; - if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) - { - OS.desktop = true; - } - // Windows Phone / Table reset - if (OS.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua)))) - { - OS.desktop = false; - } +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { - // WebApp mode in iOS - if (navigator.standalone) - { - OS.webApp = true; - } - - if (window.cordova !== undefined) - { - OS.cordova = true; - } - - if ((typeof process !== 'undefined') && (typeof process.versions.node !== 'undefined')) - { - OS.node = true; - } - - if (OS.node && typeof process.versions === 'object') - { - OS.nodeWebkit = !!process.versions['node-webkit']; - - OS.electron = !!process.versions.electron; - } - - if (navigator.isCocoonJS) - { - OS.cocoonJS = true; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - try +var EaseMap = __webpack_require__(579); + +/** + * [description] + * + * @function Phaser.Tweens.Builders.GetEaseFunction + * @since 3.0.0 + * + * @param {string|function} ease - [description] + * @param {array} easeParams - [description] + * + * @return {function} [description] + */ +var GetEaseFunction = function (ease, easeParams) +{ + if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) + { + if (easeParams) { - OS.cocoonJSApp = (typeof CocoonJS !== 'undefined'); + var cloneParams = easeParams.slice(0); + + cloneParams.unshift(0); + + return function (v) + { + cloneParams[0] = v; + + return EaseMap[ease].apply(this, cloneParams); + }; } - catch (error) + else { - OS.cocoonJSApp = false; + // String based look-up + return EaseMap[ease]; } } - - if (window.ejecta !== undefined) + else if (typeof ease === 'function') { - OS.ejecta = true; + // Custom function + return ease; } - - if ((/Crosswalk/).test(ua)) + else if (Array.isArray(ease) && ease.length === 4) { - OS.crosswalk = true; + // Bezier function (TODO) } - OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; - OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; + return EaseMap.Power0; +}; - OS.pixelRatio = window['devicePixelRatio'] || 1; +module.exports = GetEaseFunction; - return OS; -} -module.exports = init(); +/***/ }), +/* 72 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Utils.Object.HasValue + * @since 3.0.0 + * + * @param {object} source - [description] + * @param {string} key - [description] + * + * @return {boolean} [description] + */ +var HasValue = function (source, key) +{ + return (source.hasOwnProperty(key)); +}; + +module.exports = HasValue; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(496))) /***/ }), -/* 68 */ +/* 73 */ /***/ (function(module, exports) { /** @@ -10239,39 +11310,68 @@ module.exports = init(); */ /** - * Check to see if the Ellipse contains the given x / y coordinates. + * [description] * - * @function Phaser.Geom.Ellipse.Contains + * @function Phaser.Tweens.Builders.GetBoolean * @since 3.0.0 * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. - * @param {number} x - The x coordinate to check within the ellipse. - * @param {number} y - The y coordinate to check within the ellipse. + * @param {object} source - [description] + * @param {string} key - [description] + * @param {any} defaultValue - [description] * - * @return {boolean} True if the coordinates are within the ellipse, otherwise false. + * @return {any} [description] */ -var Contains = function (ellipse, x, y) +var GetBoolean = function (source, key, defaultValue) { - if (ellipse.width <= 0 || ellipse.height <= 0) + if (!source) { - return false; + return defaultValue; + } + else if (source.hasOwnProperty(key)) + { + return source[key]; + } + else + { + return defaultValue; } +}; - // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5 - var normx = ((x - ellipse.x) / ellipse.width); - var normy = ((y - ellipse.y) / ellipse.height); +module.exports = GetBoolean; - normx *= normx; - normy *= normy; - return (normx + normy < 0.25); +/***/ }), +/* 74 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Checks if the given tile coordinates are within the bounds of the layer. + * + * @function Phaser.Tilemaps.Components.IsInLayerBounds + * @since 3.0.0 + * + * @param {integer} tileX - [description] + * @param {integer} tileY - [description] + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {boolean} + */ +var IsInLayerBounds = function (tileX, tileY, layer) +{ + return (tileX >= 0 && tileX < layer.width && tileY >= 0 && tileY < layer.height); }; -module.exports = Contains; +module.exports = IsInLayerBounds; /***/ }), -/* 69 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10280,810 +11380,1089 @@ module.exports = Contains; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Actions = __webpack_require__(168); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(4); -var Range = __webpack_require__(274); -var Set = __webpack_require__(61); -var Sprite = __webpack_require__(37); /** * @classdesc - * [description] - * - * children can be either an array of children, or a config object - * config can be either a config object, or undefined if passed as the children argument instead + * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, + * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference + * to this data and use it to look up and perform operations on tiles. * - * @class Group - * @memberOf Phaser.GameObjects + * @class LayerData + * @memberOf Phaser.Tilemaps * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {array} children - [description] - * @param {object} config - [description] + * @param {object} [config] - [description] */ -var Group = new Class({ +var LayerData = new Class({ initialize: - function Group (scene, children, config) + function LayerData (config) { - if (config === undefined && !Array.isArray(children) && typeof children === 'object') - { - config = children; - children = null; - } + if (config === undefined) { config = {}; } /** * [description] - * - * @name Phaser.GameObjects.Group#scene - * @type {Phaser.Scene} + * + * @name Phaser.Tilemaps.LayerData#name + * @type {string} * @since 3.0.0 */ - this.scene = scene; + this.name = GetFastValue(config, 'name', 'layer'); /** * [description] - * - * @name Phaser.GameObjects.Group#children - * @type {Phaser.Structs.Set} + * + * @name Phaser.Tilemaps.LayerData#x + * @type {number} * @since 3.0.0 */ - this.children = new Set(children); + this.x = GetFastValue(config, 'x', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#isParent - * @type {boolean} - * @default true + * + * @name Phaser.Tilemaps.LayerData#y + * @type {number} * @since 3.0.0 */ - this.isParent = true; + this.y = GetFastValue(config, 'y', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#classType - * @type {object} + * + * @name Phaser.Tilemaps.LayerData#width + * @type {number} * @since 3.0.0 */ - this.classType = GetFastValue(config, 'classType', Sprite); + this.width = GetFastValue(config, 'width', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#active - * @type {boolean} + * + * @name Phaser.Tilemaps.LayerData#height + * @type {number} * @since 3.0.0 */ - this.active = GetFastValue(config, 'active', true); + this.height = GetFastValue(config, 'height', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#maxSize - * @type {integer} + * + * @name Phaser.Tilemaps.LayerData#tileWidth + * @type {number} * @since 3.0.0 */ - this.maxSize = GetFastValue(config, 'maxSize', -1); + this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#defaultKey - * @type {string} + * + * @name Phaser.Tilemaps.LayerData#tileHeight + * @type {number} * @since 3.0.0 */ - this.defaultKey = GetFastValue(config, 'defaultKey', null); + this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** * [description] - * - * @name Phaser.GameObjects.Group#defaultFrame - * @type {string|integer} + * + * @name Phaser.Tilemaps.LayerData#baseTileWidth + * @type {number} * @since 3.0.0 */ - this.defaultFrame = GetFastValue(config, 'defaultFrame', null); + this.baseTileWidth = GetFastValue(config, 'baseTileWidth', this.tileWidth); /** * [description] - * - * @name Phaser.GameObjects.Group#runChildUpdate - * @type {boolean} - * @default false + * + * @name Phaser.Tilemaps.LayerData#baseTileHeight + * @type {number} * @since 3.0.0 */ - this.runChildUpdate = GetFastValue(config, 'runChildUpdate', false); + this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); /** * [description] - * - * @name Phaser.GameObjects.Group#createCallback - * @type {?function} + * + * @name Phaser.Tilemaps.LayerData#widthInPixels + * @type {number} * @since 3.0.0 */ - this.createCallback = GetFastValue(config, 'createCallback', null); + this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); /** * [description] - * - * @name Phaser.GameObjects.Group#removeCallback - * @type {?function} + * + * @name Phaser.Tilemaps.LayerData#heightInPixels + * @type {number} * @since 3.0.0 */ - this.removeCallback = GetFastValue(config, 'removeCallback', null); + this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.baseTileHeight); /** * [description] - * - * @name Phaser.GameObjects.Group#createMultipleCallback - * @type {?function} + * + * @name Phaser.Tilemaps.LayerData#alpha + * @type {float} * @since 3.0.0 */ - this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); - - if (config) - { - this.createMultiple(config); - } - }, + this.alpha = GetFastValue(config, 'alpha', 1); - /** - * [description] - * - * @method Phaser.GameObjects.Group#create - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {boolean} [visible=true] - [description] - * - * @return {Phaser.GameObjects.GameObject} [description] - */ - create: function (x, y, key, frame, visible) - { - if (key === undefined) { key = this.defaultKey; } - if (frame === undefined) { frame = this.defaultFrame; } - if (visible === undefined) { visible = true; } + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#visible + * @type {boolean} + * @since 3.0.0 + */ + this.visible = GetFastValue(config, 'visible', true); - // Pool? - if (this.isFull()) - { - return null; - } + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = GetFastValue(config, 'properties', {}); - var child = new this.classType(this.scene, x, y, key, frame); + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#indexes + * @type {array} + * @since 3.0.0 + */ + this.indexes = GetFastValue(config, 'indexes', []); - this.scene.sys.displayList.add(child); + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#collideIndexes + * @type {array} + * @since 3.0.0 + */ + this.collideIndexes = GetFastValue(config, 'collideIndexes', []); - if (child.preUpdate) - { - this.scene.sys.updateList.add(child); - } + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#callbacks + * @type {array} + * @since 3.0.0 + */ + this.callbacks = GetFastValue(config, 'callbacks', []); - child.visible = visible; + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#bodies + * @type {array} + * @since 3.0.0 + */ + this.bodies = GetFastValue(config, 'bodies', []); - this.add(child); + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#data + * @type {array} + * @since 3.0.0 + */ + this.data = GetFastValue(config, 'data', []); - return child; - }, + /** + * [description] + * + * @name Phaser.Tilemaps.LayerData#tilemapLayer + * @type {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} + * @since 3.0.0 + */ + this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); + } - /** - * [description] - * - * @method Phaser.GameObjects.Group#createMultiple - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.GameObjects.GameObject[]} [description] - */ - createMultiple: function (config) - { - if (!Array.isArray(config)) - { - config = [ config ]; - } +}); - var output = []; +module.exports = LayerData; - for (var i = 0; i < config.length; i++) - { - var entries = this.createFromConfig(config[i]); - output = output.concat(entries); - } +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { - return output; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.GameObjects.Group#createFromConfig - * @since 3.0.0 - * - * @param {object} options - [description] - * - * @return {Phaser.GameObjects.GameObject[]} [description] - */ - createFromConfig: function (options) +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); + +/** + * @classdesc + * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this + * format. A Tilemap object get a copy of this data and then unpacks the needed properties into + * itself. + * + * @class MapData + * @memberOf Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {object} [config] - [description] + */ +var MapData = new Class({ + + initialize: + + function MapData (config) { - this.classType = GetFastValue(options, 'classType', this.classType); + if (config === undefined) { config = {}; } - var key = GetFastValue(options, 'key', undefined); - var frame = GetFastValue(options, 'frame', null); - var visible = GetFastValue(options, 'visible', true); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'map'); - var entries = []; + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#width + * @type {number} + * @since 3.0.0 + */ + this.width = GetFastValue(config, 'width', 0); - // Can't do anything without at least a key - if (key === undefined) - { - return entries; - } - else - { - if (!Array.isArray(key)) - { - key = [ key ]; - } + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#height + * @type {number} + * @since 3.0.0 + */ + this.height = GetFastValue(config, 'height', 0); - if (!Array.isArray(frame)) - { - frame = [ frame ]; - } - } + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#tileWidth + * @type {number} + * @since 3.0.0 + */ + this.tileWidth = GetFastValue(config, 'tileWidth', 0); - // Build an array of key frame pairs to loop through + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#tileHeight + * @type {number} + * @since 3.0.0 + */ + this.tileHeight = GetFastValue(config, 'tileHeight', 0); - var repeat = GetFastValue(options, 'repeat', 0); - var randomKey = GetFastValue(options, 'randomKey', false); - var randomFrame = GetFastValue(options, 'randomFrame', false); - var yoyo = GetFastValue(options, 'yoyo', false); - var quantity = GetFastValue(options, 'frameQuantity', 1); - var max = GetFastValue(options, 'max', 0); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#widthInPixels + * @type {number} + * @since 3.0.0 + */ + this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); - // If a grid is set we use that to override the quantity? + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#heightInPixels + * @type {number} + * @since 3.0.0 + */ + this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.tileHeight); - var range = Range(key, frame, { - max: max, - qty: quantity, - random: randomKey, - randomB: randomFrame, - repeat: repeat, - yoyo: yoyo - }); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#format + * @type {integer} + * @since 3.0.0 + */ + this.format = GetFastValue(config, 'format', null); - for (var c = 0; c < range.length; c++) - { - entries.push(this.create(0, 0, range[c].a, range[c].b, visible)); - } + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#orientation + * @type {string} + * @since 3.0.0 + */ + this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); - // Post-creation options (applied only to those items created in this call): + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#version + * @type {string} + * @since 3.0.0 + */ + this.version = GetFastValue(config, 'version', '1'); - var x = GetValue(options, 'setXY.x', 0); - var y = GetValue(options, 'setXY.y', 0); - var stepX = GetValue(options, 'setXY.stepX', 0); - var stepY = GetValue(options, 'setXY.stepY', 0); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = GetFastValue(config, 'properties', {}); - Actions.SetXY(entries, x, y, stepX, stepY); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#layers + * @type {array} + * @since 3.0.0 + */ + this.layers = GetFastValue(config, 'layers', []); - var rotation = GetValue(options, 'setRotation.value', 0); - var stepRotation = GetValue(options, 'setRotation.step', 0); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#images + * @type {array} + * @since 3.0.0 + */ + this.images = GetFastValue(config, 'images', []); - Actions.SetRotation(entries, rotation, stepRotation); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#objects + * @type {object} + * @since 3.0.0 + */ + this.objects = GetFastValue(config, 'objects', {}); - var scaleX = GetValue(options, 'setScale.x', 1); - var scaleY = GetValue(options, 'setScale.y', scaleX); - var stepScaleX = GetValue(options, 'setScale.stepX', 0); - var stepScaleY = GetValue(options, 'setScale.stepY', 0); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#collision + * @type {object} + * @since 3.0.0 + */ + this.collision = GetFastValue(config, 'collision', {}); - Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#tilesets + * @type {array} + * @since 3.0.0 + */ + this.tilesets = GetFastValue(config, 'tilesets', []); - var alpha = GetValue(options, 'setAlpha.value', 1); - var stepAlpha = GetValue(options, 'setAlpha.step', 0); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#imageCollections + * @type {array} + * @since 3.0.0 + */ + this.imageCollections = GetFastValue(config, 'imageCollections', []); - Actions.SetAlpha(entries, alpha, stepAlpha); + /** + * [description] + * + * @name Phaser.Tilemaps.MapData#tiles + * @type {array} + * @since 3.0.0 + */ + this.tiles = GetFastValue(config, 'tiles', []); + } - var hitArea = GetFastValue(options, 'hitArea', null); - var hitAreaCallback = GetFastValue(options, 'hitAreaCallback', null); +}); - if (hitArea) - { - Actions.SetHitArea(entries, hitArea, hitAreaCallback); - } +module.exports = MapData; - var grid = GetFastValue(options, 'gridAlign', false); - if (grid) - { - Actions.GridAlign(entries, grid); - } +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.createMultipleCallback) - { - this.createMultipleCallback.call(this, entries); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return entries; - }, +var BlendModes = __webpack_require__(45); +var Circle = __webpack_require__(64); +var CircleContains = __webpack_require__(32); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(1); +var Rectangle = __webpack_require__(8); +var RectangleContains = __webpack_require__(33); - /** - * [description] - * - * @method Phaser.GameObjects.Group#preUpdate - * @since 3.0.0 - * - * @param {number} time - [description] - * @param {number} delta - [description] - */ - preUpdate: function (time, delta) +/** + * @classdesc + * A Zone Game Object. + * + * A Zone is a non-rendering rectangular Game Object that has a position and size. + * It has no texture and never displays, but does live on the display list and + * can be moved, scaled and rotated like any other Game Object. + * + * Its primary use is for creating Drop Zones and Input Hit Areas and it has a couple of helper methods + * specifically for this. It is also useful for object overlap checks, or as a base for your own + * non-displaying Game Objects. + + * The default origin is 0.5, the center of the Zone, the same as with Game Objects. + * + * @class Zone + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - [description] + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} [width=1] - The width of the Game Object. + * @param {number} [height=1] - The height of the Game Object. + */ +var Zone = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Depth, + Components.GetBounds, + Components.Origin, + Components.ScaleMode, + Components.Transform, + Components.ScrollFactor, + Components.Visible + ], + + initialize: + + function Zone (scene, x, y, width, height) { - if (!this.runChildUpdate || this.children.size === 0) - { - return; - } + if (width === undefined) { width = 1; } + if (height === undefined) { height = width; } - // Because a Group child may mess with the length of the Group during its update - var temp = this.children.entries.slice(); + GameObject.call(this, scene, 'Zone'); - for (var i = 0; i < temp.length; i++) - { - var item = temp[i]; + this.setPosition(x, y); - if (item.active) - { - item.update(time, delta); - } - } + /** + * The native (un-scaled) width of this Game Object. + * + * @name Phaser.GameObjects.Zone#width + * @type {number} + * @since 3.0.0 + */ + this.width = width; + + /** + * The native (un-scaled) height of this Game Object. + * + * @name Phaser.GameObjects.Zone#height + * @type {number} + * @since 3.0.0 + */ + this.height = height; + + /** + * The Blend Mode of the Game Object. + * Although a Zone never renders, it still has a blend mode to allow it to fit seamlessly into + * display lists without causing a batch flush. + * + * @name Phaser.GameObjects.Zone#blendMode + * @type {integer} + * @since 3.0.0 + */ + this.blendMode = BlendModes.NORMAL; }, /** - * [description] - * - * @method Phaser.GameObjects.Group#add + * The displayed width of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Zone#displayWidth + * @type {number} * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {boolean} [addToScene=false] - [description] - * - * @return {Phaser.GameObjects.Group} This Group object. */ - add: function (child, addToScene) - { - if (addToScene === undefined) { addToScene = false; } + displayWidth: { - this.children.set(child); + get: function () + { + return this.scaleX * this.width; + }, - if (this.createCallback) + set: function (value) { - this.createCallback.call(this, child); + this.scaleX = value / this.width; } - if (addToScene) - { - this.scene.sys.displayList.add(child); + }, - if (child.preUpdate) - { - this.scene.sys.updateList.add(child); - } + /** + * The displayed height of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Zone#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; } - return this; }, /** - * [description] + * Sets the size of this Game Object. * - * @method Phaser.GameObjects.Group#addMultiple + * @method Phaser.GameObjects.Zone#setSize * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject[]} children - [description] - * @param {boolean} [addToScene=false] - [description] + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * @param {boolean} [resizeInput=true] - If this Zone has a Rectangle for a hit area this argument will resize the hit area as well. * - * @return {Phaser.GameObjects.Group} This Group object. + * @return {Phaser.GameObjects.Zone} This Game Object. */ - addMultiple: function (children, addToScene) + setSize: function (width, height, resizeInput) { - if (addToScene === undefined) { addToScene = false; } + if (resizeInput === undefined) { resizeInput = true; } - if (Array.isArray(children)) + this.width = width; + this.height = height; + + if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) { - for (var i = 0; i < children.length; i++) - { - this.add(children[i], addToScene); - } + this.input.hitArea.width = width; + this.input.hitArea.height = height; } return this; }, /** - * [description] + * Sets the display size of this Game Object. + * Calling this will adjust the scale. * - * @method Phaser.GameObjects.Group#remove + * @method Phaser.GameObjects.Zone#setDisplaySize * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {boolean} [removeFromScene=false] - [description] + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. * - * @return {Phaser.GameObjects.Group} This Group object. + * @return {Phaser.GameObjects.Zone} This Game Object. */ - remove: function (child, removeFromScene) + setDisplaySize: function (width, height) { - if (removeFromScene === undefined) { removeFromScene = false; } - - this.children.delete(child); - - if (removeFromScene) - { - this.scene.sys.displayList.remove(child); - - if (child.preUpdate) - { - this.scene.sys.updateList.remove(child); - } - } + this.displayWidth = width; + this.displayHeight = height; return this; }, /** - * [description] + * Sets this Zone to be a Circular Drop Zone. + * The circle is centered on this Zones `x` and `y` coordinates. * - * @method Phaser.GameObjects.Group#clear + * @method Phaser.GameObjects.Zone#setCircleDropZone * @since 3.0.0 * - * @param {boolean} [removeFromScene=false] - [description] + * @param {number} radius - The radius of the Circle that will form the Drop Zone. * - * @return {Phaser.GameObjects.Group} This Group object. + * @return {Phaser.GameObjects.Zone} This Game Object. */ - clear: function (removeFromScene) + setCircleDropZone: function (radius) { - if (removeFromScene === undefined) { removeFromScene = false; } - - if (removeFromScene) - { - var children = this.children; - - for (var i = 0; i < children.length; i++) - { - var gameObject = children[i]; - - this.scene.sys.displayList.remove(gameObject); - - if (gameObject.preUpdate) - { - this.scene.sys.updateList.remove(gameObject); - } - } - } - - this.children.clear(); - - return this; + return this.setDropZone(new Circle(0, 0, radius), CircleContains); }, /** - * [description] + * Sets this Zone to be a Rectangle Drop Zone. + * The rectangle is centered on this Zones `x` and `y` coordinates. * - * @method Phaser.GameObjects.Group#contains + * @method Phaser.GameObjects.Zone#setRectangleDropZone * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {number} width - The width of the rectangle drop zone. + * @param {number} height - The height of the rectangle drop zone. * - * @return {boolean} [description] + * @return {Phaser.GameObjects.Zone} This Game Object. */ - contains: function (child) + setRectangleDropZone: function (width, height) { - return this.children.contains(child); + var x = -(width / 2); + var y = -(height / 2); + + return this.setDropZone(new Rectangle(x, y, width, height), RectangleContains); }, /** - * [description] + * Allows you to define your own Geometry shape to be used as a Drop Zone. * - * @method Phaser.GameObjects.Group#getChildren + * @method Phaser.GameObjects.Zone#setDropZone * @since 3.0.0 * - * @return {Phaser.GameObjects.GameObject[]} [description] + * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. + * @param {function} callback - A function that will return `true` if the given x/y coords it is sent are within the shape. + * + * @return {Phaser.GameObjects.Zone} This Game Object. */ - getChildren: function () + setDropZone: function (shape, callback) { - return this.children.entries; + if (shape === undefined) + { + this.setRectangleDropZone(this.width, this.height); + } + else + if (!this.input) + { + this.setInteractive(shape, callback, true); + } + + return this; }, /** - * [description] + * A Zone does not render. * - * @method Phaser.GameObjects.Group#getLength + * @method Phaser.GameObjects.Zone#renderCanvas + * @private * @since 3.0.0 - * - * @return {integer} [description] */ - getLength: function () + renderCanvas: function () { - return this.children.size; }, /** - * [description] + * A Zone does not render. * - * @method Phaser.GameObjects.Group#getFirst + * @method Phaser.GameObjects.Zone#renderWebGL + * @private * @since 3.0.0 - * - * @param {boolean} [state=false] - [description] - * @param {boolean} [createIfNull=false] - [description] - * @param {number} [x] - The horizontal position of this Game Object in the world. - * @param {number} [y] - The vertical position of this Game Object in the world. - * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {boolean} [visible] - [description] - * - * @return {Phaser.GameObjects.GameObject|null} [description] */ - getFirst: function (state, createIfNull, x, y, key, frame, visible) + renderWebGL: function () { - if (state === undefined) { state = false; } - if (createIfNull === undefined) { createIfNull = false; } + } - var gameObject; +}); - var children = this.children.entries; +module.exports = Zone; - for (var i = 0; i < children.length; i++) - { - gameObject = children[i]; - if (gameObject.active === state) - { - if (typeof(x) === 'number') - { - gameObject.x = x; - } +/***/ }), +/* 78 */ +/***/ (function(module, exports) { - if (typeof(y) === 'number') - { - gameObject.y = y; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return gameObject; - } - } +/** + * [description] + * + * @function Phaser.Geom.Rectangle.Perimeter + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - [description] + * + * @return {number} [description] + */ +var Perimeter = function (rect) +{ + return 2 * (rect.width + rect.height); +}; - // Got this far? We need to create or bail - if (createIfNull) - { - return this.create(x, y, key, frame, visible); - } - else +module.exports = Perimeter; + + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. + * + * @class DataManager + * @memberOf Phaser.Data + * @constructor + * @since 3.0.0 + * + * @param {any} parent - [description] + * @param {any} eventEmitter - [description] + */ +var DataManager = new Class({ + + initialize: + + function DataManager (parent, eventEmitter) + { + /** + * [description] + * + * @name Phaser.Data.DataManager#parent + * @type {any} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * [description] + * + * @name Phaser.Data.DataManager#events + * @type {EventEmitter} + * @since 3.0.0 + */ + this.events = eventEmitter; + + if (!eventEmitter) { - return null; + this.events = (parent.events) ? parent.events : parent; } + + /** + * [description] + * + * @name Phaser.Data.DataManager#list + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.list = {}; + + /** + * [description] + * + * @name Phaser.Data.DataManager#blockSet + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.blockSet = false; + + /** + * [description] + * + * @name Phaser.Data.DataManager#_frozen + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._frozen = false; + + this.events.once('destroy', this.destroy, this); }, /** - * [description] + * Retrieves the value for the given key, or undefined if it doesn't exist. * - * @method Phaser.GameObjects.Group#get + * @method Phaser.Data.DataManager#get * @since 3.0.0 * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {boolean} visible - [description] + * @param {string} key - [description] * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {any} [description] */ - get: function (x, y, key, frame, visible) + get: function (key) { - return this.getFirst(false, true, x, y, key, frame, visible); + return this.list[key]; }, /** * [description] * - * @method Phaser.GameObjects.Group#getFirstAlive + * @method Phaser.Data.DataManager#getAll * @since 3.0.0 * - * @param {boolean} createIfNull - [description] - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {boolean} visible - [description] - * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {object} [description] */ - getFirstAlive: function (createIfNull, x, y, key, frame, visible) + getAll: function () { - return this.getFirst(true, createIfNull, x, y, key, frame, visible); + var results = {}; + + for (var key in this.list) + { + results[key] = this.list[key]; + } + + return results; }, /** * [description] * - * @method Phaser.GameObjects.Group#getFirstDead + * @method Phaser.Data.DataManager#query * @since 3.0.0 * - * @param {boolean} createIfNull - [description] - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {boolean} visible - [description] + * @param {string} search - [description] * - * @return {Phaser.GameObjects.GameObject} [description] + * @return {object} [description] */ - getFirstDead: function (createIfNull, x, y, key, frame, visible) + query: function (search) { - return this.getFirst(false, createIfNull, x, y, key, frame, visible); + var results = {}; + + for (var key in this.list) + { + if (key.match(search)) + { + results[key] = this.list[key]; + } + } + + return results; }, /** * [description] * - * @method Phaser.GameObjects.Group#playAnimation + * @method Phaser.Data.DataManager#set * @since 3.0.0 * * @param {string} key - [description] - * @param {string} startFrame - [description] + * @param {any} data - [description] * - * @return {Phaser.GameObjects.Group} This Group object. + * @return {Phaser.Data.DataManager} This DataManager object. */ - playAnimation: function (key, startFrame) + set: function (key, data) { - Actions.PlayAnimation(this.children.entries, key, startFrame); + if (this._frozen) + { + return this; + } + + if (this.events.listenerCount('changedata') > 0) + { + this.blockSet = false; + + var _this = this; + + var resetFunction = function (value) + { + _this.blockSet = true; + _this.list[key] = value; + _this.events.emit('setdata', _this.parent, key, value); + }; + + this.events.emit('changedata', this.parent, key, data, resetFunction); + + // One of the listeners blocked this update from being set, so abort + if (this.blockSet) + { + return this; + } + } + + this.list[key] = data; + + this.events.emit('setdata', this.parent, key, data); return this; }, /** - * [description] + * Passes all data entries to the given callback. Stores the result of the callback. * - * @method Phaser.GameObjects.Group#isFull + * @method Phaser.Data.DataManager#each * @since 3.0.0 * - * @return {boolean} [description] + * @param {function} callback - The function to call. + * @param {object} [scope] - Value to use as `this` when executing callback. + * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data. + * + * @return {Phaser.Data.DataManager} This DataManager object. */ - isFull: function () + each: function (callback, scope) { - if (this.maxSize === -1) + var args = [ this.parent, null, undefined ]; + + for (var i = 1; i < arguments.length; i++) { - return false; + args.push(arguments[i]); } - else + + for (var key in this.list) { - return (this.children.size === this.maxSize); + args[1] = key; + args[2] = this.list[key]; + + callback.apply(scope, args); } + + return this; }, /** * [description] * - * @method Phaser.GameObjects.Group#countActive + * @method Phaser.Data.DataManager#merge * @since 3.0.0 * - * @param {boolean} [value=true] - [description] + * @param {object} data - [description] + * @param {boolean} overwrite - [description] * - * @return {integer} [description] + * @return {Phaser.Data.DataManager} This DataManager object. */ - countActive: function (value) + merge: function (data, overwrite) { - if (value === undefined) { value = true; } - - var total = 0; + if (overwrite === undefined) { overwrite = true; } - for (var i = 0; i < this.children.size; i++) + // Merge data from another component into this one + for (var key in data) { - if (this.children.entries[i].active === value) + if (overwrite || (!overwrite && !this.has(key))) { - total++; + this.list[key] = data; } } - return total; + return this; }, /** * [description] * - * @method Phaser.GameObjects.Group#getTotalUsed + * @method Phaser.Data.DataManager#remove * @since 3.0.0 * - * @return {integer} [description] + * @param {string} key - [description] + * + * @return {Phaser.Data.DataManager} This DataManager object. */ - getTotalUsed: function () + remove: function (key) { - return this.countActive(); + if (!this._frozen && this.has(key)) + { + var data = this.list[key]; + + delete this.list[key]; + + this.events.emit('removedata', this, key, data); + } + + return this; }, /** - * [description] + * Gets the data associated with the given 'key', deletes it from this Data store, then returns it. * - * @method Phaser.GameObjects.Group#getTotalFree + * @method Phaser.Data.DataManager#pop * @since 3.0.0 * - * @return {integer} [description] + * @param {string} key - [description] + * + * @return {any} [description] */ - getTotalFree: function () + pop: function (key) { - var used = this.getTotalUsed(); - var capacity = (this.maxSize === -1) ? 999999999999 : this.maxSize; + var data = undefined; - return (capacity - used); + if (!this._frozen && this.has(key)) + { + data = this.list[key]; + + delete this.list[key]; + + this.events.emit('removedata', this, key, data); + } + + return data; }, /** * [description] * - * @method Phaser.GameObjects.Group#setDepth + * @method Phaser.Data.DataManager#has * @since 3.0.0 * - * @param {number} value - [description] - * @param {number} step - [description] + * @param {string} key - [description] * - * @return {Phaser.GameObjects.Group} This Group object. + * @return {boolean} [description] */ - setDepth: function (value, step) + has: function (key) { - Actions.SetDepth(this.children.entries, value, step); - - return this; + return this.list.hasOwnProperty(key); }, /** * [description] * - * @method Phaser.GameObjects.Group#kill + * @method Phaser.Data.DataManager#setFreeze * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {boolean} value - [description] + * + * @return {Phaser.Data.DataManager} This DataManager object. */ - kill: function (gameObject) + setFreeze: function (value) { - if (this.children.contains(gameObject)) - { - gameObject.setActive(false); - } + this._frozen = value; + + return this; }, /** * [description] * - * @method Phaser.GameObjects.Group#killAndHide + * @method Phaser.Data.DataManager#reset * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * + * @return {Phaser.Data.DataManager} This DataManager object. */ - killAndHide: function (gameObject) + reset: function () { - if (this.children.contains(gameObject)) + for (var key in this.list) { - gameObject.setActive(false); - gameObject.setVisible(false); + delete this.list[key]; } - }, - /** - * [description] - * - * @method Phaser.GameObjects.Group#toggleVisible - * @since 3.0.0 - * - * @return {Phaser.GameObjects.Group} This Group object. - */ - toggleVisible: function () - { - Actions.ToggleVisible(this.children.entries); + this.blockSet = false; + this._frozen = false; return this; }, @@ -11091,177 +12470,74 @@ var Group = new Class({ /** * [description] * - * @method Phaser.GameObjects.Group#destroy + * @method Phaser.Data.DataManager#destroy * @since 3.0.0 */ destroy: function () { - this.children.clear(); - - this.scene = undefined; - this.children = undefined; - } - -}); - -module.exports = Group; - - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(1); -var ImageRender = __webpack_require__(569); - -/** - * @classdesc - * An Image Game Object. - * - * An Image is a light-weight Game Object useful for the display of static images in your game, - * such as logos, backgrounds, scenery or other non-animated elements. Images can have input - * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an - * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. - * - * @class Image - * @extends Phaser.GameObjects.GameObject - * @memberOf Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScaleMode - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Image = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Origin, - Components.Pipeline, - Components.ScaleMode, - Components.ScrollFactor, - Components.Size, - Components.Texture, - Components.Tint, - Components.Transform, - Components.Visible, - ImageRender - ], - - initialize: - - function Image (scene, x, y, texture, frame) - { - GameObject.call(this, scene, 'Image'); + this.reset(); - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOriginFromFrame(); - this.initPipeline('TextureTintPipeline'); - } + this.events.off('changedata'); + this.events.off('setdata'); + this.events.off('removedata'); -}); + this.parent = null; + }, -module.exports = Image; + /** + * Freeze this Data component, so no changes can be written to it. + * + * @name Phaser.Data.DataManager#freeze + * @type {boolean} + * @since 3.0.0 + */ + freeze: { + get: function () + { + return this._frozen; + }, -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this._frozen = (value) ? true : false; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -var EaseMap = __webpack_require__(577); + /** + * Return the total number of entries in this Data component. + * + * @name Phaser.Data.DataManager#count + * @type {integer} + * @since 3.0.0 + */ + count: { -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetEaseFunction - * @since 3.0.0 - * - * @param {string|function} ease - [description] - * @param {array} easeParams - [description] - * - * @return {function} [description] - */ -var GetEaseFunction = function (ease, easeParams) -{ - if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) - { - if (easeParams) + get: function () { - var cloneParams = easeParams.slice(0); - - cloneParams.unshift(0); + var i = 0; - return function (v) + for (var key in this.list) { - cloneParams[0] = v; + if (this.list[key] !== undefined) + { + i++; + } + } - return EaseMap[ease].apply(this, cloneParams); - }; - } - else - { - // String based look-up - return EaseMap[ease]; + return i; } - } - else if (typeof ease === 'function') - { - // Custom function - return ease; - } - else if (Array.isArray(ease) && ease.length === 4) - { - // Bezier function (TODO) + } - return EaseMap.Power0; -}; +}); -module.exports = GetEaseFunction; +module.exports = DataManager; /***/ }), -/* 72 */ +/* 80 */ /***/ (function(module, exports) { /** @@ -11271,97 +12547,35 @@ module.exports = GetEaseFunction; */ /** - * [description] - * - * @function Phaser.Utils.Object.HasValue - * @since 3.0.0 - * - * @param {object} source - [description] - * @param {string} key - [description] + * Shuffles the contents of the given array using the Fisher-Yates implementation. * - * @return {boolean} [description] - */ -var HasValue = function (source, key) -{ - return (source.hasOwnProperty(key)); -}; - -module.exports = HasValue; - - -/***/ }), -/* 73 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] + * The original array is modified directly and returned. * - * @function Phaser.Tweens.Builders.GetBoolean + * @function Phaser.Utils.Array.Shuffle * @since 3.0.0 * - * @param {object} source - [description] - * @param {string} key - [description] - * @param {any} defaultValue - [description] + * @param {array} array - The array to shuffle. This array is modified in place. * - * @return {any} [description] + * @return {array} The shuffled array. */ -var GetBoolean = function (source, key, defaultValue) +var Shuffle = function (array) { - if (!source) - { - return defaultValue; - } - else if (source.hasOwnProperty(key)) - { - return source[key]; - } - else + for (var i = array.length - 1; i > 0; i--) { - return defaultValue; + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; } -}; - -module.exports = GetBoolean; - - -/***/ }), -/* 74 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ -/** - * Checks if the given tile coordinates are within the bounds of the layer. - * - * @function Phaser.Tilemaps.Components.IsInLayerBounds - * @since 3.0.0 - * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {boolean} - */ -var IsInLayerBounds = function (tileX, tileY, layer) -{ - return (tileX >= 0 && tileX < layer.width && tileY >= 0 && tileY < layer.height); + return array; }; -module.exports = IsInLayerBounds; +module.exports = Shuffle; /***/ }), -/* 75 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11371,217 +12585,263 @@ module.exports = IsInLayerBounds; */ var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); +var GameObject = __webpack_require__(1); +var Sprite = __webpack_require__(37); +var Vector2 = __webpack_require__(6); +var Vector4 = __webpack_require__(120); /** * @classdesc - * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, - * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference - * to this data and use it to look up and perform operations on tiles. + * A Sprite 3D Game Object. * - * @class LayerData - * @memberOf Phaser.Tilemaps + * The Sprite 3D object is an encapsulation of a standard Sprite object, with additional methods to allow + * it to be rendered by a 3D Camera. The Sprite can be positioned anywhere within 3D space. + * + * @class Sprite3D + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects * @constructor * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The x position of this Game Object. + * @param {number} y - The y position of this Game Object. + * @param {number} z - The z position of this Game Object. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var LayerData = new Class({ +var Sprite3D = new Class({ + + Extends: GameObject, initialize: - function LayerData (config) + function Sprite3D (scene, x, y, z, texture, frame) { - if (config === undefined) { config = {}; } - - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'layer'); + GameObject.call(this, scene, 'Sprite3D'); /** * [description] - * - * @name Phaser.Tilemaps.LayerData#x - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#gameObject + * @type {Phaser.GameObjects.GameObject} * @since 3.0.0 */ - this.x = GetFastValue(config, 'x', 0); + this.gameObject = new Sprite(scene, 0, 0, texture, frame); /** * [description] - * - * @name Phaser.Tilemaps.LayerData#y - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#position + * @type {Phaser.Math.Vector4} * @since 3.0.0 */ - this.y = GetFastValue(config, 'y', 0); + this.position = new Vector4(x, y, z); /** * [description] - * - * @name Phaser.Tilemaps.LayerData#width - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#size + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.width = GetFastValue(config, 'width', 0); + this.size = new Vector2(this.gameObject.width, this.gameObject.height); /** * [description] - * - * @name Phaser.Tilemaps.LayerData#height - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#scale + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.height = GetFastValue(config, 'height', 0); + this.scale = new Vector2(1, 1); /** * [description] - * - * @name Phaser.Tilemaps.LayerData#tileWidth - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#adjustScaleX + * @type {boolean} + * @default true * @since 3.0.0 */ - this.tileWidth = GetFastValue(config, 'tileWidth', 0); + this.adjustScaleX = true; /** * [description] - * - * @name Phaser.Tilemaps.LayerData#tileHeight - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#adjustScaleY + * @type {boolean} + * @default true * @since 3.0.0 */ - this.tileHeight = GetFastValue(config, 'tileHeight', 0); + this.adjustScaleY = true; /** * [description] - * - * @name Phaser.Tilemaps.LayerData#baseTileWidth - * @type {number} + * + * @name Phaser.GameObjects.Sprite3D#_visible + * @type {boolean} + * @default true + * @private * @since 3.0.0 */ - this.baseTileWidth = GetFastValue(config, 'baseTileWidth', this.tileWidth); + this._visible = true; + }, - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#baseTileHeight - * @type {number} - * @since 3.0.0 - */ - this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); + /** + * [description] + * + * @method Phaser.GameObjects.Sprite3D#project + * @since 3.0.0 + * + * @param {Phaser.Cameras.Sprite3D.Camera} camera - The 3D Camera onto which to project this Sprite. + */ + project: function (camera) + { + var pos = this.position; - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#widthInPixels - * @type {number} - * @since 3.0.0 - */ - this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); + var gameObject = this.gameObject; - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#heightInPixels - * @type {number} - * @since 3.0.0 - */ - this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.baseTileHeight); + camera.project(pos, gameObject); - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#alpha - * @type {float} - * @since 3.0.0 - */ - this.alpha = GetFastValue(config, 'alpha', 1); + camera.getPointSize(pos, this.size, this.scale); - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#visible - * @type {boolean} - * @since 3.0.0 - */ - this.visible = GetFastValue(config, 'visible', true); + if (this.scale.x <= 0 || this.scale.y <= 0) + { + gameObject.setVisible(false); + } + else + { + if (!gameObject.visible) + { + gameObject.setVisible(true); + } - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = GetFastValue(config, 'properties', {}); + if (this.adjustScaleX) + { + gameObject.scaleX = this.scale.x; + } - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#indexes - * @type {array} - * @since 3.0.0 - */ - this.indexes = GetFastValue(config, 'indexes', []); + if (this.adjustScaleY) + { + gameObject.scaleY = this.scale.y; + } - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#collideIndexes - * @type {array} - * @since 3.0.0 - */ - this.collideIndexes = GetFastValue(config, 'collideIndexes', []); + gameObject.setDepth(gameObject.z * -1); + } + }, - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#callbacks - * @type {array} - * @since 3.0.0 - */ - this.callbacks = GetFastValue(config, 'callbacks', []); + /** + * [description] + * + * @method Phaser.GameObjects.Sprite3D#setVisible + * @since 3.0.0 + * + * @param {boolean} value - [description] + * + * @return {Phaser.GameObjects.Sprite3D} This Sprite3D Object. + */ + setVisible: function (value) + { + this.visible = value; - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#bodies - * @type {array} - * @since 3.0.0 - */ - this.bodies = GetFastValue(config, 'bodies', []); + return this; + }, - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#data - * @type {array} - * @since 3.0.0 - */ - this.data = GetFastValue(config, 'data', []); + /** + * The visible state of the Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @name Phaser.GameObjects.Sprite3D#visible + * @type {boolean} + * @since 3.0.0 + */ + visible: { + + get: function () + { + return this._visible; + }, + + set: function (value) + { + this._visible = value; + this.gameObject.visible = value; + } + + }, + + /** + * The x position of this Game Object. + * + * @name Phaser.GameObjects.Sprite3D#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this.position.x; + }, + + set: function (value) + { + this.position.x = value; + } + + }, + + /** + * The y position of this Game Object. + * + * @name Phaser.GameObjects.Sprite3D#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this.position.y; + }, + + set: function (value) + { + this.position.y = value; + } + + }, + + /** + * The z position of this Game Object. + * + * @name Phaser.GameObjects.Sprite3D#z + * @type {number} + * @since 3.0.0 + */ + z: { + + get: function () + { + return this.position.z; + }, + + set: function (value) + { + this.position.z = value; + } - /** - * [description] - * - * @name Phaser.Tilemaps.LayerData#tilemapLayer - * @type {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} - * @since 3.0.0 - */ - this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); } }); -module.exports = LayerData; +module.exports = Sprite3D; /***/ }), -/* 76 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11590,521 +12850,777 @@ module.exports = LayerData; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var OS = __webpack_require__(67); + +/** + * Determines the browser type and version running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.browser` from within any Scene. + * + * @name Phaser.Device.Browser + * @since 3.0.0 + * + * @type {object} + * @property {boolean} chrome - Set to true if running in Chrome. + * @property {boolean} edge - Set to true if running in Microsoft Edge browser. + * @property {boolean} firefox - Set to true if running in Firefox. + * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge). + * @property {boolean} mobileSafari - Set to true if running in Mobile Safari. + * @property {boolean} opera - Set to true if running in Opera. + * @property {boolean} safari - Set to true if running in Safari. + * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle) + * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+) + * @property {number} chromeVersion - If running in Chrome this will contain the major version number. + * @property {number} firefoxVersion - If running in Firefox this will contain the major version number. + * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion. + * @property {number} safariVersion - If running in Safari this will contain the major version number. + * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx} + */ +var Browser = { + + chrome: false, + chromeVersion: 0, + edge: false, + firefox: false, + firefoxVersion: 0, + ie: false, + ieVersion: 0, + mobileSafari: false, + opera: false, + safari: false, + safariVersion: 0, + silk: false, + trident: false, + tridentVersion: 0 + +}; + +function init () +{ + var ua = navigator.userAgent; + + if (/Edge\/\d+/.test(ua)) + { + Browser.edge = true; + } + else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone) + { + Browser.chrome = true; + Browser.chromeVersion = parseInt(RegExp.$1, 10); + } + else if ((/Firefox\D+(\d+)/).test(ua)) + { + Browser.firefox = true; + Browser.firefoxVersion = parseInt(RegExp.$1, 10); + } + else if ((/AppleWebKit/).test(ua) && OS.iOS) + { + Browser.mobileSafari = true; + } + else if ((/MSIE (\d+\.\d+);/).test(ua)) + { + Browser.ie = true; + Browser.ieVersion = parseInt(RegExp.$1, 10); + } + else if ((/Opera/).test(ua)) + { + Browser.opera = true; + } + else if ((/Safari/).test(ua) && !OS.windowsPhone) + { + Browser.safari = true; + } + else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua)) + { + Browser.ie = true; + Browser.trident = true; + Browser.tridentVersion = parseInt(RegExp.$1, 10); + Browser.ieVersion = parseInt(RegExp.$3, 10); + } + + // Silk gets its own if clause because its ua also contains 'Safari' + if ((/Silk/).test(ua)) + { + Browser.silk = true; + } + + return Browser; +} + +module.exports = init(); + + +/***/ }), +/* 83 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + + +module.exports = { + + /** + * Scene state. + * + * @name Phaser.Scenes.PENDING + * @type {integer} + * @since 3.0.0 + */ + PENDING: 0, + + /** + * Scene state. + * + * @name Phaser.Scenes.INIT + * @type {integer} + * @since 3.0.0 + */ + INIT: 1, + + /** + * Scene state. + * + * @name Phaser.Scenes.START + * @type {integer} + * @since 3.0.0 + */ + START: 2, + + /** + * Scene state. + * + * @name Phaser.Scenes.LOADING + * @type {integer} + * @since 3.0.0 + */ + LOADING: 3, + + /** + * Scene state. + * + * @name Phaser.Scenes.CREATING + * @type {integer} + * @since 3.0.0 + */ + CREATING: 4, + + /** + * Scene state. + * + * @name Phaser.Scenes.RUNNING + * @type {integer} + * @since 3.0.0 + */ + RUNNING: 5, + + /** + * Scene state. + * + * @name Phaser.Scenes.PAUSED + * @type {integer} + * @since 3.0.0 + */ + PAUSED: 6, + + /** + * Scene state. + * + * @name Phaser.Scenes.SLEEPING + * @type {integer} + * @since 3.0.0 + */ + SLEEPING: 7, + + /** + * Scene state. + * + * @name Phaser.Scenes.SHUTDOWN + * @type {integer} + * @since 3.0.0 + */ + SHUTDOWN: 8, + + /** + * Scene state. + * + * @name Phaser.Scenes.DESTROYED + * @type {integer} + * @since 3.0.0 + */ + DESTROYED: 9 + +}; + + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); +var EventEmitter = __webpack_require__(14); +var NOOP = __webpack_require__(3); /** * @classdesc - * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this - * format. A Tilemap object get a copy of this data and then unpacks the needed properties into - * itself. + * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. + * The audio file type and the encoding of those files are extremely important. + * Not all browsers can play all audio formats. + * There is a good guide to what's supported [here](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). * - * @class MapData - * @memberOf Phaser.Tilemaps + * @class BaseSoundManager + * @extends EventEmitter + * @memberOf Phaser.Sound * @constructor + * @author Pavle Goloskokovic (http://prunegames.com) * @since 3.0.0 * - * @param {object} [config] - [description] + * @param {Phaser.Game} game - Reference to the current game instance. */ -var MapData = new Class({ - - initialize: - - function MapData (config) +var BaseSoundManager = new Class({ + Extends: EventEmitter, + initialize: function BaseSoundManager (game) { - if (config === undefined) { config = {}; } + EventEmitter.call(this); /** - * [description] - * - * @name Phaser.Tilemaps.MapData#name - * @type {string} + * Local reference to game. + * + * @name Phaser.Sound.BaseSoundManager#game + * @type {Phaser.Game} + * @readOnly * @since 3.0.0 */ - this.name = GetFastValue(config, 'name', 'map'); + this.game = game; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#width - * @type {number} + * An array containing all added sounds. + * + * @name Phaser.Sound.BaseSoundManager#sounds + * @type {Phaser.Sound.BaseSound[]} + * @default [] + * @private * @since 3.0.0 */ - this.width = GetFastValue(config, 'width', 0); + this.sounds = []; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#height - * @type {number} + * Global mute setting. + * + * @name Phaser.Sound.BaseSoundManager#mute + * @type {boolean} + * @default false * @since 3.0.0 */ - this.height = GetFastValue(config, 'height', 0); + this.mute = false; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#tileWidth + * Global volume setting. + * + * @name Phaser.Sound.BaseSoundManager#volume * @type {number} + * @default 1 * @since 3.0.0 */ - this.tileWidth = GetFastValue(config, 'tileWidth', 0); + this.volume = 1; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#tileHeight - * @type {number} + * Flag indicating if sounds should be paused when game looses focus, + * for instance when user switches to another tab/program/app. + * + * @name Phaser.Sound.BaseSoundManager#pauseOnBlur + * @type {boolean} + * @default true * @since 3.0.0 */ - this.tileHeight = GetFastValue(config, 'tileHeight', 0); + this.pauseOnBlur = true; + + game.events.on('blur', function () + { + if (this.pauseOnBlur) + { + this.onBlur(); + } + }, this); + + game.events.on('focus', function () + { + if (this.pauseOnBlur) + { + this.onFocus(); + } + }, this); + + game.events.once('destroy', this.destroy, this); /** - * [description] - * - * @name Phaser.Tilemaps.MapData#widthInPixels + * Property that actually holds the value of global playback rate. + * + * @name Phaser.Sound.BaseSoundManager#_rate * @type {number} + * @private + * @default 1 * @since 3.0.0 */ - this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); + this._rate = 1; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#heightInPixels + * Property that actually holds the value of global detune. + * + * @name Phaser.Sound.BaseSoundManager#_detune * @type {number} + * @private + * @default 0 * @since 3.0.0 */ - this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.tileHeight); + this._detune = 0; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#format - * @type {integer} + * Mobile devices require sounds to be triggered from an explicit user action, + * such as a tap, before any sound can be loaded/played on a web page. + * Set to true if the audio system is currently locked awaiting user interaction. + * + * @name Phaser.Sound.BaseSoundManager#locked + * @type {boolean} + * @readOnly * @since 3.0.0 */ - this.format = GetFastValue(config, 'format', null); + this.locked = this.locked || false; /** - * [description] - * - * @name Phaser.Tilemaps.MapData#orientation - * @type {string} - * @since 3.0.0 - */ - this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#version - * @type {string} - * @since 3.0.0 - */ - this.version = GetFastValue(config, 'version', '1'); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = GetFastValue(config, 'properties', {}); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#layers - * @type {array} - * @since 3.0.0 - */ - this.layers = GetFastValue(config, 'layers', []); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#images - * @type {array} - * @since 3.0.0 - */ - this.images = GetFastValue(config, 'images', []); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#objects - * @type {object} - * @since 3.0.0 - */ - this.objects = GetFastValue(config, 'objects', {}); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#collision - * @type {object} - * @since 3.0.0 - */ - this.collision = GetFastValue(config, 'collision', {}); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#tilesets - * @type {array} - * @since 3.0.0 - */ - this.tilesets = GetFastValue(config, 'tilesets', []); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#imageCollections - * @type {array} - * @since 3.0.0 - */ - this.imageCollections = GetFastValue(config, 'imageCollections', []); - - /** - * [description] - * - * @name Phaser.Tilemaps.MapData#tiles - * @type {array} - * @since 3.0.0 - */ - this.tiles = GetFastValue(config, 'tiles', []); - } - -}); - -module.exports = MapData; - - -/***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var BlendModes = __webpack_require__(45); -var Circle = __webpack_require__(63); -var CircleContains = __webpack_require__(32); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(1); -var Rectangle = __webpack_require__(8); -var RectangleContains = __webpack_require__(33); - -/** - * @classdesc - * A Zone Game Object. - * - * A Zone is a non-rendering rectangular Game Object that has a position and size. - * It has no texture and never displays, but does live on the display list and - * can be moved, scaled and rotated like any other Game Object. - * - * Its primary use is for creating Drop Zones and Input Hit Areas and it has a couple of helper methods - * specifically for this. It is also useful for object overlap checks, or as a base for your own - * non-displaying Game Objects. - - * The default origin is 0.5, the center of the Zone, the same as with Game Objects. - * - * @class Zone - * @extends Phaser.GameObjects.GameObject - * @memberOf Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.ScaleMode - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - [description] - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} [width=1] - The width of the Game Object. - * @param {number} [height=1] - The height of the Game Object. - */ -var Zone = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Depth, - Components.GetBounds, - Components.Origin, - Components.ScaleMode, - Components.Transform, - Components.ScrollFactor, - Components.Visible - ], - - initialize: - - function Zone (scene, x, y, width, height) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = width; } - - GameObject.call(this, scene, 'Zone'); - - this.setPosition(x, y); - - /** - * The native (un-scaled) width of this Game Object. - * - * @name Phaser.GameObjects.Zone#width - * @type {number} - * @since 3.0.0 - */ - this.width = width; - - /** - * The native (un-scaled) height of this Game Object. - * - * @name Phaser.GameObjects.Zone#height - * @type {number} - * @since 3.0.0 - */ - this.height = height; - - /** - * The Blend Mode of the Game Object. - * Although a Zone never renders, it still has a blend mode to allow it to fit seamlessly into - * display lists without causing a batch flush. + * Flag used internally for handling when the audio system + * has been unlocked, if there ever was a need for it. * - * @name Phaser.GameObjects.Zone#blendMode - * @type {integer} + * @name Phaser.Sound.BaseSoundManager#unlocked + * @type {boolean} + * @default false + * @private * @since 3.0.0 */ - this.blendMode = BlendModes.NORMAL; - }, - - /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Zone#displayWidth - * @type {number} - * @since 3.0.0 - */ - displayWidth: { - - get: function () - { - return this.scaleX * this.width; - }, + this.unlocked = false; - set: function (value) + if (this.locked) { - this.scaleX = value / this.width; + this.unlock(); } - }, /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Zone#displayHeight - * @type {number} + * Adds a new sound into the sound manager. + * + * @method Phaser.Sound.BaseSoundManager#add + * @override * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.BaseSound} The new sound instance. */ - displayHeight: { - - get: function () - { - return this.scaleY * this.height; - }, - - set: function (value) - { - this.scaleY = value / this.height; - } - - }, + add: NOOP, /** - * Sets the size of this Game Object. + * Audio sprite sound type. * - * @method Phaser.GameObjects.Zone#setSize + * @typedef {Phaser.Sound.BaseSound} AudioSpriteSound + * + * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. + */ + /** + * Adds a new audio sprite sound into the sound manager. + * + * @method Phaser.Sound.BaseSoundManager#addAudioSprite * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * @param {boolean} [resizeInput=true] - If this Zone has a Rectangle for a hit area this argument will resize the hit area as well. + * @param {string} key - Asset key for the sound. + * @param {SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.GameObjects.Zone} This Game Object. + * @return {AudioSpriteSound} The new audio sprite sound instance. */ - setSize: function (width, height, resizeInput) + addAudioSprite: function (key, config) { - if (resizeInput === undefined) { resizeInput = true; } - - this.width = width; - this.height = height; - - if (resizeInput && this.input && this.input.hitArea instanceof Rectangle) + var sound = this.add(key, config); + sound.spritemap = this.game.cache.json.get(key).spritemap; + for (var markerName in sound.spritemap) { - this.input.hitArea.width = width; - this.input.hitArea.height = height; + if (!sound.spritemap.hasOwnProperty(markerName)) + { + continue; + } + var marker = sound.spritemap[markerName]; + sound.addMarker({ + name: markerName, + start: marker.start, + duration: marker.end - marker.start, + config: config + }); } - - return this; + return sound; }, /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. + * Enables playing sound on the fly without the need to keep a reference to it. + * Sound will auto destroy once its playback ends. * - * @method Phaser.GameObjects.Zone#setDisplaySize + * @method Phaser.Sound.BaseSoundManager#play * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. + * @param {string} key - Asset key for the sound. + * @param {SoundConfig|SoundMarker} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. * - * @return {Phaser.GameObjects.Zone} This Game Object. + * @return {boolean} Whether the sound started playing successfully. */ - setDisplaySize: function (width, height) + play: function (key, extra) { - this.displayWidth = width; - this.displayHeight = height; - - return this; + var sound = this.add(key); + sound.once('ended', sound.destroy, sound); + if (extra) + { + if (extra.name) + { + sound.addMarker(extra); + return sound.play(extra.name); + } + else + { + return sound.play(extra); + } + } + else + { + return sound.play(); + } }, /** - * Sets this Zone to be a Circular Drop Zone. - * The circle is centered on this Zones `x` and `y` coordinates. + * Enables playing audio sprite sound on the fly without the need to keep a reference to it. + * Sound will auto destroy once its playback ends. * - * @method Phaser.GameObjects.Zone#setCircleDropZone + * @method Phaser.Sound.BaseSoundManager#playAudioSprite * @since 3.0.0 * - * @param {number} radius - The radius of the Circle that will form the Drop Zone. + * @param {string} key - Asset key for the sound. + * @param {string} spriteName - The name of the sound sprite to play. + * @param {SoundConfig} [config] - An optional config object containing default sound settings. * - * @return {Phaser.GameObjects.Zone} This Game Object. + * @return {boolean} Whether the audio sprite sound started playing successfully. */ - setCircleDropZone: function (radius) + playAudioSprite: function (key, spriteName, config) { - return this.setDropZone(new Circle(0, 0, radius), CircleContains); + var sound = this.addAudioSprite(key); + sound.once('ended', sound.destroy, sound); + return sound.play(spriteName, config); }, /** - * Sets this Zone to be a Rectangle Drop Zone. - * The rectangle is centered on this Zones `x` and `y` coordinates. + * Removes a sound from the sound manager. + * The removed sound is destroyed before removal. * - * @method Phaser.GameObjects.Zone#setRectangleDropZone + * @method Phaser.Sound.BaseSoundManager#remove * @since 3.0.0 * - * @param {number} width - The width of the rectangle drop zone. - * @param {number} height - The height of the rectangle drop zone. + * @param {Phaser.Sound.BaseSound} sound - The sound object to remove. * - * @return {Phaser.GameObjects.Zone} This Game Object. + * @return {boolean} True if the sound was removed successfully, otherwise false. */ - setRectangleDropZone: function (width, height) + remove: function (sound) { - var x = -(width / 2); - var y = -(height / 2); - - return this.setDropZone(new Rectangle(x, y, width, height), RectangleContains); + var index = this.sounds.indexOf(sound); + if (index !== -1) + { + sound.destroy(); + this.sounds.splice(index, 1); + return true; + } + return false; }, /** - * Allows you to define your own Geometry shape to be used as a Drop Zone. + * Removes all sounds from the sound manager that have an asset key matching the given value. + * The removed sounds are destroyed before removal. * - * @method Phaser.GameObjects.Zone#setDropZone + * @method Phaser.Sound.BaseSoundManager#removeByKey * @since 3.0.0 * - * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. - * @param {function} callback - A function that will return `true` if the given x/y coords it is sent are within the shape. + * @param {string} key - The key to match when removing sound objects. * - * @return {Phaser.GameObjects.Zone} This Game Object. + * @return {number} The number of matching sound objects that were removed. */ - setDropZone: function (shape, callback) + removeByKey: function (key) { - if (shape === undefined) - { - this.setRectangleDropZone(this.width, this.height); - } - else + var removed = 0; + for (var i = this.sounds.length - 1; i >= 0; i--) { - if (!this.input) + var sound = this.sounds[i]; + if (sound.key === key) { - this.setInteractive(shape, callback); + sound.destroy(); + this.sounds.splice(i, 1); + removed++; } - - this.input.dropZone = true; } - - return this; + return removed; }, /** - * A Zone does not render. + * Pauses all the sounds in the game. * - * @method Phaser.GameObjects.Zone#renderCanvas - * @private + * @method Phaser.Sound.BaseSoundManager#pauseAll * @since 3.0.0 */ - renderCanvas: function () + pauseAll: function () { + this.forEachActiveSound(function (sound) + { + sound.pause(); + }); + + /** + * @event Phaser.Sound.BaseSoundManager#pauseall + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + */ + this.emit('pauseall', this); }, /** - * A Zone does not render. + * Resumes all the sounds in the game. * - * @method Phaser.GameObjects.Zone#renderWebGL - * @private + * @method Phaser.Sound.BaseSoundManager#resumeAll * @since 3.0.0 */ - renderWebGL: function () + resumeAll: function () { - } - -}); - -module.exports = Zone; + this.forEachActiveSound(function (sound) + { + sound.resume(); + }); + /** + * @event Phaser.Sound.BaseSoundManager#resumeall + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + */ + this.emit('resumeall', this); + }, -/***/ }), -/* 78 */ -/***/ (function(module, exports) { + /** + * Stops all the sounds in the game. + * + * @method Phaser.Sound.BaseSoundManager#stopAll + * @since 3.0.0 + */ + stopAll: function () + { + this.forEachActiveSound(function (sound) + { + sound.stop(); + }); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * @event Phaser.Sound.BaseSoundManager#stopall + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + */ + this.emit('stopall', this); + }, -/** - * [description] - * - * @function Phaser.Geom.Rectangle.Perimeter - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - [description] - * - * @return {number} [description] - */ -var Perimeter = function (rect) -{ - return 2 * (rect.width + rect.height); -}; + /** + * Method used internally for unlocking audio playback on devices that + * require user interaction before any sound can be played on a web page. + * + * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). + * + * @method Phaser.Sound.BaseSoundManager#unlock + * @override + * @protected + * @since 3.0.0 + */ + unlock: NOOP, -module.exports = Perimeter; + /** + * Method used internally for pausing sound manager if + * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.BaseSoundManager#onBlur + * @override + * @protected + * @since 3.0.0 + */ + onBlur: NOOP, + /** + * Method used internally for resuming sound manager if + * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.BaseSoundManager#onFocus + * @override + * @protected + * @since 3.0.0 + */ + onFocus: NOOP, -/***/ }), -/* 79 */ + /** + * Update method called on every game step. + * Removes destroyed sounds and updates every active sound in the game. + * + * @method Phaser.Sound.BaseSoundManager#update + * @protected + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + update: function (time, delta) + { + if (this.unlocked) + { + this.unlocked = false; + this.locked = false; + + /** + * @event Phaser.Sound.BaseSoundManager#unlocked + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + */ + this.emit('unlocked', this); + } + for (var i = this.sounds.length - 1; i >= 0; i--) + { + if (this.sounds[i].pendingRemove) + { + this.sounds.splice(i, 1); + } + } + this.sounds.forEach(function (sound) + { + sound.update(time, delta); + }); + }, + + /** + * Destroys all the sounds in the game and all associated events. + * + * @method Phaser.Sound.BaseSoundManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.removeAllListeners(); + this.forEachActiveSound(function (sound) + { + sound.destroy(); + }); + this.sounds.length = 0; + this.sounds = null; + this.game = null; + }, + + /** + * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal. + * + * @method Phaser.Sound.BaseSoundManager#forEachActiveSound + * @private + * @since 3.0.0 + * + * @param {function} callbackfn - Callback function. (sound: ISound, index: number, array: ISound[]) => void + * @param {object} [scope] - Callback context. + */ + forEachActiveSound: function (callbackfn, scope) + { + var _this = this; + this.sounds.forEach(function (sound, index) + { + if (!sound.pendingRemove) + { + callbackfn.call(scope || _this, sound, index, _this.sounds); + } + }); + }, + + /** + * Global playback rate at which all the sounds will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audio's playback speed. + * + * @name Phaser.Sound.BaseSoundManager#rate + * @type {number} + * @default 1 + * @since 3.0.0 + */ + rate: { + + get: function () + { + return this._rate; + }, + + set: function (value) + { + this._rate = value; + + this.forEachActiveSound(function (sound) + { + sound.setRate(); + }); + + /** + * @event Phaser.Sound.BaseSoundManager#rate + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#rate property. + */ + this.emit('rate', this, value); + } + + }, + + /** + * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.BaseSoundManager#detune + * @type {number} + * @default 0 + * @since 3.0.0 + */ + detune: { + + get: function () + { + return this._detune; + }, + + set: function (value) + { + this._detune = value; + + this.forEachActiveSound(function (sound) + { + sound.setRate(); + }); + + /** + * @event Phaser.Sound.BaseSoundManager#detune + * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#detune property. + */ + this.emit('detune', this, value); + } + + } + +}); + +module.exports = BaseSoundManager; + + +/***/ }), +/* 85 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -12112,464 +13628,560 @@ module.exports = Perimeter; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ - var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(14); +var Extend = __webpack_require__(23); +var NOOP = __webpack_require__(3); /** * @classdesc - * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. + * Class containing all the shared state and behaviour of a sound object, independent of the implementation. * - * @class DataManager - * @memberOf Phaser.Data + * @class BaseSound + * @extends EventEmitter + * @memberOf Phaser.Sound * @constructor + * @author Pavle Goloskokovic (http://prunegames.com) * @since 3.0.0 * - * @param {any} parent - [description] - * @param {any} eventEmitter - [description] + * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance. + * @param {string} key - Asset key for the sound. + * @param {SoundConfig} [config] - An optional config object containing default sound settings. */ -var DataManager = new Class({ +var BaseSound = new Class({ + Extends: EventEmitter, + initialize: function BaseSound (manager, key, config) + { + EventEmitter.call(this); - initialize: + /** + * Local reference to the sound manager. + * + * @name Phaser.Sound.BaseSound#manager + * @type {Phaser.Sound.BaseSoundManager} + * @private + * @since 3.0.0 + */ + this.manager = manager; - function DataManager (parent, eventEmitter) - { /** - * [description] + * Asset key for the sound. * - * @name Phaser.Data.DataManager#parent - * @type {any} + * @name Phaser.Sound.BaseSound#key + * @type {string} + * @readOnly * @since 3.0.0 */ - this.parent = parent; + this.key = key; /** - * [description] + * Flag indicating if sound is currently playing. * - * @name Phaser.Data.DataManager#events - * @type {EventEmitter} + * @name Phaser.Sound.BaseSound#isPlaying + * @type {boolean} + * @default false + * @readOnly * @since 3.0.0 */ - this.events = eventEmitter; + this.isPlaying = false; - if (!eventEmitter) - { - this.events = (parent.events) ? parent.events : parent; - } + /** + * Flag indicating if sound is currently paused. + * + * @name Phaser.Sound.BaseSound#isPaused + * @type {boolean} + * @default false + * @readOnly + * @since 3.0.0 + */ + this.isPaused = false; /** - * [description] + * A property that holds the value of sound's actual playback rate, + * after its rate and detune values has been combined with global + * rate and detune values. * - * @name Phaser.Data.DataManager#list - * @type {object} - * @default {} + * @name Phaser.Sound.BaseSound#totalRate + * @type {number} + * @default 1 + * @readOnly * @since 3.0.0 */ - this.list = {}; + this.totalRate = 1; /** - * [description] + * A value representing the duration, in seconds. + * It could be total sound duration or a marker duration. * - * @name Phaser.Data.DataManager#blockSet + * @name Phaser.Sound.BaseSound#duration + * @type {number} + * @readOnly + * @since 3.0.0 + */ + this.duration = this.duration || 0; + + /** + * The total duration of the sound in seconds. + * + * @name Phaser.Sound.BaseSound#totalDuration + * @type {number} + * @readOnly + * @since 3.0.0 + */ + this.totalDuration = this.totalDuration || 0; + + /** + * A config object used to store default sound settings' values. + * Default values will be set by properties' setters. + * + * @name Phaser.Sound.BaseSound#config + * @type {SoundConfig} + * @private + * @since 3.0.0 + */ + this.config = { + /** + * Initializing delay config setting + */ + delay: 0 + }; + + /** + * Reference to the currently used config. + * It could be default config or marker config. + * + * @name Phaser.Sound.BaseSound#currentConfig + * @type {SoundConfig} + * @private + * @since 3.0.0 + */ + this.currentConfig = this.config; + + /** + * Boolean indicating whether the sound is muted or not. + * Gets or sets the muted state of this sound. + * + * @name Phaser.Sound.BaseSound#mute * @type {boolean} * @default false * @since 3.0.0 */ - this.blockSet = false; + this.mute = false; /** - * [description] + * Gets or sets the volume of this sound, + * a value between 0 (silence) and 1 (full volume). * - * @name Phaser.Data.DataManager#_frozen + * @name Phaser.Sound.BaseSound#volume + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.volume = 1; + + /** + * Defines the speed at which the audio asset will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio + * at half speed and 2.0 doubles the audio's playback speed. + * This value gets multiplied by global rate to have the final playback speed. + * + * @name Phaser.Sound.BaseSound#rate + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.rate = 1; + + /** + * Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.BaseSound#detune + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.detune = 0; + + /** + * Property representing the position of playback for this sound, in seconds. + * Setting it to a specific value moves current playback to that position. + * The value given is clamped to the range 0 to current marker duration. + * Setting seek of a stopped sound has no effect. + * + * @name Phaser.Sound.BaseSound#seek + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.seek = 0; + + /** + * Flag indicating whether or not the sound or current sound marker will loop. + * + * @name Phaser.Sound.BaseSound#loop * @type {boolean} - * @private * @default false * @since 3.0.0 */ - this._frozen = false; + this.loop = false; + this.config = Extend(this.config, config); - this.events.once('destroy', this.destroy, this); + /** + * Object containing markers definitions (Object.). + * + * @name Phaser.Sound.BaseSound#markers + * @type {object} + * @default {} + * @readOnly + * @since 3.0.0 + */ + this.markers = {}; + + /** + * Currently playing marker. + * 'null' if whole sound is playing. + * + * @name Phaser.Sound.BaseSound#currentMarker + * @type {SoundMarker} + * @default null + * @readOnly + * @since 3.0.0 + */ + this.currentMarker = null; + + /** + * Flag indicating if destroy method was called on this sound. + * + * @name Phaser.Sound.BaseSound#pendingRemove + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this.pendingRemove = false; }, /** - * Retrieves the value for the given key, or undefined if it doesn't exist. + * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object. + * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback. * - * @method Phaser.Data.DataManager#get + * @method Phaser.Sound.BaseSound#addMarker * @since 3.0.0 * - * @param {string} key - [description] + * @param {SoundMarker} marker - Marker object. * - * @return {any} [description] + * @return {boolean} Whether the marker was added successfully. */ - get: function (key) + addMarker: function (marker) { - return this.list[key]; + if (!marker || !marker.name || typeof marker.name !== 'string') + { + return false; + } + if (this.markers[marker.name]) + { + // eslint-disable-next-line no-console + console.error('addMarker - Marker with name \'' + marker.name + '\' already exists for sound \'' + this.key + '\'!'); + return false; + } + marker = Extend(true, { + name: '', + start: 0, + duration: this.totalDuration - (marker.start || 0), + config: { + mute: false, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: false, + delay: 0 + } + }, marker); + this.markers[marker.name] = marker; + return true; }, /** - * [description] + * Updates previously added marker. * - * @method Phaser.Data.DataManager#getAll + * @method Phaser.Sound.BaseSound#updateMarker * @since 3.0.0 * - * @return {object} [description] + * @param {SoundMarker} marker - Marker object with updated values. + * + * @return {boolean} Whether the marker was updated successfully. */ - getAll: function () + updateMarker: function (marker) { - var results = {}; - - for (var key in this.list) + if (!marker || !marker.name || typeof marker.name !== 'string') { - results[key] = this.list[key]; + return false; } - - return results; + if (!this.markers[marker.name]) + { + // eslint-disable-next-line no-console + console.error('updateMarker - Marker with name \'' + marker.name + '\' does not exist for sound \'' + this.key + '\'!'); + return false; + } + this.markers[marker.name] = Extend(true, this.markers[marker.name], marker); + return true; }, /** - * [description] + * Removes a marker from the sound. * - * @method Phaser.Data.DataManager#query + * @method Phaser.Sound.BaseSound#removeMarker * @since 3.0.0 * - * @param {string} search - [description] + * @param {string} markerName - The name of the marker to remove. * - * @return {object} [description] + * @return {SoundMarker|null} Removed marker object or 'null' if there was no marker with provided name. */ - query: function (search) + removeMarker: function (markerName) { - var results = {}; - - for (var key in this.list) + var marker = this.markers[markerName]; + if (!marker) { - if (key.match(search)) - { - results[key] = this.list[key]; - } + return null; } - - return results; + this.markers[markerName] = null; + return marker; }, /** - * [description] + * Play this sound, or a marked section of it. + * It always plays the sound from the start. If you want to start playback from a specific time + * you can set 'seek' setting of the config object, provided to this call, to that value. * - * @method Phaser.Data.DataManager#set + * @method Phaser.Sound.BaseSound#play * @since 3.0.0 * - * @param {string} key - [description] - * @param {any} data - [description] + * @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound. + * @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {boolean} Whether the sound started playing successfully. */ - set: function (key, data) + play: function (markerName, config) { - if (this._frozen) + if (markerName === void 0) { markerName = ''; } + if (typeof markerName === 'object') { - return this; + config = markerName; + markerName = ''; } - - if (this.events.listenerCount('changedata') > 0) + if (typeof markerName !== 'string') { - this.blockSet = false; - - var _this = this; - - var resetFunction = function (value) + // eslint-disable-next-line no-console + console.error('Sound marker name has to be a string!'); + return false; + } + if (!markerName) + { + this.currentMarker = null; + this.currentConfig = this.config; + this.duration = this.totalDuration; + } + else + { + if (!this.markers[markerName]) { - _this.blockSet = true; - _this.list[key] = value; - _this.events.emit('setdata', _this.parent, key, value); - }; - - this.events.emit('changedata', this.parent, key, data, resetFunction); - - // One of the listeners blocked this update from being set, so abort - if (this.blockSet) - { - return this; + // eslint-disable-next-line no-console + console.error('No marker with name \'' + markerName + '\' found for sound \'' + this.key + '\'!'); + return false; } + this.currentMarker = this.markers[markerName]; + this.currentConfig = this.currentMarker.config; + this.duration = this.currentMarker.duration; } - - this.list[key] = data; - - this.events.emit('setdata', this.parent, key, data); - - return this; + this.resetConfig(); + this.currentConfig = Extend(this.currentConfig, config); + this.isPlaying = true; + this.isPaused = false; + return true; }, /** - * Passes all data entries to the given callback. Stores the result of the callback. + * Pauses the sound. * - * @method Phaser.Data.DataManager#each + * @method Phaser.Sound.BaseSound#pause * @since 3.0.0 * - * @param {function} callback - The function to call. - * @param {object} [scope] - Value to use as `this` when executing callback. - * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data. - * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {boolean} Whether the sound was paused successfully. */ - each: function (callback, scope) + pause: function () { - var args = [ this.parent, null, undefined ]; - - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (var key in this.list) + if (this.isPaused || !this.isPlaying) { - args[1] = key; - args[2] = this.list[key]; - - callback.apply(scope, args); + return false; } - - return this; + this.isPlaying = false; + this.isPaused = true; + return true; }, /** - * [description] + * Resumes the sound. * - * @method Phaser.Data.DataManager#merge + * @method Phaser.Sound.BaseSound#resume * @since 3.0.0 * - * @param {object} data - [description] - * @param {boolean} overwrite - [description] - * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {boolean} Whether the sound was resumed successfully. */ - merge: function (data, overwrite) + resume: function () { - if (overwrite === undefined) { overwrite = true; } - - // Merge data from another component into this one - for (var key in data) + if (!this.isPaused || this.isPlaying) { - if (overwrite || (!overwrite && !this.has(key))) - { - this.list[key] = data; - } + return false; } - - return this; + this.isPlaying = true; + this.isPaused = false; + return true; }, /** - * [description] + * Stop playing this sound. * - * @method Phaser.Data.DataManager#remove + * @method Phaser.Sound.BaseSound#stop * @since 3.0.0 * - * @param {string} key - [description] - * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {boolean} Whether the sound was stopped successfully. */ - remove: function (key) + stop: function () { - if (!this._frozen && this.has(key)) + if (!this.isPaused && !this.isPlaying) { - var data = this.list[key]; - - delete this.list[key]; - - this.events.emit('removedata', this, key, data); + return false; } - - return this; + this.isPlaying = false; + this.isPaused = false; + this.resetConfig(); + return true; }, /** - * Gets the data associated with the given 'key', deletes it from this Data store, then returns it. + * Method used internally for applying config values to some of the sound properties. * - * @method Phaser.Data.DataManager#pop + * @method Phaser.Sound.BaseSound#applyConfig + * @protected * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {any} [description] */ - pop: function (key) + applyConfig: function () { - var data = undefined; - - if (!this._frozen && this.has(key)) - { - data = this.list[key]; - - delete this.list[key]; - - this.events.emit('removedata', this, key, data); - } - - return data; + this.mute = this.currentConfig.mute; + this.volume = this.currentConfig.volume; + this.rate = this.currentConfig.rate; + this.detune = this.currentConfig.detune; + this.loop = this.currentConfig.loop; }, /** - * [description] + * Method used internally for resetting values of some of the config properties. * - * @method Phaser.Data.DataManager#has + * @method Phaser.Sound.BaseSound#resetConfig + * @protected * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {boolean} [description] */ - has: function (key) + resetConfig: function () { - return this.list.hasOwnProperty(key); + this.currentConfig.seek = 0; + this.currentConfig.delay = 0; }, /** - * [description] + * Update method called automatically by sound manager on every game step. * - * @method Phaser.Data.DataManager#setFreeze + * @method Phaser.Sound.BaseSound#update + * @override + * @protected * @since 3.0.0 * - * @param {boolean} value - [description] - * - * @return {Phaser.Data.DataManager} This DataManager object. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. */ - setFreeze: function (value) - { - this._frozen = value; - - return this; - }, + update: NOOP, /** - * [description] + * Destroys this sound and all associated events and marks it for removal from the sound manager. * - * @method Phaser.Data.DataManager#reset + * @method Phaser.Sound.BaseSound#destroy * @since 3.0.0 - * - * @return {Phaser.Data.DataManager} This DataManager object. */ - reset: function () + destroy: function () { - for (var key in this.list) + if (this.pendingRemove) { - delete this.list[key]; + return; } - - this.blockSet = false; - this._frozen = false; - - return this; + this.pendingRemove = true; + this.manager = null; + this.key = ''; + this.removeAllListeners(); + this.isPlaying = false; + this.isPaused = false; + this.config = null; + this.currentConfig = null; + this.markers = null; + this.currentMarker = null; }, /** - * [description] + * Method used internally to calculate total playback rate of the sound. * - * @method Phaser.Data.DataManager#destroy + * @method Phaser.Sound.BaseSound#setRate + * @protected * @since 3.0.0 */ - destroy: function () + setRate: function () { - this.reset(); - - this.events.off('changedata'); - this.events.off('setdata'); - this.events.off('removedata'); - - this.parent = null; - }, - - /** - * Freeze this Data component, so no changes can be written to it. - * - * @name Phaser.Data.DataManager#freeze - * @type {boolean} - * @since 3.0.0 - */ - freeze: { - - get: function () - { - return this._frozen; - }, - - set: function (value) - { - this._frozen = (value) ? true : false; - } - + var cent = 1.0005777895065548; // Math.pow(2, 1/1200); + var totalDetune = this.currentConfig.detune + this.manager.detune; + var detuneRate = Math.pow(cent, totalDetune); + this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate; + } +}); +Object.defineProperty(BaseSound.prototype, 'rate', { + get: function () + { + return this.currentConfig.rate; }, + set: function (value) + { + this.currentConfig.rate = value; + this.setRate(); - /** - * Return the total number of entries in this Data component. - * - * @name Phaser.Data.DataManager#count - * @type {integer} - * @since 3.0.0 - */ - count: { - - get: function () - { - var i = 0; - - for (var key in this.list) - { - if (this.list[key] !== undefined) - { - i++; - } - } - - return i; - } - + /** + * @event Phaser.Sound.BaseSound#rate + * @param {Phaser.Sound.BaseSound} sound - Reference to the sound that emitted event. + * @param {number} value - An updated value of Phaser.Sound.BaseSound#rate property. + */ + this.emit('rate', this, value); } - }); - -module.exports = DataManager; - - -/***/ }), -/* 80 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Shuffles the contents of the given array using the Fisher-Yates implementation. - * - * The original array is modified directly and returned. - * - * @function Phaser.Utils.Array.Shuffle - * @since 3.0.0 - * - * @param {array} array - The array to shuffle. This array is modified in place. - * - * @return {array} The shuffled array. - */ -var Shuffle = function (array) -{ - for (var i = array.length - 1; i > 0; i--) +Object.defineProperty(BaseSound.prototype, 'detune', { + get: function () { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - - return array; -}; + return this.currentConfig.detune; + }, + set: function (value) + { + this.currentConfig.detune = value; + this.setRate(); -module.exports = Shuffle; + /** + * @event Phaser.Sound.BaseSound#detune + * @param {Phaser.Sound.BaseSound} sound - Reference to the sound that emitted event. + * @param {number} value - An updated value of Phaser.Sound.BaseSound#detune property. + */ + this.emit('detune', this, value); + } +}); +module.exports = BaseSound; /***/ }), -/* 81 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -12579,1042 +14191,1084 @@ module.exports = Shuffle; */ var Class = __webpack_require__(0); -var GameObject = __webpack_require__(1); -var Sprite = __webpack_require__(37); -var Vector2 = __webpack_require__(6); -var Vector4 = __webpack_require__(119); /** * @classdesc - * A Sprite 3D Game Object. - * - * The Sprite 3D object is an encapsulation of a standard Sprite object, with additional methods to allow - * it to be rendered by a 3D Camera. The Sprite can be positioned anywhere within 3D space. + * [description] * - * @class Sprite3D - * @extends Phaser.GameObjects.GameObject - * @memberOf Phaser.GameObjects + * @class List + * @memberOf Phaser.Structs * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The x position of this Game Object. - * @param {number} y - The y position of this Game Object. - * @param {number} z - The z position of this Game Object. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {any} parent - [description] */ -var Sprite3D = new Class({ - - Extends: GameObject, +var List = new Class({ initialize: - function Sprite3D (scene, x, y, z, texture, frame) + function List (parent) { - GameObject.call(this, scene, 'Sprite3D'); - - /** - * [description] - * - * @name Phaser.GameObjects.Sprite3D#gameObject - * @type {Phaser.GameObjects.GameObject} - * @since 3.0.0 - */ - this.gameObject = new Sprite(scene, 0, 0, texture, frame); - - /** - * [description] - * - * @name Phaser.GameObjects.Sprite3D#position - * @type {Phaser.Math.Vector4} - * @since 3.0.0 - */ - this.position = new Vector4(x, y, z); - - /** - * [description] - * - * @name Phaser.GameObjects.Sprite3D#size - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.size = new Vector2(this.gameObject.width, this.gameObject.height); - - /** - * [description] - * - * @name Phaser.GameObjects.Sprite3D#scale - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.scale = new Vector2(1, 1); - /** - * [description] + * The parent of this list. * - * @name Phaser.GameObjects.Sprite3D#adjustScaleX - * @type {boolean} - * @default true + * @name Phaser.Structs.List#parent + * @type {any} * @since 3.0.0 */ - this.adjustScaleX = true; + this.parent = parent; /** - * [description] + * The objects that belong to this collection. * - * @name Phaser.GameObjects.Sprite3D#adjustScaleY - * @type {boolean} - * @default true + * @name Phaser.Structs.List#list + * @type {array} + * @default [] * @since 3.0.0 */ - this.adjustScaleY = true; + this.list = []; /** * [description] * - * @name Phaser.GameObjects.Sprite3D#_visible - * @type {boolean} - * @default true - * @private + * @name Phaser.Structs.List#position + * @type {integer} + * @default 0 * @since 3.0.0 */ - this._visible = true; + this.position = 0; }, /** * [description] * - * @method Phaser.GameObjects.Sprite3D#project + * @method Phaser.Structs.List#add * @since 3.0.0 * - * @param {Phaser.Cameras.Sprite3D.Camera} camera - The 3D Camera onto which to project this Sprite. + * @param {object} child - [description] + * + * @return {object} [description] */ - project: function (camera) + add: function (child) { - var pos = this.position; + // Is child already in this display list? - var gameObject = this.gameObject; + if (this.getIndex(child) === -1) + { + this.list.push(child); + } - camera.project(pos, gameObject); + return child; + }, - camera.getPointSize(pos, this.size, this.scale); + /** + * [description] + * + * @method Phaser.Structs.List#addAt + * @since 3.0.0 + * + * @param {object} child - [description] + * @param {integer} index - [description] + * + * @return {object} [description] + */ + addAt: function (child, index) + { + if (index === undefined) { index = 0; } - if (this.scale.x <= 0 || this.scale.y <= 0) + if (this.list.length === 0) { - gameObject.setVisible(false); + return this.add(child); } - else + + if (index >= 0 && index <= this.list.length) { - if (!gameObject.visible) + if (this.getIndex(child) === -1) { - gameObject.setVisible(true); + this.list.splice(index, 0, child); } + } - if (this.adjustScaleX) - { - gameObject.scaleX = this.scale.x; - } + return child; + }, - if (this.adjustScaleY) + /** + * [description] + * + * @method Phaser.Structs.List#addMultiple + * @since 3.0.0 + * + * @param {array} children - [description] + * + * @return {array} [description] + */ + addMultiple: function (children) + { + if (Array.isArray(children)) + { + for (var i = 0; i < children.length; i++) { - gameObject.scaleY = this.scale.y; + this.add(children[i]); } - - gameObject.setDepth(gameObject.z * -1); } + + return children; }, /** * [description] * - * @method Phaser.GameObjects.Sprite3D#setVisible + * @method Phaser.Structs.List#getAt * @since 3.0.0 * - * @param {boolean} value - [description] + * @param {integer} index - [description] * - * @return {Phaser.GameObjects.Sprite3D} This Sprite3D Object. + * @return {object} [description] */ - setVisible: function (value) + getAt: function (index) { - this.visible = value; - - return this; + return this.list[index]; }, /** - * The visible state of the Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. - * - * @name Phaser.GameObjects.Sprite3D#visible - * @type {boolean} + * [description] + * + * @method Phaser.Structs.List#getIndex * @since 3.0.0 + * + * @param {object} child - [description] + * + * @return {integer} [description] */ - visible: { - - get: function () - { - return this._visible; - }, + getIndex: function (child) + { + // Return -1 if given child isn't a child of this display list + return this.list.indexOf(child); + }, - set: function (value) - { - this._visible = value; - this.gameObject.visible = value; - } + /** + * Given an array of objects, sort the array and return it, + * so that the objects are in index order with the lowest at the bottom. + * + * @method Phaser.Structs.List#sort + * @since 3.0.0 + * + * @param {array} children - [description] + * + * @return {array} [description] + */ + sort: function (children) + { + if (children === undefined) { children = this.list; } + return children.sort(this.sortIndexHandler.bind(this)); }, /** - * The x position of this Game Object. - * - * @name Phaser.GameObjects.Sprite3D#x - * @type {number} + * [description] + * + * @method Phaser.Structs.List#sortIndexHandler * @since 3.0.0 + * + * @param {object} childA - [description] + * @param {object} childB - [description] + * + * @return {integer} [description] */ - x: { + sortIndexHandler: function (childA, childB) + { + // The lower the index, the lower down the display list they are + var indexA = this.getIndex(childA); + var indexB = this.getIndex(childB); - get: function () + if (indexA < indexB) { - return this.position.x; - }, - - set: function (value) + return -1; + } + else if (indexA > indexB) { - this.position.x = value; + return 1; } + // Technically this shouldn't happen, but if the GO wasn't part of this display list then it'll + // have an index of -1, so in some cases it can + return 0; }, /** - * The y position of this Game Object. - * - * @name Phaser.GameObjects.Sprite3D#y - * @type {number} + * Gets the first item from the set based on the property strictly equaling the value given. + * Returns null if not found. + * + * @method Phaser.Structs.List#getByKey * @since 3.0.0 + * + * @param {string} property - The property to check against the value. + * @param {any} value - The value to check if the property strictly equals. + * + * @return {any} The item that was found, or null if nothing matched. */ - y: { - - get: function () - { - return this.position.y; - }, - - set: function (value) + getByKey: function (property, value) + { + for (var i = 0; i < this.list.length; i++) { - this.position.y = value; + if (this.list[i][property] === value) + { + return this.list[i]; + } } + return null; }, /** - * The z position of this Game Object. - * - * @name Phaser.GameObjects.Sprite3D#z - * @type {number} + * Searches the Group for the first instance of a child with the `name` + * property matching the given argument. Should more than one child have + * the same name only the first instance is returned. + * + * @method Phaser.Structs.List#getByName * @since 3.0.0 + * + * @param {string} name - The name to search for. + * + * @return {any} The first child with a matching name, or null if none were found. */ - z: { + getByName: function (name) + { + return this.getByKey('name', name); + }, - get: function () - { - return this.position.z; - }, + /** + * Returns a random child from the group. + * + * @method Phaser.Structs.List#getRandom + * @since 3.0.0 + * + * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child). + * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from. + * + * @return {any} A random child of this Group. + */ + getRandom: function (startIndex, length) + { + if (startIndex === undefined) { startIndex = 0; } + if (length === undefined) { length = this.list.length; } - set: function (value) + if (length === 0 || length > this.list.length) { - this.position.z = value; + return null; } - } - -}); + var randomIndex = startIndex + Math.floor(Math.random() * length); -module.exports = Sprite3D; + return this.list[randomIndex]; + }, + /** + * [description] + * + * @method Phaser.Structs.List#getFirst + * @since 3.0.0 + * + * @param {[type]} property - [description] + * @param {[type]} value - [description] + * @param {[type]} startIndex - [description] + * @param {[type]} endIndex - [description] + * + * @return {[type]} [description] + */ + getFirst: function (property, value, startIndex, endIndex) + { + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = this.list.length; } -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = startIndex; i < endIndex; i++) + { + var child = this.list[i]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (child[property] === value) + { + return child; + } + } -var OS = __webpack_require__(67); + return null; + }, -/** - * Determines the browser type and version running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.browser` from within any Scene. - * - * @name Phaser.Device.Browser - * @since 3.0.0 - * - * @type {object} - * @property {boolean} chrome - Set to true if running in Chrome. - * @property {boolean} edge - Set to true if running in Microsoft Edge browser. - * @property {boolean} firefox - Set to true if running in Firefox. - * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge). - * @property {boolean} mobileSafari - Set to true if running in Mobile Safari. - * @property {boolean} opera - Set to true if running in Opera. - * @property {boolean} safari - Set to true if running in Safari. - * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle) - * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+) - * @property {number} chromeVersion - If running in Chrome this will contain the major version number. - * @property {number} firefoxVersion - If running in Firefox this will contain the major version number. - * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion. - * @property {number} safariVersion - If running in Safari this will contain the major version number. - * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx} - */ -var Browser = { + /** + * Returns all children in this List. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('visible', true)` would return only children that have their visible property set. + * + * Optionally you can specify a start and end index. For example if this List had 100 children, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 children in the List. + * + * @method Phaser.Structs.List#getAll + * @since 3.0.0 + * + * @param {string} [property] - An optional property to test against the value argument. + * @param {any} [value] - If property is set then Child.property must strictly equal this value to be included in the results. + * @param {integer} [startIndex=0] - The first child index to start the search from. + * @param {integer} [endIndex] - The last child index to search up until. + * + * @return {array} [description] + */ + getAll: function (property, value, startIndex, endIndex) + { + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = this.list.length; } - chrome: false, - chromeVersion: 0, - edge: false, - firefox: false, - firefoxVersion: 0, - ie: false, - ieVersion: 0, - mobileSafari: false, - opera: false, - safari: false, - safariVersion: 0, - silk: false, - trident: false, - tridentVersion: 0 + var output = []; -}; + for (var i = startIndex; i < endIndex; i++) + { + var child = this.list[i]; -function init () -{ - var ua = navigator.userAgent; + if (property) + { + if (child[property] === value) + { + output.push(child); + } + } + else + { + output.push(child); + } + } - if (/Edge\/\d+/.test(ua)) - { - Browser.edge = true; - } - else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone) - { - Browser.chrome = true; - Browser.chromeVersion = parseInt(RegExp.$1, 10); - } - else if ((/Firefox\D+(\d+)/).test(ua)) - { - Browser.firefox = true; - Browser.firefoxVersion = parseInt(RegExp.$1, 10); - } - else if ((/AppleWebKit/).test(ua) && OS.iOS) - { - Browser.mobileSafari = true; - } - else if ((/MSIE (\d+\.\d+);/).test(ua)) - { - Browser.ie = true; - Browser.ieVersion = parseInt(RegExp.$1, 10); - } - else if ((/Opera/).test(ua)) - { - Browser.opera = true; - } - else if ((/Safari/).test(ua) && !OS.windowsPhone) - { - Browser.safari = true; - } - else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua)) - { - Browser.ie = true; - Browser.trident = true; - Browser.tridentVersion = parseInt(RegExp.$1, 10); - Browser.ieVersion = parseInt(RegExp.$3, 10); - } + return output; + }, - // Silk gets its own if clause because its ua also contains 'Safari' - if ((/Silk/).test(ua)) + /** + * [description] + * + * @method Phaser.Structs.List#count + * @since 3.0.0 + * + * @param {string} property - [description] + * @param {any} value - [description] + * + * @return {integer} [description] + */ + count: function (property, value) { - Browser.silk = true; - } + var total = 0; - return Browser; -} + for (var i = 0; i < this.list.length; i++) + { + var child = this.list[i]; -module.exports = init(); + if (child[property] === value) + { + total++; + } + } + return total; + }, -/***/ }), -/* 83 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Structs.List#swap + * @since 3.0.0 + * + * @param {object} child1 - [description] + * @param {object} child2 - [description] + */ + swap: function (child1, child2) + { + if (child1 === child2) + { + return; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var index1 = this.getIndex(child1); + var index2 = this.getIndex(child2); + if (index1 < 0 || index2 < 0) + { + throw new Error('List.swap: Supplied objects must be children of the same list'); + } -module.exports = { + this.list[index1] = child2; + this.list[index2] = child1; + }, /** - * Scene state. - * - * @name Phaser.Scenes.PENDING - * @type {integer} + * [description] + * + * @method Phaser.Structs.List#moveTo * @since 3.0.0 + * + * @param {object} child - [description] + * @param {integer} index - [description] + * + * @return {object} [description] */ - PENDING: 0, + moveTo: function (child, index) + { + var currentIndex = this.getIndex(child); - /** - * Scene state. - * - * @name Phaser.Scenes.INIT - * @type {integer} - * @since 3.0.0 - */ - INIT: 1, + if (currentIndex === -1 || index < 0 || index >= this.list.length) + { + throw new Error('List.moveTo: The supplied index is out of bounds'); + } - /** - * Scene state. - * - * @name Phaser.Scenes.START - * @type {integer} - * @since 3.0.0 - */ - START: 2, + // Remove + this.list.splice(currentIndex, 1); - /** - * Scene state. - * - * @name Phaser.Scenes.LOADING - * @type {integer} - * @since 3.0.0 - */ - LOADING: 3, + // Add in new location + this.list.splice(index, 0, child); - /** - * Scene state. - * - * @name Phaser.Scenes.CREATING - * @type {integer} - * @since 3.0.0 - */ - CREATING: 4, + return child; + }, /** - * Scene state. - * - * @name Phaser.Scenes.RUNNING - * @type {integer} + * [description] + * + * @method Phaser.Structs.List#remove * @since 3.0.0 + * + * @param {object} child - [description] + * + * @return {object} [description] */ - RUNNING: 5, + remove: function (child) + { + var index = this.list.indexOf(child); - /** - * Scene state. - * - * @name Phaser.Scenes.PAUSED - * @type {integer} - * @since 3.0.0 - */ - PAUSED: 6, + if (index !== -1) + { + this.list.splice(index, 1); + } + + return child; + }, /** - * Scene state. - * - * @name Phaser.Scenes.SLEEPING - * @type {integer} + * [description] + * + * @method Phaser.Structs.List#removeAt * @since 3.0.0 + * + * @param {integer} index - [description] + * + * @return {object} [description] */ - SLEEPING: 7, + removeAt: function (index) + { + var child = this.list[index]; - /** - * Scene state. - * - * @name Phaser.Scenes.SHUTDOWN - * @type {integer} - * @since 3.0.0 - */ - SHUTDOWN: 8, + if (child) + { + this.children.splice(index, 1); + } + + return child; + }, /** - * Scene state. - * - * @name Phaser.Scenes.DESTROYED - * @type {integer} + * [description] + * + * @method Phaser.Structs.List#removeBetween * @since 3.0.0 + * + * @param {integer} beginIndex - [description] + * @param {integer} endIndex - [description] + * + * @return {array} [description] */ - DESTROYED: 9 + removeBetween: function (beginIndex, endIndex) + { + if (beginIndex === undefined) { beginIndex = 0; } + if (endIndex === undefined) { endIndex = this.list.length; } -}; - - -/***/ }), -/* 84 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(14); -var NOOP = __webpack_require__(3); - -/** - * @classdesc - * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. - * The audio file type and the encoding of those files are extremely important. - * Not all browsers can play all audio formats. - * There is a good guide to what's supported [here](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). - * - * @class BaseSoundManager - * @extends EventEmitter - * @memberOf Phaser.Sound - * @constructor - * @author Pavle Goloskokovic (http://prunegames.com) - * @since 3.0.0 - * - * @param {Phaser.Game} game - Reference to the current game instance. - */ -var BaseSoundManager = new Class({ - Extends: EventEmitter, - initialize: function BaseSoundManager (game) - { - EventEmitter.call(this); - - /** - * Local reference to game. - * - * @name Phaser.Sound.BaseSoundManager#game - * @type {Phaser.Game} - * @readOnly - * @since 3.0.0 - */ - this.game = game; - - /** - * An array containing all added sounds. - * - * @name Phaser.Sound.BaseSoundManager#sounds - * @type {Phaser.Sound.BaseSound[]} - * @default [] - * @private - * @since 3.0.0 - */ - this.sounds = []; - - /** - * Global mute setting. - * - * @name Phaser.Sound.BaseSoundManager#mute - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.mute = false; - - /** - * Global volume setting. - * - * @name Phaser.Sound.BaseSoundManager#volume - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.volume = 1; - - /** - * Flag indicating if sounds should be paused when game looses focus, - * for instance when user switches to another tab/program/app. - * - * @name Phaser.Sound.BaseSoundManager#pauseOnBlur - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.pauseOnBlur = true; + var range = endIndex - beginIndex; - game.events.on('blur', function () + if (range > 0 && range <= endIndex) { - if (this.pauseOnBlur) - { - this.onBlur(); - } - }, this); + var removed = this.list.splice(beginIndex, range); - game.events.on('focus', function () + return removed; + } + else if (range === 0 && this.list.length === 0) { - if (this.pauseOnBlur) - { - this.onFocus(); - } - }, this); - - game.events.once('destroy', this.destroy, this); - - /** - * Property that actually holds the value of global playback rate. - * - * @name Phaser.Sound.BaseSoundManager#_rate - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - this._rate = 1; - - /** - * Property that actually holds the value of global detune. - * - * @name Phaser.Sound.BaseSoundManager#_detune - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._detune = 0; - - /** - * Mobile devices require sounds to be triggered from an explicit user action, - * such as a tap, before any sound can be loaded/played on a web page. - * Set to true if the audio system is currently locked awaiting user interaction. - * - * @name Phaser.Sound.BaseSoundManager#locked - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - this.locked = this.locked || false; - - /** - * Flag used internally for handling when the audio system - * has been unlocked, if there ever was a need for it. - * - * @name Phaser.Sound.BaseSoundManager#unlocked - * @type {boolean} - * @default false - * @private - * @since 3.0.0 - */ - this.unlocked = false; - - if (this.locked) + return []; + } + else { - this.unlock(); + throw new Error('List.removeBetween: Range Error, numeric values are outside the acceptable range'); } }, /** - * Adds a new sound into the sound manager. - * - * @method Phaser.Sound.BaseSoundManager#add - * @override - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {Phaser.Sound.BaseSound} The new sound instance. - */ - add: NOOP, - - /** - * Audio sprite sound type. - * - * @typedef {Phaser.Sound.BaseSound} AudioSpriteSound - * - * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool. - */ - /** - * Adds a new audio sprite sound into the sound manager. + * Removes all the items. * - * @method Phaser.Sound.BaseSoundManager#addAudioSprite + * @method Phaser.Structs.List#removeAll * @since 3.0.0 * - * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {AudioSpriteSound} The new audio sprite sound instance. + * @return {Phaser.Structs.List} This List object. */ - addAudioSprite: function (key, config) + removeAll: function () { - var sound = this.add(key, config); - sound.spritemap = this.game.cache.json.get(key).spritemap; - for (var markerName in sound.spritemap) + var i = this.list.length; + + while (i--) { - if (!sound.spritemap.hasOwnProperty(markerName)) - { - continue; - } - var marker = sound.spritemap[markerName]; - sound.addMarker({ - name: markerName, - start: marker.start, - duration: marker.end - marker.start, - config: config - }); + this.remove(this.list[i]); } - return sound; + + return this; }, /** - * Enables playing sound on the fly without the need to keep a reference to it. - * Sound will auto destroy once its playback ends. + * Brings the given child to the top of this List. * - * @method Phaser.Sound.BaseSoundManager#play + * @method Phaser.Structs.List#bringToTop * @since 3.0.0 * - * @param {string} key - Asset key for the sound. - * @param {SoundConfig|SoundMarker} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. + * @param {object} child - [description] * - * @return {boolean} Whether the sound started playing successfully. + * @return {object} [description] */ - play: function (key, extra) + bringToTop: function (child) { - var sound = this.add(key); - sound.once('ended', sound.destroy, sound); - if (extra) - { - if (extra.name) - { - sound.addMarker(extra); - return sound.play(extra.name); - } - else - { - return sound.play(extra); - } - } - else + if (this.getIndex(child) < this.list.length) { - return sound.play(); + this.remove(child); + this.add(child); } + + return child; }, /** - * Enables playing audio sprite sound on the fly without the need to keep a reference to it. - * Sound will auto destroy once its playback ends. + * Sends the given child to the bottom of this List. * - * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @method Phaser.Structs.List#sendToBack * @since 3.0.0 * - * @param {string} key - Asset key for the sound. - * @param {string} spriteName - The name of the sound sprite to play. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @param {object} child - [description] * - * @return {boolean} Whether the audio sprite sound started playing successfully. + * @return {object} [description] */ - playAudioSprite: function (key, spriteName, config) + sendToBack: function (child) { - var sound = this.addAudioSprite(key); - sound.once('ended', sound.destroy, sound); - return sound.play(spriteName, config); + if (this.getIndex(child) > 0) + { + this.remove(child); + this.addAt(child, 0); + } + + return child; }, /** - * Removes a sound from the sound manager. - * The removed sound is destroyed before removal. + * Moves the given child up one place in this group unless it's already at the top. * - * @method Phaser.Sound.BaseSoundManager#remove + * @method Phaser.Structs.List#moveUp * @since 3.0.0 * - * @param {Phaser.Sound.BaseSound} sound - The sound object to remove. + * @param {object} child - [description] * - * @return {boolean} True if the sound was removed successfully, otherwise false. + * @return {object} [description] */ - remove: function (sound) + moveUp: function (child) { - var index = this.sounds.indexOf(sound); - if (index !== -1) + var a = this.getIndex(child); + + if (a !== -1 && a < this.list.length - 1) { - sound.destroy(); - this.sounds.splice(index, 1); - return true; + var b = this.getAt(a + 1); + + if (b) + { + this.swap(child, b); + } } - return false; + + return child; }, /** - * Removes all sounds from the sound manager that have an asset key matching the given value. - * The removed sounds are destroyed before removal. + * Moves the given child down one place in this group unless it's already at the bottom. * - * @method Phaser.Sound.BaseSoundManager#removeByKey + * @method Phaser.Structs.List#moveDown * @since 3.0.0 * - * @param {string} key - The key to match when removing sound objects. + * @param {object} child - [description] * - * @return {number} The number of matching sound objects that were removed. + * @return {object} [description] */ - removeByKey: function (key) + moveDown: function (child) { - var removed = 0; - for (var i = this.sounds.length - 1; i >= 0; i--) + var a = this.getIndex(child); + + if (a > 0) { - var sound = this.sounds[i]; - if (sound.key === key) + var b = this.getAt(a - 1); + + if (b) { - sound.destroy(); - this.sounds.splice(i, 1); - removed++; + this.swap(child, b); } } - return removed; + + return child; }, /** - * Pauses all the sounds in the game. + * Reverses the order of all children in this List. * - * @method Phaser.Sound.BaseSoundManager#pauseAll + * @method Phaser.Structs.List#reverse * @since 3.0.0 + * + * @return {Phaser.Structs.List} This List object. */ - pauseAll: function () + reverse: function () { - this.forEachActiveSound(function (sound) - { - sound.pause(); - }); + this.list.reverse(); - /** - * @event Phaser.Sound.BaseSoundManager#pauseall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - this.emit('pauseall', this); + return this; }, /** - * Resumes all the sounds in the game. + * [description] * - * @method Phaser.Sound.BaseSoundManager#resumeAll + * @method Phaser.Structs.List#shuffle * @since 3.0.0 + * + * @return {Phaser.Structs.List} This List object. */ - resumeAll: function () + shuffle: function () { - this.forEachActiveSound(function (sound) + for (var i = this.list.length - 1; i > 0; i--) { - sound.resume(); - }); + var j = Math.floor(Math.random() * (i + 1)); + var temp = this.list[i]; + this.list[i] = this.list[j]; + this.list[j] = temp; + } - /** - * @event Phaser.Sound.BaseSoundManager#resumeall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - this.emit('resumeall', this); + return this; }, /** - * Stops all the sounds in the game. + * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. * - * @method Phaser.Sound.BaseSoundManager#stopAll + * @method Phaser.Structs.List#replace * @since 3.0.0 + * + * @param {object} oldChild - The child in this List that will be replaced. + * @param {object} newChild - The child to be inserted into this List. + * + * @return {object} Returns the oldChild that was replaced within this group. */ - stopAll: function () + replace: function (oldChild, newChild) { - this.forEachActiveSound(function (sound) + var index = this.getIndex(oldChild); + + if (index !== -1) { - sound.stop(); - }); + this.remove(oldChild); - /** - * @event Phaser.Sound.BaseSoundManager#stopall - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - this.emit('stopall', this); + this.addAt(newChild, index); + + return oldChild; + } }, /** - * Method used internally for unlocking audio playback on devices that - * require user interaction before any sound can be played on a web page. - * - * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). + * [description] * - * @method Phaser.Sound.BaseSoundManager#unlock - * @override - * @protected + * @method Phaser.Structs.List#exists * @since 3.0.0 - */ - unlock: NOOP, - - /** - * Method used internally for pausing sound manager if - * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. * - * @method Phaser.Sound.BaseSoundManager#onBlur - * @override - * @protected - * @since 3.0.0 - */ - onBlur: NOOP, - - /** - * Method used internally for resuming sound manager if - * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. + * @param {object} child - [description] * - * @method Phaser.Sound.BaseSoundManager#onFocus - * @override - * @protected - * @since 3.0.0 + * @return {boolean} True if the item is found in the list, otherwise false. */ - onFocus: NOOP, + exists: function (child) + { + return (this.list.indexOf(child) > -1); + }, /** - * Update method called on every game step. - * Removes destroyed sounds and updates every active sound in the game. + * Sets the property `key` to the given value on all members of this List. * - * @method Phaser.Sound.BaseSoundManager#update - * @protected + * @method Phaser.Structs.List#setAll * @since 3.0.0 * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. + * @param {string} key - [description] + * @param {any} value - [description] */ - update: function (time, delta) + setAll: function (key, value) { - if (this.unlocked) - { - this.unlocked = false; - this.locked = false; - - /** - * @event Phaser.Sound.BaseSoundManager#unlocked - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - */ - this.emit('unlocked', this); - } - for (var i = this.sounds.length - 1; i >= 0; i--) + for (var i = 0; i < this.list.length; i++) { - if (this.sounds[i].pendingRemove) + if (this.list[i]) { - this.sounds.splice(i, 1); + this.list[i][key] = value; } } - this.sounds.forEach(function (sound) - { - sound.update(time, delta); - }); }, /** - * Destroys all the sounds in the game and all associated events. + * Passes all children to the given callback. * - * @method Phaser.Sound.BaseSoundManager#destroy + * @method Phaser.Structs.List#each * @since 3.0.0 + * + * @param {function} callback - The function to call. + * @param {object} [thisArg] - Value to use as `this` when executing callback. + * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. */ - destroy: function () + each: function (callback, thisArg) { - this.removeAllListeners(); - this.forEachActiveSound(function (sound) + var args = [ null ]; + + for (var i = 1; i < arguments.length; i++) { - sound.destroy(); - }); - this.sounds.length = 0; - this.sounds = null; - this.game = null; + args.push(arguments[i]); + } + + for (i = 0; i < this.list.length; i++) + { + args[0] = this.list[i]; + callback.apply(thisArg, args); + } }, /** - * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal. + * [description] * - * @method Phaser.Sound.BaseSoundManager#forEachActiveSound - * @private + * @method Phaser.Structs.List#shutdown * @since 3.0.0 - * - * @param {function} callbackfn - Callback function. (sound: ISound, index: number, array: ISound[]) => void - * @param {object} scope - Callback context. */ - forEachActiveSound: function (callbackfn, scope) + shutdown: function () { - var _this = this; - this.sounds.forEach(function (sound, index) - { - if (!sound.pendingRemove) - { - callbackfn.call(scope || _this, sound, index, _this.sounds); - } - }); + this.removeAll(); }, /** - * Global playback rate at which all the sounds will be played. - * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audio's playback speed. + * [description] * - * @name Phaser.Sound.BaseSoundManager#rate - * @type {number} - * @default 1 + * @method Phaser.Structs.List#destroy * @since 3.0.0 */ - rate: { + destroy: function () + { + this.removeAll(); + + this.list = []; + + this.parent = null; + }, + + /** + * [description] + * + * @name Phaser.Structs.List#length + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + length: { get: function () { - return this._rate; - }, + return this.list.length; + } - set: function (value) + }, + + /** + * [description] + * + * @name Phaser.Structs.List#first + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + first: { + + get: function () { - this._rate = value; + this.position = 0; - this.forEachActiveSound(function (sound) + if (this.list.length > 0) { - sound.setRate(); - }); - - /** - * @event Phaser.Sound.BaseSoundManager#rate - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#rate property. - */ - this.emit('rate', this, value); + return this.list[0]; + } + else + { + return null; + } } }, /** - * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * [description] * - * @name Phaser.Sound.BaseSoundManager#detune - * @type {number} - * @default 0 + * @name Phaser.Structs.List#last + * @type {integer} + * @readOnly * @since 3.0.0 */ - detune: { + last: { get: function () { - return this._detune; - }, + if (this.list.length > 0) + { + this.position = this.list.length - 1; - set: function (value) + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * [description] + * + * @name Phaser.Structs.List#next + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + next: { + + get: function () { - this._detune = value; + if (this.position < this.list.length) + { + this.position++; - this.forEachActiveSound(function (sound) + return this.list[this.position]; + } + else { - sound.setRate(); - }); + return null; + } + } - /** - * @event Phaser.Sound.BaseSoundManager#detune - * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#detune property. - */ - this.emit('detune', this, value); + }, + + /** + * [description] + * + * @name Phaser.Structs.List#previous + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + previous: { + + get: function () + { + if (this.position > 0) + { + this.position--; + + return this.list[this.position]; + } + else + { + return null; + } } } }); -module.exports = BaseSoundManager; +module.exports = List; /***/ }), -/* 85 */ +/* 87 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var TWEEN_CONST = { + + /** + * TweenData state. + * + * @name Phaser.Tweens.CREATED + * @type {integer} + * @since 3.0.0 + */ + CREATED: 0, + + /** + * TweenData state. + * + * @name Phaser.Tweens.INIT + * @type {integer} + * @since 3.0.0 + */ + INIT: 1, + + /** + * TweenData state. + * + * @name Phaser.Tweens.DELAY + * @type {integer} + * @since 3.0.0 + */ + DELAY: 2, + + /** + * TweenData state. + * + * @name Phaser.Tweens.OFFSET_DELAY + * @type {integer} + * @since 3.0.0 + */ + OFFSET_DELAY: 3, + + /** + * TweenData state. + * + * @name Phaser.Tweens.PENDING_RENDER + * @type {integer} + * @since 3.0.0 + */ + PENDING_RENDER: 4, + + /** + * TweenData state. + * + * @name Phaser.Tweens.PLAYING_FORWARD + * @type {integer} + * @since 3.0.0 + */ + PLAYING_FORWARD: 5, + + /** + * TweenData state. + * + * @name Phaser.Tweens.PLAYING_BACKWARD + * @type {integer} + * @since 3.0.0 + */ + PLAYING_BACKWARD: 6, + + /** + * TweenData state. + * + * @name Phaser.Tweens.HOLD_DELAY + * @type {integer} + * @since 3.0.0 + */ + HOLD_DELAY: 7, + + /** + * TweenData state. + * + * @name Phaser.Tweens.REPEAT_DELAY + * @type {integer} + * @since 3.0.0 + */ + REPEAT_DELAY: 8, + + /** + * TweenData state. + * + * @name Phaser.Tweens.COMPLETE + * @type {integer} + * @since 3.0.0 + */ + COMPLETE: 9, + + // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future) + + /** + * Tween state. + * + * @name Phaser.Tweens.PENDING_ADD + * @type {integer} + * @since 3.0.0 + */ + PENDING_ADD: 20, + + /** + * Tween state. + * + * @name Phaser.Tweens.PAUSED + * @type {integer} + * @since 3.0.0 + */ + PAUSED: 21, + + /** + * Tween state. + * + * @name Phaser.Tweens.LOOP_DELAY + * @type {integer} + * @since 3.0.0 + */ + LOOP_DELAY: 22, + + /** + * Tween state. + * + * @name Phaser.Tweens.ACTIVE + * @type {integer} + * @since 3.0.0 + */ + ACTIVE: 23, + + /** + * Tween state. + * + * @name Phaser.Tweens.COMPLETE_DELAY + * @type {integer} + * @since 3.0.0 + */ + COMPLETE_DELAY: 24, + + /** + * Tween state. + * + * @name Phaser.Tweens.PENDING_REMOVE + * @type {integer} + * @since 3.0.0 + */ + PENDING_REMOVE: 25, + + /** + * Tween state. + * + * @name Phaser.Tweens.REMOVED + * @type {integer} + * @since 3.0.0 + */ + REMOVED: 26 + +}; + +module.exports = TWEEN_CONST; + + +/***/ }), +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13622,561 +15276,236 @@ module.exports = BaseSoundManager; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ + var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(14); -var Extend = __webpack_require__(23); -var NOOP = __webpack_require__(3); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(1); +var MeshRender = __webpack_require__(658); /** * @classdesc - * Class containing all the shared state and behaviour of a sound object, independent of the implementation. + * A Mesh Game Object. * - * @class BaseSound - * @extends EventEmitter - * @memberOf Phaser.Sound + * @class Mesh + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects * @constructor - * @author Pavle Goloskokovic (http://prunegames.com) + * @webglOnly * @since 3.0.0 * - * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance. - * @param {string} key - Asset key for the sound. - * @param {SoundConfig} [config] - An optional config object containing default sound settings. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {array} vertices - An array containing the vertices data for this Mesh. + * @param {array} uv - An array containing the uv data for this Mesh. + * @param {array} colors - An array containing the color data for this Mesh. + * @param {array} alphas - An array containing the alpha data for this Mesh. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var BaseSound = new Class({ - Extends: EventEmitter, - initialize: function BaseSound (manager, key, config) +var Mesh = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Origin, + Components.Pipeline, + Components.ScaleMode, + Components.Size, + Components.Texture, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + MeshRender + ], + + initialize: + + function Mesh (scene, x, y, vertices, uv, colors, alphas, texture, frame) { - EventEmitter.call(this); + GameObject.call(this, scene, 'Mesh'); - /** - * Local reference to the sound manager. - * - * @name Phaser.Sound.BaseSound#manager - * @type {Phaser.Sound.BaseSoundManager} - * @private - * @since 3.0.0 - */ - this.manager = manager; + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOrigin(); + this.initPipeline('TextureTintPipeline'); - /** - * Asset key for the sound. - * - * @name Phaser.Sound.BaseSound#key - * @type {string} - * @readOnly - * @since 3.0.0 - */ - this.key = key; + if (vertices.length !== uv.length) + { + throw new Error('Mesh Vertex count must match UV count'); + } - /** - * Flag indicating if sound is currently playing. - * - * @name Phaser.Sound.BaseSound#isPlaying - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isPlaying = false; + var verticesUB = (vertices.length / 2) | 0; - /** - * Flag indicating if sound is currently paused. - * - * @name Phaser.Sound.BaseSound#isPaused - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isPaused = false; + if (colors.length > 0 && colors.length < verticesUB) + { + throw new Error('Mesh Color count must match Vertex count'); + } + + if (alphas.length > 0 && alphas.length < verticesUB) + { + throw new Error('Mesh Alpha count must match Vertex count'); + } + + var i; + + if (colors.length === 0) + { + for (i = 0; i < verticesUB; ++i) + { + colors[i] = 0xFFFFFF; + } + } + + if (alphas.length === 0) + { + for (i = 0; i < verticesUB; ++i) + { + alphas[i] = 1.0; + } + } /** - * A property that holds the value of sound's actual playback rate, - * after its rate and detune values has been combined with global - * rate and detune values. + * [description] * - * @name Phaser.Sound.BaseSound#totalRate - * @type {number} - * @default 1 - * @readOnly + * @name Phaser.GameObjects.Mesh#vertices + * @type {Float32Array} * @since 3.0.0 */ - this.totalRate = 1; + this.vertices = new Float32Array(vertices); /** - * A value representing the duration, in seconds. - * It could be total sound duration or a marker duration. + * [description] * - * @name Phaser.Sound.BaseSound#duration - * @type {number} - * @readOnly + * @name Phaser.GameObjects.Mesh#uv + * @type {Float32Array} * @since 3.0.0 */ - this.duration = this.duration || 0; + this.uv = new Float32Array(uv); /** - * The total duration of the sound in seconds. + * [description] * - * @name Phaser.Sound.BaseSound#totalDuration - * @type {number} - * @readOnly + * @name Phaser.GameObjects.Mesh#colors + * @type {Uint32Array} * @since 3.0.0 */ - this.totalDuration = this.totalDuration || 0; + this.colors = new Uint32Array(colors); /** - * A config object used to store default sound settings' values. - * Default values will be set by properties' setters. + * [description] * - * @name Phaser.Sound.BaseSound#config - * @type {SoundConfig} - * @private + * @name Phaser.GameObjects.Mesh#alphas + * @type {Float32Array} * @since 3.0.0 */ - this.config = { - /** - * Initializing delay config setting - */ - delay: 0 - }; + this.alphas = new Float32Array(alphas); + } - /** - * Reference to the currently used config. - * It could be default config or marker config. - * - * @name Phaser.Sound.BaseSound#currentConfig - * @type {SoundConfig} - * @private - * @since 3.0.0 - */ - this.currentConfig = this.config; - - /** - * Boolean indicating whether the sound is muted or not. - * Gets or sets the muted state of this sound. - * - * @name Phaser.Sound.BaseSound#mute - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.mute = false; - - /** - * Gets or sets the volume of this sound, - * a value between 0 (silence) and 1 (full volume). - * - * @name Phaser.Sound.BaseSound#volume - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.volume = 1; - - /** - * Defines the speed at which the audio asset will be played. - * Value of 1.0 plays the audio at full speed, 0.5 plays the audio - * at half speed and 2.0 doubles the audio's playback speed. - * This value gets multiplied by global rate to have the final playback speed. - * - * @name Phaser.Sound.BaseSound#rate - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.rate = 1; - - /** - * Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @name Phaser.Sound.BaseSound#detune - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.detune = 0; +}); - /** - * Property representing the position of playback for this sound, in seconds. - * Setting it to a specific value moves current playback to that position. - * The value given is clamped to the range 0 to current marker duration. - * Setting seek of a stopped sound has no effect. - * - * @name Phaser.Sound.BaseSound#seek - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.seek = 0; +module.exports = Mesh; - /** - * Flag indicating whether or not the sound or current sound marker will loop. - * - * @name Phaser.Sound.BaseSound#loop - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.loop = false; - this.config = Extend(this.config, config); - /** - * Object containing markers definitions (Object.). - * - * @name Phaser.Sound.BaseSound#markers - * @type {object} - * @default {} - * @readOnly - * @since 3.0.0 - */ - this.markers = {}; +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Currently playing marker. - * 'null' if whole sound is playing. - * - * @name Phaser.Sound.BaseSound#currentMarker - * @type {SoundMarker} - * @default null - * @readOnly - * @since 3.0.0 - */ - this.currentMarker = null; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Flag indicating if destroy method was called on this sound. - * - * @name Phaser.Sound.BaseSound#pendingRemove - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this.pendingRemove = false; - }, +var Point = __webpack_require__(5); - /** - * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object. - * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback. - * - * @method Phaser.Sound.BaseSound#addMarker - * @since 3.0.0 - * - * @param {SoundMarker} marker - Marker object. - * - * @return {boolean} Whether the marker was added successfully. - */ - addMarker: function (marker) - { - if (!marker || !marker.name || typeof marker.name !== 'string') - { - return false; - } - if (this.markers[marker.name]) - { - // eslint-disable-next-line no-console - console.error('addMarker - Marker with name \'' + marker.name + '\' already exists for sound \'' + this.key + '\'!'); - return false; - } - marker = Extend(true, { - name: '', - start: 0, - duration: this.totalDuration - (marker.start || 0), - config: { - mute: false, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: false, - delay: 0 - } - }, marker); - this.markers[marker.name] = marker; - return true; - }, +// This is based off an explanation and expanded math presented by Paul Bourke: +// See http:'local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ - /** - * Updates previously added marker. - * - * @method Phaser.Sound.BaseSound#updateMarker - * @since 3.0.0 - * - * @param {SoundMarker} marker - Marker object with updated values. - * - * @return {boolean} Whether the marker was updated successfully. - */ - updateMarker: function (marker) - { - if (!marker || !marker.name || typeof marker.name !== 'string') - { - return false; - } - if (!this.markers[marker.name]) - { - // eslint-disable-next-line no-console - console.error('updateMarker - Marker with name \'' + marker.name + '\' does not exist for sound \'' + this.key + '\'!'); - return false; - } - this.markers[marker.name] = Extend(true, this.markers[marker.name], marker); - return true; - }, +/** + * [description] + * + * @function Phaser.Geom.Intersects.LineToLine + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line1 - [description] + * @param {Phaser.Geom.Line} line2 - [description] + * @param {Phaser.Geom.Point} [out] - [description] + * + * @return {boolean} [description] + */ +var LineToLine = function (line1, line2, out) +{ + if (out === undefined) { out = new Point(); } - /** - * Removes a marker from the sound. - * - * @method Phaser.Sound.BaseSound#removeMarker - * @since 3.0.0 - * - * @param {string} markerName - The name of the marker to remove. - * - * @return {SoundMarker|null} Removed marker object or 'null' if there was no marker with provided name. - */ - removeMarker: function (markerName) - { - var marker = this.markers[markerName]; - if (!marker) - { - return null; - } - this.markers[markerName] = null; - return marker; - }, + var x1 = line1.x1; + var y1 = line1.y1; + var x2 = line1.x2; + var y2 = line1.y2; - /** - * Play this sound, or a marked section of it. - * It always plays the sound from the start. If you want to start playback from a specific time - * you can set 'seek' setting of the config object, provided to this call, to that value. - * - * @method Phaser.Sound.BaseSound#play - * @since 3.0.0 - * - * @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound. - * @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. - * - * @return {boolean} Whether the sound started playing successfully. - */ - play: function (markerName, config) - { - if (markerName === void 0) { markerName = ''; } - if (typeof markerName === 'object') - { - config = markerName; - markerName = ''; - } - if (typeof markerName !== 'string') - { - // eslint-disable-next-line no-console - console.error('Sound marker name has to be a string!'); - return false; - } - if (!markerName) - { - this.currentMarker = null; - this.currentConfig = this.config; - this.duration = this.totalDuration; - } - else - { - if (!this.markers[markerName]) - { - // eslint-disable-next-line no-console - console.error('No marker with name \'' + markerName + '\' found for sound \'' + this.key + '\'!'); - return false; - } - this.currentMarker = this.markers[markerName]; - this.currentConfig = this.currentMarker.config; - this.duration = this.currentMarker.duration; - } - this.resetConfig(); - this.currentConfig = Extend(this.currentConfig, config); - this.isPlaying = true; - this.isPaused = false; - return true; - }, + var x3 = line2.x1; + var y3 = line2.y1; + var x4 = line2.x2; + var y4 = line2.y2; - /** - * Pauses the sound. - * - * @method Phaser.Sound.BaseSound#pause - * @since 3.0.0 - * - * @return {boolean} Whether the sound was paused successfully. - */ - pause: function () - { - if (this.isPaused || !this.isPlaying) - { - return false; - } - this.isPlaying = false; - this.isPaused = true; - return true; - }, + var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); + var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); + var deNom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); - /** - * Resumes the sound. - * - * @method Phaser.Sound.BaseSound#resume - * @since 3.0.0 - * - * @return {boolean} Whether the sound was resumed successfully. - */ - resume: function () - { - if (!this.isPaused || this.isPlaying) - { - return false; - } - this.isPlaying = true; - this.isPaused = false; - return true; - }, + // Make sure there is not a division by zero - this also indicates that the lines are parallel. + // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). + // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). - /** - * Stop playing this sound. - * - * @method Phaser.Sound.BaseSound#stop - * @since 3.0.0 - * - * @return {boolean} Whether the sound was stopped successfully. - */ - stop: function () + if (deNom === 0) { - if (!this.isPaused && !this.isPlaying) - { - return false; - } - this.isPlaying = false; - this.isPaused = false; - this.resetConfig(); - return true; - }, + return false; + } - /** - * Method used internally for applying config values to some of the sound properties. - * - * @method Phaser.Sound.BaseSound#applyConfig - * @protected - * @since 3.0.0 - */ - applyConfig: function () - { - this.mute = this.currentConfig.mute; - this.volume = this.currentConfig.volume; - this.rate = this.currentConfig.rate; - this.detune = this.currentConfig.detune; - this.loop = this.currentConfig.loop; - }, + // Calculate the intermediate fractional point that the lines potentially intersect. - /** - * Method used internally for resetting values of some of the config properties. - * - * @method Phaser.Sound.BaseSound#resetConfig - * @protected - * @since 3.0.0 - */ - resetConfig: function () - { - this.currentConfig.seek = 0; - this.currentConfig.delay = 0; - }, + var uA = numA / deNom; + var uB = numB / deNom; - /** - * Update method called automatically by sound manager on every game step. - * - * @method Phaser.Sound.BaseSound#update - * @override - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. - */ - update: NOOP, + // The fractional point will be between 0 and 1 inclusive if the lines intersect. + // If the fractional calculation is larger than 1 or smaller than 0 the lines would need to be longer to intersect. - /** - * Destroys this sound and all associated events and marks it for removal from the sound manager. - * - * @method Phaser.Sound.BaseSound#destroy - * @since 3.0.0 - */ - destroy: function () + if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) { - if (this.pendingRemove) - { - return; - } - this.pendingRemove = true; - this.manager = null; - this.key = ''; - this.removeAllListeners(); - this.isPlaying = false; - this.isPaused = false; - this.config = null; - this.currentConfig = null; - this.markers = null; - this.currentMarker = null; - }, + out.x = x1 + (uA * (x2 - x1)); + out.y = y1 + (uA * (y2 - y1)); - /** - * Method used internally to calculate total playback rate of the sound. - * - * @method Phaser.Sound.BaseSound#setRate - * @protected - * @since 3.0.0 - */ - setRate: function () - { - var cent = 1.0005777895065548; // Math.pow(2, 1/1200); - var totalDetune = this.currentConfig.detune + this.manager.detune; - var detuneRate = Math.pow(cent, totalDetune); - this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate; + return true; } -}); -Object.defineProperty(BaseSound.prototype, 'rate', { - get: function () - { - return this.currentConfig.rate; - }, - set: function (value) - { - this.currentConfig.rate = value; - this.setRate(); - /** - * @event Phaser.Sound.BaseSound#rate - * @param {Phaser.Sound.BaseSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.BaseSound#rate property. - */ - this.emit('rate', this, value); - } -}); -Object.defineProperty(BaseSound.prototype, 'detune', { - get: function () - { - return this.currentConfig.detune; - }, - set: function (value) - { - this.currentConfig.detune = value; - this.setRate(); + return false; +}; - /** - * @event Phaser.Sound.BaseSound#detune - * @param {Phaser.Sound.BaseSound} sound - Reference to the sound that emitted event. - * @param {number} value - An updated value of Phaser.Sound.BaseSound#detune property. - */ - this.emit('detune', this, value); - } -}); -module.exports = BaseSound; +module.exports = LineToLine; /***/ }), -/* 86 */ -/***/ (function(module, exports, __webpack_require__) { +/* 90 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -14184,914 +15513,824 @@ module.exports = BaseSound; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); - /** - * @classdesc - * [description] + * Creates an XHRSettings Object with default values. * - * @class List - * @memberOf Phaser.Structs - * @constructor + * @function Phaser.Loader.XHRSettings * @since 3.0.0 * - * @param {any} parent - [description] + * @param {string} [responseType] - The responseType, such as 'text'. + * @param {boolean} [async=true] - Should the XHR request use async or not? + * @param {string} [user] - Optional username for the XHR request. + * @param {string} [password] - Optional password for the XHR request. + * @param {integer} [timeout=0] - Optional XHR timeout value. + * + * @return {Phaser.Loader.XHRSettings} The XHRSettings object as used by the Loader. */ -var List = new Class({ +var XHRSettings = function (responseType, async, user, password, timeout) +{ + if (responseType === undefined) { responseType = ''; } + if (async === undefined) { async = true; } + if (user === undefined) { user = ''; } + if (password === undefined) { password = ''; } + if (timeout === undefined) { timeout = 0; } - initialize: + // Before sending a request, set the xhr.responseType to "text", + // "arraybuffer", "blob", or "document", depending on your data needs. + // Note, setting xhr.responseType = '' (or omitting) will default the response to "text". - function List (parent) - { - /** - * The parent of this list. - * - * @name Phaser.Structs.List#parent - * @type {any} - * @since 3.0.0 - */ - this.parent = parent; + return { - /** - * The objects that belong to this collection. - * - * @name Phaser.Structs.List#list - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.list = []; - - /** - * [description] - * - * @name Phaser.Structs.List#position - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.position = 0; - }, - - /** - * [description] - * - * @method Phaser.Structs.List#add - * @since 3.0.0 - * - * @param {object} child - [description] - * - * @return {object} [description] - */ - add: function (child) - { - // Is child already in this display list? + // Ignored by the Loader, only used by File. + responseType: responseType, - if (this.getIndex(child) === -1) - { - this.list.push(child); - } + async: async, - return child; - }, + // credentials + user: user, + password: password, - /** - * [description] - * - * @method Phaser.Structs.List#addAt - * @since 3.0.0 - * - * @param {object} child - [description] - * @param {integer} index - [description] - * - * @return {object} [description] - */ - addAt: function (child, index) - { - if (index === undefined) { index = 0; } + // timeout in ms (0 = no timeout) + timeout: timeout, - if (this.list.length === 0) - { - return this.add(child); - } + // setRequestHeader + header: undefined, + headerValue: undefined, - if (index >= 0 && index <= this.list.length) - { - if (this.getIndex(child) === -1) - { - this.list.splice(index, 0, child); - } - } + // overrideMimeType + overrideMimeType: undefined - return child; - }, + }; +}; - /** - * [description] - * - * @method Phaser.Structs.List#addMultiple - * @since 3.0.0 - * - * @param {array} children - [description] - * - * @return {array} [description] - */ - addMultiple: function (children) - { - if (Array.isArray(children)) - { - for (var i = 0; i < children.length; i++) - { - this.add(children[i]); - } - } +module.exports = XHRSettings; - return children; - }, - /** - * [description] - * - * @method Phaser.Structs.List#getAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {object} [description] - */ - getAt: function (index) - { - return this.list[index]; - }, +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Structs.List#getIndex - * @since 3.0.0 - * - * @param {object} child - [description] - * - * @return {integer} [description] - */ - getIndex: function (child) - { - // Return -1 if given child isn't a child of this display list - return this.list.indexOf(child); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Given an array of objects, sort the array and return it, - * so that the objects are in index order with the lowest at the bottom. - * - * @method Phaser.Structs.List#sort - * @since 3.0.0 - * - * @param {array} children - [description] - * - * @return {array} [description] - */ - sort: function (children) - { - if (children === undefined) { children = this.list; } +var Class = __webpack_require__(0); +var Components = __webpack_require__(329); +var Sprite = __webpack_require__(37); - return children.sort(this.sortIndexHandler.bind(this)); - }, +/** + * @classdesc + * An Arcade Physics Sprite Game Object. + * + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @class Sprite + * @extends Phaser.GameObjects.Sprite + * @memberOf Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @extends Phaser.Physics.Arcade.Components.Acceleration + * @extends Phaser.Physics.Arcade.Components.Angular + * @extends Phaser.Physics.Arcade.Components.Bounce + * @extends Phaser.Physics.Arcade.Components.Debug + * @extends Phaser.Physics.Arcade.Components.Drag + * @extends Phaser.Physics.Arcade.Components.Enable + * @extends Phaser.Physics.Arcade.Components.Friction + * @extends Phaser.Physics.Arcade.Components.Gravity + * @extends Phaser.Physics.Arcade.Components.Immovable + * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Size + * @extends Phaser.Physics.Arcade.Components.Velocity + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.Animation + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + */ +var ArcadeSprite = new Class({ - /** - * [description] - * - * @method Phaser.Structs.List#sortIndexHandler - * @since 3.0.0 - * - * @param {object} childA - [description] - * @param {object} childB - [description] - * - * @return {integer} [description] - */ - sortIndexHandler: function (childA, childB) - { - // The lower the index, the lower down the display list they are - var indexA = this.getIndex(childA); - var indexB = this.getIndex(childB); + Extends: Sprite, - if (indexA < indexB) - { - return -1; - } - else if (indexA > indexB) - { - return 1; - } + Mixins: [ + Components.Acceleration, + Components.Angular, + Components.Bounce, + Components.Debug, + Components.Drag, + Components.Enable, + Components.Friction, + Components.Gravity, + Components.Immovable, + Components.Mass, + Components.Size, + Components.Velocity + ], - // Technically this shouldn't happen, but if the GO wasn't part of this display list then it'll - // have an index of -1, so in some cases it can - return 0; - }, + initialize: - /** - * Gets the first item from the set based on the property strictly equaling the value given. - * Returns null if not found. - * - * @method Phaser.Structs.List#getByKey - * @since 3.0.0 - * - * @param {string} property - The property to check against the value. - * @param {any} value - The value to check if the property strictly equals. - * - * @return {any} The item that was found, or null if nothing matched. - */ - getByKey: function (property, value) + function ArcadeSprite (scene, x, y, texture, frame) { - for (var i = 0; i < this.list.length; i++) - { - if (this.list[i][property] === value) - { - return this.list[i]; - } - } - - return null; - }, + Sprite.call(this, scene, x, y, texture, frame); + } - /** - * Searches the Group for the first instance of a child with the `name` - * property matching the given argument. Should more than one child have - * the same name only the first instance is returned. - * - * @method Phaser.Structs.List#getByName - * @since 3.0.0 - * - * @param {string} name - The name to search for. - * - * @return {any} The first child with a matching name, or null if none were found. - */ - getByName: function (name) - { - return this.getByKey('name', name); - }, +}); - /** - * Returns a random child from the group. - * - * @method Phaser.Structs.List#getRandom - * @since 3.0.0 - * - * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child). - * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from. - * - * @return {any} A random child of this Group. - */ - getRandom: function (startIndex, length) - { - if (startIndex === undefined) { startIndex = 0; } - if (length === undefined) { length = this.list.length; } +module.exports = ArcadeSprite; - if (length === 0 || length > this.list.length) - { - return null; - } - var randomIndex = startIndex + Math.floor(Math.random() * length); +/***/ }), +/* 92 */, +/* 93 */, +/* 94 */, +/* 95 */, +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { - return this.list[randomIndex]; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Structs.List#getFirst - * @since 3.0.0 - * - * @param {[type]} property - [description] - * @param {[type]} value - [description] - * @param {[type]} startIndex - [description] - * @param {[type]} endIndex - [description] - * - * @return {[type]} [description] - */ - getFirst: function (property, value, startIndex, endIndex) - { - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = this.list.length; } +/** + * @namespace Phaser.Tilemaps.Components + */ - for (var i = startIndex; i < endIndex; i++) - { - var child = this.list[i]; +module.exports = { - if (child[property] === value) - { - return child; - } - } + CalculateFacesAt: __webpack_require__(151), + CalculateFacesWithin: __webpack_require__(34), + Copy: __webpack_require__(874), + CreateFromTiles: __webpack_require__(875), + CullTiles: __webpack_require__(876), + Fill: __webpack_require__(877), + FilterTiles: __webpack_require__(878), + FindByIndex: __webpack_require__(879), + FindTile: __webpack_require__(880), + ForEachTile: __webpack_require__(881), + GetTileAt: __webpack_require__(97), + GetTileAtWorldXY: __webpack_require__(882), + GetTilesWithin: __webpack_require__(15), + GetTilesWithinShape: __webpack_require__(883), + GetTilesWithinWorldXY: __webpack_require__(884), + HasTileAt: __webpack_require__(346), + HasTileAtWorldXY: __webpack_require__(885), + IsInLayerBounds: __webpack_require__(74), + PutTileAt: __webpack_require__(152), + PutTileAtWorldXY: __webpack_require__(886), + PutTilesAt: __webpack_require__(887), + Randomize: __webpack_require__(888), + RemoveTileAt: __webpack_require__(347), + RemoveTileAtWorldXY: __webpack_require__(889), + RenderDebug: __webpack_require__(890), + ReplaceByIndex: __webpack_require__(345), + SetCollision: __webpack_require__(891), + SetCollisionBetween: __webpack_require__(892), + SetCollisionByExclusion: __webpack_require__(893), + SetCollisionByProperty: __webpack_require__(894), + SetCollisionFromCollisionGroup: __webpack_require__(895), + SetTileIndexCallback: __webpack_require__(896), + SetTileLocationCallback: __webpack_require__(897), + Shuffle: __webpack_require__(898), + SwapByIndex: __webpack_require__(899), + TileToWorldX: __webpack_require__(98), + TileToWorldXY: __webpack_require__(900), + TileToWorldY: __webpack_require__(99), + WeightedRandomize: __webpack_require__(901), + WorldToTileX: __webpack_require__(39), + WorldToTileXY: __webpack_require__(902), + WorldToTileY: __webpack_require__(40) - return null; - }, +}; - /** - * Returns all children in this List. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('visible', true)` would return only children that have their visible property set. - * - * Optionally you can specify a start and end index. For example if this List had 100 children, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 children in the List. - * - * @method Phaser.Structs.List#getAll - * @since 3.0.0 - * - * @param {string} [property] - An optional property to test against the value argument. - * @param {any} [value] - If property is set then Child.property must strictly equal this value to be included in the results. - * @param {integer} [startIndex=0] - The first child index to start the search from. - * @param {integer} [endIndex] - The last child index to search up until. - * - * @return {array} [description] - */ - getAll: function (property, value, startIndex, endIndex) - { - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = this.list.length; } - var output = []; +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { - for (var i = startIndex; i < endIndex; i++) - { - var child = this.list[i]; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (property) - { - if (child[property] === value) - { - output.push(child); - } - } - else - { - output.push(child); - } - } +var IsInLayerBounds = __webpack_require__(74); - return output; - }, +/** + * Gets a tile at the given tile coordinates from the given layer. + * + * @function Phaser.Tilemaps.Components.GetTileAt + * @since 3.0.0 + * + * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile + * object with an index of -1. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates + * were invalid. + */ +var GetTileAt = function (tileX, tileY, nonNull, layer) +{ + if (nonNull === undefined) { nonNull = false; } - /** - * [description] - * - * @method Phaser.Structs.List#count - * @since 3.0.0 - * - * @param {string} property - [description] - * @param {any} value - [description] - * - * @return {integer} [description] - */ - count: function (property, value) + if (IsInLayerBounds(tileX, tileY, layer)) { - var total = 0; - - for (var i = 0; i < this.list.length; i++) + var tile = layer.data[tileY][tileX]; + if (tile === null) { - var child = this.list[i]; - - if (child[property] === value) - { - total++; - } + return null; } - - return total; - }, - - /** - * [description] - * - * @method Phaser.Structs.List#swap - * @since 3.0.0 - * - * @param {object} child1 - [description] - * @param {object} child2 - [description] - */ - swap: function (child1, child2) - { - if (child1 === child2) + else if (tile.index === -1) { - return; + return nonNull ? tile : null; } - - var index1 = this.getIndex(child1); - var index2 = this.getIndex(child2); - - if (index1 < 0 || index2 < 0) + else { - throw new Error('List.swap: Supplied objects must be children of the same list'); + return tile; } + } + else + { + return null; + } +}; - this.list[index1] = child2; - this.list[index2] = child1; - }, +module.exports = GetTileAt; - /** - * [description] - * - * @method Phaser.Structs.List#moveTo - * @since 3.0.0 - * - * @param {object} child - [description] - * @param {integer} index - [description] - * - * @return {object} [description] - */ - moveTo: function (child, index) + +/***/ }), +/* 98 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldX + * @since 3.0.0 + * + * @param {integer} tileX - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} + */ +var TileToWorldX = function (tileX, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + var layerWorldX = 0; + + if (tilemapLayer) { - var currentIndex = this.getIndex(child); + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - if (currentIndex === -1 || index < 0 || index >= this.list.length) - { - throw new Error('List.moveTo: The supplied index is out of bounds'); - } + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - // Remove - this.list.splice(currentIndex, 1); + tileWidth *= tilemapLayer.scaleX; + } - // Add in new location - this.list.splice(index, 0, child); + return layerWorldX + tileX * tileWidth; +}; - return child; - }, +module.exports = TileToWorldX; - /** - * [description] - * - * @method Phaser.Structs.List#remove - * @since 3.0.0 - * - * @param {object} child - [description] - * - * @return {object} [description] - */ - remove: function (child) - { - var index = this.list.indexOf(child); - if (index !== -1) - { - this.list.splice(index, 1); - } - - return child; - }, +/***/ }), +/* 99 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Structs.List#removeAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {object} [description] - */ - removeAt: function (index) +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldY + * @since 3.0.0 + * + * @param {integer} tileY - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} + */ +var TileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) { - var child = this.list[index]; + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - if (child) - { - this.children.splice(index, 1); - } + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - return child; - }, + tileHeight *= tilemapLayer.scaleY; + } - /** - * [description] - * - * @method Phaser.Structs.List#removeBetween - * @since 3.0.0 - * - * @param {integer} beginIndex - [description] - * @param {integer} endIndex - [description] - * - * @return {array} [description] - */ - removeBetween: function (beginIndex, endIndex) + return layerWorldY + tileY * tileHeight; +}; + +module.exports = TileToWorldY; + + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A Tileset is a combination of an image containing the tiles and a container for data about + * each tile. + * + * @class Tileset + * @memberOf Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {string} name - The name of the tileset in the map data. + * @param {integer} firstgid - The first tile index this tileset contains. + * @param {integer} [tileWidth=32] - Width of each tile (in pixels). + * @param {integer} [tileHeight=32] - Height of each tile (in pixels). + * @param {integer} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). + * @param {integer} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). + * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. + * These typically are custom properties created in Tiled when editing a tileset. + * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled + * when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor. + */ +var Tileset = new Class({ + + initialize: + + function Tileset (name, firstgid, tileWidth, tileHeight, tileMargin, tileSpacing, tileProperties, tileData) { - if (beginIndex === undefined) { beginIndex = 0; } - if (endIndex === undefined) { endIndex = this.list.length; } + if (tileWidth === undefined || tileWidth <= 0) { tileWidth = 32; } + if (tileHeight === undefined || tileHeight <= 0) { tileHeight = 32; } + if (tileMargin === undefined) { tileMargin = 0; } + if (tileSpacing === undefined) { tileSpacing = 0; } + if (tileProperties === undefined) { tileProperties = {}; } + if (tileData === undefined) { tileData = {}; } - var range = endIndex - beginIndex; + /** + * The name of the Tileset. + * + * @name Phaser.Tilemaps.Tileset#name + * @type {string} + * @since 3.0.0 + */ + this.name = name; - if (range > 0 && range <= endIndex) - { - var removed = this.list.splice(beginIndex, range); + /** + * The starting index of the first tile index this Tileset contains. + * + * @name Phaser.Tilemaps.Tileset#firstgid + * @type {integer} + * @since 3.0.0 + */ + this.firstgid = firstgid; - return removed; - } - else if (range === 0 && this.list.length === 0) - { - return []; - } - else - { - throw new Error('List.removeBetween: Range Error, numeric values are outside the acceptable range'); - } + /** + * The width of each tile (in pixels). Use setTileSize to change. + * + * @name Phaser.Tilemaps.Tileset#tileWidth + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.tileWidth = tileWidth; + + /** + * The height of each tile (in pixels). Use setTileSize to change. + * + * @name Phaser.Tilemaps.Tileset#tileHeight + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.tileHeight = tileHeight; + + /** + * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.Tileset#tileMargin + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.tileMargin = tileMargin; + + /** + * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.Tileset#tileSpacing + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.tileSpacing = tileSpacing; + + /** + * Tileset-specific properties per tile that are typically defined in the Tiled editor in the + * Tileset editor. + * + * @name Phaser.Tilemaps.Tileset#tileProperties + * @type {object} + * @since 3.0.0 + */ + this.tileProperties = tileProperties; + + /** + * Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within + * the Tileset collision editor. This is where collision objects and terrain are stored. + * + * @name Phaser.Tilemaps.Tileset#tileData + * @type {object} + * @since 3.0.0 + */ + this.tileData = tileData; + + /** + * The cached image that contains the individual tiles. Use setImage to set. + * + * @name Phaser.Tilemaps.Tileset#image + * @type {Phaser.Textures.Texture|null} + * @readOnly + * @since 3.0.0 + */ + this.image = null; + + /** + * The number of tile rows in the the tileset. + * + * @name Phaser.Tilemaps.Tileset#rows + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.rows = 0; + + /** + * The number of tile columns in the tileset. + * + * @name Phaser.Tilemaps.Tileset#columns + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.columns = 0; + + /** + * The total number of tiles in the tileset. + * + * @name Phaser.Tilemaps.Tileset#total + * @type {integer} + * @readOnly + * @since 3.0.0 + */ + this.total = 0; + + /** + * The look-up table to specific tile image texture coordinates (UV in pixels). Each element + * contains the coordinates for a tile in an object of the form {x, y}. + * + * @name Phaser.Tilemaps.Tileset#texCoordinates + * @type {object[]} + * @readOnly + * @since 3.0.0 + */ + this.texCoordinates = []; }, /** - * Removes all the items. + * Get a tiles properties that are stored in the Tileset. Returns null if tile index is not + * contained in this Tileset. This is typically defined in Tiled under the Tileset editor. * - * @method Phaser.Structs.List#removeAll + * @method Phaser.Tilemaps.Tileset#getTileProperties * @since 3.0.0 * - * @return {Phaser.Structs.List} This List object. + * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {object|undefined|null} */ - removeAll: function () + getTileProperties: function (tileIndex) { - var i = this.list.length; - - while (i--) - { - this.remove(this.list[i]); - } + if (!this.containsTileIndex(tileIndex)) { return null; } - return this; + return this.tileProperties[tileIndex - this.firstgid]; }, /** - * Brings the given child to the top of this List. + * Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained + * in this Tileset. This is typically defined in Tiled and will contain both Tileset collision + * info and terrain mapping. * - * @method Phaser.Structs.List#bringToTop + * @method Phaser.Tilemaps.Tileset#getTileData * @since 3.0.0 * - * @param {object} child - [description] - * - * @return {object} [description] + * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {object|undefined|null} */ - bringToTop: function (child) + getTileData: function (tileIndex) { - if (this.getIndex(child) < this.list.length) - { - this.remove(child); - this.add(child); - } + if (!this.containsTileIndex(tileIndex)) { return null; } - return child; + return this.tileData[tileIndex - this.firstgid]; }, /** - * Sends the given child to the bottom of this List. + * Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not + * contained in this Tileset. This is typically defined within Tiled's tileset collision editor. * - * @method Phaser.Structs.List#sendToBack + * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup * @since 3.0.0 * - * @param {object} child - [description] - * - * @return {object} [description] + * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {object|null} */ - sendToBack: function (child) + getTileCollisionGroup: function (tileIndex) { - if (this.getIndex(child) > 0) - { - this.remove(child); - this.addAt(child, 0); - } + var data = this.getTileData(tileIndex); - return child; + return (data && data.objectgroup) ? data.objectgroup : null; }, /** - * Moves the given child up one place in this group unless it's already at the top. + * Returns true if and only if this Tileset contains the given tile index. * - * @method Phaser.Structs.List#moveUp + * @method Phaser.Tilemaps.Tileset#containsTileIndex * @since 3.0.0 * - * @param {object} child - [description] - * - * @return {object} [description] + * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {boolean} */ - moveUp: function (child) + containsTileIndex: function (tileIndex) { - var a = this.getIndex(child); - - if (a !== -1 && a < this.list.length - 1) - { - var b = this.getAt(a + 1); - - if (b) - { - this.swap(child, b); - } - } - - return child; + return ( + tileIndex >= this.firstgid && + tileIndex < (this.firstgid + this.total) + ); }, /** - * Moves the given child down one place in this group unless it's already at the bottom. + * Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index. + * Returns null if tile index is not contained in this Tileset. * - * @method Phaser.Structs.List#moveDown + * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates * @since 3.0.0 * - * @param {object} child - [description] - * - * @return {object} [description] + * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {object|null} Object in the form { x, y } representing the top-left UV coordinate + * within the Tileset image. */ - moveDown: function (child) + getTileTextureCoordinates: function (tileIndex) { - var a = this.getIndex(child); - - if (a > 0) - { - var b = this.getAt(a - 1); - - if (b) - { - this.swap(child, b); - } - } + if (!this.containsTileIndex(tileIndex)) { return null; } - return child; + return this.texCoordinates[tileIndex - this.firstgid]; }, /** - * Reverses the order of all children in this List. + * Sets the image associated with this Tileset and updates the tile data (rows, columns, etc.). * - * @method Phaser.Structs.List#reverse + * @method Phaser.Tilemaps.Tileset#setImage * @since 3.0.0 * - * @return {Phaser.Structs.List} This List object. + * @param {Phaser.Textures.Texture} texture - The image that contains the tiles. + * + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - reverse: function () + setImage: function (texture) { - this.list.reverse(); + this.image = texture; + + this.updateTileData(this.image.source[0].width, this.image.source[0].height); return this; }, /** - * [description] + * Sets the tile width & height and updates the tile data (rows, columns, etc.). * - * @method Phaser.Structs.List#shuffle + * @method Phaser.Tilemaps.Tileset#setTileSize * @since 3.0.0 * - * @return {Phaser.Structs.List} This List object. + * @param {integer} [tileWidth] - The width of a tile in pixels. + * @param {integer} [tileHeight] - The height of a tile in pixels. + * + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - shuffle: function () + setTileSize: function (tileWidth, tileHeight) { - for (var i = this.list.length - 1; i > 0; i--) + if (tileWidth !== undefined) { this.tileWidth = tileWidth; } + if (tileHeight !== undefined) { this.tileHeight = tileHeight; } + + if (this.image) { - var j = Math.floor(Math.random() * (i + 1)); - var temp = this.list[i]; - this.list[i] = this.list[j]; - this.list[j] = temp; + this.updateTileData(this.image.source[0].width, this.image.source[0].height); } return this; }, /** - * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. + * Sets the tile margin & spacing and updates the tile data (rows, columns, etc.). * - * @method Phaser.Structs.List#replace + * @method Phaser.Tilemaps.Tileset#setSpacing * @since 3.0.0 * - * @param {object} oldChild - The child in this List that will be replaced. - * @param {object} newChild - The child to be inserted into this List. - * - * @return {object} Returns the oldChild that was replaced within this group. + * @param {integer} [margin] - The margin around the tiles in the sheet (in pixels). + * @param {integer} [spacing] - The spacing between the tiles in the sheet (in pixels). + * + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - replace: function (oldChild, newChild) + setSpacing: function (margin, spacing) { - var index = this.getIndex(oldChild); + if (margin !== undefined) { this.tileMargin = margin; } + if (spacing !== undefined) { this.tileSpacing = spacing; } - if (index !== -1) + if (this.image) { - this.remove(oldChild); - - this.addAt(newChild, index); - - return oldChild; + this.updateTileData(this.image.source[0].width, this.image.source[0].height); } + + return this; }, /** - * [description] - * - * @method Phaser.Structs.List#exists - * @since 3.0.0 - * - * @param {object} child - [description] - * - * @return {boolean} True if the item is found in the list, otherwise false. - */ - exists: function (child) - { - return (this.list.indexOf(child) > -1); - }, - - /** - * Sets the property `key` to the given value on all members of this List. - * - * @method Phaser.Structs.List#setAll - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {any} value - [description] - */ - setAll: function (key, value) - { - for (var i = 0; i < this.list.length; i++) - { - if (this.list[i]) - { - this.list[i][key] = value; - } - } - }, - - /** - * Passes all children to the given callback. + * Updates tile texture coordinates and tileset data. * - * @method Phaser.Structs.List#each + * @method Phaser.Tilemaps.Tileset#updateTileData * @since 3.0.0 * - * @param {function} callback - The function to call. - * @param {object} [thisArg] - Value to use as `this` when executing callback. - * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. + * @param {integer} imageWidth - The (expected) width of the image to slice. + * @param {integer} imageHeight - The (expected) height of the image to slice. + * + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - each: function (callback, thisArg) + updateTileData: function (imageWidth, imageHeight) { - var args = [ null ]; - - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } + var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing); + var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing); - for (i = 0; i < this.list.length; i++) + if (rowCount % 1 !== 0 || colCount % 1 !== 0) { - args[0] = this.list[i]; - callback.apply(thisArg, args); + console.warn('Tileset ' + this.name + ' image tile area is not an even multiple of tile size'); } - }, - - /** - * [description] - * - * @method Phaser.Structs.List#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.removeAll(); - }, - - /** - * [description] - * - * @method Phaser.Structs.List#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAll(); - - this.list = []; - this.parent = null; - }, + // In Tiled a tileset image that is not an even multiple of the tile dimensions is truncated + // - hence the floor when calculating the rows/columns. + rowCount = Math.floor(rowCount); + colCount = Math.floor(colCount); - /** - * [description] - * - * @name Phaser.Structs.List#length - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - length: { + this.rows = rowCount; + this.columns = colCount; - get: function () - { - return this.list.length; - } + // In Tiled, "empty" spaces in a tileset count as tiles and hence count towards the gid + this.total = rowCount * colCount; - }, + this.texCoordinates.length = 0; - /** - * [description] - * - * @name Phaser.Structs.List#first - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - first: { + var tx = this.tileMargin; + var ty = this.tileMargin; - get: function () + for (var y = 0; y < this.rows; y++) { - this.position = 0; - - if (this.list.length > 0) - { - return this.list[0]; - } - else + for (var x = 0; x < this.columns; x++) { - return null; + this.texCoordinates.push({ x: tx, y: ty }); + tx += this.tileWidth + this.tileSpacing; } - } - - }, - /** - * [description] - * - * @name Phaser.Structs.List#last - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - last: { + tx = this.tileMargin; + ty += this.tileHeight + this.tileSpacing; + } - get: function () - { - if (this.list.length > 0) - { - this.position = this.list.length - 1; + return this; + } - return this.list[this.position]; - } - else - { - return null; - } - } +}); - }, +module.exports = Tileset; - /** - * [description] - * - * @name Phaser.Structs.List#next - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - next: { - get: function () - { - if (this.position < this.list.length) - { - this.position++; +/***/ }), +/* 101 */ +/***/ (function(module, exports) { - return this.list[this.position]; - } - else - { - return null; - } - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - }, +/** + * [description] + * + * @function Phaser.Tweens.Builders.GetNewValue + * @since 3.0.0 + * + * @param {object} source - [description] + * @param {string} key - [description] + * @param {any} defaultValue - [description] + * + * @return {function} [description] + */ +var GetNewValue = function (source, key, defaultValue) +{ + var valueCallback; - /** - * [description] - * - * @name Phaser.Structs.List#previous - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - previous: { + if (source.hasOwnProperty(key)) + { + var t = typeof(source[key]); - get: function () + if (t === 'function') { - if (this.position > 0) + valueCallback = function (index, totalTargets, target) { - this.position--; - - return this.list[this.position]; - } - else + return source[key](index, totalTargets, target); + }; + } + else + { + valueCallback = function () { - return null; - } + return source[key]; + }; } - + } + else if (typeof defaultValue === 'function') + { + valueCallback = defaultValue; + } + else + { + valueCallback = function () + { + return defaultValue; + }; } -}); + return valueCallback; +}; -module.exports = List; +module.exports = GetNewValue; /***/ }), -/* 87 */ -/***/ (function(module, exports) { +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -15099,170 +16338,129 @@ module.exports = List; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TWEEN_CONST = { +var Defaults = __webpack_require__(158); +var GetAdvancedValue = __webpack_require__(10); +var GetBoolean = __webpack_require__(73); +var GetEaseFunction = __webpack_require__(71); +var GetNewValue = __webpack_require__(101); +var GetProps = __webpack_require__(360); +var GetTargets = __webpack_require__(156); +var GetValue = __webpack_require__(4); +var GetValueOp = __webpack_require__(157); +var Tween = __webpack_require__(159); +var TweenData = __webpack_require__(160); - /** - * TweenData state. - * - * @name Phaser.Tweens.CREATED - * @type {integer} - * @since 3.0.0 - */ - CREATED: 0, +/** + * [description] + * + * @function Phaser.Tweens.Builders.TweenBuilder + * @since 3.0.0 + * + * @param {Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline} parent - [description] + * @param {object} config - [description] + * @param {Phaser.Tweens.Tween~ConfigDefaults} defaults - [description] + * + * @return {Phaser.Tweens.Tween} [description] + */ +var TweenBuilder = function (parent, config, defaults) +{ + if (defaults === undefined) + { + defaults = Defaults; + } - /** - * TweenData state. - * - * @name Phaser.Tweens.INIT - * @type {integer} - * @since 3.0.0 - */ - INIT: 1, + // Create arrays of the Targets and the Properties + var targets = (defaults.targets) ? defaults.targets : GetTargets(config); - /** - * TweenData state. - * - * @name Phaser.Tweens.DELAY - * @type {integer} - * @since 3.0.0 - */ - DELAY: 2, + // var props = (defaults.props) ? defaults.props : GetProps(config); + var props = GetProps(config); - /** - * TweenData state. - * - * @name Phaser.Tweens.OFFSET_DELAY - * @type {integer} - * @since 3.0.0 - */ - OFFSET_DELAY: 3, + // Default Tween values + var delay = GetNewValue(config, 'delay', defaults.delay); + var duration = GetNewValue(config, 'duration', defaults.duration); + var easeParams = GetValue(config, 'easeParams', defaults.easeParams); + var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); + var hold = GetNewValue(config, 'hold', defaults.hold); + var repeat = GetNewValue(config, 'repeat', defaults.repeat); + var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); + var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); + var flipX = GetBoolean(config, 'flipX', defaults.flipX); + var flipY = GetBoolean(config, 'flipY', defaults.flipY); - /** - * TweenData state. - * - * @name Phaser.Tweens.PENDING_RENDER - * @type {integer} - * @since 3.0.0 - */ - PENDING_RENDER: 4, + var data = []; - /** - * TweenData state. - * - * @name Phaser.Tweens.PLAYING_FORWARD - * @type {integer} - * @since 3.0.0 - */ - PLAYING_FORWARD: 5, + // Loop through every property defined in the Tween, i.e.: props { x, y, alpha } + for (var p = 0; p < props.length; p++) + { + var key = props[p].key; + var value = props[p].value; - /** - * TweenData state. - * - * @name Phaser.Tweens.PLAYING_BACKWARD - * @type {integer} - * @since 3.0.0 - */ - PLAYING_BACKWARD: 6, + // Create 1 TweenData per target, per property + for (var t = 0; t < targets.length; t++) + { + var ops = GetValueOp(key, value); - /** - * TweenData state. - * - * @name Phaser.Tweens.HOLD_DELAY - * @type {integer} - * @since 3.0.0 - */ - HOLD_DELAY: 7, + var tweenData = TweenData( + targets[t], + key, + ops.getEnd, + ops.getStart, + GetEaseFunction(GetValue(value, 'ease', ease), easeParams), + GetNewValue(value, 'delay', delay), + GetNewValue(value, 'duration', duration), + GetBoolean(value, 'yoyo', yoyo), + GetNewValue(value, 'hold', hold), + GetNewValue(value, 'repeat', repeat), + GetNewValue(value, 'repeatDelay', repeatDelay), + GetBoolean(value, 'flipX', flipX), + GetBoolean(value, 'flipY', flipY) + ); - /** - * TweenData state. - * - * @name Phaser.Tweens.REPEAT_DELAY - * @type {integer} - * @since 3.0.0 - */ - REPEAT_DELAY: 8, + data.push(tweenData); + } + } - /** - * TweenData state. - * - * @name Phaser.Tweens.COMPLETE - * @type {integer} - * @since 3.0.0 - */ - COMPLETE: 9, + var tween = new Tween(parent, data, targets); - // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future) + tween.offset = GetAdvancedValue(config, 'offset', null); + tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + tween.paused = GetBoolean(config, 'paused', false); + tween.useFrames = GetBoolean(config, 'useFrames', false); - /** - * Tween state. - * - * @name Phaser.Tweens.PENDING_ADD - * @type {integer} - * @since 3.0.0 - */ - PENDING_ADD: 20, + // Set the Callbacks + var scope = GetValue(config, 'callbackScope', tween); - /** - * Tween state. - * - * @name Phaser.Tweens.PAUSED - * @type {integer} - * @since 3.0.0 - */ - PAUSED: 21, + // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params + var tweenArray = [ tween, null ]; - /** - * Tween state. - * - * @name Phaser.Tweens.LOOP_DELAY - * @type {integer} - * @since 3.0.0 - */ - LOOP_DELAY: 22, + var callbacks = Tween.TYPES; - /** - * Tween state. - * - * @name Phaser.Tweens.ACTIVE - * @type {integer} - * @since 3.0.0 - */ - ACTIVE: 23, + for (var i = 0; i < callbacks.length; i++) + { + var type = callbacks[i]; - /** - * Tween state. - * - * @name Phaser.Tweens.COMPLETE_DELAY - * @type {integer} - * @since 3.0.0 - */ - COMPLETE_DELAY: 24, + var callback = GetValue(config, type, false); - /** - * Tween state. - * - * @name Phaser.Tweens.PENDING_REMOVE - * @type {integer} - * @since 3.0.0 - */ - PENDING_REMOVE: 25, + if (callback) + { + var callbackScope = GetValue(config, type + 'Scope', scope); + var callbackParams = GetValue(config, type + 'Params', []); - /** - * Tween state. - * - * @name Phaser.Tweens.REMOVED - * @type {integer} - * @since 3.0.0 - */ - REMOVED: 26 + // The null is reset to be the Tween target + tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); + } + } + return tween; }; -module.exports = TWEEN_CONST; +module.exports = TweenBuilder; /***/ }), -/* 88 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15272,297 +16470,625 @@ module.exports = TWEEN_CONST; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(1); -var MeshRender = __webpack_require__(655); +var Utils = __webpack_require__(41); /** * @classdesc - * A Mesh Game Object. + * [description] * - * @class Mesh - * @extends Phaser.GameObjects.GameObject - * @memberOf Phaser.GameObjects + * @class WebGLPipeline + * @memberOf Phaser.Renderer.WebGL * @constructor - * @webglOnly * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScaleMode - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {array} vertices - An array containing the vertices data for this Mesh. - * @param {array} uv - An array containing the uv data for this Mesh. - * @param {array} colors - An array containing the color data for this Mesh. - * @param {array} alphas - An array containing the alpha data for this Mesh. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {object} config - [description] */ -var Mesh = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Origin, - Components.Pipeline, - Components.ScaleMode, - Components.Size, - Components.Texture, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - MeshRender - ], +var WebGLPipeline = new Class({ initialize: - function Mesh (scene, x, y, vertices, uv, colors, alphas, texture, frame) + function WebGLPipeline (config) { - GameObject.call(this, scene, 'Mesh'); - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOrigin(); - this.initPipeline('TextureTintPipeline'); - - if (vertices.length !== uv.length) - { - throw new Error('Mesh Vertex count must match UV count'); - } - - var verticesUB = (vertices.length / 2) | 0; - - if (colors.length > 0 && colors.length < verticesUB) - { - throw new Error('Mesh Color count must match Vertex count'); - } - - if (alphas.length > 0 && alphas.length < verticesUB) - { - throw new Error('Mesh Alpha count must match Vertex count'); - } - - var i; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#name + * @type {string} + * @since 3.0.0 + */ + this.name = 'WebGLPipeline'; - if (colors.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - colors[i] = 0xFFFFFF; - } - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = config.game; - if (alphas.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - alphas[i] = 1.0; - } - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#view + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.view = config.game.canvas; /** * [description] * - * @name Phaser.GameObjects.Mesh#vertices - * @type {Float32Array} + * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution + * @type {number} * @since 3.0.0 */ - this.vertices = new Float32Array(vertices); + this.resolution = config.game.config.resolution; /** * [description] * - * @name Phaser.GameObjects.Mesh#uv - * @type {Float32Array} + * @name Phaser.Renderer.WebGL.WebGLPipeline#width + * @type {number} * @since 3.0.0 */ - this.uv = new Float32Array(uv); + this.width = config.game.config.width * this.resolution; /** * [description] * - * @name Phaser.GameObjects.Mesh#colors - * @type {Uint32Array} + * @name Phaser.Renderer.WebGL.WebGLPipeline#height + * @type {number} * @since 3.0.0 */ - this.colors = new Uint32Array(colors); + this.height = config.game.config.height * this.resolution; /** * [description] * - * @name Phaser.GameObjects.Mesh#alphas - * @type {Float32Array} + * @name Phaser.Renderer.WebGL.WebGLPipeline#gl + * @type {WebGLRenderingContext} * @since 3.0.0 */ - this.alphas = new Float32Array(alphas); - } + this.gl = config.gl; -}); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.vertexCount = 0; -module.exports = Mesh; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity + * @type {integer} + * @since 3.0.0 + */ + this.vertexCapacity = config.vertexCapacity; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = config.renderer; -/***/ }), -/* 89 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData + * @type {ArrayBuffer} + * @since 3.0.0 + */ + this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize)); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer + * @type {WebGLBuffer} + * @since 3.0.0 + */ + this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW); -var Point = __webpack_require__(5); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#program + * @type {WebGLProgram} + * @since 3.0.0 + */ + this.program = this.renderer.createProgram(config.vertShader, config.fragShader); -// This is based off an explanation and expanded math presented by Paul Bourke: -// See http:'local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes + * @type {object} + * @since 3.0.0 + */ + this.attributes = config.attributes; -/** - * [description] - * - * @function Phaser.Geom.Intersects.LineToLine - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line1 - [description] - * @param {Phaser.Geom.Line} line2 - [description] - * @param {Phaser.Geom.Point} [out] - [description] - * - * @return {boolean} [description] - */ -var LineToLine = function (line1, line2, out) -{ - if (out === undefined) { out = new Point(); } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize + * @type {integer} + * @since 3.0.0 + */ + this.vertexSize = config.vertexSize; - var x1 = line1.x1; - var y1 = line1.y1; - var x2 = line1.x2; - var y2 = line1.y2; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#topology + * @type {integer} + * @since 3.0.0 + */ + this.topology = config.topology; - var x3 = line2.x1; - var y3 = line2.y1; - var x4 = line2.x2; - var y4 = line2.y2; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes + * @type {Uint8Array} + * @since 3.0.0 + */ + this.bytes = new Uint8Array(this.vertexData); - var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); - var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); - var deNom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); + /** + * This will store the amount of components of 32 bit length + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount + * @type {integer} + * @since 3.0.0 + */ + this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl); - // Make sure there is not a division by zero - this also indicates that the lines are parallel. - // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). - // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). + /** + * Indicates if the current pipeline is flushing the contents to the GPU. + * When the variable is set the flush function will be locked. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked + * @type {boolean} + * @since 3.1.0 + */ + this.flushLocked = false; + }, - if (deNom === 0) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} size - [description] + * @param {int} type - [description] + * @param {boolean} normalized - [description] + * @param {int} offset - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + addAttribute: function (name, size, type, normalized, offset) { - return false; - } - - // Calculate the intermediate fractional point that the lines potentially intersect. + this.attributes.push({ + name: name, + size: size, + type: this.renderer.glFormats[type], + normalized: normalized, + offset: offset + }); - var uA = numA / deNom; - var uB = numB / deNom; + return this; + }, - // The fractional point will be between 0 and 1 inclusive if the lines intersect. - // If the fractional calculation is larger than 1 or smaller than 0 the lines would need to be longer to intersect. + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @since 3.0.0 + * + * @return {boolean} [description] + */ + shouldFlush: function () + { + return (this.vertexCount >= this.vertexCapacity); + }, - if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + resize: function (width, height, resolution) { - out.x = x1 + (uA * (x2 - x1)); - out.y = y1 + (uA * (y2 - y1)); + this.width = width * resolution; + this.height = height * resolution; + return this; + }, - return true; - } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + bind: function () + { + var gl = this.gl; + var vertexBuffer = this.vertexBuffer; + var attributes = this.attributes; + var program = this.program; + var renderer = this.renderer; + var vertexSize = this.vertexSize; - return false; -}; + renderer.setProgram(program); + renderer.setVertexBuffer(vertexBuffer); -module.exports = LineToLine; + for (var index = 0; index < attributes.length; ++index) + { + var element = attributes[index]; + var location = gl.getAttribLocation(program, element.name); + if (location >= 0) + { + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); + } + else + { + gl.disableVertexAttribArray(location); + } + } -/***/ }), -/* 90 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onBind: function () + { + // This is for updating uniform data it's called on each bind attempt. + return this; + }, -/** - * Creates an XHRSettings Object with default values. - * - * @function Phaser.Loader.XHRSettings - * @since 3.0.0 - * - * @param {string} [responseType] - The responseType, such as 'text'. - * @param {boolean} [async=true] - Should the XHR request use async or not? - * @param {string} [user] - Optional username for the XHR request. - * @param {string} [password] - Optional password for the XHR request. - * @param {integer} [timeout=0] - Optional XHR timeout value. - * - * @return {Phaser.Loader.XHRSettings} The XHRSettings object as used by the Loader. - */ -var XHRSettings = function (responseType, async, user, password, timeout) -{ - if (responseType === undefined) { responseType = ''; } - if (async === undefined) { async = true; } - if (user === undefined) { user = ''; } - if (password === undefined) { password = ''; } - if (timeout === undefined) { timeout = 0; } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onPreRender: function () + { + // called once every frame + return this; + }, - // Before sending a request, set the xhr.responseType to "text", - // "arraybuffer", "blob", or "document", depending on your data needs. - // Note, setting xhr.responseType = '' (or omitting) will default the response to "text". + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onRender: function () + { + // called for each camera + return this; + }, - return { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onPostRender: function () + { + // called once every frame + return this; + }, - // Ignored by the Loader, only used by File. - responseType: responseType, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + flush: function () + { + if (this.flushLocked) { return this; } - async: async, + this.flushLocked = true; - // credentials - user: user, - password: password, + var gl = this.gl; + var vertexCount = this.vertexCount; + var topology = this.topology; + var vertexSize = this.vertexSize; - // timeout in ms (0 = no timeout) - timeout: timeout, + if (vertexCount === 0) + { + this.flushLocked = false; + return; + } - // setRequestHeader - header: undefined, - headerValue: undefined, + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + gl.drawArrays(topology, 0, vertexCount); - // overrideMimeType - overrideMimeType: undefined + this.vertexCount = 0; + this.flushLocked = false; - }; -}; + return this; + }, -module.exports = XHRSettings; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + destroy: function () + { + var gl = this.gl; + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { + delete this.program; + delete this.vertexBuffer; + delete this.gl; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat1: function (name, x) + { + this.renderer.setFloat1(this.program, name, x); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat2: function (name, x, y) + { + + this.renderer.setFloat2(this.program, name, x, y); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat3: function (name, x, y, z) + { + + this.renderer.setFloat3(this.program, name, x, y, z); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * @param {float} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat4: function (name, x, y, z, w) + { + + this.renderer.setFloat4(this.program, name, x, y, z, w); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt1: function (name, x) + { + this.renderer.setInt1(this.program, name, x); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt2: function (name, x, y) + { + this.renderer.setInt2(this.program, name, x, y); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * @param {int} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt3: function (name, x, y, z) + { + this.renderer.setInt3(this.program, name, x, y, z); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * @param {int} z - [description] + * @param {int} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt4: function (name, x, y, z, w) + { + this.renderer.setInt4(this.program, name, x, y, z, w); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix2: function (name, transpose, matrix) + { + this.renderer.setMatrix2(this.program, name, transpose, matrix); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix3: function (name, transpose, matrix) + { + this.renderer.setMatrix3(this.program, name, transpose, matrix); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix4: function (name, transpose, matrix) + { + this.renderer.setMatrix4(this.program, name, transpose, matrix); + return this; + } + +}); + +module.exports = WebGLPipeline; + + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -15570,99 +17096,77 @@ module.exports = XHRSettings; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(327); -var Sprite = __webpack_require__(37); +var Clone = __webpack_require__(53); /** - * @classdesc - * An Arcade Physics Sprite Game Object. - * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. - * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * Creates a new Object using all values from obj1 and obj2. + * If a value exists in both obj1 and obj2, the value in obj1 is used. * - * @class Sprite - * @extends Phaser.GameObjects.Sprite - * @memberOf Phaser.Physics.Arcade - * @constructor + * @function Phaser.Utils.Object.Merge * @since 3.0.0 * - * @extends Phaser.Physics.Arcade.Components.Acceleration - * @extends Phaser.Physics.Arcade.Components.Angular - * @extends Phaser.Physics.Arcade.Components.Bounce - * @extends Phaser.Physics.Arcade.Components.Debug - * @extends Phaser.Physics.Arcade.Components.Drag - * @extends Phaser.Physics.Arcade.Components.Enable - * @extends Phaser.Physics.Arcade.Components.Friction - * @extends Phaser.Physics.Arcade.Components.Gravity - * @extends Phaser.Physics.Arcade.Components.Immovable - * @extends Phaser.Physics.Arcade.Components.Mass - * @extends Phaser.Physics.Arcade.Components.Size - * @extends Phaser.Physics.Arcade.Components.Velocity - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.Animation - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScaleMode - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @param {object} obj1 - [description] + * @param {object} obj2 - [description] * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @return {object} [description] */ -var ArcadeSprite = new Class({ +var Merge = function (obj1, obj2) +{ + var clone = Clone(obj1); - Extends: Sprite, + for (var key in obj2) + { + if (!clone.hasOwnProperty(key)) + { + clone[key] = obj2[key]; + } + } - Mixins: [ - Components.Acceleration, - Components.Angular, - Components.Bounce, - Components.Debug, - Components.Drag, - Components.Enable, - Components.Friction, - Components.Gravity, - Components.Immovable, - Components.Mass, - Components.Size, - Components.Velocity - ], + return clone; +}; - initialize: +module.exports = Merge; - function ArcadeSprite (scene, x, y, texture, frame) - { - Sprite.call(this, scene, x, y, texture, frame); - } -}); +/***/ }), +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = ArcadeSprite; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(5); + +/** + * Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle. + * + * @function Phaser.Geom.Circle.CircumferencePoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. + * @param {number} angle - The angle from the center of the Circle to the circumference to return the point from. Given in radians. + * @param {Phaser.Geom.Point|object} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. + * + * @return {Phaser.Geom.Point|object} A Point object where the `x` and `y` properties are the point on the circumference. + */ +var CircumferencePoint = function (circle, angle, out) +{ + if (out === undefined) { out = new Point(); } + + out.x = circle.x + (circle.radius * Math.cos(angle)); + out.y = circle.y + (circle.radius * Math.sin(angle)); + + return out; +}; + +module.exports = CircumferencePoint; /***/ }), -/* 92 */, -/* 93 */, -/* 94 */, -/* 95 */, -/* 96 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15671,60 +17175,40 @@ module.exports = ArcadeSprite; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Point = __webpack_require__(5); + /** - * @namespace Phaser.Tilemaps.Components + * Returns a uniformly distributed random point from anywhere within the given Circle. + * + * @function Phaser.Geom.Circle.Random + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get a random point from. + * @param {Phaser.Geom.Point|object} [point] - A Point or point-like object to set the random `x` and `y` values in. + * + * @return {Phaser.Geom.Point|object} A Point object with the random values set in the `x` and `y` properties. */ +var Random = function (circle, out) +{ + if (out === undefined) { out = new Point(); } -module.exports = { + var t = 2 * Math.PI * Math.random(); + var u = Math.random() + Math.random(); + var r = (u > 1) ? 2 - u : u; + var x = r * Math.cos(t); + var y = r * Math.sin(t); - CalculateFacesAt: __webpack_require__(152), - CalculateFacesWithin: __webpack_require__(34), - Copy: __webpack_require__(871), - CreateFromTiles: __webpack_require__(872), - CullTiles: __webpack_require__(873), - Fill: __webpack_require__(874), - FilterTiles: __webpack_require__(875), - FindByIndex: __webpack_require__(876), - FindTile: __webpack_require__(877), - ForEachTile: __webpack_require__(878), - GetTileAt: __webpack_require__(97), - GetTileAtWorldXY: __webpack_require__(879), - GetTilesWithin: __webpack_require__(15), - GetTilesWithinShape: __webpack_require__(880), - GetTilesWithinWorldXY: __webpack_require__(881), - HasTileAt: __webpack_require__(344), - HasTileAtWorldXY: __webpack_require__(882), - IsInLayerBounds: __webpack_require__(74), - PutTileAt: __webpack_require__(153), - PutTileAtWorldXY: __webpack_require__(883), - PutTilesAt: __webpack_require__(884), - Randomize: __webpack_require__(885), - RemoveTileAt: __webpack_require__(345), - RemoveTileAtWorldXY: __webpack_require__(886), - RenderDebug: __webpack_require__(887), - ReplaceByIndex: __webpack_require__(343), - SetCollision: __webpack_require__(888), - SetCollisionBetween: __webpack_require__(889), - SetCollisionByExclusion: __webpack_require__(890), - SetCollisionByProperty: __webpack_require__(891), - SetCollisionFromCollisionGroup: __webpack_require__(892), - SetTileIndexCallback: __webpack_require__(893), - SetTileLocationCallback: __webpack_require__(894), - Shuffle: __webpack_require__(895), - SwapByIndex: __webpack_require__(896), - TileToWorldX: __webpack_require__(98), - TileToWorldXY: __webpack_require__(897), - TileToWorldY: __webpack_require__(99), - WeightedRandomize: __webpack_require__(898), - WorldToTileX: __webpack_require__(39), - WorldToTileXY: __webpack_require__(899), - WorldToTileY: __webpack_require__(40) + out.x = circle.x + (x * circle.radius); + out.y = circle.y + (y * circle.radius); + return out; }; +module.exports = Random; + /***/ }), -/* 97 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15733,55 +17217,74 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsInLayerBounds = __webpack_require__(74); +var Perimeter = __webpack_require__(78); +var Point = __webpack_require__(5); /** - * Gets a tile at the given tile coordinates from the given layer. + * Position is a value between 0 and 1 where 0 = the top-left of the rectangle and 0.5 = the bottom right. * - * @function Phaser.Tilemaps.Components.GetTileAt + * @function Phaser.Geom.Rectangle.GetPoint * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile - * object with an index of -1. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @param {Phaser.Geom.Rectangle} rectangle - [description] + * @param {float} position - [description] + * @param {Phaser.Geom.Point|object} [out] - [description] + * + * @return {Phaser.Geom.Point} [description] */ -var GetTileAt = function (tileX, tileY, nonNull, layer) +var GetPoint = function (rectangle, position, out) { - if (nonNull === undefined) { nonNull = false; } + if (out === undefined) { out = new Point(); } - if (IsInLayerBounds(tileX, tileY, layer)) + if (position <= 0 || position >= 1) { - var tile = layer.data[tileY][tileX]; - if (tile === null) - { - return null; - } - else if (tile.index === -1) + out.x = rectangle.x; + out.y = rectangle.y; + + return out; + } + + var p = Perimeter(rectangle) * position; + + if (position > 0.5) + { + p -= (rectangle.width + rectangle.height); + + if (p <= rectangle.width) { - return nonNull ? tile : null; + // Face 3 + out.x = rectangle.right - p; + out.y = rectangle.bottom; } else { - return tile; + // Face 4 + out.x = rectangle.x; + out.y = rectangle.bottom - (p - rectangle.width); } } + else if (p <= rectangle.width) + { + // Face 1 + out.x = rectangle.x + p; + out.y = rectangle.y; + } else { - return null; + // Face 2 + out.x = rectangle.right; + out.y = rectangle.y + (p - rectangle.width); } + + return out; }; -module.exports = GetTileAt; +module.exports = GetPoint; /***/ }), -/* 98 */ -/***/ (function(module, exports) { +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -15789,43 +17292,35 @@ module.exports = GetTileAt; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Point = __webpack_require__(5); + /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layer's position, scale and scroll. + * [description] * - * @function Phaser.Tilemaps.Components.TileToWorldX + * @function Phaser.Geom.Rectangle.Random * @since 3.0.0 * - * @param {integer} tileX - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} + * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {Phaser.Geom.Point} out - [description] + * + * @return {Phaser.Geom.Point} [description] */ -var TileToWorldX = function (tileX, camera, layer) +var Random = function (rect, out) { - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; - var layerWorldX = 0; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + if (out === undefined) { out = new Point(); } - tileWidth *= tilemapLayer.scaleX; - } + out.x = rect.x + (Math.random() * rect.width); + out.y = rect.y + (Math.random() * rect.height); - return layerWorldX + tileX * tileWidth; + return out; }; -module.exports = TileToWorldX; +module.exports = Random; /***/ }), -/* 99 */ -/***/ (function(module, exports) { +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -15833,42 +17328,56 @@ module.exports = TileToWorldX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Length = __webpack_require__(66); +var Point = __webpack_require__(5); + /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layer's position, scale and scroll. + * [description] * - * @function Phaser.Tilemaps.Components.TileToWorldY + * @function Phaser.Geom.Line.GetPoints * @since 3.0.0 * - * @param {integer} tileY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} + * @param {Phaser.Geom.Line} line - [description] + * @param {integer} quantity - [description] + * @param {integer} [stepRate] - [description] + * @param {array} out - [description] + * + * @return {array} [description] */ -var TileToWorldY = function (tileY, camera, layer) +var GetPoints = function (line, quantity, stepRate, out) { - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; + if (out === undefined) { out = []; } - if (tilemapLayer) + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity) { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + quantity = Length(line) / stepRate; + } - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + var x1 = line.x1; + var y1 = line.y1; - tileHeight *= tilemapLayer.scaleY; + var x2 = line.x2; + var y2 = line.y2; + + for (var i = 0; i < quantity; i++) + { + var position = i / quantity; + + var x = x1 + (x2 - x1) * position; + var y = y1 + (y2 - y1) * position; + + out.push(new Point(x, y)); } - return layerWorldY + tileY * tileHeight; + return out; }; -module.exports = TileToWorldY; +module.exports = GetPoints; /***/ }), -/* 100 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15877,453 +17386,493 @@ module.exports = TileToWorldY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); +var Point = __webpack_require__(5); /** - * @classdesc - * A Tileset is a combination of an image containing the tiles and a container for data about - * each tile. + * Returns a uniformly distributed random point from anywhere within the given Ellipse. * - * @class Tileset - * @memberOf Phaser.Tilemaps - * @constructor + * @function Phaser.Geom.Ellipse.Random * @since 3.0.0 * - * @param {string} name - The name of the tileset in the map data. - * @param {integer} firstgid - The first tile index this tileset contains. - * @param {integer} [tileWidth=32] - Width of each tile (in pixels). - * @param {integer} [tileHeight=32] - Height of each tile (in pixels). - * @param {integer} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). - * @param {integer} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). - * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. - * These typically are custom properties created in Tiled when editing a tileset. - * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled - * when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor. - */ -var Tileset = new Class({ + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get a random point from. + * @param {Phaser.Geom.Point|object} [point] - A Point or point-like object to set the random `x` and `y` values in. + * + * @return {Phaser.Geom.Point|object} A Point object with the random values set in the `x` and `y` properties. + */ +var Random = function (ellipse, out) +{ + if (out === undefined) { out = new Point(); } - initialize: + var p = Math.random() * Math.PI * 2; + var s = Math.sqrt(Math.random()); - function Tileset (name, firstgid, tileWidth, tileHeight, tileMargin, tileSpacing, tileProperties, tileData) + out.x = ellipse.x + ((s * Math.cos(p)) * ellipse.width / 2); + out.y = ellipse.y + ((s * Math.sin(p)) * ellipse.height / 2); + + return out; +}; + +module.exports = Random; + + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(5); + +/** + * [description] + * + * @function Phaser.Geom.Line.Random + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - [description] + * @param {Phaser.Geom.Point|object} [out] - [description] + * + * @return {Phaser.Geom.Point|object} [description] + */ +var Random = function (line, out) +{ + if (out === undefined) { out = new Point(); } + + var t = Math.random(); + + out.x = line.x1 + t * (line.x2 - line.x1); + out.y = line.y1 + t * (line.y2 - line.y1); + + return out; +}; + +module.exports = Random; + + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Point = __webpack_require__(5); + +/** + * [description] + * + * @function Phaser.Geom.Triangle.Random + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {Phaser.Geom.Point} [out] - [description] + * + * @return {Phaser.Geom.Point} [description] + */ +var Random = function (triangle, out) +{ + if (out === undefined) { out = new Point(); } + + // Basis vectors + var ux = triangle.x2 - triangle.x1; + var uy = triangle.y2 - triangle.y1; + + var vx = triangle.x3 - triangle.x1; + var vy = triangle.y3 - triangle.y1; + + // Random point within the unit square + var r = Math.random(); + var s = Math.random(); + + // Point outside the triangle? Remap it. + if (r + s >= 1) { - if (tileWidth === undefined || tileWidth <= 0) { tileWidth = 32; } - if (tileHeight === undefined || tileHeight <= 0) { tileHeight = 32; } - if (tileMargin === undefined) { tileMargin = 0; } - if (tileSpacing === undefined) { tileSpacing = 0; } - if (tileProperties === undefined) { tileProperties = {}; } - if (tileData === undefined) { tileData = {}; } + r = 1 - r; + s = 1 - s; + } - /** - * The name of the Tileset. - * - * @name Phaser.Tilemaps.Tileset#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; + out.x = triangle.x1 + ((ux * r) + (vx * s)); + out.y = triangle.y1 + ((uy * r) + (vy * s)); - /** - * The starting index of the first tile index this Tileset contains. - * - * @name Phaser.Tilemaps.Tileset#firstgid - * @type {integer} - * @since 3.0.0 - */ - this.firstgid = firstgid; + return out; +}; - /** - * The width of each tile (in pixels). Use setTileSize to change. - * - * @name Phaser.Tilemaps.Tileset#tileWidth - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - this.tileWidth = tileWidth; +module.exports = Random; - /** - * The height of each tile (in pixels). Use setTileSize to change. - * - * @name Phaser.Tilemaps.Tileset#tileHeight - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - this.tileHeight = tileHeight; - /** - * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.Tileset#tileMargin - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - this.tileMargin = tileMargin; +/***/ }), +/* 113 */ +/***/ (function(module, exports) { - /** - * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.Tileset#tileSpacing - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - this.tileSpacing = tileSpacing; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Tileset-specific properties per tile that are typically defined in the Tiled editor in the - * Tileset editor. - * - * @name Phaser.Tilemaps.Tileset#tileProperties - * @type {object} - * @since 3.0.0 - */ - this.tileProperties = tileProperties; +/** + * [description] + * + * @function Phaser.Math.RotateAroundDistance + * @since 3.0.0 + * + * @param {Phaser.Geom.Point|object} point - The Point to be rotated. + * @param {number} x - The horizontal coordinate to rotate around. + * @param {number} y - The vertical coordinate to rotate around. + * @param {number} angle - The angle of rotation in radians. + * @param {number} distance - [description] + * + * @return {Phaser.Geom.Point} [description] + */ +var RotateAroundDistance = function (point, x, y, angle, distance) +{ + var t = angle + Math.atan2(point.y - y, point.x - x); - /** - * Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within - * the Tileset collision editor. This is where collision objects and terrain are stored. - * - * @name Phaser.Tilemaps.Tileset#tileData - * @type {object} - * @since 3.0.0 - */ - this.tileData = tileData; + point.x = x + (distance * Math.cos(t)); + point.y = y + (distance * Math.sin(t)); - /** - * The cached image that contains the individual tiles. Use setImage to set. - * - * @name Phaser.Tilemaps.Tileset#image - * @type {Phaser.Textures.Texture|null} - * @readOnly - * @since 3.0.0 - */ - this.image = null; + return point; +}; - /** - * The number of tile rows in the the tileset. - * - * @name Phaser.Tilemaps.Tileset#rows - * @type {integer} - * @readOnly - * @since 3.0.0 - */ - this.rows = 0; +module.exports = RotateAroundDistance; + + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * The keys of a Map can be arbitrary values. + * var map = new Map([ + * [ 1, 'one' ], + * [ 2, 'two' ], + * [ 3, 'three' ] + * ]); + * + * @class Map + * @memberOf Phaser.Structs + * @constructor + * @since 3.0.0 + * + * @param {array} elements - [description] + */ +var Map = new Class({ + + initialize: + function Map (elements) + { /** - * The number of tile columns in the tileset. - * - * @name Phaser.Tilemaps.Tileset#columns - * @type {integer} - * @readOnly + * [description] + * + * @name Phaser.Structs.Map#entries + * @type {object} + * @default {} * @since 3.0.0 */ - this.columns = 0; + this.entries = {}; /** - * The total number of tiles in the tileset. - * - * @name Phaser.Tilemaps.Tileset#total - * @type {integer} - * @readOnly + * [description] + * + * @name Phaser.Structs.Map#size + * @type {number} + * @default 0 * @since 3.0.0 */ - this.total = 0; + this.size = 0; - /** - * The look-up table to specific tile image texture coordinates (UV in pixels). Each element - * contains the coordinates for a tile in an object of the form {x, y}. - * - * @name Phaser.Tilemaps.Tileset#texCoordinates - * @type {object[]} - * @readOnly - * @since 3.0.0 - */ - this.texCoordinates = []; + if (Array.isArray(elements)) + { + for (var i = 0; i < elements.length; i++) + { + this.set(elements[i][0], elements[i][1]); + } + } }, /** - * Get a tiles properties that are stored in the Tileset. Returns null if tile index is not - * contained in this Tileset. This is typically defined in Tiled under the Tileset editor. + * [description] * - * @method Phaser.Tilemaps.Tileset#getTileProperties + * @method Phaser.Structs.Map#set * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {object|undefined|null} + * @param {string} key - [description] + * @param {any} value - [description] + * + * @return {Phaser.Structs.Map} This Map object. */ - getTileProperties: function (tileIndex) + set: function (key, value) { - if (!this.containsTileIndex(tileIndex)) { return null; } + if (!this.has(key)) + { + this.entries[key] = value; + this.size++; + } - return this.tileProperties[tileIndex - this.firstgid]; + return this; }, /** - * Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained - * in this Tileset. This is typically defined in Tiled and will contain both Tileset collision - * info and terrain mapping. + * [description] * - * @method Phaser.Tilemaps.Tileset#getTileData + * @method Phaser.Structs.Map#get * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {object|undefined|null} + * @param {string} key - [description] + * + * @return {any} [description] */ - getTileData: function (tileIndex) + get: function (key) { - if (!this.containsTileIndex(tileIndex)) { return null; } - - return this.tileData[tileIndex - this.firstgid]; + if (this.has(key)) + { + return this.entries[key]; + } }, /** - * Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not - * contained in this Tileset. This is typically defined within Tiled's tileset collision editor. + * [description] * - * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup + * @method Phaser.Structs.Map#getArray * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {object|null} + * @return {array} [description] */ - getTileCollisionGroup: function (tileIndex) + getArray: function () { - var data = this.getTileData(tileIndex); + var output = []; + var entries = this.entries; - return (data && data.objectgroup) ? data.objectgroup : null; + for (var key in entries) + { + output.push(entries[key]); + } + + return output; }, /** - * Returns true if and only if this Tileset contains the given tile index. + * [description] * - * @method Phaser.Tilemaps.Tileset#containsTileIndex + * @method Phaser.Structs.Map#has * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {boolean} + * @param {string} key - [description] + * + * @return {boolean} [description] */ - containsTileIndex: function (tileIndex) + has: function (key) { - return ( - tileIndex >= this.firstgid && - tileIndex < (this.firstgid + this.total) - ); + return (this.entries.hasOwnProperty(key)); }, /** - * Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index. - * Returns null if tile index is not contained in this Tileset. + * [description] * - * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates + * @method Phaser.Structs.Map#delete * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {object|null} Object in the form { x, y } representing the top-left UV coordinate - * within the Tileset image. + * @param {string} key - [description] + * + * @return {Phaser.Structs.Map} This Map object. */ - getTileTextureCoordinates: function (tileIndex) + delete: function (key) { - if (!this.containsTileIndex(tileIndex)) { return null; } + if (this.has(key)) + { + delete this.entries[key]; + this.size--; + } - return this.texCoordinates[tileIndex - this.firstgid]; + return this; }, /** - * Sets the image associated with this Tileset and updates the tile data (rows, columns, etc.). + * [description] * - * @method Phaser.Tilemaps.Tileset#setImage + * @method Phaser.Structs.Map#clear * @since 3.0.0 * - * @param {Phaser.Textures.Texture} texture - The image that contains the tiles. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. + * @return {Phaser.Structs.Map} This Map object. */ - setImage: function (texture) + clear: function () { - this.image = texture; + Object.keys(this.entries).forEach(function (prop) + { + delete this.entries[prop]; - this.updateTileData(this.image.source[0].width, this.image.source[0].height); + }, this); + + this.size = 0; return this; }, /** - * Sets the tile width & height and updates the tile data (rows, columns, etc.). + * [description] * - * @method Phaser.Tilemaps.Tileset#setTileSize + * @method Phaser.Structs.Map#keys * @since 3.0.0 * - * @param {integer} [tileWidth] - The width of a tile in pixels. - * @param {integer} [tileHeight] - The height of a tile in pixels. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. + * @return {[type]} [description] */ - setTileSize: function (tileWidth, tileHeight) + keys: function () { - if (tileWidth !== undefined) { this.tileWidth = tileWidth; } - if (tileHeight !== undefined) { this.tileHeight = tileHeight; } + return Object.keys(this.entries); + }, - if (this.image) + /** + * [description] + * + * @method Phaser.Structs.Map#values + * @since 3.0.0 + * + * @return {array} [description] + */ + values: function () + { + var output = []; + var entries = this.entries; + + for (var key in entries) { - this.updateTileData(this.image.source[0].width, this.image.source[0].height); + output.push(entries[key]); } - return this; + return output; }, /** - * Sets the tile margin & spacing and updates the tile data (rows, columns, etc.). + * [description] * - * @method Phaser.Tilemaps.Tileset#setSpacing + * @method Phaser.Structs.Map#dump * @since 3.0.0 - * - * @param {integer} [margin] - The margin around the tiles in the sheet (in pixels). - * @param {integer} [spacing] - The spacing between the tiles in the sheet (in pixels). - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - setSpacing: function (margin, spacing) + dump: function () { - if (margin !== undefined) { this.tileMargin = margin; } - if (spacing !== undefined) { this.tileSpacing = spacing; } + var entries = this.entries; - if (this.image) + // eslint-disable-next-line no-console + console.group('Map'); + + for (var key in entries) { - this.updateTileData(this.image.source[0].width, this.image.source[0].height); + console.log(key, entries[key]); } - return this; + // eslint-disable-next-line no-console + console.groupEnd(); }, /** - * Updates tile texture coordinates and tileset data. + * [description] * - * @method Phaser.Tilemaps.Tileset#updateTileData + * @method Phaser.Structs.Map#each * @since 3.0.0 * - * @param {integer} imageWidth - The (expected) width of the image to slice. - * @param {integer} imageHeight - The (expected) height of the image to slice. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. + * @param {function} callback - [description] + * + * @return {Phaser.Structs.Map} This Map object. */ - updateTileData: function (imageWidth, imageHeight) + each: function (callback) { - var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing); - var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing); + var entries = this.entries; - if (rowCount % 1 !== 0 || colCount % 1 !== 0) + for (var key in entries) { - console.warn('Tileset ' + this.name + ' image tile area is not an even multiple of tile size'); + if (callback(key, entries[key]) === false) + { + break; + } } - // In Tiled a tileset image that is not an even multiple of the tile dimensions is truncated - // - hence the floor when calculating the rows/columns. - rowCount = Math.floor(rowCount); - colCount = Math.floor(colCount); - - this.rows = rowCount; - this.columns = colCount; - - // In Tiled, "empty" spaces in a tileset count as tiles and hence count towards the gid - this.total = rowCount * colCount; - - this.texCoordinates.length = 0; + return this; + }, - var tx = this.tileMargin; - var ty = this.tileMargin; + /** + * [description] + * + * @method Phaser.Structs.Map#contains + * @since 3.0.0 + * + * @param {any} value - [description] + * + * @return {boolean} [description] + */ + contains: function (value) + { + var entries = this.entries; - for (var y = 0; y < this.rows; y++) + for (var key in entries) { - for (var x = 0; x < this.columns; x++) + if (entries[key] === value) { - this.texCoordinates.push({ x: tx, y: ty }); - tx += this.tileWidth + this.tileSpacing; + return true; } - - tx = this.tileMargin; - ty += this.tileHeight + this.tileSpacing; } - return this; - } - -}); - -module.exports = Tileset; - - -/***/ }), -/* 101 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetNewValue - * @since 3.0.0 - * - * @param {object} source - [description] - * @param {string} key - [description] - * @param {any} defaultValue - [description] - * - * @return {function} [description] - */ -var GetNewValue = function (source, key, defaultValue) -{ - var valueCallback; + return false; + }, - if (source.hasOwnProperty(key)) + /** + * Merges all new keys from the given Map into this one + * If it encounters a key that already exists it will be skipped + * unless override = true. + * + * @method Phaser.Structs.Map#merge + * @since 3.0.0 + * + * @param {Phaser.Structs.Map} map - [description] + * @param {boolean} [override=false] - [description] + * + * @return {Phaser.Structs.Map} This Map object. + */ + merge: function (map, override) { - var t = typeof(source[key]); + if (override === undefined) { override = false; } - if (t === 'function') + var local = this.entries; + var source = map.entries; + + for (var key in source) { - valueCallback = function (index, totalTargets, target) + if (local.hasOwnProperty(key) && override) { - return source[key](index, totalTargets, target); - }; - } - else - { - valueCallback = function () + local[key] = source[key]; + } + else { - return source[key]; - }; + this.set(key, source[key]); + } } - } - else if (typeof defaultValue === 'function') - { - valueCallback = defaultValue; - } - else - { - valueCallback = function () - { - return defaultValue; - }; + + return this; } - return valueCallback; -}; +}); -module.exports = GetNewValue; +module.exports = Map; /***/ }), -/* 102 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -16332,665 +17881,824 @@ module.exports = GetNewValue; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(159); -var GetAdvancedValue = __webpack_require__(10); -var GetBoolean = __webpack_require__(73); -var GetEaseFunction = __webpack_require__(71); -var GetNewValue = __webpack_require__(101); -var GetProps = __webpack_require__(358); -var GetTargets = __webpack_require__(157); -var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(158); -var Tween = __webpack_require__(160); -var TweenData = __webpack_require__(161); +var Class = __webpack_require__(0); +var DegToRad = __webpack_require__(35); +var Rectangle = __webpack_require__(8); +var TransformMatrix = __webpack_require__(188); +var ValueToColor = __webpack_require__(116); +var Vector2 = __webpack_require__(6); /** + * @classdesc * [description] * - * @function Phaser.Tweens.Builders.TweenBuilder + * @class Camera + * @memberOf Phaser.Cameras.Scene2D + * @constructor * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline} parent - [description] - * @param {object} config - [description] - * @param {Phaser.Tweens.Tween~ConfigDefaults} defaults - [description] - * - * @return {Phaser.Tweens.Tween} [description] + * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. + * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. + * @param {number} width - The width of the Camera, in pixels. + * @param {number} height - The height of the Camera, in pixels. */ -var TweenBuilder = function (parent, config, defaults) -{ - if (defaults === undefined) - { - defaults = Defaults; - } - - // Create arrays of the Targets and the Properties - var targets = (defaults.targets) ? defaults.targets : GetTargets(config); - - // var props = (defaults.props) ? defaults.props : GetProps(config); - var props = GetProps(config); - - // Default Tween values - var delay = GetNewValue(config, 'delay', defaults.delay); - var duration = GetNewValue(config, 'duration', defaults.duration); - var easeParams = GetValue(config, 'easeParams', defaults.easeParams); - var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); - var hold = GetNewValue(config, 'hold', defaults.hold); - var repeat = GetNewValue(config, 'repeat', defaults.repeat); - var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - var flipX = GetBoolean(config, 'flipX', defaults.flipX); - var flipY = GetBoolean(config, 'flipY', defaults.flipY); +var Camera = new Class({ - var data = []; + initialize: - // Loop through every property defined in the Tween, i.e.: props { x, y, alpha } - for (var p = 0; p < props.length; p++) + function Camera (x, y, width, height) { - var key = props[p].key; - var value = props[p].value; + /** + * A reference to the Scene this camera belongs to. + * + * @name Phaser.Cameras.Scene2D.Camera#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene; - // Create 1 TweenData per target, per property - for (var t = 0; t < targets.length; t++) - { - var ops = GetValueOp(key, value); + /** + * The name of the Camera. This is left empty for your own use. + * + * @name Phaser.Cameras.Scene2D.Camera#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; - var tweenData = TweenData( - targets[t], - key, - ops.getEnd, - ops.getStart, - GetEaseFunction(GetValue(value, 'ease', ease), easeParams), - GetNewValue(value, 'delay', delay), - GetNewValue(value, 'duration', duration), - GetBoolean(value, 'yoyo', yoyo), - GetNewValue(value, 'hold', hold), - GetNewValue(value, 'repeat', repeat), - GetNewValue(value, 'repeatDelay', repeatDelay), - GetBoolean(value, 'flipX', flipX), - GetBoolean(value, 'flipY', flipY) - ); + /** + * The x position of the Camera, relative to the top-left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.Camera#x + * @type {number} + * @since 3.0.0 + */ + this.x = x; - data.push(tweenData); - } - } + /** + * The y position of the Camera, relative to the top-left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.Camera#y + * @type {number} + * @since 3.0.0 + */ + this.y = y; - var tween = new Tween(parent, data, targets); + /** + * The width of the Camera, in pixels. + * + * @name Phaser.Cameras.Scene2D.Camera#width + * @type {number} + * @since 3.0.0 + */ + this.width = width; - tween.offset = GetAdvancedValue(config, 'offset', null); - tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - tween.paused = GetBoolean(config, 'paused', false); - tween.useFrames = GetBoolean(config, 'useFrames', false); + /** + * The height of the Camera, in pixels. + * + * @name Phaser.Cameras.Scene2D.Camera#height + * @type {number} + * @since 3.0.0 + */ + this.height = height; - // Set the Callbacks - var scope = GetValue(config, 'callbackScope', tween); + /** + * Should this camera round its pixel values to integers? + * + * @name Phaser.Cameras.Scene2D.Camera#roundPixels + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.roundPixels = false; - // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params - var tweenArray = [ tween, null ]; + /** + * Is this Camera using a bounds to restrict scrolling movement? + * Set this property along with the bounds via `Camera.setBounds`. + * + * @name Phaser.Cameras.Scene2D.Camera#useBounds + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.useBounds = false; - var callbacks = Tween.TYPES; + /** + * The bounds the camera is restrained to during scrolling. + * + * @name Phaser.Cameras.Scene2D.Camera#_bounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.0.0 + */ + this._bounds = new Rectangle(); - for (var i = 0; i < callbacks.length; i++) - { - var type = callbacks[i]; + /** + * Does this Camera allow the Game Objects it renders to receive input events? + * + * @name Phaser.Cameras.Scene2D.Camera#inputEnabled + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.inputEnabled = true; - var callback = GetValue(config, type, false); + /** + * The horizontal scroll position of this camera. + * Optionally restricted via the Camera bounds. + * + * @name Phaser.Cameras.Scene2D.Camera#scrollX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.scrollX = 0; - if (callback) - { - var callbackScope = GetValue(config, type + 'Scope', scope); - var callbackParams = GetValue(config, type + 'Params', []); + /** + * The vertical scroll position of this camera. + * Optionally restricted via the Camera bounds. + * + * @name Phaser.Cameras.Scene2D.Camera#scrollY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.scrollY = 0; - // The null is reset to be the Tween target - tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); - } - } + /** + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * Set to 1 to return to the default zoom level. + * + * @name Phaser.Cameras.Scene2D.Camera#zoom + * @type {float} + * @default 1 + * @since 3.0.0 + */ + this.zoom = 1; - return tween; -}; + /** + * The rotation of the Camera. This influences the rendering of all Game Objects visible by this camera. + * + * @name Phaser.Cameras.Scene2D.Camera#rotation + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rotation = 0; -module.exports = TweenBuilder; + /** + * A local transform matrix used for internal calculations. + * + * @name Phaser.Cameras.Scene2D.Camera#matrix + * @type {TransformMatrix} + * @since 3.0.0 + */ + this.matrix = new TransformMatrix(1, 0, 0, 1, 0, 0); + /** + * Does this Camera have a transparent background? + * + * @name Phaser.Cameras.Scene2D.Camera#transparent + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.transparent = true; -/***/ }), -/* 103 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * TODO + * + * @name Phaser.Cameras.Scene2D.Camera#clearBeforeRender + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.clearBeforeRender = true; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * The background color of this Camera. Only used if `transparent` is `false`. + * + * @name Phaser.Cameras.Scene2D.Camera#backgroundColor + * @type {Phaser.Display.Color} + * @since 3.0.0 + */ + this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); -var Clone = __webpack_require__(52); + /** + * Should the camera cull Game Objects before rendering? + * In some special cases it may be beneficial to disable this. + * + * @name Phaser.Cameras.Scene2D.Camera#disableCull + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.disableCull = false; -/** - * Creates a new Object using all values from obj1 and obj2. - * If a value exists in both obj1 and obj2, the value in obj1 is used. - * - * @function Phaser.Utils.Object.Merge - * @since 3.0.0 - * - * @param {object} obj1 - [description] - * @param {object} obj2 - [description] - * - * @return {object} [description] - */ -var Merge = function (obj1, obj2) -{ - var clone = Clone(obj1); + /** + * A temporary array of culled objects. + * + * @name Phaser.Cameras.Scene2D.Camera#culledObjects + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.culledObjects = []; - for (var key in obj2) - { - if (!clone.hasOwnProperty(key)) - { - clone[key] = obj2[key]; - } - } + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_shakeDuration + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._shakeDuration = 0; - return clone; -}; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_shakeIntensity + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._shakeIntensity = 0; -module.exports = Merge; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_shakeOffsetX + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._shakeOffsetX = 0; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_shakeOffsetY + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._shakeOffsetY = 0; -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_fadeDuration + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._fadeDuration = 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_fadeRed + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._fadeRed = 0; -var Point = __webpack_require__(5); + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_fadeGreen + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._fadeGreen = 0; -/** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle. - * - * @function Phaser.Geom.Circle.CircumferencePoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. - * @param {number} angle - The angle from the center of the Circle to the circumference to return the point from. Given in radians. - * @param {Phaser.Geom.Point|object} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. - * - * @return {Phaser.Geom.Point|object} A Point object where the `x` and `y` properties are the point on the circumference. - */ -var CircumferencePoint = function (circle, angle, out) -{ - if (out === undefined) { out = new Point(); } + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_fadeBlue + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._fadeBlue = 0; - out.x = circle.x + (circle.radius * Math.cos(angle)); - out.y = circle.y + (circle.radius * Math.sin(angle)); + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_fadeAlpha + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._fadeAlpha = 0; - return out; -}; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_flashDuration + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._flashDuration = 0; -module.exports = CircumferencePoint; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_flashRed + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._flashRed = 1; + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_flashGreen + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._flashGreen = 1; -/***/ }), -/* 105 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_flashBlue + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._flashBlue = 1; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_flashAlpha + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._flashAlpha = 0; -var Point = __webpack_require__(5); + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_follow + * @type {?any} + * @private + * @default null + * @since 3.0.0 + */ + this._follow = null; -/** - * Returns a uniformly distributed random point from anywhere within the given Circle. - * - * @function Phaser.Geom.Circle.Random - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get a random point from. - * @param {Phaser.Geom.Point|object} [point] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {Phaser.Geom.Point|object} A Point object with the random values set in the `x` and `y` properties. - */ -var Random = function (circle, out) -{ - if (out === undefined) { out = new Point(); } + /** + * [description] + * + * @name Phaser.Cameras.Scene2D.Camera#_id + * @type {integer} + * @private + * @default 0 + * @since 3.0.0 + */ + this._id = 0; + }, - var t = 2 * Math.PI * Math.random(); - var u = Math.random() + Math.random(); - var r = (u > 1) ? 2 - u : u; - var x = r * Math.cos(t); - var y = r * Math.sin(t); + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#centerToBounds + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + centerToBounds: function () + { + this.scrollX = (this._bounds.width * 0.5) - (this.width * 0.5); + this.scrollY = (this._bounds.height * 0.5) - (this.height * 0.5); - out.x = circle.x + (x * circle.radius); - out.y = circle.y + (y * circle.radius); + return this; + }, - return out; -}; + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#centerToSize + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + centerToSize: function () + { + this.scrollX = this.width * 0.5; + this.scrollY = this.height * 0.5; -module.exports = Random; + return this; + }, + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#cull + * @since 3.0.0 + * + * @param {array} renderableObjects - [description] + * + * @return {array} [description] + */ + cull: function (renderableObjects) + { + if (this.disableCull) + { + return renderableObjects; + } -/***/ }), -/* 106 */ -/***/ (function(module, exports, __webpack_require__) { + var cameraMatrix = this.matrix.matrix; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; -var Perimeter = __webpack_require__(78); -var Point = __webpack_require__(5); + /* First Invert Matrix */ + var determinant = (mva * mvd) - (mvb * mvc); -/** - * Position is a value between 0 and 1 where 0 = the top-left of the rectangle and 0.5 = the bottom right. - * - * @function Phaser.Geom.Rectangle.GetPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectangle - [description] - * @param {float} position - [description] - * @param {Phaser.Geom.Point|object} [out] - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var GetPoint = function (rectangle, position, out) -{ - if (out === undefined) { out = new Point(); } + if (!determinant) + { + return renderableObjects; + } - if (position <= 0 || position >= 1) - { - out.x = rectangle.x; - out.y = rectangle.y; + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; - return out; - } + var scrollX = this.scrollX; + var scrollY = this.scrollY; + var cameraW = this.width; + var cameraH = this.height; + var culledObjects = this.culledObjects; + var length = renderableObjects.length; - var p = Perimeter(rectangle) * position; + determinant = 1 / determinant; - if (position > 0.5) - { - p -= (rectangle.width + rectangle.height); + culledObjects.length = 0; - if (p <= rectangle.width) - { - // Face 3 - out.x = rectangle.right - p; - out.y = rectangle.bottom; - } - else + for (var index = 0; index < length; ++index) { - // Face 4 - out.x = rectangle.x; - out.y = rectangle.bottom - (p - rectangle.width); - } - } - else if (p <= rectangle.width) - { - // Face 1 - out.x = rectangle.x + p; - out.y = rectangle.y; - } - else - { - // Face 2 - out.x = rectangle.right; - out.y = rectangle.y + (p - rectangle.width); - } + var object = renderableObjects[index]; - return out; -}; + if (!object.hasOwnProperty('width')) + { + culledObjects.push(object); + continue; + } -module.exports = GetPoint; + var objectW = object.width; + var objectH = object.height; + var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); + var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); + var tx = (objectX * mva + objectY * mvc + mve); + var ty = (objectX * mvb + objectY * mvd + mvf); + var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); + var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); + var cullW = cameraW + objectW; + var cullH = cameraH + objectH; + if (tx > -objectW || ty > -objectH || tx < cullW || ty < cullH || + tw > -objectW || th > -objectH || tw < cullW || th < cullH) + { + culledObjects.push(object); + } + } -/***/ }), -/* 107 */ -/***/ (function(module, exports, __webpack_require__) { + return culledObjects; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#cullHitTest + * @since 3.0.0 + * + * @param {array} interactiveObjects - [description] + * + * @return {array} [description] + */ + cullHitTest: function (interactiveObjects) + { + if (this.disableCull) + { + return interactiveObjects; + } -var Point = __webpack_require__(5); + var cameraMatrix = this.matrix.matrix; -/** - * [description] - * - * @function Phaser.Geom.Rectangle.Random - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {Phaser.Geom.Point} out - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var Random = function (rect, out) -{ - if (out === undefined) { out = new Point(); } + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; - out.x = rect.x + (Math.random() * rect.width); - out.y = rect.y + (Math.random() * rect.height); + /* First Invert Matrix */ + var determinant = (mva * mvd) - (mvb * mvc); - return out; -}; + if (!determinant) + { + return interactiveObjects; + } -module.exports = Random; + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; + var scrollX = this.scrollX; + var scrollY = this.scrollY; + var cameraW = this.width; + var cameraH = this.height; + var length = interactiveObjects.length; -/***/ }), -/* 108 */ -/***/ (function(module, exports, __webpack_require__) { + determinant = 1 / determinant; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var culledObjects = []; -var Length = __webpack_require__(65); -var Point = __webpack_require__(5); + for (var index = 0; index < length; ++index) + { + var object = interactiveObjects[index].gameObject; -/** - * [description] - * - * @function Phaser.Geom.Line.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - [description] - * @param {integer} quantity - [description] - * @param {integer} [stepRate] - [description] - * @param {array} out - [description] - * - * @return {array} [description] - */ -var GetPoints = function (line, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + if (!object.hasOwnProperty('width')) + { + culledObjects.push(interactiveObjects[index]); + continue; + } - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity) - { - quantity = Length(line) / stepRate; - } + var objectW = object.width; + var objectH = object.height; + var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); + var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); + var tx = (objectX * mva + objectY * mvc + mve); + var ty = (objectX * mvb + objectY * mvd + mvf); + var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); + var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); + var cullW = cameraW + objectW; + var cullH = cameraH + objectH; - var x1 = line.x1; - var y1 = line.y1; + if (tx > -objectW || ty > -objectH || tx < cullW || ty < cullH || + tw > -objectW || th > -objectH || tw < cullW || th < cullH) + { + culledObjects.push(interactiveObjects[index]); + } + } - var x2 = line.x2; - var y2 = line.y2; + return culledObjects; + }, - for (var i = 0; i < quantity; i++) + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#cullTilemap + * @since 3.0.0 + * + * @param {array} tilemap - [description] + * + * @return {array} [description] + */ + cullTilemap: function (tilemap) { - var position = i / quantity; + var cameraMatrix = this.matrix.matrix; - var x = x1 + (x2 - x1) * position; - var y = y1 + (y2 - y1) * position; + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; - out.push(new Point(x, y)); - } + /* First Invert Matrix */ + var determinant = (mva * mvd) - (mvb * mvc); - return out; -}; + if (!determinant) + { + return tiles; + } -module.exports = GetPoints; + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; + var tiles = tilemap.tiles; + var scrollX = this.scrollX; + var scrollY = this.scrollY; + var cameraW = this.width; + var cameraH = this.height; + var culledObjects = this.culledObjects; + var length = tiles.length; + var tileW = tilemap.tileWidth; + var tileH = tilemap.tileHeight; + var cullW = cameraW + tileW; + var cullH = cameraH + tileH; + var scrollFactorX = tilemap.scrollFactorX; + var scrollFactorY = tilemap.scrollFactorY; + determinant = 1 / determinant; -/***/ }), -/* 109 */ -/***/ (function(module, exports, __webpack_require__) { + culledObjects.length = 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var index = 0; index < length; ++index) + { + var tile = tiles[index]; + var tileX = (tile.x - (scrollX * scrollFactorX)); + var tileY = (tile.y - (scrollY * scrollFactorY)); + var tx = (tileX * mva + tileY * mvc + mve); + var ty = (tileX * mvb + tileY * mvd + mvf); + var tw = ((tileX + tileW) * mva + (tileY + tileH) * mvc + mve); + var th = ((tileX + tileW) * mvb + (tileY + tileH) * mvd + mvf); -var Point = __webpack_require__(5); + if (tx > -tileW && ty > -tileH && tw < cullW && th < cullH) + { + culledObjects.push(tile); + } + } -/** - * Returns a uniformly distributed random point from anywhere within the given Ellipse. - * - * @function Phaser.Geom.Ellipse.Random - * @since 3.0.0 - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get a random point from. - * @param {Phaser.Geom.Point|object} [point] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {Phaser.Geom.Point|object} A Point object with the random values set in the `x` and `y` properties. - */ -var Random = function (ellipse, out) -{ - if (out === undefined) { out = new Point(); } - - var p = Math.random() * Math.PI * 2; - var s = Math.sqrt(Math.random()); - - out.x = ellipse.x + ((s * Math.cos(p)) * ellipse.width / 2); - out.y = ellipse.y + ((s * Math.sin(p)) * ellipse.height / 2); - - return out; -}; - -module.exports = Random; - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Point = __webpack_require__(5); - -/** - * [description] - * - * @function Phaser.Geom.Line.Random - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - [description] - * @param {Phaser.Geom.Point|object} [out] - [description] - * - * @return {Phaser.Geom.Point|object} [description] - */ -var Random = function (line, out) -{ - if (out === undefined) { out = new Point(); } - - var t = Math.random(); - - out.x = line.x1 + t * (line.x2 - line.x1); - out.y = line.y1 + t * (line.y2 - line.y1); - - return out; -}; - -module.exports = Random; - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { + return culledObjects; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#fade + * @since 3.0.0 + * + * @param {number} duration - [description] + * @param {number} red - [description] + * @param {number} green - [description] + * @param {number} blue - [description] + * @param {number} force - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + fade: function (duration, red, green, blue, force) + { + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } -var Point = __webpack_require__(5); + if (!force && this._fadeAlpha > 0) + { + return this; + } -/** - * [description] - * - * @function Phaser.Geom.Triangle.Random - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {Phaser.Geom.Point} [out] - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var Random = function (triangle, out) -{ - if (out === undefined) { out = new Point(); } + this._fadeRed = red; + this._fadeGreen = green; + this._fadeBlue = blue; - // Basis vectors - var ux = triangle.x2 - triangle.x1; - var uy = triangle.y2 - triangle.y1; + if (duration <= 0) + { + duration = Number.MIN_VALUE; + } - var vx = triangle.x3 - triangle.x1; - var vy = triangle.y3 - triangle.y1; + this._fadeDuration = duration; + this._fadeAlpha = Number.MIN_VALUE; - // Random point within the unit square - var r = Math.random(); - var s = Math.random(); + return this; + }, - // Point outside the triangle? Remap it. - if (r + s >= 1) + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#flash + * @since 3.0.0 + * + * @param {number} duration - [description] + * @param {number} red - [description] + * @param {number} green - [description] + * @param {number} blue - [description] + * @param {number} force - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + flash: function (duration, red, green, blue, force) { - r = 1 - r; - s = 1 - s; - } + if (!force && this._flashAlpha > 0.0) + { + return this; + } - out.x = triangle.x1 + ((ux * r) + (vx * s)); - out.y = triangle.y1 + ((uy * r) + (vy * s)); + if (red === undefined) { red = 1.0; } + if (green === undefined) { green = 1.0; } + if (blue === undefined) { blue = 1.0; } - return out; -}; + this._flashRed = red; + this._flashGreen = green; + this._flashBlue = blue; -module.exports = Random; + if (duration <= 0) + { + duration = Number.MIN_VALUE; + } + this._flashDuration = duration; + this._flashAlpha = 1.0; -/***/ }), -/* 112 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#getWorldPoint + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {object|Phaser.Math.Vector2} output - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getWorldPoint: function (x, y, output) + { + if (output === undefined) { output = new Vector2(); } -/** - * [description] - * - * @function Phaser.Math.RotateAroundDistance - * @since 3.0.0 - * - * @param {Phaser.Geom.Point|object} point - The Point to be rotated. - * @param {number} x - The horizontal coordinate to rotate around. - * @param {number} y - The vertical coordinate to rotate around. - * @param {number} angle - The angle of rotation in radians. - * @param {number} distance - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var RotateAroundDistance = function (point, x, y, angle, distance) -{ - var t = angle + Math.atan2(point.y - y, point.x - x); + var cameraMatrix = this.matrix.matrix; - point.x = x + (distance * Math.cos(t)); - point.y = y + (distance * Math.sin(t)); + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; - return point; -}; + /* First Invert Matrix */ + var determinant = (mva * mvd) - (mvb * mvc); -module.exports = RotateAroundDistance; + if (!determinant) + { + output.x = x; + output.y = y; + return output; + } -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { + determinant = 1 / determinant; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var ima = mvd * determinant; + var imb = -mvb * determinant; + var imc = -mvc * determinant; + var imd = mva * determinant; + var ime = (mvc * mvf - mvd * mve) * determinant; + var imf = (mvb * mve - mva * mvf) * determinant; -var Class = __webpack_require__(0); + var c = Math.cos(this.rotation); + var s = Math.sin(this.rotation); -/** - * @classdesc - * The keys of a Map can be arbitrary values. - * var map = new Map([ - * [ 1, 'one' ], - * [ 2, 'two' ], - * [ 3, 'three' ] - * ]); - * - * @class Map - * @memberOf Phaser.Structs - * @constructor - * @since 3.0.0 - * - * @param {array} elements - [description] - */ -var Map = new Class({ + var zoom = this.zoom; - initialize: + var scrollX = this.scrollX; + var scrollY = this.scrollY; - function Map (elements) - { - /** - * [description] - * - * @name Phaser.Structs.Map#entries - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.entries = {}; + var sx = x + ((scrollX * c - scrollY * s) * zoom); + var sy = y + ((scrollX * s + scrollY * c) * zoom); - /** - * [description] - * - * @name Phaser.Structs.Map#size - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.size = 0; + /* Apply transform to point */ + output.x = (sx * ima + sy * imc + ime); + output.y = (sx * imb + sy * imd + imf); - if (Array.isArray(elements)) - { - for (var i = 0; i < elements.length; i++) - { - this.set(elements[i][0], elements[i][1]); - } - } + return output; }, /** * [description] * - * @method Phaser.Structs.Map#set + * @method Phaser.Cameras.Scene2D.Camera#ignore * @since 3.0.0 * - * @param {string} key - [description] - * @param {any} value - [description] + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjectOrArray - [description] * - * @return {Phaser.Structs.Map} This Map object. + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - set: function (key, value) + ignore: function (gameObjectOrArray) { - if (!this.has(key)) + if (gameObjectOrArray instanceof Array) { - this.entries[key] = value; - this.size++; + for (var index = 0; index < gameObjectOrArray.length; ++index) + { + gameObjectOrArray[index].cameraFilter |= this._id; + } + } + else + { + gameObjectOrArray.cameraFilter |= this._id; } return this; @@ -16999,74 +18707,126 @@ var Map = new Class({ /** * [description] * - * @method Phaser.Structs.Map#get + * @method Phaser.Cameras.Scene2D.Camera#preRender * @since 3.0.0 * - * @param {string} key - [description] + * @param {number} baseScale - [description] + * @param {number} resolution - [description] * - * @return {any} [description] */ - get: function (key) + preRender: function (baseScale, resolution) { - if (this.has(key)) + var width = this.width; + var height = this.height; + var zoom = this.zoom * baseScale; + var matrix = this.matrix; + var originX = width / 2; + var originY = height / 2; + var follow = this._follow; + + if (follow !== null) { - return this.entries[key]; + originX = follow.x; + originY = follow.y; + + this.scrollX = originX - width * 0.5; + this.scrollY = originY - height * 0.5; + } + + if (this.useBounds) + { + var bounds = this._bounds; + + var bw = Math.max(0, bounds.right - width); + var bh = Math.max(0, bounds.bottom - height); + + if (this.scrollX < bounds.x) + { + this.scrollX = bounds.x; + } + else if (this.scrollX > bw) + { + this.scrollX = bw; + } + + if (this.scrollY < bounds.y) + { + this.scrollY = bounds.y; + } + else if (this.scrollY > bh) + { + this.scrollY = bh; + } } + + if (this.roundPixels) + { + this.scrollX = Math.round(this.scrollX); + this.scrollY = Math.round(this.scrollY); + } + + matrix.loadIdentity(); + matrix.scale(resolution, resolution); + matrix.translate(this.x + originX, this.y + originY); + matrix.rotate(this.rotation); + matrix.scale(zoom, zoom); + matrix.translate(-originX, -originY); + matrix.translate(this._shakeOffsetX, this._shakeOffsetY); }, /** * [description] * - * @method Phaser.Structs.Map#getArray + * @method Phaser.Cameras.Scene2D.Camera#removeBounds * @since 3.0.0 * - * @return {array} [description] + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - getArray: function () + removeBounds: function () { - var output = []; - var entries = this.entries; + this.useBounds = false; - for (var key in entries) - { - output.push(entries[key]); - } + this._bounds.setEmpty(); - return output; + return this; }, /** * [description] * - * @method Phaser.Structs.Map#has + * @method Phaser.Cameras.Scene2D.Camera#setAngle * @since 3.0.0 * - * @param {string} key - [description] + * @param {number} value - [description] * - * @return {boolean} [description] + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - has: function (key) + setAngle: function (value) { - return (this.entries.hasOwnProperty(key)); + if (value === undefined) { value = 0; } + + this.rotation = DegToRad(value); + + return this; }, /** * [description] * - * @method Phaser.Structs.Map#delete + * @method Phaser.Cameras.Scene2D.Camera#setBackgroundColor * @since 3.0.0 * - * @param {string} key - [description] + * @param {integer} color - [description] * - * @return {Phaser.Structs.Map} This Map object. + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - delete: function (key) + setBackgroundColor: function (color) { - if (this.has(key)) - { - delete this.entries[key]; - this.size--; - } + if (color === undefined) { color = 'rgba(0,0,0,0)'; } + + this.backgroundColor = ValueToColor(color); + + this.transparent = (this.backgroundColor.alpha === 0); return this; }, @@ -17074,20 +18834,21 @@ var Map = new Class({ /** * [description] * - * @method Phaser.Structs.Map#clear + * @method Phaser.Cameras.Scene2D.Camera#setBounds * @since 3.0.0 * - * @return {Phaser.Structs.Map} This Map object. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - clear: function () + setBounds: function (x, y, width, height) { - Object.keys(this.entries).forEach(function (prop) - { - delete this.entries[prop]; - - }, this); + this._bounds.setTo(x, y, width, height); - this.size = 0; + this.useBounds = true; return this; }, @@ -17095,151 +18856,467 @@ var Map = new Class({ /** * [description] * - * @method Phaser.Structs.Map#keys + * @method Phaser.Cameras.Scene2D.Camera#setName * @since 3.0.0 * - * @return {[type]} [description] + * @param {string} value - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - keys: function () + setName: function (value) { - return Object.keys(this.entries); + if (value === undefined) { value = ''; } + + this.name = value; + + return this; }, /** * [description] * - * @method Phaser.Structs.Map#values + * @method Phaser.Cameras.Scene2D.Camera#setPosition * @since 3.0.0 * - * @return {array} [description] + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - values: function () + setPosition: function (x, y) { - var output = []; - var entries = this.entries; + if (y === undefined) { y = x; } - for (var key in entries) - { - output.push(entries[key]); - } + this.x = x; + this.y = y; - return output; + return this; }, /** * [description] * - * @method Phaser.Structs.Map#dump + * @method Phaser.Cameras.Scene2D.Camera#setRotation * @since 3.0.0 + * + * @param {number} value - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - dump: function () + setRotation: function (value) { - var entries = this.entries; - - // eslint-disable-next-line no-console - console.group('Map'); + if (value === undefined) { value = 0; } - for (var key in entries) - { - console.log(key, entries[key]); - } + this.rotation = value; - // eslint-disable-next-line no-console - console.groupEnd(); + return this; }, /** * [description] * - * @method Phaser.Structs.Map#each + * @method Phaser.Cameras.Scene2D.Camera#setRoundPixels * @since 3.0.0 * - * @param {function} callback - [description] + * @param {boolean} value - [description] * - * @return {Phaser.Structs.Map} This Map object. + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - each: function (callback) + setRoundPixels: function (value) { - var entries = this.entries; + this.roundPixels = value; - for (var key in entries) + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#setScene + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + setScene: function (scene) + { + this.scene = scene; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#setScroll + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + setScroll: function (x, y) + { + if (y === undefined) { y = x; } + + this.scrollX = x; + this.scrollY = y; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#setSize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + setSize: function (width, height) + { + if (height === undefined) { height = width; } + + this.width = width; + this.height = height; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#setViewport + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + setViewport: function (x, y, width, height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#setZoom + * @since 3.0.0 + * + * @param {float} value - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + setZoom: function (value) + { + if (value === undefined) { value = 1; } + + this.zoom = value; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#shake + * @since 3.0.0 + * + * @param {number} duration - [description] + * @param {number} intensity - [description] + * @param {number} force - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + shake: function (duration, intensity, force) + { + if (intensity === undefined) { intensity = 0.05; } + + if (!force && (this._shakeOffsetX !== 0 || this._shakeOffsetY !== 0)) { - if (callback(key, entries[key]) === false) - { - break; - } + return this; } + this._shakeDuration = duration; + this._shakeIntensity = intensity; + this._shakeOffsetX = 0; + this._shakeOffsetY = 0; + return this; }, /** * [description] * - * @method Phaser.Structs.Map#contains + * @method Phaser.Cameras.Scene2D.Camera#startFollow * @since 3.0.0 * - * @param {any} value - [description] + * @param {Phaser.GameObjects.GameObject|object} gameObjectOrPoint - [description] + * @param {boolean} roundPx - [description] * - * @return {boolean} [description] + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - contains: function (value) + startFollow: function (gameObjectOrPoint, roundPx) { - var entries = this.entries; + this._follow = gameObjectOrPoint; - for (var key in entries) + if (roundPx !== undefined) { - if (entries[key] === value) - { - return true; - } + this.roundPixels = roundPx; } - return false; + return this; }, /** - * Merges all new keys from the given Map into this one - * If it encounters a key that already exists it will be skipped - * unless override = true. + * [description] * - * @method Phaser.Structs.Map#merge + * @method Phaser.Cameras.Scene2D.Camera#stopFollow * @since 3.0.0 * - * @param {Phaser.Structs.Map} map - [description] - * @param {boolean} [override=false] - [description] + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + stopFollow: function () + { + this._follow = null; + + return this; + }, + + /** + * [description] * - * @return {Phaser.Structs.Map} This Map object. + * @method Phaser.Cameras.Scene2D.Camera#toJSON + * @since 3.0.0 + * + * @return {object} [description] */ - merge: function (map, override) + toJSON: function () { - if (override === undefined) { override = false; } + var output = { + name: this.name, + x: this.x, + y: this.y, + width: this.width, + height: this.height, + zoom: this.zoom, + rotation: this.rotation, + roundPixels: this.roundPixels, + scrollX: this.scrollX, + scrollY: this.scrollY, + backgroundColor: this.backgroundColor.rgba + }; - var local = this.entries; - var source = map.entries; + if (this.useBounds) + { + output['bounds'] = { + x: this._bounds.x, + y: this._bounds.y, + width: this._bounds.width, + height: this._bounds.height + }; + } - for (var key in source) + return output; + }, + + /** + * Resets any active FX, such as a fade, flash or shake. Useful to call after a fade in order to + * remove the fade. + * + * @method Phaser.Cameras.Scene2D.Camera#resetFX + * @since 3.0.0 + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + */ + resetFX: function () + { + this._flashAlpha = 0; + this._fadeAlpha = 0; + this._shakeOffsetX = 0.0; + this._shakeOffsetY = 0.0; + this._shakeDuration = 0; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#update + * @since 3.0.0 + * + * @param {[type]} timestep - [description] + * @param {[type]} delta - [description] + */ + update: function (timestep, delta) + { + if (this._flashAlpha > 0.0) { - if (local.hasOwnProperty(key) && override) + this._flashAlpha -= delta / this._flashDuration; + + if (this._flashAlpha < 0.0) { - local[key] = source[key]; + this._flashAlpha = 0.0; + } + } + + if (this._fadeAlpha > 0.0 && this._fadeAlpha < 1.0) + { + this._fadeAlpha += delta / this._fadeDuration; + + if (this._fadeAlpha >= 1.0) + { + this._fadeAlpha = 1.0; + } + } + + if (this._shakeDuration > 0.0) + { + var intensity = this._shakeIntensity; + + this._shakeDuration -= delta; + + if (this._shakeDuration <= 0.0) + { + this._shakeOffsetX = 0.0; + this._shakeOffsetY = 0.0; } else { - this.set(key, source[key]); + this._shakeOffsetX = (Math.random() * intensity * this.width * 2 - intensity * this.width) * this.zoom; + this._shakeOffsetY = (Math.random() * intensity * this.height * 2 - intensity * this.height) * this.zoom; + + if (this.roundPixels) + { + this._shakeOffsetX |= 0; + this._shakeOffsetY |= 0; + } } } + }, - return this; + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.Camera#destroy + * @since 3.0.0 + */ + destroy: function () + { + this._bounds = undefined; + this.matrix = undefined; + this.culledObjects = []; + this.scene = undefined; } }); -module.exports = Map; +module.exports = Camera; /***/ }), -/* 114 */ +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var HexStringToColor = __webpack_require__(201); +var IntegerToColor = __webpack_require__(203); +var ObjectToColor = __webpack_require__(205); +var RGBStringToColor = __webpack_require__(206); + +/** + * Converts the given source color value into an instance of a Color class. + * The value can be either a string, prefixed with `rgb` or a hex string, a number or an Object. + * + * @function Phaser.Display.Color.ValueToColor + * @since 3.0.0 + * + * @param {string|number|object} input - The source color value to convert. + * + * @return {Phaser.Display.Color} A Color object. + */ +var ValueToColor = function (input) +{ + var t = typeof input; + + switch (t) + { + case 'string': + + if (input.substr(0, 3).toLowerCase() === 'rgb') + { + return RGBStringToColor(input); + } + else + { + return HexStringToColor(input); + } + + case 'number': + + return IntegerToColor(input); + + case 'object': + + return ObjectToColor(input); + } +}; + +module.exports = ValueToColor; + + +/***/ }), +/* 117 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Given 3 separate color values this will return an integer representation of it. + * + * @function Phaser.Display.Color.GetColor + * @since 3.0.0 + * + * @param {integer} red - The red color value. A number between 0 and 255. + * @param {integer} green - The green color value. A number between 0 and 255. + * @param {integer} blue - The blue color value. A number between 0 and 255. + * + * @return {number} The combined color value. + */ +var GetColor = function (red, green, blue) +{ + return red << 16 | green << 8 | blue; +}; + +module.exports = GetColor; + + +/***/ }), +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -17249,1355 +19326,1065 @@ module.exports = Map; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(35); -var Rectangle = __webpack_require__(8); -var TransformMatrix = __webpack_require__(187); -var ValueToColor = __webpack_require__(115); +var Matrix4 = __webpack_require__(119); +var RandomXYZ = __webpack_require__(207); +var RandomXYZW = __webpack_require__(208); +var RotateVec3 = __webpack_require__(209); +var Set = __webpack_require__(62); +var Sprite3D = __webpack_require__(81); var Vector2 = __webpack_require__(6); +var Vector3 = __webpack_require__(51); +var Vector4 = __webpack_require__(120); + +// Local cache vars +var tmpVec3 = new Vector3(); +var tmpVec4 = new Vector4(); +var dirvec = new Vector3(); +var rightvec = new Vector3(); +var billboardMatrix = new Matrix4(); + +// @author attribute https://github.com/mattdesl/cam3d/wiki /** * @classdesc * [description] * * @class Camera - * @memberOf Phaser.Cameras.Scene2D + * @memberOf Phaser.Cameras.Sprite3D * @constructor * @since 3.0.0 * - * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. - * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. - * @param {number} width - The width of the Camera, in pixels. - * @param {number} height - The height of the Camera, in pixels. + * @param {Phaser.Scene} scene - [description] */ var Camera = new Class({ initialize: - function Camera (x, y, width, height) + function Camera (scene) { /** - * A reference to the Scene this camera belongs to. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#scene + * @name Phaser.Cameras.Sprite3D#scene * @type {Phaser.Scene} * @since 3.0.0 */ - this.scene; + this.scene = scene; /** - * The name of the Camera. This is left empty for your own use. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#name - * @type {string} - * @default '' + * @name Phaser.Cameras.Sprite3D#displayList + * @type {Phaser.GameObjects.DisplayList} * @since 3.0.0 */ - this.name = ''; + this.displayList = scene.sys.displayList; /** - * The x position of the Camera, relative to the top-left of the game canvas. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#x - * @type {number} + * @name Phaser.Cameras.Sprite3D#updateList + * @type {Phaser.GameObjects.UpdateList} * @since 3.0.0 */ - this.x = x; + this.updateList = scene.sys.updateList; /** - * The y position of the Camera, relative to the top-left of the game canvas. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#y - * @type {number} + * @name Phaser.Cameras.Sprite3D#name + * @type {string} + * @default '' * @since 3.0.0 */ - this.y = y; + this.name = ''; /** - * The width of the Camera, in pixels. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#width - * @type {number} + * @name Phaser.Cameras.Sprite3D#direction + * @type {Phaser.Math.Vector3} * @since 3.0.0 */ - this.width = width; + this.direction = new Vector3(0, 0, -1); /** - * The height of the Camera, in pixels. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#height - * @type {number} + * @name Phaser.Cameras.Sprite3D#up + * @type {Phaser.Math.Vector3} * @since 3.0.0 */ - this.height = height; + this.up = new Vector3(0, 1, 0); /** - * Should this camera round its pixel values to integers? + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#roundPixels - * @type {boolean} - * @default false + * @name Phaser.Cameras.Sprite3D#position + * @type {Phaser.Math.Vector3} * @since 3.0.0 */ - this.roundPixels = false; + this.position = new Vector3(); + + // The mapping from 3D size units to pixels. + // In the default case 1 3D unit = 128 pixels. So a sprite that is + // 256 x 128 px in size will be 2 x 1 units. + // Change to whatever best fits your game assets. /** - * Is this Camera using a bounds to restrict scrolling movement? - * Set this property along with the bounds via `Camera.setBounds`. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#useBounds - * @type {boolean} - * @default false + * @name Phaser.Cameras.Sprite3D#pixelScale + * @type {number} * @since 3.0.0 */ - this.useBounds = false; + this.pixelScale = 128; /** - * The bounds the camera is restrained to during scrolling. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_bounds - * @type {Phaser.Geom.Rectangle} - * @private + * @name Phaser.Cameras.Sprite3D#projection + * @type {Phaser.Math.Matrix4} * @since 3.0.0 */ - this._bounds = new Rectangle(); + this.projection = new Matrix4(); /** - * Does this Camera allow the Game Objects it renders to receive input events? + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#inputEnabled - * @type {boolean} - * @default true + * @name Phaser.Cameras.Sprite3D#view + * @type {Phaser.Math.Matrix4} * @since 3.0.0 */ - this.inputEnabled = true; + this.view = new Matrix4(); /** - * The horizontal scroll position of this camera. - * Optionally restricted via the Camera bounds. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#scrollX - * @type {number} - * @default 0 + * @name Phaser.Cameras.Sprite3D#combined + * @type {Phaser.Math.Matrix4} * @since 3.0.0 */ - this.scrollX = 0; + this.combined = new Matrix4(); /** - * The vertical scroll position of this camera. - * Optionally restricted via the Camera bounds. + * [description] * - * @name Phaser.Cameras.Scene2D.Camera#scrollY - * @type {number} - * @default 0 + * @name Phaser.Cameras.Sprite3D#invProjectionView + * @type {Phaser.Math.Matrix4} * @since 3.0.0 */ - this.scrollY = 0; - - /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. - * Set to 1 to return to the default zoom level. - * - * @name Phaser.Cameras.Scene2D.Camera#zoom - * @type {float} - * @default 1 - * @since 3.0.0 - */ - this.zoom = 1; - - /** - * The rotation of the Camera. This influences the rendering of all Game Objects visible by this camera. - * - * @name Phaser.Cameras.Scene2D.Camera#rotation - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rotation = 0; - - /** - * A local transform matrix used for internal calculations. - * - * @name Phaser.Cameras.Scene2D.Camera#matrix - * @type {TransformMatrix} - * @since 3.0.0 - */ - this.matrix = new TransformMatrix(1, 0, 0, 1, 0, 0); - - /** - * Does this Camera have a transparent background? - * - * @name Phaser.Cameras.Scene2D.Camera#transparent - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.transparent = true; - - /** - * TODO - * - * @name Phaser.Cameras.Scene2D.Camera#clearBeforeRender - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.clearBeforeRender = true; - - /** - * The background color of this Camera. Only used if `transparent` is `false`. - * - * @name Phaser.Cameras.Scene2D.Camera#backgroundColor - * @type {Phaser.Display.Color} - * @since 3.0.0 - */ - this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); - - /** - * Should the camera cull Game Objects before rendering? - * In some special cases it may be beneficial to disable this. - * - * @name Phaser.Cameras.Scene2D.Camera#disableCull - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.disableCull = false; - - /** - * A temporary array of culled objects. - * - * @name Phaser.Cameras.Scene2D.Camera#culledObjects - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.culledObjects = []; - - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_shakeDuration - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._shakeDuration = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_shakeIntensity - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._shakeIntensity = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_shakeOffsetX - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._shakeOffsetX = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_shakeOffsetY - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._shakeOffsetY = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_fadeDuration - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._fadeDuration = 0; + this.invProjectionView = new Matrix4(); /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_fadeRed + * @name Phaser.Cameras.Sprite3D#near * @type {number} - * @private - * @default 0 + * @default 1 * @since 3.0.0 */ - this._fadeRed = 0; + this.near = 1; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_fadeGreen + * @name Phaser.Cameras.Sprite3D#far * @type {number} - * @private - * @default 0 * @since 3.0.0 */ - this._fadeGreen = 0; + this.far = 100; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_fadeBlue - * @type {number} - * @private - * @default 0 + * @name Phaser.Cameras.Sprite3D#ray + * @type {[type]} * @since 3.0.0 */ - this._fadeBlue = 0; + this.ray = { + origin: new Vector3(), + direction: new Vector3() + }; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_fadeAlpha + * @name Phaser.Cameras.Sprite3D#viewportWidth * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._fadeAlpha = 0; + this.viewportWidth = 0; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_flashDuration + * @name Phaser.Cameras.Sprite3D#viewportHeight * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._flashDuration = 0; + this.viewportHeight = 0; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_flashRed - * @type {number} - * @private - * @default 1 + * @name Phaser.Cameras.Sprite3D#billboardMatrixDirty + * @type {boolean} + * @default true * @since 3.0.0 */ - this._flashRed = 1; + this.billboardMatrixDirty = true; /** * [description] * - * @name Phaser.Cameras.Scene2D.Camera#_flashGreen - * @type {number} - * @private - * @default 1 + * @name Phaser.Cameras.Sprite3D#children + * @type {Phaser.Structs.Set} * @since 3.0.0 */ - this._flashGreen = 1; + this.children = new Set(); + }, - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_flashBlue - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - this._flashBlue = 1; + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#setPosition + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} z - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + */ + setPosition: function (x, y, z) + { + this.position.set(x, y, z); - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_flashAlpha - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._flashAlpha = 0; + return this.update(); + }, - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_follow - * @type {?any} - * @private - * @default null - * @since 3.0.0 - */ - this._follow = null; + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#setScene + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + */ + setScene: function (scene) + { + this.scene = scene; - /** - * [description] - * - * @name Phaser.Cameras.Scene2D.Camera#_id - * @type {integer} - * @private - * @default 0 - * @since 3.0.0 - */ - this._id = 0; + return this; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#centerToBounds + * @method Phaser.Cameras.Sprite3D.Camera#setPixelScale * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @param {[type]} value - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - centerToBounds: function () + setPixelScale: function (value) { - this.scrollX = (this._bounds.width * 0.5) - (this.width * 0.5); - this.scrollY = (this._bounds.height * 0.5) - (this.height * 0.5); + this.pixelScale = value; - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#centerToSize + * @method Phaser.Cameras.Sprite3D.Camera#add * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @param {[type]} sprite3D - [description] + * + * @return {[type]} [description] */ - centerToSize: function () + add: function (sprite3D) { - this.scrollX = this.width * 0.5; - this.scrollY = this.height * 0.5; + this.children.set(sprite3D); - return this; + this.updateChildren(); + + return sprite3D; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#cull + * @method Phaser.Cameras.Sprite3D.Camera#remove * @since 3.0.0 * - * @param {array} renderableObjects - [description] + * @param {[type]} child - [description] * - * @return {array} [description] + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - cull: function (renderableObjects) + remove: function (child) { - if (this.disableCull) - { - return renderableObjects; - } + this.displayList.remove(child.gameObject); + this.updateList.remove(child.gameObject); - var cameraMatrix = this.matrix.matrix; + this.children.delete(child); - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; + return this; + }, - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#clear + * @since 3.0.0 + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + */ + clear: function () + { + var children = this.getChildren(); - if (!determinant) + for (var i = 0; i < children.length; i++) { - return renderableObjects; + this.remove(children[i]); } - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; + return this; + }, - var scrollX = this.scrollX; - var scrollY = this.scrollY; - var cameraW = this.width; - var cameraH = this.height; - var culledObjects = this.culledObjects; - var length = renderableObjects.length; + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#getChildren + * @since 3.0.0 + * + * @return {array} [description] + */ + getChildren: function () + { + return this.children.entries; + }, - determinant = 1 / determinant; + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#create + * @since 3.0.0 + * + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] + * @param {[type]} key - [description] + * @param {[type]} frame - [description] + * @param {[type]} visible - [description] + * + * @return {[type]} [description] + */ + create: function (x, y, z, key, frame, visible) + { + if (visible === undefined) { visible = true; } - culledObjects.length = 0; + var child = new Sprite3D(this.scene, x, y, z, key, frame); - for (var index = 0; index < length; ++index) - { - var object = renderableObjects[index]; + this.displayList.add(child.gameObject); + this.updateList.add(child.gameObject); - if (!object.hasOwnProperty('width')) - { - culledObjects.push(object); - continue; - } + child.visible = visible; - var objectW = object.width; - var objectH = object.height; - var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); - var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); - var tx = (objectX * mva + objectY * mvc + mve); - var ty = (objectX * mvb + objectY * mvd + mvf); - var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); - var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); - var cullW = cameraW + objectW; - var cullH = cameraH + objectH; + this.children.set(child); - if (tx > -objectW || ty > -objectH || tx < cullW || ty < cullH || - tw > -objectW || th > -objectH || tw < cullW || th < cullH) - { - culledObjects.push(object); - } - } + this.updateChildren(); - return culledObjects; + return child; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#cullHitTest + * @method Phaser.Cameras.Sprite3D.Camera#createMultiple * @since 3.0.0 * - * @param {array} interactiveObjects - [description] + * @param {[type]} quantity - [description] + * @param {[type]} key - [description] + * @param {[type]} frame - [description] + * @param {[type]} visible - [description] * - * @return {array} [description] + * @return {[type]} [description] */ - cullHitTest: function (interactiveObjects) + createMultiple: function (quantity, key, frame, visible) { - if (this.disableCull) + if (visible === undefined) { visible = true; } + + var output = []; + + for (var i = 0; i < quantity; i++) { - return interactiveObjects; - } + var child = new Sprite3D(this.scene, 0, 0, 0, key, frame); - var cameraMatrix = this.matrix.matrix; + this.displayList.add(child.gameObject); + this.updateList.add(child.gameObject); - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; + child.visible = visible; - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); + this.children.set(child); - if (!determinant) - { - return interactiveObjects; + output.push(child); } - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; + return output; + }, - var scrollX = this.scrollX; - var scrollY = this.scrollY; - var cameraW = this.width; - var cameraH = this.height; - var length = interactiveObjects.length; + // Create a bunch of Sprite3D objects in a rectangle + // size and spacing are Vec3s (or if integers are converted to vec3s) + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.Camera#createRect + * @since 3.0.0 + * + * @param {[type]} size - [description] + * @param {[type]} spacing - [description] + * @param {[type]} key - [description] + * @param {[type]} frame - [description] + * + * @return {[type]} [description] + */ + createRect: function (size, spacing, key, frame) + { + if (typeof size === 'number') { size = { x: size, y: size, z: size }; } + if (typeof spacing === 'number') { spacing = { x: spacing, y: spacing, z: spacing }; } - determinant = 1 / determinant; + var quantity = size.x * size.y * size.z; - var culledObjects = []; + var sprites = this.createMultiple(quantity, key, frame); - for (var index = 0; index < length; ++index) - { - var object = interactiveObjects[index].gameObject; + var i = 0; - if (!object.hasOwnProperty('width')) + for (var z = 0.5 - (size.z / 2); z < (size.z / 2); z++) + { + for (var y = 0.5 - (size.y / 2); y < (size.y / 2); y++) { - culledObjects.push(interactiveObjects[index]); - continue; - } + for (var x = 0.5 - (size.x / 2); x < (size.x / 2); x++) + { + var bx = (x * spacing.x); + var by = (y * spacing.y); + var bz = (z * spacing.z); - var objectW = object.width; - var objectH = object.height; - var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); - var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); - var tx = (objectX * mva + objectY * mvc + mve); - var ty = (objectX * mvb + objectY * mvd + mvf); - var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); - var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); - var cullW = cameraW + objectW; - var cullH = cameraH + objectH; + sprites[i].position.set(bx, by, bz); - if (tx > -objectW || ty > -objectH || tx < cullW || ty < cullH || - tw > -objectW || th > -objectH || tw < cullW || th < cullH) - { - culledObjects.push(interactiveObjects[index]); + i++; + } } } - return culledObjects; + this.update(); + + return sprites; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#cullTilemap + * @method Phaser.Cameras.Sprite3D.Camera#randomSphere * @since 3.0.0 * - * @param {array} tilemap - [description] + * @param {[type]} radius - [description] + * @param {[type]} sprites - [description] * - * @return {array} [description] + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - cullTilemap: function (tilemap) + randomSphere: function (radius, sprites) { - var cameraMatrix = this.matrix.matrix; - - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; - - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); - - if (!determinant) - { - return tiles; - } - - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; - var tiles = tilemap.tiles; - var scrollX = this.scrollX; - var scrollY = this.scrollY; - var cameraW = this.width; - var cameraH = this.height; - var culledObjects = this.culledObjects; - var length = tiles.length; - var tileW = tilemap.tileWidth; - var tileH = tilemap.tileHeight; - var cullW = cameraW + tileW; - var cullH = cameraH + tileH; - var scrollFactorX = tilemap.scrollFactorX; - var scrollFactorY = tilemap.scrollFactorY; - - determinant = 1 / determinant; - - culledObjects.length = 0; + if (sprites === undefined) { sprites = this.getChildren(); } - for (var index = 0; index < length; ++index) + for (var i = 0; i < sprites.length; i++) { - var tile = tiles[index]; - var tileX = (tile.x - (scrollX * scrollFactorX)); - var tileY = (tile.y - (scrollY * scrollFactorY)); - var tx = (tileX * mva + tileY * mvc + mve); - var ty = (tileX * mvb + tileY * mvd + mvf); - var tw = ((tileX + tileW) * mva + (tileY + tileH) * mvc + mve); - var th = ((tileX + tileW) * mvb + (tileY + tileH) * mvd + mvf); - - if (tx > -tileW && ty > -tileH && tw < cullW && th < cullH) - { - culledObjects.push(tile); - } + RandomXYZ(sprites[i].position, radius); } - return culledObjects; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#fade + * @method Phaser.Cameras.Sprite3D.Camera#randomCube * @since 3.0.0 * - * @param {number} duration - [description] - * @param {number} red - [description] - * @param {number} green - [description] - * @param {number} blue - [description] - * @param {number} force - [description] + * @param {[type]} scale - [description] + * @param {[type]} sprites - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - fade: function (duration, red, green, blue, force) + randomCube: function (scale, sprites) { - if (red === undefined) { red = 0; } - if (green === undefined) { green = 0; } - if (blue === undefined) { blue = 0; } - - if (!force && this._fadeAlpha > 0) - { - return this; - } - - this._fadeRed = red; - this._fadeGreen = green; - this._fadeBlue = blue; + if (sprites === undefined) { sprites = this.getChildren(); } - if (duration <= 0) + for (var i = 0; i < sprites.length; i++) { - duration = Number.MIN_VALUE; + RandomXYZW(sprites[i].position, scale); } - this._fadeDuration = duration; - this._fadeAlpha = Number.MIN_VALUE; - - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#flash + * @method Phaser.Cameras.Sprite3D.Camera#translateChildren * @since 3.0.0 * - * @param {number} duration - [description] - * @param {number} red - [description] - * @param {number} green - [description] - * @param {number} blue - [description] - * @param {number} force - [description] + * @param {[type]} vec3 - [description] + * @param {[type]} sprites - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - flash: function (duration, red, green, blue, force) + translateChildren: function (vec3, sprites) { - if (!force && this._flashAlpha > 0.0) - { - return this; - } - - if (red === undefined) { red = 1.0; } - if (green === undefined) { green = 1.0; } - if (blue === undefined) { blue = 1.0; } - - this._flashRed = red; - this._flashGreen = green; - this._flashBlue = blue; + if (sprites === undefined) { sprites = this.getChildren(); } - if (duration <= 0) + for (var i = 0; i < sprites.length; i++) { - duration = Number.MIN_VALUE; + sprites[i].position.add(vec3); } - this._flashDuration = duration; - this._flashAlpha = 1.0; - - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#getWorldPoint + * @method Phaser.Cameras.Sprite3D.Camera#transformChildren * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {object|Phaser.Math.Vector2} output - [description] + * @param {[type]} mat4 - [description] + * @param {[type]} sprites - [description] * - * @return {Phaser.Math.Vector2} [description] + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - getWorldPoint: function (x, y, output) + transformChildren: function (mat4, sprites) { - if (output === undefined) { output = new Vector2(); } - - var cameraMatrix = this.matrix.matrix; - - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; - - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); + if (sprites === undefined) { sprites = this.getChildren(); } - if (!determinant) + for (var i = 0; i < sprites.length; i++) { - output.x = x; - output.y = y; - - return output; + sprites[i].position.transformMat4(mat4); } - determinant = 1 / determinant; - - var ima = mvd * determinant; - var imb = -mvb * determinant; - var imc = -mvc * determinant; - var imd = mva * determinant; - var ime = (mvc * mvf - mvd * mve) * determinant; - var imf = (mvb * mve - mva * mvf) * determinant; - - var c = Math.cos(this.rotation); - var s = Math.sin(this.rotation); - - var zoom = this.zoom; - - var scrollX = this.scrollX; - var scrollY = this.scrollY; - - var sx = x + ((scrollX * c - scrollY * s) * zoom); - var sy = y + ((scrollX * s + scrollY * c) * zoom); + return this.update(); + }, - /* Apply transform to point */ - output.x = (sx * ima + sy * imc + ime); - output.y = (sx * imb + sy * imd + imf); + /** + * Sets the width and height of the viewport. Does not update any matrices. + * + * @method Phaser.Cameras.Sprite3D.Camera#setViewport + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + */ + setViewport: function (width, height) + { + this.viewportWidth = width; + this.viewportHeight = height; - return output; + return this.update(); }, /** - * [description] + * Translates this camera by a specified Vector3 object + * or x, y, z parameters. Any undefined x y z values will + * default to zero, leaving that component unaffected. + * If you wish to set the camera position directly call setPosition instead. * - * @method Phaser.Cameras.Scene2D.Camera#ignore + * @method Phaser.Cameras.Sprite3D.Camera#translate * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjectOrArray - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - ignore: function (gameObjectOrArray) + translate: function (x, y, z) { - if (gameObjectOrArray instanceof Array) + if (typeof x === 'object') { - for (var index = 0; index < gameObjectOrArray.length; ++index) - { - gameObjectOrArray[index].cameraFilter |= this._id; - } + this.position.x += x.x || 0; + this.position.y += x.y || 0; + this.position.z += x.z || 0; } else { - gameObjectOrArray.cameraFilter |= this._id; + this.position.x += x || 0; + this.position.y += y || 0; + this.position.z += z || 0; } - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#preRender + * @method Phaser.Cameras.Sprite3D.Camera#lookAt * @since 3.0.0 * - * @param {number} baseScale - [description] - * @param {number} resolution - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - preRender: function (baseScale, resolution) + lookAt: function (x, y, z) { - var width = this.width; - var height = this.height; - var zoom = this.zoom * baseScale; - var matrix = this.matrix; - var originX = width / 2; - var originY = height / 2; - var follow = this._follow; + var dir = this.direction; + var up = this.up; - if (follow !== null) + if (typeof x === 'object') { - originX = follow.x; - originY = follow.y; - - this.scrollX = originX - width * 0.5; - this.scrollY = originY - height * 0.5; + dir.copy(x); } - - if (this.useBounds) + else { - var bounds = this._bounds; - - var bw = Math.max(0, bounds.right - width); - var bh = Math.max(0, bounds.bottom - height); + dir.set(x, y, z); + } - if (this.scrollX < bounds.x) - { - this.scrollX = bounds.x; - } - else if (this.scrollX > bw) - { - this.scrollX = bw; - } + dir.subtract(this.position).normalize(); - if (this.scrollY < bounds.y) - { - this.scrollY = bounds.y; - } - else if (this.scrollY > bh) - { - this.scrollY = bh; - } - } + // Calculate right vector + tmpVec3.copy(dir).cross(up).normalize(); - if (this.roundPixels) - { - this.scrollX = Math.round(this.scrollX); - this.scrollY = Math.round(this.scrollY); - } + // Calculate up vector + up.copy(tmpVec3).cross(dir).normalize(); - matrix.loadIdentity(); - matrix.scale(resolution, resolution); - matrix.translate(this.x + originX, this.y + originY); - matrix.rotate(this.rotation); - matrix.scale(zoom, zoom); - matrix.translate(-originX, -originY); - matrix.translate(this._shakeOffsetX, this._shakeOffsetY); + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#removeBounds + * @method Phaser.Cameras.Sprite3D.Camera#rotate * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @param {[type]} radians - [description] + * @param {[type]} axis - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - removeBounds: function () + rotate: function (radians, axis) { - this.useBounds = false; - - this._bounds.setEmpty(); + RotateVec3(this.direction, axis, radians); + RotateVec3(this.up, axis, radians); - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setAngle + * @method Phaser.Cameras.Sprite3D.Camera#rotateAround * @since 3.0.0 * - * @param {number} value - [description] + * @param {[type]} point - [description] + * @param {[type]} radians - [description] + * @param {[type]} axis - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - setAngle: function (value) + rotateAround: function (point, radians, axis) { - if (value === undefined) { value = 0; } + tmpVec3.copy(point).subtract(this.position); - this.rotation = DegToRad(value); + this.translate(tmpVec3); + this.rotate(radians, axis); + this.translate(tmpVec3.negate()); - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setBackgroundColor + * @method Phaser.Cameras.Sprite3D.Camera#project * @since 3.0.0 * - * @param {integer} color - [description] + * @param {[type]} vec - [description] + * @param {[type]} out - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {[type]} [description] */ - setBackgroundColor: function (color) + project: function (vec, out) { - if (color === undefined) { color = 'rgba(0,0,0,0)'; } + if (out === undefined) { out = new Vector4(); } - this.backgroundColor = ValueToColor(color); + // TODO: support viewport XY + var viewportWidth = this.viewportWidth; + var viewportHeight = this.viewportHeight; + var n = Camera.NEAR_RANGE; + var f = Camera.FAR_RANGE; - this.transparent = (this.backgroundColor.alpha === 0); + // For useful Z and W values we should do the usual steps: clip space -> NDC -> window coords - return this; - }, + // Implicit 1.0 for w component + tmpVec4.set(vec.x, vec.y, vec.z, 1.0); - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#setBounds - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. - */ - setBounds: function (x, y, width, height) - { - this._bounds.setTo(x, y, width, height); + // Transform into clip space + tmpVec4.transformMat4(this.combined); - this.useBounds = true; + // Avoid divide by zero when 0x0x0 camera projects to a 0x0x0 vec3 + if (tmpVec4.w === 0) + { + tmpVec4.w = 1; + } - return this; - }, + // Now into NDC + tmpVec4.x = tmpVec4.x / tmpVec4.w; + tmpVec4.y = tmpVec4.y / tmpVec4.w; + tmpVec4.z = tmpVec4.z / tmpVec4.w; - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#setName - * @since 3.0.0 - * - * @param {string} value - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. - */ - setName: function (value) - { - if (value === undefined) { value = ''; } + // And finally into window coordinates + out.x = viewportWidth / 2 * tmpVec4.x + (0 + viewportWidth / 2); + out.y = viewportHeight / 2 * tmpVec4.y + (0 + viewportHeight / 2); + out.z = (f - n) / 2 * tmpVec4.z + (f + n) / 2; - this.name = value; + // If the out vector has a fourth component, we also store (1/clip.w), same idea as gl_FragCoord.w + if (out.w === 0 || out.w) + { + out.w = 1 / tmpVec4.w; + } - return this; + return out; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setPosition + * @method Phaser.Cameras.Sprite3D.Camera#unproject * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] + * @param {[type]} vec - [description] + * @param {[type]} out - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {[type]} [description] */ - setPosition: function (x, y) + unproject: function (vec, out) { - if (y === undefined) { y = x; } + if (out === undefined) { out = new Vector3(); } - this.x = x; - this.y = y; + var viewport = tmpVec4.set(0, 0, this.viewportWidth, this.viewportHeight); - return this; + return out.copy(vec).unproject(viewport, this.invProjectionView); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setRotation + * @method Phaser.Cameras.Sprite3D.Camera#getPickRay * @since 3.0.0 * - * @param {number} value - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {[type]} [description] */ - setRotation: function (value) + getPickRay: function (x, y) { - if (value === undefined) { value = 0; } + var origin = this.ray.origin.set(x, y, 0); + var direction = this.ray.direction.set(x, y, 1); + var viewport = tmpVec4.set(0, 0, this.viewportWidth, this.viewportHeight); + var mtx = this.invProjectionView; - this.rotation = value; + origin.unproject(viewport, mtx); - return this; - }, + direction.unproject(viewport, mtx); - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#setRoundPixels - * @since 3.0.0 - * - * @param {boolean} value - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. - */ - setRoundPixels: function (value) - { - this.roundPixels = value; + direction.subtract(origin).normalize(); - return this; + return this.ray; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setScene + * @method Phaser.Cameras.Sprite3D.Camera#updateChildren * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - setScene: function (scene) + updateChildren: function () { - this.scene = scene; + var children = this.children.entries; + + for (var i = 0; i < children.length; i++) + { + children[i].project(this); + } return this; }, + // Overriden by subclasses /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setScroll + * @method Phaser.Cameras.Sprite3D.Camera#update * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - setScroll: function (x, y) + update: function () { - if (y === undefined) { y = x; } - - this.scrollX = x; - this.scrollY = y; - - return this; + return this.updateChildren(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#setSize + * @method Phaser.Cameras.Sprite3D.Camera#updateBillboardMatrix * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - setSize: function (width, height) + updateBillboardMatrix: function () { - if (height === undefined) { height = width; } + var dir = dirvec.set(this.direction).negate(); - this.width = width; - this.height = height; + // Better view-aligned billboards might use this: + // var dir = tmp.set(camera.position).subtract(p).normalize(); + + var right = rightvec.set(this.up).cross(dir).normalize(); + var up = tmpVec3.set(dir).cross(right).normalize(); - return this; - }, + var out = billboardMatrix.val; - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#setViewport - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. - */ - setViewport: function (x, y, width, height) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; + out[0] = right.x; + out[1] = right.y; + out[2] = right.z; + out[3] = 0; - return this; - }, + out[4] = up.x; + out[5] = up.y; + out[6] = up.z; + out[7] = 0; - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#setZoom - * @since 3.0.0 - * - * @param {float} value - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. - */ - setZoom: function (value) - { - if (value === undefined) { value = 1; } + out[8] = dir.x; + out[9] = dir.y; + out[10] = dir.z; + out[11] = 0; - this.zoom = value; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; - return this; + this.billboardMatrixDirty = false; }, - + /** - * [description] + * This is a utility function for canvas 3D rendering, + * which determines the "point size" of a camera-facing + * sprite billboard given its 3D world position + * (origin at center of sprite) and its world width + * and height in x/y. * - * @method Phaser.Cameras.Scene2D.Camera#shake + * We place into the output Vector2 the scaled width + * and height. If no `out` is specified, a new Vector2 + * will be created for convenience (this should be avoided + * in tight loops). + * + * @method Phaser.Cameras.Sprite3D.Camera#getPointSize * @since 3.0.0 * - * @param {number} duration - [description] - * @param {number} intensity - [description] - * @param {number} force - [description] + * @param {[type]} vec - The position of the 3D Sprite. + * @param {[type]} size - The x and y dimensions. + * @param {[type]} out - The result, scaled x and y dimensions. * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {[type]} [description] */ - shake: function (duration, intensity, force) + getPointSize: function (vec, size, out) { - if (intensity === undefined) { intensity = 0.05; } + if (out === undefined) { out = new Vector2(); } - if (!force && (this._shakeOffsetX !== 0 || this._shakeOffsetY !== 0)) + // TODO: optimize this with a simple distance calculation: + // https://developer.valvesoftware.com/wiki/Field_of_View + + if (this.billboardMatrixDirty) { - return this; + this.updateBillboardMatrix(); } - this._shakeDuration = duration; - this._shakeIntensity = intensity; - this._shakeOffsetX = 0; - this._shakeOffsetY = 0; + var tmp = tmpVec3; - return this; + var dx = (size.x / this.pixelScale) / 2; + var dy = (size.y / this.pixelScale) / 2; + + tmp.set(-dx, -dy, 0).transformMat4(billboardMatrix).add(vec); + + this.project(tmp, tmp); + + var tlx = tmp.x; + var tly = tmp.y; + + tmp.set(dx, dy, 0).transformMat4(billboardMatrix).add(vec); + + this.project(tmp, tmp); + + var brx = tmp.x; + var bry = tmp.y; + + // var w = Math.abs(brx - tlx); + // var h = Math.abs(bry - tly); + + // Allow the projection to get negative ... + var w = brx - tlx; + var h = bry - tly; + + return out.set(w, h); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#startFollow + * @method Phaser.Cameras.Sprite3D.Camera#destroy * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject|object} gameObjectOrPoint - [description] - * @param {boolean} roundPx - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - startFollow: function (gameObjectOrPoint, roundPx) + destroy: function () { - this._follow = gameObjectOrPoint; - - if (roundPx !== undefined) - { - this.roundPixels = roundPx; - } + this.children.clear(); - return this; + this.scene = undefined; + this.children = undefined; }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#stopFollow + * @method Phaser.Cameras.Sprite3D.Camera#setX * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @param {[type]} value - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - stopFollow: function () + setX: function (value) { - this._follow = null; + this.position.x = value; - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#toJSON + * @method Phaser.Cameras.Sprite3D.Camera#setY * @since 3.0.0 * - * @return {object} [description] + * @param {[type]} value - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - toJSON: function () + setY: function (value) { - var output = { - name: this.name, - x: this.x, - y: this.y, - width: this.width, - height: this.height, - zoom: this.zoom, - rotation: this.rotation, - roundPixels: this.roundPixels, - scrollX: this.scrollX, - scrollY: this.scrollY, - backgroundColor: this.backgroundColor.rgba - }; - - if (this.useBounds) - { - output['bounds'] = { - x: this._bounds.x, - y: this._bounds.y, - width: this._bounds.width, - height: this._bounds.height - }; - } + this.position.y = value; - return output; + return this.update(); }, /** - * Resets any active FX, such as a fade, flash or shake. Useful to call after a fade in order to - * remove the fade. + * [description] * - * @method Phaser.Cameras.Scene2D.Camera#resetFX + * @method Phaser.Cameras.Sprite3D.Camera#setZ * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @param {[type]} value - [description] + * + * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. */ - resetFX: function () + setZ: function (value) { - this._flashAlpha = 0; - this._fadeAlpha = 0; - this._shakeOffsetX = 0.0; - this._shakeOffsetY = 0.0; - this._shakeDuration = 0; + this.position.z = value; - return this; + return this.update(); }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#update + * @name Phaser.Cameras.Sprite3D.Camera#x + * @type {number} * @since 3.0.0 - * - * @param {[type]} timestep - [description] - * @param {[type]} delta - [description] */ - update: function (timestep, delta) - { - if (this._flashAlpha > 0.0) + x: { + get: function () { - this._flashAlpha -= delta / this._flashDuration; - - if (this._flashAlpha < 0.0) - { - this._flashAlpha = 0.0; - } - } + return this.position.x; + }, - if (this._fadeAlpha > 0.0 && this._fadeAlpha < 1.0) + set: function (value) { - this._fadeAlpha += delta / this._fadeDuration; - - if (this._fadeAlpha >= 1.0) - { - this._fadeAlpha = 1.0; - } + this.position.x = value; + this.update(); } + }, - if (this._shakeDuration > 0.0) + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.Camera#y + * @type {number} + * @since 3.0.0 + */ + y: { + get: function () { - var intensity = this._shakeIntensity; - - this._shakeDuration -= delta; + return this.position.y; + }, - if (this._shakeDuration <= 0.0) - { - this._shakeOffsetX = 0.0; - this._shakeOffsetY = 0.0; - } - else - { - this._shakeOffsetX = (Math.random() * intensity * this.width * 2 - intensity * this.width) * this.zoom; - this._shakeOffsetY = (Math.random() * intensity * this.height * 2 - intensity * this.height) * this.zoom; - - if (this.roundPixels) - { - this._shakeOffsetX |= 0; - this._shakeOffsetY |= 0; - } - } + set: function (value) + { + this.position.y = value; + this.update(); } }, /** * [description] * - * @method Phaser.Cameras.Scene2D.Camera#destroy + * @name Phaser.Cameras.Sprite3D.Camera#z + * @type {number} * @since 3.0.0 */ - destroy: function () - { - this._bounds = undefined; - this.matrix = undefined; - this.culledObjects = []; - this.scene = undefined; + z: { + get: function () + { + return this.position.z; + }, + + set: function (value) + { + this.position.z = value; + this.update(); + } } }); +Camera.FAR_RANGE = 1.0; +Camera.NEAR_RANGE = 0.0; + module.exports = Camera; /***/ }), -/* 115 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18606,346 +20393,144 @@ module.exports = Camera; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HexStringToColor = __webpack_require__(200); -var IntegerToColor = __webpack_require__(202); -var ObjectToColor = __webpack_require__(204); -var RGBStringToColor = __webpack_require__(205); - -/** - * Converts the given source color value into an instance of a Color class. - * The value can be either a string, prefixed with `rgb` or a hex string, a number or an Object. - * - * @function Phaser.Display.Color.ValueToColor - * @since 3.0.0 - * - * @param {string|number|object} input - The source color value to convert. - * - * @return {Phaser.Display.Color} A Color object. - */ -var ValueToColor = function (input) -{ - var t = typeof input; - - switch (t) - { - case 'string': - - if (input.substr(0, 3).toLowerCase() === 'rgb') - { - return RGBStringToColor(input); - } - else - { - return HexStringToColor(input); - } - - case 'number': - - return IntegerToColor(input); - - case 'object': - - return ObjectToColor(input); - } -}; - -module.exports = ValueToColor; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Given 3 separate color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor - * @since 3.0.0 - * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * - * @return {number} The combined color value. - */ -var GetColor = function (red, green, blue) -{ - return red << 16 | green << 8 | blue; -}; - -module.exports = GetColor; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); -var Matrix4 = __webpack_require__(118); -var RandomXYZ = __webpack_require__(206); -var RandomXYZW = __webpack_require__(207); -var RotateVec3 = __webpack_require__(208); -var Set = __webpack_require__(61); -var Sprite3D = __webpack_require__(81); -var Vector2 = __webpack_require__(6); -var Vector3 = __webpack_require__(51); -var Vector4 = __webpack_require__(119); - -// Local cache vars -var tmpVec3 = new Vector3(); -var tmpVec4 = new Vector4(); -var dirvec = new Vector3(); -var rightvec = new Vector3(); -var billboardMatrix = new Matrix4(); -// @author attribute https://github.com/mattdesl/cam3d/wiki +var EPSILON = 0.000001; /** * @classdesc * [description] * - * @class Camera - * @memberOf Phaser.Cameras.Sprite3D + * @class Matrix4 + * @memberOf Phaser.Math * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Math.Matrix4} [m] - [description] */ -var Camera = new Class({ +var Matrix4 = new Class({ initialize: - function Camera (scene) + function Matrix4 (m) { /** * [description] * - * @name Phaser.Cameras.Sprite3D#scene - * @type {Phaser.Scene} + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} * @since 3.0.0 */ - this.scene = scene; + this.val = new Float32Array(16); - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#displayList - * @type {Phaser.GameObjects.DisplayList} - * @since 3.0.0 - */ - this.displayList = scene.sys.displayList; + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#updateList - * @type {Phaser.GameObjects.UpdateList} - * @since 3.0.0 - */ - this.updateList = scene.sys.updateList; + /** + * [description] + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {[type]} [description] + */ + clone: function () + { + return new Matrix4(this); + }, - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; + /** + * [description] + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {[type]} src - [description] + * + * @return {[type]} [description] + */ + set: function (src) + { + return this.copy(src); + }, - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#direction - * @type {Phaser.Math.Vector3} - * @since 3.0.0 - */ - this.direction = new Vector3(0, 0, -1); + /** + * [description] + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {[type]} src - [description] + * + * @return {[type]} [description] + */ + copy: function (src) + { + var out = this.val; + var a = src.val; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#up - * @type {Phaser.Math.Vector3} - * @since 3.0.0 - */ - this.up = new Vector3(0, 1, 0); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#position - * @type {Phaser.Math.Vector3} - * @since 3.0.0 - */ - this.position = new Vector3(); - - // The mapping from 3D size units to pixels. - // In the default case 1 3D unit = 128 pixels. So a sprite that is - // 256 x 128 px in size will be 2 x 1 units. - // Change to whatever best fits your game assets. - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#pixelScale - * @type {number} - * @since 3.0.0 - */ - this.pixelScale = 128; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#projection - * @type {Phaser.Math.Matrix4} - * @since 3.0.0 - */ - this.projection = new Matrix4(); - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#view - * @type {Phaser.Math.Matrix4} - * @since 3.0.0 - */ - this.view = new Matrix4(); - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#combined - * @type {Phaser.Math.Matrix4} - * @since 3.0.0 - */ - this.combined = new Matrix4(); - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#invProjectionView - * @type {Phaser.Math.Matrix4} - * @since 3.0.0 - */ - this.invProjectionView = new Matrix4(); - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#near - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.near = 1; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#far - * @type {number} - * @since 3.0.0 - */ - this.far = 100; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#ray - * @type {[type]} - * @since 3.0.0 - */ - this.ray = { - origin: new Vector3(), - direction: new Vector3() - }; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#viewportWidth - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.viewportWidth = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#viewportHeight - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.viewportHeight = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#billboardMatrixDirty - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.billboardMatrixDirty = true; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D#children - * @type {Phaser.Structs.Set} - * @since 3.0.0 - */ - this.children = new Set(); + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#setPosition + * @method Phaser.Math.Matrix4#fromArray * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] + * @param {[type]} a - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - setPosition: function (x, y, z) + fromArray: function (a) { - this.position.set(x, y, z); - - return this.update(); - }, + var out = this.val; - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.Camera#setScene - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - setScene: function (scene) - { - this.scene = scene; + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; return this; }, @@ -18953,55 +20538,82 @@ var Camera = new Class({ /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#setPixelScale + * @method Phaser.Math.Matrix4#zero * @since 3.0.0 * - * @param {[type]} value - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - setPixelScale: function (value) + zero: function () { - this.pixelScale = value; + var out = this.val; - return this.update(); + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 0; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#add + * @method Phaser.Math.Matrix4#xyz * @since 3.0.0 * - * @param {[type]} sprite3D - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] * * @return {[type]} [description] */ - add: function (sprite3D) + xyz: function (x, y, z) { - this.children.set(sprite3D); + this.identity(); - this.updateChildren(); + var out = this.val; - return sprite3D; + out[12] = x; + out[13] = y; + out[14] = z; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#remove + * @method Phaser.Math.Matrix4#scaling * @since 3.0.0 * - * @param {[type]} child - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - remove: function (child) + scaling: function (x, y, z) { - this.displayList.remove(child.gameObject); - this.updateList.remove(child.gameObject); + this.zero(); - this.children.delete(child); + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; return this; }, @@ -19009,19 +20621,31 @@ var Camera = new Class({ /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#clear + * @method Phaser.Math.Matrix4#identity * @since 3.0.0 * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - clear: function () + identity: function () { - var children = this.getChildren(); + var out = this.val; - for (var i = 0; i < children.length; i++) - { - this.remove(children[i]); - } + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; return this; }, @@ -19029,907 +20653,1293 @@ var Camera = new Class({ /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#getChildren + * @method Phaser.Math.Matrix4#transpose * @since 3.0.0 * - * @return {array} [description] + * @return {[type]} [description] */ - getChildren: function () + transpose: function () { - return this.children.entries; + var a = this.val; + + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a12 = a[6]; + var a13 = a[7]; + var a23 = a[11]; + + a[1] = a[4]; + a[2] = a[8]; + a[3] = a[12]; + a[4] = a01; + a[6] = a[9]; + a[7] = a[13]; + a[8] = a02; + a[9] = a12; + a[11] = a[14]; + a[12] = a03; + a[13] = a13; + a[14] = a23; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#create + * @method Phaser.Math.Matrix4#invert * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] - * @param {[type]} key - [description] - * @param {[type]} frame - [description] - * @param {[type]} visible - [description] - * * @return {[type]} [description] */ - create: function (x, y, z, key, frame, visible) + invert: function () { - if (visible === undefined) { visible = true; } + var a = this.val; - var child = new Sprite3D(this.scene, x, y, z, key, frame); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - this.displayList.add(child.gameObject); - this.updateList.add(child.gameObject); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - child.visible = visible; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - this.children.set(child); + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - this.updateChildren(); + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; - return child; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) + { + return null; + } + + det = 1 / det; + + a[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + a[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + a[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + a[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + a[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + a[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + a[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + a[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + a[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + a[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + a[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + a[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + a[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + a[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + a[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + a[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#createMultiple + * @method Phaser.Math.Matrix4#adjoint * @since 3.0.0 * - * @param {[type]} quantity - [description] - * @param {[type]} key - [description] - * @param {[type]} frame - [description] - * @param {[type]} visible - [description] - * * @return {[type]} [description] */ - createMultiple: function (quantity, key, frame, visible) + adjoint: function () { - if (visible === undefined) { visible = true; } - - var output = []; + var a = this.val; - for (var i = 0; i < quantity; i++) - { - var child = new Sprite3D(this.scene, 0, 0, 0, key, frame); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - this.displayList.add(child.gameObject); - this.updateList.add(child.gameObject); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - child.visible = visible; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - this.children.set(child); + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - output.push(child); - } + a[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + a[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + a[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + a[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + a[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + a[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + a[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + a[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + a[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + a[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + a[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + a[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + a[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + a[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + a[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + a[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); - return output; + return this; }, - // Create a bunch of Sprite3D objects in a rectangle - // size and spacing are Vec3s (or if integers are converted to vec3s) /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#createRect + * @method Phaser.Math.Matrix4#determinant * @since 3.0.0 * - * @param {[type]} size - [description] - * @param {[type]} spacing - [description] - * @param {[type]} key - [description] - * @param {[type]} frame - [description] - * * @return {[type]} [description] */ - createRect: function (size, spacing, key, frame) + determinant: function () { - if (typeof size === 'number') { size = { x: size, y: size, z: size }; } - if (typeof spacing === 'number') { spacing = { x: spacing, y: spacing, z: spacing }; } - - var quantity = size.x * size.y * size.z; - - var sprites = this.createMultiple(quantity, key, frame); + var a = this.val; - var i = 0; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - for (var z = 0.5 - (size.z / 2); z < (size.z / 2); z++) - { - for (var y = 0.5 - (size.y / 2); y < (size.y / 2); y++) - { - for (var x = 0.5 - (size.x / 2); x < (size.x / 2); x++) - { - var bx = (x * spacing.x); - var by = (y * spacing.y); - var bz = (z * spacing.z); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - sprites[i].position.set(bx, by, bz); + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - i++; - } - } - } + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - this.update(); + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; - return sprites; + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#randomSphere + * @method Phaser.Math.Matrix4#multiply * @since 3.0.0 * - * @param {[type]} radius - [description] - * @param {[type]} sprites - [description] + * @param {[type]} src - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - randomSphere: function (radius, sprites) + multiply: function (src) { - if (sprites === undefined) { sprites = this.getChildren(); } + var a = this.val; - for (var i = 0; i < sprites.length; i++) - { - RandomXYZ(sprites[i].position, radius); - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - return this.update(); - }, + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.Camera#randomCube - * @since 3.0.0 - * - * @param {[type]} scale - [description] - * @param {[type]} sprites - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - randomCube: function (scale, sprites) - { - if (sprites === undefined) { sprites = this.getChildren(); } + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - for (var i = 0; i < sprites.length; i++) - { - RandomXYZW(sprites[i].position, scale); - } + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - return this.update(); - }, + var b = src.val; - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.Camera#translateChildren - * @since 3.0.0 - * - * @param {[type]} vec3 - [description] - * @param {[type]} sprites - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - translateChildren: function (vec3, sprites) - { - if (sprites === undefined) { sprites = this.getChildren(); } + // Cache only the current line of the second matrix + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; - for (var i = 0; i < sprites.length; i++) - { - sprites[i].position.add(vec3); - } + a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return this.update(); + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + + a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + + a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + + a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#transformChildren + * @method Phaser.Math.Matrix4#multiplyLocal * @since 3.0.0 * - * @param {[type]} mat4 - [description] - * @param {[type]} sprites - [description] + * @param {[type]} src - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - transformChildren: function (mat4, sprites) + multiplyLocal: function (src) { - if (sprites === undefined) { sprites = this.getChildren(); } + var a = []; + var m1 = this.val; + var m2 = src.val; - for (var i = 0; i < sprites.length; i++) - { - sprites[i].position.transformMat4(mat4); - } + a[0] = m1[0] * m2[0] + m1[1] * m2[4] + m1[2] * m2[8] + m1[3] * m2[12]; + a[1] = m1[0] * m2[1] + m1[1] * m2[5] + m1[2] * m2[9] + m1[3] * m2[13]; + a[2] = m1[0] * m2[2] + m1[1] * m2[6] + m1[2] * m2[10] + m1[3] * m2[14]; + a[3] = m1[0] * m2[3] + m1[1] * m2[7] + m1[2] * m2[11] + m1[3] * m2[15]; - return this.update(); - }, + a[4] = m1[4] * m2[0] + m1[5] * m2[4] + m1[6] * m2[8] + m1[7] * m2[12]; + a[5] = m1[4] * m2[1] + m1[5] * m2[5] + m1[6] * m2[9] + m1[7] * m2[13]; + a[6] = m1[4] * m2[2] + m1[5] * m2[6] + m1[6] * m2[10] + m1[7] * m2[14]; + a[7] = m1[4] * m2[3] + m1[5] * m2[7] + m1[6] * m2[11] + m1[7] * m2[15]; - /** - * Sets the width and height of the viewport. Does not update any matrices. - * - * @method Phaser.Cameras.Sprite3D.Camera#setViewport - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - setViewport: function (width, height) - { - this.viewportWidth = width; - this.viewportHeight = height; + a[8] = m1[8] * m2[0] + m1[9] * m2[4] + m1[10] * m2[8] + m1[11] * m2[12]; + a[9] = m1[8] * m2[1] + m1[9] * m2[5] + m1[10] * m2[9] + m1[11] * m2[13]; + a[10] = m1[8] * m2[2] + m1[9] * m2[6] + m1[10] * m2[10] + m1[11] * m2[14]; + a[11] = m1[8] * m2[3] + m1[9] * m2[7] + m1[10] * m2[11] + m1[11] * m2[15]; - return this.update(); + a[12] = m1[12] * m2[0] + m1[13] * m2[4] + m1[14] * m2[8] + m1[15] * m2[12]; + a[13] = m1[12] * m2[1] + m1[13] * m2[5] + m1[14] * m2[9] + m1[15] * m2[13]; + a[14] = m1[12] * m2[2] + m1[13] * m2[6] + m1[14] * m2[10] + m1[15] * m2[14]; + a[15] = m1[12] * m2[3] + m1[13] * m2[7] + m1[14] * m2[11] + m1[15] * m2[15]; + + return this.fromArray(a); }, /** - * Translates this camera by a specified Vector3 object - * or x, y, z parameters. Any undefined x y z values will - * default to zero, leaving that component unaffected. - * If you wish to set the camera position directly call setPosition instead. + * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#translate + * @method Phaser.Math.Matrix4#translate * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] + * @param {[type]} v - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - translate: function (x, y, z) + translate: function (v) { - if (typeof x === 'object') - { - this.position.x += x.x || 0; - this.position.y += x.y || 0; - this.position.z += x.z || 0; - } - else - { - this.position.x += x || 0; - this.position.y += y || 0; - this.position.z += z || 0; - } + var x = v.x; + var y = v.y; + var z = v.z; + var a = this.val; - return this.update(); + a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#lookAt + * @method Phaser.Math.Matrix4#scale * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] + * @param {[type]} v - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - lookAt: function (x, y, z) + scale: function (v) { - var dir = this.direction; - var up = this.up; - - if (typeof x === 'object') - { - dir.copy(x); - } - else - { - dir.set(x, y, z); - } + var x = v.x; + var y = v.y; + var z = v.z; + var a = this.val; - dir.subtract(this.position).normalize(); + a[0] = a[0] * x; + a[1] = a[1] * x; + a[2] = a[2] * x; + a[3] = a[3] * x; - // Calculate right vector - tmpVec3.copy(dir).cross(up).normalize(); + a[4] = a[4] * y; + a[5] = a[5] * y; + a[6] = a[6] * y; + a[7] = a[7] * y; - // Calculate up vector - up.copy(tmpVec3).cross(dir).normalize(); + a[8] = a[8] * z; + a[9] = a[9] * z; + a[10] = a[10] * z; + a[11] = a[11] * z; - return this.update(); + return this; }, + // Axis = vec3, angle = radians /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#rotate + * @method Phaser.Math.Matrix4#makeRotationAxis * @since 3.0.0 * - * @param {[type]} radians - [description] * @param {[type]} axis - [description] + * @param {[type]} angle - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - rotate: function (radians, axis) + makeRotationAxis: function (axis, angle) { - RotateVec3(this.direction, axis, radians); - RotateVec3(this.up, axis, radians); - - return this.update(); - }, + // Based on http://www.gamedev.net/reference/articles/article1199.asp - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.Camera#rotateAround - * @since 3.0.0 - * - * @param {[type]} point - [description] - * @param {[type]} radians - [description] - * @param {[type]} axis - [description] - * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - rotateAround: function (point, radians, axis) - { - tmpVec3.copy(point).subtract(this.position); + var c = Math.cos(angle); + var s = Math.sin(angle); + var t = 1 - c; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var tx = t * x; + var ty = t * y; - this.translate(tmpVec3); - this.rotate(radians, axis); - this.translate(tmpVec3.negate()); + this.set( + tx * x + c, tx * y - s * z, tx * z + s * y, 0, + tx * y + s * z, ty * y + c, ty * z - s * x, 0, + tx * z - s * y, ty * z + s * x, t * z * z + c, 0, + 0, 0, 0, 1 + ); - return this.update(); + return this; }, + // aka rotationAxis /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#project + * @method Phaser.Math.Matrix4#rotate * @since 3.0.0 * - * @param {[type]} vec - [description] - * @param {[type]} out - [description] + * @param {[type]} rad - [description] + * @param {[type]} axis - [description] * * @return {[type]} [description] */ - project: function (vec, out) + rotate: function (rad, axis) { - if (out === undefined) { out = new Vector4(); } + var a = this.val; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var len = Math.sqrt(x * x + y * y + z * z); - // TODO: support viewport XY - var viewportWidth = this.viewportWidth; - var viewportHeight = this.viewportHeight; - var n = Camera.NEAR_RANGE; - var f = Camera.FAR_RANGE; + if (Math.abs(len) < EPSILON) + { + return null; + } + + len = 1 / len; + x *= len; + y *= len; + z *= len; - // For useful Z and W values we should do the usual steps: clip space -> NDC -> window coords + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; - // Implicit 1.0 for w component - tmpVec4.set(vec.x, vec.y, vec.z, 1.0); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - // Transform into clip space - tmpVec4.transformMat4(this.combined); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - // Avoid divide by zero when 0x0x0 camera projects to a 0x0x0 vec3 - if (tmpVec4.w === 0) - { - tmpVec4.w = 1; - } + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - // Now into NDC - tmpVec4.x = tmpVec4.x / tmpVec4.w; - tmpVec4.y = tmpVec4.y / tmpVec4.w; - tmpVec4.z = tmpVec4.z / tmpVec4.w; + // Construct the elements of the rotation matrix + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; - // And finally into window coordinates - out.x = viewportWidth / 2 * tmpVec4.x + (0 + viewportWidth / 2); - out.y = viewportHeight / 2 * tmpVec4.y + (0 + viewportHeight / 2); - out.z = (f - n) / 2 * tmpVec4.z + (f + n) / 2; + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; - // If the out vector has a fourth component, we also store (1/clip.w), same idea as gl_FragCoord.w - if (out.w === 0 || out.w) - { - out.w = 1 / tmpVec4.w; - } + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; - return out; + // Perform rotation-specific matrix multiplication + a[0] = a00 * b00 + a10 * b01 + a20 * b02; + a[1] = a01 * b00 + a11 * b01 + a21 * b02; + a[2] = a02 * b00 + a12 * b01 + a22 * b02; + a[3] = a03 * b00 + a13 * b01 + a23 * b02; + a[4] = a00 * b10 + a10 * b11 + a20 * b12; + a[5] = a01 * b10 + a11 * b11 + a21 * b12; + a[6] = a02 * b10 + a12 * b11 + a22 * b12; + a[7] = a03 * b10 + a13 * b11 + a23 * b12; + a[8] = a00 * b20 + a10 * b21 + a20 * b22; + a[9] = a01 * b20 + a11 * b21 + a21 * b22; + a[10] = a02 * b20 + a12 * b21 + a22 * b22; + a[11] = a03 * b20 + a13 * b21 + a23 * b22; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#unproject + * @method Phaser.Math.Matrix4#rotateX * @since 3.0.0 * - * @param {[type]} vec - [description] - * @param {[type]} out - [description] + * @param {[type]} rad - [description] * * @return {[type]} [description] */ - unproject: function (vec, out) + rotateX: function (rad) { - if (out === undefined) { out = new Vector3(); } + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); - var viewport = tmpVec4.set(0, 0, this.viewportWidth, this.viewportHeight); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - return out.copy(vec).unproject(viewport, this.invProjectionView); + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + // Perform axis-specific matrix multiplication + a[4] = a10 * c + a20 * s; + a[5] = a11 * c + a21 * s; + a[6] = a12 * c + a22 * s; + a[7] = a13 * c + a23 * s; + a[8] = a20 * c - a10 * s; + a[9] = a21 * c - a11 * s; + a[10] = a22 * c - a12 * s; + a[11] = a23 * c - a13 * s; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#getPickRay + * @method Phaser.Math.Matrix4#rotateY * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] + * @param {[type]} rad - [description] * * @return {[type]} [description] */ - getPickRay: function (x, y) + rotateY: function (rad) { - var origin = this.ray.origin.set(x, y, 0); - var direction = this.ray.direction.set(x, y, 1); - var viewport = tmpVec4.set(0, 0, this.viewportWidth, this.viewportHeight); - var mtx = this.invProjectionView; + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); - origin.unproject(viewport, mtx); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - direction.unproject(viewport, mtx); + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - direction.subtract(origin).normalize(); + // Perform axis-specific matrix multiplication + a[0] = a00 * c - a20 * s; + a[1] = a01 * c - a21 * s; + a[2] = a02 * c - a22 * s; + a[3] = a03 * c - a23 * s; + a[8] = a00 * s + a20 * c; + a[9] = a01 * s + a21 * c; + a[10] = a02 * s + a22 * c; + a[11] = a03 * s + a23 * c; - return this.ray; + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#updateChildren + * @method Phaser.Math.Matrix4#rotateZ * @since 3.0.0 * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @param {[type]} rad - [description] + * + * @return {[type]} [description] */ - updateChildren: function () + rotateZ: function (rad) { - var children = this.children.entries; + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); - for (var i = 0; i < children.length; i++) - { - children[i].project(this); - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + // Perform axis-specific matrix multiplication + a[0] = a00 * c + a10 * s; + a[1] = a01 * c + a11 * s; + a[2] = a02 * c + a12 * s; + a[3] = a03 * c + a13 * s; + a[4] = a10 * c - a00 * s; + a[5] = a11 * c - a01 * s; + a[6] = a12 * c - a02 * s; + a[7] = a13 * c - a03 * s; return this; }, - // Overriden by subclasses /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#update + * @method Phaser.Math.Matrix4#fromRotationTranslation * @since 3.0.0 * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. - */ - update: function () - { - return this.updateChildren(); - }, - - /** - * [description] + * @param {[type]} q - [description] + * @param {[type]} v - [description] * - * @method Phaser.Cameras.Sprite3D.Camera#updateBillboardMatrix - * @since 3.0.0 + * @return {[type]} [description] */ - updateBillboardMatrix: function () + fromRotationTranslation: function (q, v) { - var dir = dirvec.set(this.direction).negate(); + // Quaternion math + var out = this.val; - // Better view-aligned billboards might use this: - // var dir = tmp.set(camera.position).subtract(p).normalize(); - - var right = rightvec.set(this.up).cross(dir).normalize(); - var up = tmpVec3.set(dir).cross(right).normalize(); + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - var out = billboardMatrix.val; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - out[0] = right.x; - out[1] = right.y; - out[2] = right.z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; out[3] = 0; - out[4] = up.x; - out[5] = up.y; - out[6] = up.z; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; out[7] = 0; - out[8] = dir.x; - out[9] = dir.y; - out[10] = dir.z; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; + out[12] = v.x; + out[13] = v.y; + out[14] = v.z; out[15] = 1; - this.billboardMatrixDirty = false; + return this; }, - + /** - * This is a utility function for canvas 3D rendering, - * which determines the "point size" of a camera-facing - * sprite billboard given its 3D world position - * (origin at center of sprite) and its world width - * and height in x/y. - * - * We place into the output Vector2 the scaled width - * and height. If no `out` is specified, a new Vector2 - * will be created for convenience (this should be avoided - * in tight loops). + * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#getPointSize + * @method Phaser.Math.Matrix4#fromQuat * @since 3.0.0 * - * @param {[type]} vec - The position of the 3D Sprite. - * @param {[type]} size - The x and y dimensions. - * @param {[type]} out - The result, scaled x and y dimensions. + * @param {[type]} q - [description] * * @return {[type]} [description] */ - getPointSize: function (vec, size, out) + fromQuat: function (q) { - if (out === undefined) { out = new Vector2(); } - - // TODO: optimize this with a simple distance calculation: - // https://developer.valvesoftware.com/wiki/Field_of_View - - if (this.billboardMatrixDirty) - { - this.updateBillboardMatrix(); - } - - var tmp = tmpVec3; + var out = this.val; - var dx = (size.x / this.pixelScale) / 2; - var dy = (size.y / this.pixelScale) / 2; + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - tmp.set(-dx, -dy, 0).transformMat4(billboardMatrix).add(vec); + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - this.project(tmp, tmp); + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; - var tlx = tmp.x; - var tly = tmp.y; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; - tmp.set(dx, dy, 0).transformMat4(billboardMatrix).add(vec); + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; - this.project(tmp, tmp); + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; - var brx = tmp.x; - var bry = tmp.y; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; - // var w = Math.abs(brx - tlx); - // var h = Math.abs(bry - tly); + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; - // Allow the projection to get negative ... - var w = brx - tlx; - var h = bry - tly; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; - return out.set(w, h); + return this; }, /** - * [description] + * Generates a frustum matrix with the given bounds * - * @method Phaser.Cameras.Sprite3D.Camera#destroy - * @since 3.0.0 + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {Matrix4} this for chaining */ - destroy: function () - { - this.children.clear(); - - this.scene = undefined; - this.children = undefined; - }, - /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#setX + * @method Phaser.Math.Matrix4#frustum * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} left - [description] + * @param {[type]} right - [description] + * @param {[type]} bottom - [description] + * @param {[type]} top - [description] + * @param {[type]} near - [description] + * @param {[type]} far - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - setX: function (value) + frustum: function (left, right, bottom, top, near, far) { - this.position.x = value; + var out = this.val; - return this.update(); + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + + return this; }, + /** + * Generates a perspective projection matrix with the given bounds. + * perspective fov lh + * + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {Matrix4} this for chaining + */ /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#setY + * @method Phaser.Math.Matrix4#perspective * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} fovy - [description] + * @param {[type]} aspect - [description] + * @param {[type]} near - [description] + * @param {[type]} far - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - setY: function (value) + perspective: function (fovy, aspect, near, far) { - this.position.y = value; + var out = this.val; + var f = 1.0 / Math.tan(fovy / 2); + var nf = 1 / (near - far); - return this.update(); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + + return this; }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.Camera#setZ + * @method Phaser.Math.Matrix4#perspectiveLH * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} width - [description] + * @param {[type]} height - [description] + * @param {[type]} near - [description] + * @param {[type]} far - [description] * - * @return {Phaser.Cameras.Sprite3D.Camera} This Camera object. + * @return {[type]} [description] */ - setZ: function (value) + perspectiveLH: function (width, height, near, far) { - this.position.z = value; + var out = this.val; - return this.update(); + out[0] = (2 * near) / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + + out[4] = 0; + out[5] = (2 * near) / height; + out[6] = 0; + out[7] = 0; + + out[8] = 0; + out[9] = 0; + out[10] = -far / (near - far); + out[11] = 1; + + out[12] = 0; + out[13] = 0; + out[14] = (near * far) / (near - far); + out[15] = 0; + + return this; }, /** - * [description] + * Generates a orthogonal projection matrix with the given bounds * - * @name Phaser.Cameras.Sprite3D.Camera#x - * @type {number} - * @since 3.0.0 + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {Matrix4} this for chaining */ - x: { - get: function () - { - return this.position.x; - }, - - set: function (value) - { - this.position.x = value; - this.update(); - } - }, - /** * [description] * - * @name Phaser.Cameras.Sprite3D.Camera#y - * @type {number} + * @method Phaser.Math.Matrix4#ortho * @since 3.0.0 + * + * @param {[type]} left - [description] + * @param {[type]} right - [description] + * @param {[type]} bottom - [description] + * @param {[type]} top - [description] + * @param {[type]} near - [description] + * @param {[type]} far - [description] + * + * @return {[type]} [description] */ - y: { - get: function () - { - return this.position.y; - }, + ortho: function (left, right, bottom, top, near, far) + { + var out = this.val; + var lr = left - right; + var bt = bottom - top; + var nf = near - far; - set: function (value) - { - this.position.y = value; - this.update(); - } + // Avoid division by zero + lr = (lr === 0) ? lr : 1 / lr; + bt = (bt === 0) ? bt : 1 / bt; + nf = (nf === 0) ? nf : 1 / nf; + + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + + return this; }, + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {Vector3} eye Position of the viewer + * @param {Vector3} center Point the viewer is looking at + * @param {Vector3} up vec3 pointing up + * @returns {Matrix4} this for chaining + */ /** * [description] * - * @name Phaser.Cameras.Sprite3D.Camera#z - * @type {number} + * @method Phaser.Math.Matrix4#lookAt * @since 3.0.0 + * + * @param {[type]} eye - [description] + * @param {[type]} center - [description] + * @param {[type]} up - [description] + * + * @return {[type]} [description] */ - z: { - get: function () - { - return this.position.z; - }, - - set: function (value) - { - this.position.z = value; - this.update(); - } - } + lookAt: function (eye, center, up) + { + var out = this.val; -}); + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; -Camera.FAR_RANGE = 1.0; -Camera.NEAR_RANGE = 0.0; + var upx = up.x; + var upy = up.y; + var upz = up.z; -module.exports = Camera; + var centerx = center.x; + var centery = center.y; + var centerz = center.z; + if (Math.abs(eyex - centerx) < EPSILON && + Math.abs(eyey - centery) < EPSILON && + Math.abs(eyez - centerz) < EPSILON) + { + return this.identity(); + } -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + z0 *= len; + z1 *= len; + z2 *= len; -var Class = __webpack_require__(0); + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; -var EPSILON = 0.000001; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); -/** - * @classdesc - * [description] - * - * @class Matrix4 - * @memberOf Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - [description] - */ -var Matrix4 = new Class({ + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } - initialize: + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; - function Matrix4 (m) - { - /** - * [description] - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - if (m) + if (!len) { - // Assume Matrix4 with val: - this.copy(m); + y0 = 0; + y1 = 0; + y2 = 0; } else { - // Default to identity - this.identity(); + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; } - }, - /** - * [description] - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {[type]} [description] - */ - clone: function () - { - return new Matrix4(this); + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return this; }, /** * [description] * - * @method Phaser.Math.Matrix4#set + * @method Phaser.Math.Matrix4#yawPitchRoll * @since 3.0.0 * - * @param {[type]} src - [description] + * @param {[type]} yaw - [description] + * @param {[type]} pitch - [description] + * @param {[type]} roll - [description] * * @return {[type]} [description] */ - set: function (src) + yawPitchRoll: function (yaw, pitch, roll) { - return this.copy(src); + this.zero(); + _tempMat1.zero(); + _tempMat2.zero(); + + var m0 = this.val; + var m1 = _tempMat1.val; + var m2 = _tempMat2.val; + + // Rotate Z + var s = Math.sin(roll); + var c = Math.cos(roll); + + m0[10] = 1; + m0[15] = 1; + m0[0] = c; + m0[1] = s; + m0[4] = -s; + m0[5] = c; + + // Rotate X + s = Math.sin(pitch); + c = Math.cos(pitch); + + m1[0] = 1; + m1[15] = 1; + m1[5] = c; + m1[10] = c; + m1[9] = -s; + m1[6] = s; + + // Rotate Y + s = Math.sin(yaw); + c = Math.cos(yaw); + + m2[5] = 1; + m2[15] = 1; + m2[0] = c; + m2[2] = -s; + m2[8] = s; + m2[10] = c; + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + return this; }, /** * [description] * - * @method Phaser.Math.Matrix4#copy + * @method Phaser.Math.Matrix4#setWorldMatrix * @since 3.0.0 * - * @param {[type]} src - [description] + * @param {[type]} rotation - [description] + * @param {[type]} position - [description] + * @param {[type]} scale - [description] + * @param {[type]} viewMatrix - [description] + * @param {[type]} projectionMatrix - [description] * * @return {[type]} [description] */ - copy: function (src) + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) { - var out = this.val; - var a = src.val; + this.yawPitchRoll(rotation.y, rotation.x, rotation.z); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; + _tempMat1.scaling(scale.x, scale.y, scale.z); + _tempMat2.xyz(position.x, position.y, position.z); + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + if (viewMatrix !== undefined) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix !== undefined) + { + this.multiplyLocal(projectionMatrix); + } return this; + } + +}); + +var _tempMat1 = new Matrix4(); +var _tempMat2 = new Matrix4(); + +module.exports = Matrix4; + + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(0); + +/** + * @classdesc + * [description] + * + * @class Vector4 + * @memberOf Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - [description] + * @param {number} [y] - [description] + * @param {number} [z] - [description] + * @param {number} [w] - [description] + */ +var Vector4 = new Class({ + + initialize: + + function Vector4 (x, y, z, w) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector4#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector4#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector4#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + /** + * The w component of this Vector. + * + * @name Phaser.Math.Vector4#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } }, /** * [description] * - * @method Phaser.Math.Matrix4#fromArray + * @method Phaser.Math.Vector4#clone * @since 3.0.0 * - * @param {[type]} a - [description] - * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} [description] */ - fromArray: function (a) + clone: function () { - var out = this.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - - return this; + return new Vector4(this.x, this.y, this.z, this.w); }, /** * [description] * - * @method Phaser.Math.Matrix4#zero + * @method Phaser.Math.Vector4#copy * @since 3.0.0 * - * @return {[type]} [description] + * @param {Phaser.Math.Vector4} src - [description] + * + * @return {Phaser.Math.Vector4} This Vector4 object. */ - zero: function () + copy: function (src) { - var out = this.val; - - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 0; + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + this.w = src.w || 0; return this; }, @@ -19937,50 +21947,47 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#xyz + * @method Phaser.Math.Vector4#equals * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] + * @param {Phaser.Math.Vector4} v - [description] * - * @return {[type]} [description] + * @return {boolean} [description] */ - xyz: function (x, y, z) + equals: function (v) { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); }, /** * [description] * - * @method Phaser.Math.Matrix4#scaling + * @method Phaser.Math.Vector4#set * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} z - [description] + * @param {number} w - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - scaling: function (x, y, z) + set: function (x, y, z, w) { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } return this; }, @@ -19988,31 +21995,19 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#identity + * @method Phaser.Math.Vector4#add * @since 3.0.0 * - * @return {[type]} [description] + * @param {Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4} v - [description] + * + * @return {Phaser.Math.Vector4} This Vector4 object. */ - identity: function () + add: function (v) { - var out = this.val; - - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + this.w += v.w || 0; return this; }, @@ -20020,34 +22015,19 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#transpose + * @method Phaser.Math.Vector4#subtract * @since 3.0.0 * - * @return {[type]} [description] + * @param {Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4} v - [description] + * + * @return {Phaser.Math.Vector4} This Vector4 object. */ - transpose: function () + subtract: function (v) { - var a = this.val; - - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a12 = a[6]; - var a13 = a[7]; - var a23 = a[11]; - - a[1] = a[4]; - a[2] = a[8]; - a[3] = a[12]; - a[4] = a01; - a[6] = a[9]; - a[7] = a[13]; - a[8] = a02; - a[9] = a12; - a[11] = a[14]; - a[12] = a03; - a[13] = a13; - a[14] = a23; + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + this.w -= v.w || 0; return this; }, @@ -20055,77 +22035,19 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#invert + * @method Phaser.Math.Vector4#scale * @since 3.0.0 * - * @return {[type]} [description] + * @param {number} scale - [description] + * + * @return {Phaser.Math.Vector4} This Vector4 object. */ - invert: function () + scale: function (scale) { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) - { - return null; - } - - det = 1 / det; - - a[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - a[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - a[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - a[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - a[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - a[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - a[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - a[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - a[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - a[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - a[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - a[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - a[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - a[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - a[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - a[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; return this; }, @@ -20133,180 +22055,64 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#adjoint + * @method Phaser.Math.Vector4#length * @since 3.0.0 * - * @return {[type]} [description] + * @return {number} [description] */ - adjoint: function () + length: function () { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - a[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); - a[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - a[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); - a[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - a[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - a[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); - a[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - a[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); - a[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); - a[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - a[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); - a[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - a[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - a[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); - a[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - a[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - return this; + return Math.sqrt(x * x + y * y + z * z + w * w); }, /** * [description] * - * @method Phaser.Math.Matrix4#determinant + * @method Phaser.Math.Vector4#lengthSq * @since 3.0.0 * - * @return {[type]} [description] + * @return {number} [description] */ - determinant: function () + lengthSq: function () { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - }, + return x * x + y * y + z * z + w * w; + }, /** * [description] * - * @method Phaser.Math.Matrix4#multiply + * @method Phaser.Math.Vector4#normalize * @since 3.0.0 * - * @param {[type]} src - [description] - * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - multiply: function (src) + normalize: function () { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b = src.val; - - // Cache only the current line of the second matrix - var b0 = b[0]; - var b1 = b[1]; - var b2 = b[2]; - var b3 = b[3]; - - a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - - a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - - a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var len = x * x + y * y + z * z + w * w; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; + if (len > 0) + { + len = 1 / Math.sqrt(len); - a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + this.x = x * len; + this.y = y * len; + this.z = z * len; + this.w = w * len; + } return this; }, @@ -20314,63 +22120,42 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#multiplyLocal + * @method Phaser.Math.Vector4#dot * @since 3.0.0 * - * @param {[type]} src - [description] + * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {number} [description] */ - multiplyLocal: function (src) + dot: function (v) { - var a = []; - var m1 = this.val; - var m2 = src.val; - - a[0] = m1[0] * m2[0] + m1[1] * m2[4] + m1[2] * m2[8] + m1[3] * m2[12]; - a[1] = m1[0] * m2[1] + m1[1] * m2[5] + m1[2] * m2[9] + m1[3] * m2[13]; - a[2] = m1[0] * m2[2] + m1[1] * m2[6] + m1[2] * m2[10] + m1[3] * m2[14]; - a[3] = m1[0] * m2[3] + m1[1] * m2[7] + m1[2] * m2[11] + m1[3] * m2[15]; - - a[4] = m1[4] * m2[0] + m1[5] * m2[4] + m1[6] * m2[8] + m1[7] * m2[12]; - a[5] = m1[4] * m2[1] + m1[5] * m2[5] + m1[6] * m2[9] + m1[7] * m2[13]; - a[6] = m1[4] * m2[2] + m1[5] * m2[6] + m1[6] * m2[10] + m1[7] * m2[14]; - a[7] = m1[4] * m2[3] + m1[5] * m2[7] + m1[6] * m2[11] + m1[7] * m2[15]; - - a[8] = m1[8] * m2[0] + m1[9] * m2[4] + m1[10] * m2[8] + m1[11] * m2[12]; - a[9] = m1[8] * m2[1] + m1[9] * m2[5] + m1[10] * m2[9] + m1[11] * m2[13]; - a[10] = m1[8] * m2[2] + m1[9] * m2[6] + m1[10] * m2[10] + m1[11] * m2[14]; - a[11] = m1[8] * m2[3] + m1[9] * m2[7] + m1[10] * m2[11] + m1[11] * m2[15]; - - a[12] = m1[12] * m2[0] + m1[13] * m2[4] + m1[14] * m2[8] + m1[15] * m2[12]; - a[13] = m1[12] * m2[1] + m1[13] * m2[5] + m1[14] * m2[9] + m1[15] * m2[13]; - a[14] = m1[12] * m2[2] + m1[13] * m2[6] + m1[14] * m2[10] + m1[15] * m2[14]; - a[15] = m1[12] * m2[3] + m1[13] * m2[7] + m1[14] * m2[11] + m1[15] * m2[15]; - - return this.fromArray(a); + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; }, /** * [description] * - * @method Phaser.Math.Matrix4#translate + * @method Phaser.Math.Vector4#lerp * @since 3.0.0 * * @param {[type]} v - [description] + * @param {[type]} t - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - translate: function (v) + lerp: function (v, t) { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; + if (t === undefined) { t = 0; } - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + this.w = aw + t * (v.w - aw); return this; }, @@ -20378,226 +22163,97 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#scale + * @method Phaser.Math.Vector4#multiply * @since 3.0.0 * * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - scale: function (v) + multiply: function (v) { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; - - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; - - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + this.w *= v.w || 1; return this; }, - // Axis = vec3, angle = radians /** * [description] * - * @method Phaser.Math.Matrix4#makeRotationAxis + * @method Phaser.Math.Vector4#divide * @since 3.0.0 * - * @param {[type]} axis - [description] - * @param {[type]} angle - [description] + * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - makeRotationAxis: function (axis, angle) + divide: function (v) { - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos(angle); - var s = Math.sin(angle); - var t = 1 - c; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var tx = t * x; - var ty = t * y; - - this.set( - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - ); + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + this.w /= v.w || 1; return this; }, - // aka rotationAxis /** * [description] * - * @method Phaser.Math.Matrix4#rotate + * @method Phaser.Math.Vector4#distance * @since 3.0.0 * - * @param {[type]} rad - [description] - * @param {[type]} axis - [description] + * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {number} [description] */ - rotate: function (rad, axis) + distance: function (v) { - var a = this.val; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var len = Math.sqrt(x * x + y * y + z * z); - - if (Math.abs(len) < EPSILON) - { - return null; - } - - len = 1 / len; - x *= len; - y *= len; - z *= len; - - var s = Math.sin(rad); - var c = Math.cos(rad); - var t = 1 - c; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Construct the elements of the rotation matrix - var b00 = x * x * t + c; - var b01 = y * x * t + z * s; - var b02 = z * x * t - y * s; - - var b10 = x * y * t - z * s; - var b11 = y * y * t + c; - var b12 = z * y * t + x * s; - - var b20 = x * z * t + y * s; - var b21 = y * z * t - x * s; - var b22 = z * z * t + c; - - // Perform rotation-specific matrix multiplication - a[0] = a00 * b00 + a10 * b01 + a20 * b02; - a[1] = a01 * b00 + a11 * b01 + a21 * b02; - a[2] = a02 * b00 + a12 * b01 + a22 * b02; - a[3] = a03 * b00 + a13 * b01 + a23 * b02; - a[4] = a00 * b10 + a10 * b11 + a20 * b12; - a[5] = a01 * b10 + a11 * b11 + a21 * b12; - a[6] = a02 * b10 + a12 * b11 + a22 * b12; - a[7] = a03 * b10 + a13 * b11 + a23 * b12; - a[8] = a00 * b20 + a10 * b21 + a20 * b22; - a[9] = a01 * b20 + a11 * b21 + a21 * b22; - a[10] = a02 * b20 + a12 * b21 + a22 * b22; - a[11] = a03 * b20 + a13 * b21 + a23 * b22; + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + var dw = v.w - this.w || 0; - return this; + return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); }, /** * [description] * - * @method Phaser.Math.Matrix4#rotateX + * @method Phaser.Math.Vector4#distanceSq * @since 3.0.0 * - * @param {[type]} rad - [description] + * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {number} [description] */ - rotateX: function (rad) + distanceSq: function (v) { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[4] = a10 * c + a20 * s; - a[5] = a11 * c + a21 * s; - a[6] = a12 * c + a22 * s; - a[7] = a13 * c + a23 * s; - a[8] = a20 * c - a10 * s; - a[9] = a21 * c - a11 * s; - a[10] = a22 * c - a12 * s; - a[11] = a23 * c - a13 * s; + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + var dw = v.w - this.w || 0; - return this; + return dx * dx + dy * dy + dz * dz + dw * dw; }, /** * [description] * - * @method Phaser.Math.Matrix4#rotateY + * @method Phaser.Math.Vector4#negate * @since 3.0.0 * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - rotateY: function (rad) + negate: function () { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c - a20 * s; - a[1] = a01 * c - a21 * s; - a[2] = a02 * c - a22 * s; - a[3] = a03 * c - a23 * s; - a[8] = a00 * s + a20 * c; - a[9] = a01 * s + a21 * c; - a[10] = a02 * s + a22 * c; - a[11] = a03 * s + a23 * c; + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + this.w = -this.w; return this; }, @@ -20605,98 +22261,62 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#rotateZ + * @method Phaser.Math.Vector4#transformMat4 * @since 3.0.0 * - * @param {[type]} rad - [description] + * @param {[type]} mat - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - rotateZ: function (rad) + transformMat4: function (mat) { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var m = mat.val; - // Perform axis-specific matrix multiplication - a[0] = a00 * c + a10 * s; - a[1] = a01 * c + a11 * s; - a[2] = a02 * c + a12 * s; - a[3] = a03 * c + a13 * s; - a[4] = a10 * c - a00 * s; - a[5] = a11 * c - a01 * s; - a[6] = a12 * c - a02 * s; - a[7] = a13 * c - a03 * s; + this.x = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + this.w = m[3] * x + m[7] * y + m[11] * z + m[15] * w; return this; }, + // TODO: is this really the same as Vector3? + // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ /** * [description] * - * @method Phaser.Math.Matrix4#fromRotationTranslation + * @method Phaser.Math.Vector4#transformQuat * @since 3.0.0 * * @param {[type]} q - [description] - * @param {[type]} v - [description] * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - fromRotationTranslation: function (q, v) + transformQuat: function (q) { - // Quaternion math - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; + // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; + // calculate quat * vec + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; + // calculate result * inverse quat + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; return this; }, @@ -20704,495 +22324,351 @@ var Matrix4 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix4#fromQuat + * @method Phaser.Math.Vector4#reset * @since 3.0.0 * - * @param {[type]} q - [description] - * - * @return {[type]} [description] + * @return {Phaser.Math.Vector4} This Vector4 object. */ - fromQuat: function (q) + reset: function () { - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 0; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; + return this; + } - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; +}); - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; +// TODO: Check if these are required internally, if not, remove. +Vector4.prototype.sub = Vector4.prototype.subtract; +Vector4.prototype.mul = Vector4.prototype.multiply; +Vector4.prototype.div = Vector4.prototype.divide; +Vector4.prototype.dist = Vector4.prototype.distance; +Vector4.prototype.distSq = Vector4.prototype.distanceSq; +Vector4.prototype.len = Vector4.prototype.length; +Vector4.prototype.lenSq = Vector4.prototype.lengthSq; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; +module.exports = Vector4; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; +/***/ }), +/* 121 */ +/***/ (function(module, exports) { - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +// Browser specific prefix, so not going to change between contexts, only between browsers +var prefix = ''; +/** + * @namespace Phaser.Display.Canvas.Smoothing + * @since 3.0.0 + */ +var Smoothing = function () +{ /** - * Generates a frustum matrix with the given bounds - * - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {Matrix4} this for chaining - */ - /** - * [description] + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. * - * @method Phaser.Math.Matrix4#frustum + * @function Phaser.Display.Canvas.Smoothing.getPrefix * @since 3.0.0 - * - * @param {[type]} left - [description] - * @param {[type]} right - [description] - * @param {[type]} bottom - [description] - * @param {[type]} top - [description] - * @param {[type]} near - [description] - * @param {[type]} far - [description] - * - * @return {[type]} [description] + * + * @param {[type]} context - [description] + * + * @return {string} [description] */ - frustum: function (left, right, bottom, top, near, far) + var getPrefix = function (context) { - var out = this.val; - - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - - out[0] = (near * 2) * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (near * 2) * tb; - out[6] = 0; - out[7] = 0; + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; - out[12] = 0; - out[13] = 0; - out[14] = (far * near * 2) * nf; - out[15] = 0; + if (s in context) + { + return s; + } + } - return this; - }, + return null; + }; /** - * Generates a perspective projection matrix with the given bounds. - * perspective fov lh - * - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {Matrix4} this for chaining - */ - /** - * [description] + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. * - * @method Phaser.Math.Matrix4#perspective + * @function Phaser.Display.Canvas.Smoothing.enable * @since 3.0.0 - * - * @param {[type]} fovy - [description] - * @param {[type]} aspect - [description] - * @param {[type]} near - [description] - * @param {[type]} far - [description] - * + * + * @param {[type]} context - [description] + * * @return {[type]} [description] */ - perspective: function (fovy, aspect, near, far) + var enable = function (context) { - var out = this.val; - var f = 1.0 / Math.tan(fovy / 2); - var nf = 1 / (near - far); - - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = (far + near) * nf; - out[11] = -1; + if (prefix === '') + { + prefix = getPrefix(context); + } - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; + if (prefix) + { + context[prefix] = true; + } - return this; - }, + return context; + }; /** - * [description] + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. * - * @method Phaser.Math.Matrix4#perspectiveLH + * @function Phaser.Display.Canvas.Smoothing.disable * @since 3.0.0 - * - * @param {[type]} width - [description] - * @param {[type]} height - [description] - * @param {[type]} near - [description] - * @param {[type]} far - [description] - * + * + * @param {[type]} context - [description] + * * @return {[type]} [description] */ - perspectiveLH: function (width, height, near, far) + var disable = function (context) { - var out = this.val; - - out[0] = (2 * near) / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (2 * near) / height; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = -far / (near - far); - out[11] = 1; + if (prefix === '') + { + prefix = getPrefix(context); + } - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; + if (prefix) + { + context[prefix] = false; + } - return this; - }, + return context; + }; /** - * Generates a orthogonal projection matrix with the given bounds - * - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {Matrix4} this for chaining - */ - /** - * [description] + * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. + * Returns null if no smoothing prefix is available. * - * @method Phaser.Math.Matrix4#ortho + * @function Phaser.Display.Canvas.Smoothing.isEnabled * @since 3.0.0 - * - * @param {[type]} left - [description] - * @param {[type]} right - [description] - * @param {[type]} bottom - [description] - * @param {[type]} top - [description] - * @param {[type]} near - [description] - * @param {[type]} far - [description] - * - * @return {[type]} [description] + * + * @param {[type]} context - [description] + * + * @return {boolean} [description] */ - ortho: function (left, right, bottom, top, near, far) + var isEnabled = function (context) { - var out = this.val; - var lr = left - right; - var bt = bottom - top; - var nf = near - far; - - // Avoid division by zero - lr = (lr === 0) ? lr : 1 / lr; - bt = (bt === 0) ? bt : 1 / bt; - nf = (nf === 0) ? nf : 1 / nf; - - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; + return (prefix !== null) ? context[prefix] : null; + }; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; +}; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; +module.exports = Smoothing(); - return this; - }, - /** - * Generates a look-at matrix with the given eye position, focal point, and up axis - * - * @param {Vector3} eye Position of the viewer - * @param {Vector3} center Point the viewer is looking at - * @param {Vector3} up vec3 pointing up - * @returns {Matrix4} this for chaining - */ - /** - * [description] - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {[type]} eye - [description] - * @param {[type]} center - [description] - * @param {[type]} up - [description] - * - * @return {[type]} [description] - */ - lookAt: function (eye, center, up) - { - var out = this.val; +/***/ }), +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var upx = up.x; - var upy = up.y; - var upz = up.z; +var Rectangle = __webpack_require__(8); - var centerx = center.x; - var centery = center.y; - var centerz = center.z; +// points is an array of Point-like objects, +// either 2 dimensional arrays, or objects with public x/y properties: +// var points = [ +// [100, 200], +// [200, 400], +// { x: 30, y: 60 } +// ] - if (Math.abs(eyex - centerx) < EPSILON && - Math.abs(eyey - centery) < EPSILON && - Math.abs(eyez - centerz) < EPSILON) - { - return this.identity(); - } +/** + * [description] + * + * @function Phaser.Geom.Rectangle.FromPoints + * @since 3.0.0 + * + * @param {[type]} points - [description] + * @param {Phaser.Geom.Rectangle} out - [description] + * + * @return {Phaser.Geom.Rectangle} [description] + */ +var FromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; + if (points.length === 0) + { + return out; + } - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; - z0 *= len; - z1 *= len; - z2 *= len; + var maxX = Number.MIN_SAFE_INTEGER; + var maxY = Number.MIN_SAFE_INTEGER; - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; + var p; + var px; + var py; - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + for (var i = 0; i < points.length; i++) + { + p = points[i]; - if (!len) + if (Array.isArray(p)) { - x0 = 0; - x1 = 0; - x2 = 0; + px = p[0]; + py = p[1]; } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; + px = p.x; + py = p.y; } - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; + minX = Math.min(minX, px); + minY = Math.min(minY, py); - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + maxX = Math.max(maxX, px); + maxY = Math.max(maxY, py); + } - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; + return out; +}; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; +module.exports = FromPoints; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; +/***/ }), +/* 123 */ +/***/ (function(module, exports) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {[type]} yaw - [description] - * @param {[type]} pitch - [description] - * @param {[type]} roll - [description] - * - * @return {[type]} [description] - */ - yawPitchRoll: function (yaw, pitch, roll) - { - this.zero(); - _tempMat1.zero(); - _tempMat2.zero(); +/** + * [description] + * + * @function Phaser.Math.CatmullRom + * @since 3.0.0 + * + * @param {number} t - [description] + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {number} p2 - [description] + * @param {number} p3 - [description] + * + * @return {number} [description] + */ +var CatmullRom = function (t, p0, p1, p2, p3) +{ + var v0 = (p2 - p0) * 0.5; + var v1 = (p3 - p1) * 0.5; + var t2 = t * t; + var t3 = t * t2; - var m0 = this.val; - var m1 = _tempMat1.val; - var m2 = _tempMat2.val; + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; +}; - // Rotate Z - var s = Math.sin(roll); - var c = Math.cos(roll); +module.exports = CatmullRom; - m0[10] = 1; - m0[15] = 1; - m0[0] = c; - m0[1] = s; - m0[4] = -s; - m0[5] = c; - // Rotate X - s = Math.sin(pitch); - c = Math.cos(pitch); - - m1[0] = 1; - m1[15] = 1; - m1[5] = c; - m1[10] = c; - m1[9] = -s; - m1[6] = s; - - // Rotate Y - s = Math.sin(yaw); - c = Math.cos(yaw); +/***/ }), +/* 124 */ +/***/ (function(module, exports) { - m2[5] = 1; - m2[15] = 1; - m2[0] = c; - m2[2] = -s; - m2[8] = s; - m2[10] = c; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); +/** + * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it. + * If no parent was given or falls back to using `document.body`. + * + * @function Phaser.DOM.AddToDOM + * @since 3.0.0 + * + * @param {object} element - The element to be added to the DOM. Usually a Canvas object. + * @param {string|object} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * @param {boolean} [overflowHidden=true] - [description] + * + * @return {object} The element that was added to the DOM. + */ +var AddToDOM = function (element, parent, overflowHidden) +{ + if (overflowHidden === undefined) { overflowHidden = true; } - return this; - }, + var target; - /** - * [description] - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {[type]} rotation - [description] - * @param {[type]} position - [description] - * @param {[type]} scale - [description] - * @param {[type]} viewMatrix - [description] - * @param {[type]} projectionMatrix - [description] - * - * @return {[type]} [description] - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + if (parent) { - this.yawPitchRoll(rotation.y, rotation.x, rotation.z); - - _tempMat1.scaling(scale.x, scale.y, scale.z); - _tempMat2.xyz(position.x, position.y, position.z); - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - if (viewMatrix !== undefined) + if (typeof parent === 'string') { - this.multiplyLocal(viewMatrix); + // Hopefully an element ID + target = document.getElementById(parent); } - - if (projectionMatrix !== undefined) + else if (typeof parent === 'object' && parent.nodeType === 1) { - this.multiplyLocal(projectionMatrix); + // Quick test for a HTMLelement + target = parent; } + } - return this; + // Fallback, covers an invalid ID and a non HTMLelement object + if (!target) + { + target = document.body; } -}); + if (overflowHidden && target.style) + { + target.style.overflow = 'hidden'; + } -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); + target.appendChild(element); -module.exports = Matrix4; + return element; +}; + +module.exports = AddToDOM; /***/ }), -/* 119 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21201,841 +22677,840 @@ module.exports = Matrix4; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); +var OS = __webpack_require__(67); +var Browser = __webpack_require__(82); +var CanvasPool = __webpack_require__(19); /** - * @classdesc - * [description] - * - * @class Vector4 - * @memberOf Phaser.Math - * @constructor + * Determines the features of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.features` from within any Scene. + * + * @name Phaser.Device.Features * @since 3.0.0 - * - * @param {number} [x] - [description] - * @param {number} [y] - [description] - * @param {number} [z] - [description] - * @param {number} [w] - [description] + * + * @type {object} + * @property {?boolean} canvasBitBltShift - True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap. + * @property {boolean} canvas - Is canvas available? + * @property {boolean} file - Is file available? + * @property {boolean} fileSystem - Is fileSystem available? + * @property {boolean} getUserMedia - Does the device support the getUserMedia API? + * @property {boolean} littleEndian - Is the device big or little endian? (only detected if the browser supports TypedArrays) + * @property {boolean} localStorage - Is localStorage available? + * @property {boolean} pointerLock - Is Pointer Lock available? + * @property {boolean} support32bit - Does the device context support 32bit pixel manipulation using array buffer views? + * @property {boolean} vibration - Does the device support the Vibration API? + * @property {boolean} webGL - Is webGL available? + * @property {boolean} worker - Is worker available? */ -var Vector4 = new Class({ - - initialize: - - function Vector4 (x, y, z, w) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector4#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ +var Features = { - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector4#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ + canvas: false, + canvasBitBltShift: null, + file: false, + fileSystem: false, + getUserMedia: true, + littleEndian: false, + localStorage: false, + pointerLock: false, + support32bit: false, + vibration: false, + webGL: false, + worker: false - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector4#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ +}; - /** - * The w component of this Vector. - * - * @name Phaser.Math.Vector4#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ +// Check Little or Big Endian system. +// @author Matt DesLauriers (@mattdesl) +function checkIsLittleEndian () +{ + var a = new ArrayBuffer(4); + var b = new Uint8Array(a); + var c = new Uint32Array(a); - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } - }, + b[0] = 0xa1; + b[1] = 0xb2; + b[2] = 0xc3; + b[3] = 0xd4; - /** - * [description] - * - * @method Phaser.Math.Vector4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} [description] - */ - clone: function () + if (c[0] === 0xd4c3b2a1) { - return new Vector4(this.x, this.y, this.z, this.w); - }, + return true; + } - /** - * [description] - * - * @method Phaser.Math.Vector4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} src - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - copy: function (src) + if (c[0] === 0xa1b2c3d4) { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - this.w = src.w || 0; + return false; + } + else + { + // Could not determine endianness + return null; + } +} - return this; - }, +function init () +{ + Features.canvas = !!window['CanvasRenderingContext2D'] || OS.cocoonJS; - /** - * [description] - * - * @method Phaser.Math.Vector4#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} v - [description] - * - * @return {boolean} [description] - */ - equals: function (v) + try { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); - }, + Features.localStorage = !!localStorage.getItem; + } + catch (error) + { + Features.localStorage = false; + } - /** - * [description] - * - * @method Phaser.Math.Vector4#set - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} z - [description] - * @param {number} w - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - set: function (x, y, z, w) + Features.file = !!window['File'] && !!window['FileReader'] && !!window['FileList'] && !!window['Blob']; + Features.fileSystem = !!window['requestFileSystem']; + + var isUint8 = false; + + var testWebGL = function () { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else + if (window['WebGLRenderingContext']) { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + try + { + var canvas = CanvasPool.createWebGL(this); - return this; - }, + if (OS.cocoonJS) + { + canvas.screencanvas = false; + } - /** - * [description] - * - * @method Phaser.Math.Vector4#add - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4} v - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - this.w += v.w || 0; + var ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); - return this; - }, + var canvas2D = CanvasPool.create2D(this); - /** - * [description] - * - * @method Phaser.Math.Vector4#subtract - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4} v - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - this.w -= v.w || 0; + var ctx2D = canvas2D.getContext('2d'); - return this; - }, + // Can't be done on a webgl context + var image = ctx2D.createImageData(1, 1); - /** - * [description] - * - * @method Phaser.Math.Vector4#scale - * @since 3.0.0 - * - * @param {number} scale - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + // Test to see if ImageData uses CanvasPixelArray or Uint8ClampedArray. + // @author Matt DesLauriers (@mattdesl) + isUint8 = image.data instanceof Uint8ClampedArray; - return this; - }, + CanvasPool.remove(canvas); + CanvasPool.remove(canvas2D); - /** - * [description] - * - * @method Phaser.Math.Vector4#length - * @since 3.0.0 - * - * @return {number} [description] - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + return !!ctx; + } + catch (e) + { + return false; + } + } - return Math.sqrt(x * x + y * y + z * z + w * w); - }, + return false; + }; - /** - * [description] - * - * @method Phaser.Math.Vector4#lengthSq - * @since 3.0.0 - * - * @return {number} [description] - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + Features.webGL = testWebGL(); - return x * x + y * y + z * z + w * w; - }, + Features.worker = !!window['Worker']; - /** - * [description] - * - * @method Phaser.Math.Vector4#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var len = x * x + y * y + z * z + w * w; + Features.pointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document; - if (len > 0) - { - len = 1 / Math.sqrt(len); + navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; - } + window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; - return this; - }, + Features.getUserMedia = Features.getUserMedia && !!navigator.getUserMedia && !!window.URL; - /** - * [description] - * - * @method Phaser.Math.Vector4#dot - * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {number} [description] - */ - dot: function (v) + // Older versions of firefox (< 21) apparently claim support but user media does not actually work + if (Browser.firefox && Browser.firefoxVersion < 21) { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, + Features.getUserMedia = false; + } - /** - * [description] - * - * @method Phaser.Math.Vector4#lerp - * @since 3.0.0 - * - * @param {[type]} v - [description] - * @param {[type]} t - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - lerp: function (v, t) + // Excludes iOS versions as they generally wrap UIWebView (eg. Safari WebKit) and it + // is safer to not try and use the fast copy-over method. + if (!OS.iOS && (Browser.ie || Browser.firefox || Browser.chrome)) { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + Features.canvasBitBltShift = true; + } - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); + // Known not to work + if (Browser.safari || Browser.mobileSafari) + { + Features.canvasBitBltShift = false; + } - return this; - }, + navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; - /** - * [description] - * - * @method Phaser.Math.Vector4#multiply - * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. - */ - multiply: function (v) + if (navigator.vibrate) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - this.w *= v.w || 1; + Features.vibration = true; + } - return this; - }, + if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined') + { + Features.littleEndian = checkIsLittleEndian(); + } + + Features.support32bit = ( + typeof ArrayBuffer !== 'undefined' && + typeof Uint8ClampedArray !== 'undefined' && + typeof Int32Array !== 'undefined' && + Features.littleEndian !== null && + isUint8 + ); + + return Features; +} + +module.exports = init(); + + +/***/ }), +/* 126 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Checks if the given `width` and `height` are a power of two. + * Useful for checking texture dimensions. + * + * @function Phaser.Math.Pow2.IsSizePowerOfTwo + * @since 3.0.0 + * + * @param {number} width - The width. + * @param {number} height - The height. + * + * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`. + */ +var IsSizePowerOfTwo = function (width, height) +{ + return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); +}; + +module.exports = IsSizePowerOfTwo; + + +/***/ }), +/* 127 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Graphics.Commands + */ + +module.exports = { + + ARC: 0, + BEGIN_PATH: 1, + CLOSE_PATH: 2, + FILL_RECT: 3, + LINE_TO: 4, + MOVE_TO: 5, + LINE_STYLE: 6, + FILL_STYLE: 7, + FILL_PATH: 8, + STROKE_PATH: 9, + FILL_TRIANGLE: 10, + STROKE_TRIANGLE: 11, + LINE_FX_TO: 12, + MOVE_FX_TO: 13, + SAVE: 14, + RESTORE: 15, + TRANSLATE: 16, + SCALE: 17, + ROTATE: 18 + +}; + + +/***/ }), +/* 128 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +module.exports = { /** - * [description] - * - * @method Phaser.Math.Vector4#divide + * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE + * @type {integer} * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - this.w /= v.w || 1; - - return this; - }, + BACKSPACE: 8, /** - * [description] - * - * @method Phaser.Math.Vector4#distance + * @name Phaser.Input.Keyboard.KeyCodes.TAB + * @type {integer} * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {number} [description] */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - var dw = v.w - this.w || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); - }, + TAB: 9, /** - * [description] - * - * @method Phaser.Math.Vector4#distanceSq + * @name Phaser.Input.Keyboard.KeyCodes.ENTER + * @type {integer} * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {number} [description] */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - var dw = v.w - this.w || 0; + ENTER: 13, - return dx * dx + dy * dy + dz * dz + dw * dw; - }, + /** + * @name Phaser.Input.Keyboard.KeyCodes.SHIFT + * @type {integer} + * @since 3.0.0 + */ + SHIFT: 16, /** - * [description] - * - * @method Phaser.Math.Vector4#negate + * @name Phaser.Input.Keyboard.KeyCodes.CTRL + * @type {integer} * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4 object. */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; + CTRL: 17, - return this; - }, + /** + * @name Phaser.Input.Keyboard.KeyCodes.ALT + * @type {integer} + * @since 3.0.0 + */ + ALT: 18, /** - * [description] - * - * @method Phaser.Math.Vector4#transformMat4 + * @name Phaser.Input.Keyboard.KeyCodes.PAUSE + * @type {integer} * @since 3.0.0 - * - * @param {[type]} mat - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var m = mat.val; + PAUSE: 19, - this.x = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - this.w = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + /** + * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK + * @type {integer} + * @since 3.0.0 + */ + CAPS_LOCK: 20, - return this; - }, + /** + * @name Phaser.Input.Keyboard.KeyCodes.ESC + * @type {integer} + * @since 3.0.0 + */ + ESC: 27, - // TODO: is this really the same as Vector3? - // Also, what about this: http://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/ /** - * [description] - * - * @method Phaser.Math.Vector4#transformQuat + * @name Phaser.Input.Keyboard.KeyCodes.SPACE + * @type {integer} * @since 3.0.0 - * - * @param {[type]} q - [description] - * - * @return {Phaser.Math.Vector4} This Vector4 object. */ - transformQuat: function (q) - { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - var x = this.x; - var y = this.y; - var z = this.z; - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; + SPACE: 32, - // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; + /** + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP + * @type {integer} + * @since 3.0.0 + */ + PAGE_UP: 33, - // calculate result * inverse quat - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + /** + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN + * @type {integer} + * @since 3.0.0 + */ + PAGE_DOWN: 34, - return this; - }, + /** + * @name Phaser.Input.Keyboard.KeyCodes.END + * @type {integer} + * @since 3.0.0 + */ + END: 35, /** - * [description] - * - * @method Phaser.Math.Vector4#reset + * @name Phaser.Input.Keyboard.KeyCodes.HOME + * @type {integer} * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4 object. */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; + HOME: 36, - return this; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.LEFT + * @type {integer} + * @since 3.0.0 + */ + LEFT: 37, -}); + /** + * @name Phaser.Input.Keyboard.KeyCodes.UP + * @type {integer} + * @since 3.0.0 + */ + UP: 38, -// TODO: Check if these are required internally, if not, remove. -Vector4.prototype.sub = Vector4.prototype.subtract; -Vector4.prototype.mul = Vector4.prototype.multiply; -Vector4.prototype.div = Vector4.prototype.divide; -Vector4.prototype.dist = Vector4.prototype.distance; -Vector4.prototype.distSq = Vector4.prototype.distanceSq; -Vector4.prototype.len = Vector4.prototype.length; -Vector4.prototype.lenSq = Vector4.prototype.lengthSq; + /** + * @name Phaser.Input.Keyboard.KeyCodes.RIGHT + * @type {integer} + * @since 3.0.0 + */ + RIGHT: 39, -module.exports = Vector4; + /** + * @name Phaser.Input.Keyboard.KeyCodes.DOWN + * @type {integer} + * @since 3.0.0 + */ + DOWN: 40, + /** + * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN + * @type {integer} + * @since 3.0.0 + */ + PRINT_SCREEN: 42, -/***/ }), -/* 120 */ -/***/ (function(module, exports) { + /** + * @name Phaser.Input.Keyboard.KeyCodes.INSERT + * @type {integer} + * @since 3.0.0 + */ + INSERT: 45, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * @name Phaser.Input.Keyboard.KeyCodes.DELETE + * @type {integer} + * @since 3.0.0 + */ + DELETE: 46, -// Browser specific prefix, so not going to change between contexts, only between browsers -var prefix = ''; + /** + * @name Phaser.Input.Keyboard.KeyCodes.ZERO + * @type {integer} + * @since 3.0.0 + */ + ZERO: 48, -/** - * @namespace Phaser.Display.Canvas.Smoothing - * @since 3.0.0 - */ -var Smoothing = function () -{ /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. - * - * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @name Phaser.Input.Keyboard.KeyCodes.ONE + * @type {integer} * @since 3.0.0 - * - * @param {[type]} context - [description] - * - * @return {string} [description] */ - var getPrefix = function (context) - { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + ONE: 49, - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; + /** + * @name Phaser.Input.Keyboard.KeyCodes.TWO + * @type {integer} + * @since 3.0.0 + */ + TWO: 50, - if (s in context) - { - return s; - } - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.THREE + * @type {integer} + * @since 3.0.0 + */ + THREE: 51, - return null; - }; + /** + * @name Phaser.Input.Keyboard.KeyCodes.FOUR + * @type {integer} + * @since 3.0.0 + */ + FOUR: 52, /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.enable + * @name Phaser.Input.Keyboard.KeyCodes.FIVE + * @type {integer} * @since 3.0.0 - * - * @param {[type]} context - [description] - * - * @return {[type]} [description] */ - var enable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } + FIVE: 53, - if (prefix) - { - context[prefix] = true; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.SIX + * @type {integer} + * @since 3.0.0 + */ + SIX: 54, - return context; - }; + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEVEN + * @type {integer} + * @since 3.0.0 + */ + SEVEN: 55, /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.disable + * @name Phaser.Input.Keyboard.KeyCodes.EIGHT + * @type {integer} * @since 3.0.0 - * - * @param {[type]} context - [description] - * - * @return {[type]} [description] */ - var disable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } + EIGHT: 56, - if (prefix) - { - context[prefix] = false; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.NINE + * @type {integer} + * @since 3.0.0 + */ + NINE: 57, - return context; - }; + /** + * @name Phaser.Input.Keyboard.KeyCodes.A + * @type {integer} + * @since 3.0.0 + */ + A: 65, /** - * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. - * Returns null if no smoothing prefix is available. - * - * @function Phaser.Display.Canvas.Smoothing.isEnabled + * @name Phaser.Input.Keyboard.KeyCodes.B + * @type {integer} * @since 3.0.0 - * - * @param {[type]} context - [description] - * - * @return {boolean} [description] */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; + B: 66, - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; + /** + * @name Phaser.Input.Keyboard.KeyCodes.C + * @type {integer} + * @since 3.0.0 + */ + C: 67, -}; + /** + * @name Phaser.Input.Keyboard.KeyCodes.D + * @type {integer} + * @since 3.0.0 + */ + D: 68, -module.exports = Smoothing(); + /** + * @name Phaser.Input.Keyboard.KeyCodes.E + * @type {integer} + * @since 3.0.0 + */ + E: 69, + /** + * @name Phaser.Input.Keyboard.KeyCodes.F + * @type {integer} + * @since 3.0.0 + */ + F: 70, -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @name Phaser.Input.Keyboard.KeyCodes.G + * @type {integer} + * @since 3.0.0 + */ + G: 71, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * @name Phaser.Input.Keyboard.KeyCodes.H + * @type {integer} + * @since 3.0.0 + */ + H: 72, -var Rectangle = __webpack_require__(8); + /** + * @name Phaser.Input.Keyboard.KeyCodes.I + * @type {integer} + * @since 3.0.0 + */ + I: 73, -// points is an array of Point-like objects, -// either 2 dimensional arrays, or objects with public x/y properties: -// var points = [ -// [100, 200], -// [200, 400], -// { x: 30, y: 60 } -// ] + /** + * @name Phaser.Input.Keyboard.KeyCodes.J + * @type {integer} + * @since 3.0.0 + */ + J: 74, -/** - * [description] - * - * @function Phaser.Geom.Rectangle.FromPoints - * @since 3.0.0 - * - * @param {[type]} points - [description] - * @param {Phaser.Geom.Rectangle} out - [description] - * - * @return {Phaser.Geom.Rectangle} [description] - */ -var FromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } + /** + * @name Phaser.Input.Keyboard.KeyCodes.K + * @type {integer} + * @since 3.0.0 + */ + K: 75, - if (points.length === 0) - { - return out; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.L + * @type {integer} + * @since 3.0.0 + */ + L: 76, - var minX = Number.MAX_VALUE; - var minY = Number.MAX_VALUE; + /** + * @name Phaser.Input.Keyboard.KeyCodes.M + * @type {integer} + * @since 3.0.0 + */ + M: 77, - var maxX = Number.MIN_SAFE_INTEGER; - var maxY = Number.MIN_SAFE_INTEGER; + /** + * @name Phaser.Input.Keyboard.KeyCodes.N + * @type {integer} + * @since 3.0.0 + */ + N: 78, - var p; - var px; - var py; + /** + * @name Phaser.Input.Keyboard.KeyCodes.O + * @type {integer} + * @since 3.0.0 + */ + O: 79, - for (var i = 0; i < points.length; i++) - { - p = points[i]; + /** + * @name Phaser.Input.Keyboard.KeyCodes.P + * @type {integer} + * @since 3.0.0 + */ + P: 80, - if (Array.isArray(p)) - { - px = p[0]; - py = p[1]; - } - else - { - px = p.x; - py = p.y; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.Q + * @type {integer} + * @since 3.0.0 + */ + Q: 81, - minX = Math.min(minX, px); - minY = Math.min(minY, py); + /** + * @name Phaser.Input.Keyboard.KeyCodes.R + * @type {integer} + * @since 3.0.0 + */ + R: 82, - maxX = Math.max(maxX, px); - maxY = Math.max(maxY, py); - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.S + * @type {integer} + * @since 3.0.0 + */ + S: 83, - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; + /** + * @name Phaser.Input.Keyboard.KeyCodes.T + * @type {integer} + * @since 3.0.0 + */ + T: 84, - return out; -}; + /** + * @name Phaser.Input.Keyboard.KeyCodes.U + * @type {integer} + * @since 3.0.0 + */ + U: 85, -module.exports = FromPoints; + /** + * @name Phaser.Input.Keyboard.KeyCodes.V + * @type {integer} + * @since 3.0.0 + */ + V: 86, + /** + * @name Phaser.Input.Keyboard.KeyCodes.W + * @type {integer} + * @since 3.0.0 + */ + W: 87, -/***/ }), -/* 122 */ -/***/ (function(module, exports) { + /** + * @name Phaser.Input.Keyboard.KeyCodes.X + * @type {integer} + * @since 3.0.0 + */ + X: 88, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * @name Phaser.Input.Keyboard.KeyCodes.Y + * @type {integer} + * @since 3.0.0 + */ + Y: 89, -/** - * [description] - * - * @function Phaser.Math.CatmullRom - * @since 3.0.0 - * - * @param {number} t - [description] - * @param {number} p0 - [description] - * @param {number} p1 - [description] - * @param {number} p2 - [description] - * @param {number} p3 - [description] - * - * @return {number} [description] - */ -var CatmullRom = function (t, p0, p1, p2, p3) -{ - var v0 = (p2 - p0) * 0.5; - var v1 = (p3 - p1) * 0.5; - var t2 = t * t; - var t3 = t * t2; + /** + * @name Phaser.Input.Keyboard.KeyCodes.Z + * @type {integer} + * @since 3.0.0 + */ + Z: 90, - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -}; + /** + * @name Phaser.Input.Keyboard.KeyCodes.F1 + * @type {integer} + * @since 3.0.0 + */ + F1: 112, -module.exports = CatmullRom; + /** + * @name Phaser.Input.Keyboard.KeyCodes.F2 + * @type {integer} + * @since 3.0.0 + */ + F2: 113, + /** + * @name Phaser.Input.Keyboard.KeyCodes.F3 + * @type {integer} + * @since 3.0.0 + */ + F3: 114, -/***/ }), -/* 123 */ -/***/ (function(module, exports) { + /** + * @name Phaser.Input.Keyboard.KeyCodes.F4 + * @type {integer} + * @since 3.0.0 + */ + F4: 115, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * @name Phaser.Input.Keyboard.KeyCodes.F5 + * @type {integer} + * @since 3.0.0 + */ + F5: 116, -/** - * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it. - * If no parent was given or falls back to using `document.body`. - * - * @function Phaser.DOM.AddToDOM - * @since 3.0.0 - * - * @param {object} element - The element to be added to the DOM. Usually a Canvas object. - * @param {string|object} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. - * @param {boolean} [overflowHidden=true] - [description] - * - * @return {object} The element that was added to the DOM. - */ -var AddToDOM = function (element, parent, overflowHidden) -{ - if (overflowHidden === undefined) { overflowHidden = true; } + /** + * @name Phaser.Input.Keyboard.KeyCodes.F6 + * @type {integer} + * @since 3.0.0 + */ + F6: 117, - var target; + /** + * @name Phaser.Input.Keyboard.KeyCodes.F7 + * @type {integer} + * @since 3.0.0 + */ + F7: 118, - if (parent) - { - if (typeof parent === 'string') - { - // Hopefully an element ID - target = document.getElementById(parent); - } - else if (typeof parent === 'object' && parent.nodeType === 1) - { - // Quick test for a HTMLelement - target = parent; - } - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.F8 + * @type {integer} + * @since 3.0.0 + */ + F8: 119, - // Fallback, covers an invalid ID and a non HTMLelement object - if (!target) - { - target = document.body; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.F9 + * @type {integer} + * @since 3.0.0 + */ + F9: 120, - if (overflowHidden && target.style) - { - target.style.overflow = 'hidden'; - } + /** + * @name Phaser.Input.Keyboard.KeyCodes.F10 + * @type {integer} + * @since 3.0.0 + */ + F10: 121, - target.appendChild(element); + /** + * @name Phaser.Input.Keyboard.KeyCodes.F11 + * @type {integer} + * @since 3.0.0 + */ + F11: 122, - return element; -}; + /** + * @name Phaser.Input.Keyboard.KeyCodes.F12 + * @type {integer} + * @since 3.0.0 + */ + F12: 123, -module.exports = AddToDOM; + /** + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON + * @type {integer} + * @since 3.0.0 + */ + SEMICOLON: 186, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PLUS + * @type {integer} + * @since 3.0.0 + */ + PLUS: 187, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.COMMA + * @type {integer} + * @since 3.0.0 + */ + COMMA: 188, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.MINUS + * @type {integer} + * @since 3.0.0 + */ + MINUS: 189, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.PERIOD + * @type {integer} + * @since 3.0.0 + */ + PERIOD: 190, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH + * @type {integer} + * @since 3.0.0 + */ + FORWARD_SLASH: 191, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH + * @type {integer} + * @since 3.0.0 + */ + BACK_SLASH: 220, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.QUOTES + * @type {integer} + * @since 3.0.0 + */ + QUOTES: 222, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK + * @type {integer} + * @since 3.0.0 + */ + BACKTICK: 192, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET + * @type {integer} + * @since 3.0.0 + */ + OPEN_BRACKET: 219, + + /** + * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET + * @type {integer} + * @since 3.0.0 + */ + CLOSED_BRACKET: 221 + +}; /***/ }), -/* 124 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -22044,1787 +23519,1150 @@ module.exports = AddToDOM; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(67); -var Browser = __webpack_require__(82); -var CanvasPool = __webpack_require__(21); +var Class = __webpack_require__(0); +var CONST = __webpack_require__(83); +var GetPhysicsPlugins = __webpack_require__(531); +var GetScenePlugins = __webpack_require__(532); +var Plugins = __webpack_require__(236); +var Settings = __webpack_require__(255); /** - * Determines the features of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.features` from within any Scene. - * - * @name Phaser.Device.Features + * @classdesc + * The Scene Systems class. + * + * This class is available from within a Scene under the property `sys`. + * It is responsible for managing all of the plugins a Scene has running, including the display list, and + * handling the update step and renderer. It also contains references to global systems belonging to Game. + * + * @class Systems + * @memberOf Phaser.Scenes + * @constructor * @since 3.0.0 - * - * @type {object} - * @property {?boolean} canvasBitBltShift - True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap. - * @property {boolean} canvas - Is canvas available? - * @property {boolean} file - Is file available? - * @property {boolean} fileSystem - Is fileSystem available? - * @property {boolean} getUserMedia - Does the device support the getUserMedia API? - * @property {boolean} littleEndian - Is the device big or little endian? (only detected if the browser supports TypedArrays) - * @property {boolean} localStorage - Is localStorage available? - * @property {boolean} pointerLock - Is Pointer Lock available? - * @property {boolean} support32bit - Does the device context support 32bit pixel manipulation using array buffer views? - * @property {boolean} vibration - Does the device support the Vibration API? - * @property {boolean} webGL - Is webGL available? - * @property {boolean} worker - Is worker available? + * + * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. + * @param {object} config - Scene specific configuration settings. */ -var Features = { - - canvas: false, - canvasBitBltShift: null, - file: false, - fileSystem: false, - getUserMedia: true, - littleEndian: false, - localStorage: false, - pointerLock: false, - support32bit: false, - vibration: false, - webGL: false, - worker: false - -}; +var Systems = new Class({ -// Check Little or Big Endian system. -// @author Matt DesLauriers (@mattdesl) -function checkIsLittleEndian () -{ - var a = new ArrayBuffer(4); - var b = new Uint8Array(a); - var c = new Uint32Array(a); + initialize: - b[0] = 0xa1; - b[1] = 0xb2; - b[2] = 0xc3; - b[3] = 0xd4; - - if (c[0] === 0xd4c3b2a1) - { - return true; - } - - if (c[0] === 0xa1b2c3d4) - { - return false; - } - else - { - // Could not determine endianness - return null; - } -} - -function init () -{ - Features.canvas = !!window['CanvasRenderingContext2D'] || OS.cocoonJS; - - try - { - Features.localStorage = !!localStorage.getItem; - } - catch (error) - { - Features.localStorage = false; - } - - Features.file = !!window['File'] && !!window['FileReader'] && !!window['FileList'] && !!window['Blob']; - Features.fileSystem = !!window['requestFileSystem']; - - var isUint8 = false; - - var testWebGL = function () - { - if (window['WebGLRenderingContext']) - { - try - { - var canvas = CanvasPool.createWebGL(this); - - if (OS.cocoonJS) - { - canvas.screencanvas = false; - } - - var ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); - - var canvas2D = CanvasPool.create2D(this); - - var ctx2D = canvas2D.getContext('2d'); - - // Can't be done on a webgl context - var image = ctx2D.createImageData(1, 1); - - // Test to see if ImageData uses CanvasPixelArray or Uint8ClampedArray. - // @author Matt DesLauriers (@mattdesl) - isUint8 = image.data instanceof Uint8ClampedArray; - - CanvasPool.remove(canvas); - CanvasPool.remove(canvas2D); - - return !!ctx; - } - catch (e) - { - return false; - } - } - - return false; - }; - - Features.webGL = testWebGL(); - - Features.worker = !!window['Worker']; - - Features.pointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document; - - navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; - - window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; - - Features.getUserMedia = Features.getUserMedia && !!navigator.getUserMedia && !!window.URL; - - // Older versions of firefox (< 21) apparently claim support but user media does not actually work - if (Browser.firefox && Browser.firefoxVersion < 21) - { - Features.getUserMedia = false; - } - - // Excludes iOS versions as they generally wrap UIWebView (eg. Safari WebKit) and it - // is safer to not try and use the fast copy-over method. - if (!OS.iOS && (Browser.ie || Browser.firefox || Browser.chrome)) - { - Features.canvasBitBltShift = true; - } - - // Known not to work - if (Browser.safari || Browser.mobileSafari) - { - Features.canvasBitBltShift = false; - } - - navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; - - if (navigator.vibrate) - { - Features.vibration = true; - } - - if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined') - { - Features.littleEndian = checkIsLittleEndian(); - } - - Features.support32bit = ( - typeof ArrayBuffer !== 'undefined' && - typeof Uint8ClampedArray !== 'undefined' && - typeof Int32Array !== 'undefined' && - Features.littleEndian !== null && - isUint8 - ); - - return Features; -} - -module.exports = init(); - - -/***/ }), -/* 125 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Checks if the given `width` and `height` are a power of two. - * Useful for checking texture dimensions. - * - * @function Phaser.Math.Pow2.IsSizePowerOfTwo - * @since 3.0.0 - * - * @param {number} width - The width. - * @param {number} height - The height. - * - * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`. - */ -var IsSizePowerOfTwo = function (width, height) -{ - return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); -}; - -module.exports = IsSizePowerOfTwo; - - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var Utils = __webpack_require__(42); - -/** - * @classdesc - * [description] - * - * @class WebGLPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] - */ -var WebGLPipeline = new Class({ - - initialize: - - function WebGLPipeline (config) + function Systems (scene, config) { /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#name - * @type {string} + * @name Phaser.Scenes.Systems#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.name = 'WebGLPipeline'; + this.scene = scene; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @name Phaser.Scenes.Systems#game * @type {Phaser.Game} * @since 3.0.0 */ - this.game = config.game; + this.game; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#view - * @type {HTMLCanvasElement} + * @name Phaser.Scenes.Systems#config + * @type {object} * @since 3.0.0 */ - this.view = config.game.canvas; + this.config = config; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution - * @type {number} + * @name Phaser.Scenes.Systems#settings + * @type {[type]} * @since 3.0.0 */ - this.resolution = config.game.config.resolution; + this.settings = Settings.create(config); /** - * [description] + * A handy reference to the Scene canvas / context. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#width - * @type {number} + * @name Phaser.Scenes.Systems#canvas + * @type {HTMLCanvasElement} * @since 3.0.0 */ - this.width = config.game.config.width * this.resolution; + this.canvas; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#height - * @type {number} + * @name Phaser.Scenes.Systems#context + * @type {CanvasRenderingContext2D} * @since 3.0.0 */ - this.height = config.game.config.height * this.resolution; + this.context; + + // Global Systems - these are single-instance global managers that belong to Game /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#gl - * @type {WebGLRenderingContext} + * @name Phaser.Scenes.Systems#anims + * @type {Phaser.Animations.AnimationManager} * @since 3.0.0 */ - this.gl = config.gl; + this.anims; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount - * @type {number} - * @default 0 + * @name Phaser.Scenes.Systems#cache + * @type {Phaser.Cache.CacheManager} * @since 3.0.0 */ - this.vertexCount = 0; + this.cache; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity - * @type {integer} + * @name Phaser.Scenes.Systems#plugins + * @type {Phaser.Plugins.PluginManager} * @since 3.0.0 */ - this.vertexCapacity = config.vertexCapacity; + this.plugins; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @name Phaser.Scenes.Systems#registry + * @type {[type]} * @since 3.0.0 */ - this.renderer = config.renderer; + this.registry; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData - * @type {ArrayBuffer} + * @name Phaser.Scenes.Systems#sound + * @type {Phaser.Sound.BaseSoundManager} * @since 3.0.0 */ - this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize)); + this.sound; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer - * @type {WebGLBuffer} + * @name Phaser.Scenes.Systems#textures + * @type {Phaser.Textures.TextureManager} * @since 3.0.0 */ - this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW); + this.textures; + + // Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#program - * @type {WebGLProgram} + * @name Phaser.Scenes.Systems#add + * @type {Phaser.GameObjects.GameObjectFactory} * @since 3.0.0 */ - this.program = this.renderer.createProgram(config.vertShader, config.fragShader); + this.add; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes - * @type {object} + * @name Phaser.Scenes.Systems#cameras + * @type {Phaser.Cameras.Scene2D.CameraManager} * @since 3.0.0 */ - this.attributes = config.attributes; + this.cameras; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize - * @type {integer} + * @name Phaser.Scenes.Systems#displayList + * @type {null} * @since 3.0.0 */ - this.vertexSize = config.vertexSize; + this.displayList; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#topology - * @type {integer} + * @name Phaser.Scenes.Systems#events + * @type {EventEmitter} * @since 3.0.0 */ - this.topology = config.topology; + this.events; /** * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes - * @type {Uint8Array} + * @name Phaser.Scenes.Systems#make + * @type {Phaser.GameObjects.GameObjectCreator} * @since 3.0.0 */ - this.bytes = new Uint8Array(this.vertexData); + this.make; /** - * This will store the amount of components of 32 bit length + * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount - * @type {integer} + * @name Phaser.Scenes.Systems#scenePlugin + * @type {Phaser.Scenes.ScenePlugin} * @since 3.0.0 */ - this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl); + this.scenePlugin; /** - * Indicates if the current pipeline is flushing the contents to the GPU. - * When the variable is set the flush function will be locked. + * [description] * - * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked - * @type {boolean} - * @since 3.1.0 + * @name Phaser.Scenes.Systems#updateList + * @type {[type]} + * @since 3.0.0 */ - this.flushLocked = false; + this.updateList; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @method Phaser.Scenes.Systems#init * @since 3.0.0 * - * @return {boolean} [description] + * @param {Phaser.Game} game - A reference to the Phaser Game */ - shouldFlush: function () + init: function (game) { - return (this.vertexCount >= this.vertexCapacity); + this.settings.status = CONST.INIT; + + this.game = game; + + this.canvas = game.canvas; + this.context = game.context; + + var pluginManager = game.plugins; + + this.plugins = pluginManager; + + pluginManager.installGlobal(this, Plugins.Global); + + pluginManager.installLocal(this, Plugins.CoreScene); + + pluginManager.installLocal(this, GetScenePlugins(this)); + + pluginManager.installLocal(this, GetPhysicsPlugins(this)); + + this.events.emit('boot', this); + + this.settings.isBooted = true; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @method Phaser.Scenes.Systems#install + * @private * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @param {array} plugin - An array of plugins to install into this Scene. */ - resize: function (width, height, resolution) + install: function (plugin) { - this.width = width * resolution; - this.height = height * resolution; - return this; + if (!Array.isArray(plugin)) + { + plugin = [ plugin ]; + } + + this.plugins.installLocal(this, plugin); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @method Phaser.Scenes.Systems#step * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @param {number} time - [description] + * @param {number} delta - [description] */ - bind: function () + step: function (time, delta) { - var gl = this.gl; - var vertexBuffer = this.vertexBuffer; - var attributes = this.attributes; - var program = this.program; - var renderer = this.renderer; - var vertexSize = this.vertexSize; - - renderer.setProgram(program); - renderer.setVertexBuffer(vertexBuffer); + this.events.emit('preupdate', time, delta); - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - var location = gl.getAttribLocation(program, element.name); + this.events.emit('update', time, delta); - if (location >= 0) - { - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); - } - else - { - gl.disableVertexAttribArray(location); - } - } + this.scene.update.call(this.scene, time, delta); - return this; + this.events.emit('postupdate', time, delta); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @method Phaser.Scenes.Systems#render * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] */ - onBind: function () + render: function (renderer) { - // This is for updating uniform data it's called on each bind attempt. - return this; + var displayList = this.displayList; + + displayList.depthSort(); + + this.cameras.render(renderer, displayList); + + this.events.emit('render', renderer); }, /** - * [description] + * Force a sort of the display list on the next render. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @method Phaser.Scenes.Systems#queueDepthSort * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - onPreRender: function () + queueDepthSort: function () { - // called once every frame - return this; + this.displayList.queueDepthSort(); }, /** - * [description] + * Immediately sorts the display list if the flag is set. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @method Phaser.Scenes.Systems#depthSort * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - onRender: function () + depthSort: function () { - // called for each camera - return this; + this.displayList.depthSort(); }, /** - * [description] + * Pause this Scene. + * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @method Phaser.Scenes.Systems#pause * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @return {Phaser.Scenes.Systems} This Systems object. */ - onPostRender: function () + pause: function () { - // called once every frame + if (this.settings.active) + { + this.settings.status = CONST.PAUSED; + + this.settings.active = false; + + this.events.emit('pause', this); + } + return this; }, /** - * [description] + * Resume this Scene. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @method Phaser.Scenes.Systems#resume * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @return {Phaser.Scenes.Systems} This Systems object. */ - flush: function () + resume: function () { - if (this.flushLocked) { return this; } - - this.flushLocked = true; - - var gl = this.gl; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - - if (vertexCount === 0) + if (!this.settings.active) { - this.flushLocked = false; - return; - } + this.settings.status = CONST.RUNNING; - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - gl.drawArrays(topology, 0, vertexCount); + this.settings.active = true; - this.vertexCount = 0; - this.flushLocked = false; + this.events.emit('resume', this); + } return this; }, /** - * [description] + * Send this Scene to sleep. + * + * A sleeping Scene doesn't run it's update step or render anything, but it also isn't destroyed, + * or have any of its systems or children removed, meaning it can be re-activated at any point. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @method Phaser.Scenes.Systems#sleep * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + * @return {Phaser.Scenes.Systems} This Systems object. */ - destroy: function () + sleep: function () { - var gl = this.gl; + this.settings.status = CONST.SLEEPING; - gl.deleteProgram(this.program); - gl.deleteBuffer(this.vertexBuffer); + this.settings.active = false; + this.settings.visible = false; - delete this.program; - delete this.vertexBuffer; - delete this.gl; + this.events.emit('sleep', this); return this; - } - -}); - -module.exports = WebGLPipeline; - - -/***/ }), -/* 127 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.GameObjects.Graphics.Commands - */ - -module.exports = { - - ARC: 0, - BEGIN_PATH: 1, - CLOSE_PATH: 2, - FILL_RECT: 3, - LINE_TO: 4, - MOVE_TO: 5, - LINE_STYLE: 6, - FILL_STYLE: 7, - FILL_PATH: 8, - STROKE_PATH: 9, - FILL_TRIANGLE: 10, - STROKE_TRIANGLE: 11, - LINE_FX_TO: 12, - MOVE_FX_TO: 13, - SAVE: 14, - RESTORE: 15, - TRANSLATE: 16, - SCALE: 17, - ROTATE: 18 - -}; - - -/***/ }), -/* 128 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -module.exports = { - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE - * @type {integer} - * @since 3.0.0 - */ - BACKSPACE: 8, + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.TAB - * @type {integer} + * Wake-up this Scene if it was previously asleep. + * + * @method Phaser.Scenes.Systems#wake * @since 3.0.0 + * + * @return {Phaser.Scenes.Systems} This Systems object. */ - TAB: 9, + wake: function () + { + this.settings.status = CONST.RUNNING; - /** - * @name Phaser.Input.Keyboard.KeyCodes.ENTER - * @type {integer} - * @since 3.0.0 - */ - ENTER: 13, + this.settings.active = true; + this.settings.visible = true; - /** - * @name Phaser.Input.Keyboard.KeyCodes.SHIFT - * @type {integer} - * @since 3.0.0 - */ - SHIFT: 16, + this.events.emit('wake', this); - /** - * @name Phaser.Input.Keyboard.KeyCodes.CTRL - * @type {integer} - * @since 3.0.0 - */ - CTRL: 17, + return this; + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.ALT - * @type {integer} + * Is this Scene sleeping? + * + * @method Phaser.Scenes.Systems#isSleeping * @since 3.0.0 + * + * @return {boolean} [description] */ - ALT: 18, + isSleeping: function () + { + return (this.settings.status === CONST.SLEEPING); + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.PAUSE - * @type {integer} + * Is this Scene active? + * + * @method Phaser.Scenes.Systems#isActive * @since 3.0.0 + * + * @return {boolean} [description] */ - PAUSE: 19, + isActive: function () + { + return (this.settings.status === CONST.RUNNING); + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK - * @type {integer} + * Is this Scene visible and rendering? + * + * @method Phaser.Scenes.Systems#isVisible * @since 3.0.0 + * + * @return {boolean} [description] */ - CAPS_LOCK: 20, + isVisible: function () + { + return this.settings.visible; + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.ESC - * @type {integer} + * [description] + * + * @method Phaser.Scenes.Systems#setVisible * @since 3.0.0 + * + * @param {boolean} value - [description] + * + * @return {Phaser.Scenes.Systems} This Systems object. */ - ESC: 27, + setVisible: function (value) + { + this.settings.visible = value; - /** - * @name Phaser.Input.Keyboard.KeyCodes.SPACE - * @type {integer} - * @since 3.0.0 - */ - SPACE: 32, + return this; + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP - * @type {integer} + * [description] + * + * @method Phaser.Scenes.Systems#setActive * @since 3.0.0 + * + * @param {boolean} value - [description] + * + * @return {Phaser.Scenes.Systems} This Systems object. */ - PAGE_UP: 33, + setActive: function (value) + { + if (value) + { + return this.resume(); + } + else + { + return this.pause(); + } + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN - * @type {integer} + * Start this Scene running and rendering. + * + * @method Phaser.Scenes.Systems#start * @since 3.0.0 + * + * @param {object} data - [description] */ - PAGE_DOWN: 34, + start: function (data) + { + this.settings.status = CONST.START; - /** - * @name Phaser.Input.Keyboard.KeyCodes.END - * @type {integer} - * @since 3.0.0 - */ - END: 35, + this.settings.data = data; - /** - * @name Phaser.Input.Keyboard.KeyCodes.HOME - * @type {integer} - * @since 3.0.0 - */ - HOME: 36, + this.settings.active = true; + this.settings.visible = true; - /** - * @name Phaser.Input.Keyboard.KeyCodes.LEFT - * @type {integer} - * @since 3.0.0 - */ - LEFT: 37, + this.events.emit('start', this); + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.UP - * @type {integer} - * @since 3.0.0 + * Called automatically by the SceneManager if the Game resizes. + * Dispatches an event you can respond to in your game code. + * + * @method Phaser.Scenes.Systems#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. */ - UP: 38, + resize: function (width, height) + { + this.events.emit('resize', width, height); + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.RIGHT - * @type {integer} + * Shutdown this Scene and send a shutdown event to all of its systems. + * + * @method Phaser.Scenes.Systems#shutdown * @since 3.0.0 */ - RIGHT: 39, + shutdown: function () + { + this.settings.status = CONST.SHUTDOWN; - /** - * @name Phaser.Input.Keyboard.KeyCodes.DOWN - * @type {integer} - * @since 3.0.0 - */ - DOWN: 40, + this.settings.active = false; + this.settings.visible = false; - /** - * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN - * @type {integer} - * @since 3.0.0 - */ - PRINT_SCREEN: 42, + this.events.emit('shutdown', this); + }, /** - * @name Phaser.Input.Keyboard.KeyCodes.INSERT - * @type {integer} + * Destroy this Scene and send a destroy event all of its systems. + * + * @method Phaser.Scenes.Systems#destroy * @since 3.0.0 */ - INSERT: 45, + destroy: function () + { + this.settings.status = CONST.DESTROYED; - /** - * @name Phaser.Input.Keyboard.KeyCodes.DELETE - * @type {integer} - * @since 3.0.0 - */ - DELETE: 46, + this.settings.active = false; + this.settings.visible = false; - /** - * @name Phaser.Input.Keyboard.KeyCodes.ZERO - * @type {integer} - * @since 3.0.0 - */ - ZERO: 48, + this.events.emit('destroy', this); + } - /** - * @name Phaser.Input.Keyboard.KeyCodes.ONE - * @type {integer} - * @since 3.0.0 - */ - ONE: 49, +}); - /** - * @name Phaser.Input.Keyboard.KeyCodes.TWO - * @type {integer} - * @since 3.0.0 - */ - TWO: 50, +module.exports = Systems; - /** - * @name Phaser.Input.Keyboard.KeyCodes.THREE - * @type {integer} - * @since 3.0.0 - */ - THREE: 51, - /** - * @name Phaser.Input.Keyboard.KeyCodes.FOUR - * @type {integer} - * @since 3.0.0 - */ - FOUR: 52, +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * @name Phaser.Input.Keyboard.KeyCodes.FIVE - * @type {integer} - * @since 3.0.0 - */ - FIVE: 53, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * @name Phaser.Input.Keyboard.KeyCodes.SIX - * @type {integer} - * @since 3.0.0 - */ - SIX: 54, +var Class = __webpack_require__(0); +var Extend = __webpack_require__(23); - /** - * @name Phaser.Input.Keyboard.KeyCodes.SEVEN - * @type {integer} - * @since 3.0.0 - */ - SEVEN: 55, +/** + * @classdesc + * A Frame is a section of a Texture. + * + * @class Frame + * @memberOf Phaser.Textures + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. + * @param {integer|string} name - The name of this Frame. The name is unique within the Texture. + * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {number} x - The x coordinate of the top-left of this Frame. + * @param {number} y - The y coordinate of the top-left of this Frame. + * @param {number} width - The width of this Frame. + * @param {number} height - The height of this Frame. + */ +var Frame = new Class({ - /** - * @name Phaser.Input.Keyboard.KeyCodes.EIGHT - * @type {integer} - * @since 3.0.0 - */ - EIGHT: 56, + initialize: - /** - * @name Phaser.Input.Keyboard.KeyCodes.NINE - * @type {integer} - * @since 3.0.0 - */ - NINE: 57, + function Frame (texture, name, sourceIndex, x, y, width, height) + { + /** + * The Texture this Frame is a part of. + * + * @name Phaser.Textures.Frame#texture + * @type {Phaser.Textures.Texture} + * @since 3.0.0 + */ + this.texture = texture; - /** - * @name Phaser.Input.Keyboard.KeyCodes.A - * @type {integer} - * @since 3.0.0 - */ - A: 65, + /** + * The name of this Frame. + * The name is unique within the Texture. + * + * @name Phaser.Textures.Frame#name + * @type {string} + * @since 3.0.0 + */ + this.name = name; - /** - * @name Phaser.Input.Keyboard.KeyCodes.B - * @type {integer} - * @since 3.0.0 - */ - B: 66, + /** + * The TextureSource this Frame is part of. + * + * @name Phaser.Textures.Frame#source + * @type {Phaser.Textures.TextureSource} + * @since 3.0.0 + */ + this.source = texture.source[sourceIndex]; - /** - * @name Phaser.Input.Keyboard.KeyCodes.C - * @type {integer} - * @since 3.0.0 - */ - C: 67, + /** + * The index of the TextureSource in the Texture sources array. + * + * @name Phaser.Textures.Frame#sourceIndex + * @type {integer} + * @since 3.0.0 + */ + this.sourceIndex = sourceIndex; - /** - * @name Phaser.Input.Keyboard.KeyCodes.D - * @type {integer} - * @since 3.0.0 - */ - D: 68, + /** + * X position within the source image to cut from. + * + * @name Phaser.Textures.Frame#cutX + * @type {integer} + * @since 3.0.0 + */ + this.cutX = x; - /** - * @name Phaser.Input.Keyboard.KeyCodes.E - * @type {integer} - * @since 3.0.0 - */ - E: 69, + /** + * Y position within the source image to cut from. + * + * @name Phaser.Textures.Frame#cutY + * @type {integer} + * @since 3.0.0 + */ + this.cutY = y; - /** - * @name Phaser.Input.Keyboard.KeyCodes.F - * @type {integer} - * @since 3.0.0 - */ - F: 70, + /** + * The width of the area in the source image to cut. + * + * @name Phaser.Textures.Frame#cutWidth + * @type {integer} + * @since 3.0.0 + */ + this.cutWidth = width; - /** - * @name Phaser.Input.Keyboard.KeyCodes.G - * @type {integer} - * @since 3.0.0 - */ - G: 71, + /** + * The height of the area in the source image to cut. + * + * @name Phaser.Textures.Frame#cutHeight + * @type {integer} + * @since 3.0.0 + */ + this.cutHeight = height; - /** - * @name Phaser.Input.Keyboard.KeyCodes.H - * @type {integer} - * @since 3.0.0 - */ - H: 72, + /** + * The X rendering offset of this Frame, taking trim into account. + * + * @name Phaser.Textures.Frame#x + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; - /** - * @name Phaser.Input.Keyboard.KeyCodes.I - * @type {integer} - * @since 3.0.0 - */ - I: 73, + /** + * The Y rendering offset of this Frame, taking trim into account. + * + * @name Phaser.Textures.Frame#y + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; - /** - * @name Phaser.Input.Keyboard.KeyCodes.J - * @type {integer} - * @since 3.0.0 - */ - J: 74, + /** + * The rendering width of this Frame, taking trim into account. + * + * @name Phaser.Textures.Frame#width + * @type {integer} + * @since 3.0.0 + */ + this.width = width; - /** - * @name Phaser.Input.Keyboard.KeyCodes.K - * @type {integer} - * @since 3.0.0 - */ - K: 75, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.L - * @type {integer} - * @since 3.0.0 - */ - L: 76, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.M - * @type {integer} - * @since 3.0.0 - */ - M: 77, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.N - * @type {integer} - * @since 3.0.0 - */ - N: 78, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.O - * @type {integer} - * @since 3.0.0 - */ - O: 79, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.P - * @type {integer} - * @since 3.0.0 - */ - P: 80, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Q - * @type {integer} - * @since 3.0.0 - */ - Q: 81, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.R - * @type {integer} - * @since 3.0.0 - */ - R: 82, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.S - * @type {integer} - * @since 3.0.0 - */ - S: 83, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.T - * @type {integer} - * @since 3.0.0 - */ - T: 84, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.U - * @type {integer} - * @since 3.0.0 - */ - U: 85, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.V - * @type {integer} - * @since 3.0.0 - */ - V: 86, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.W - * @type {integer} - * @since 3.0.0 - */ - W: 87, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.X - * @type {integer} - * @since 3.0.0 - */ - X: 88, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Y - * @type {integer} - * @since 3.0.0 - */ - Y: 89, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.Z - * @type {integer} - * @since 3.0.0 - */ - Z: 90, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F1 - * @type {integer} - * @since 3.0.0 - */ - F1: 112, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F2 - * @type {integer} - * @since 3.0.0 - */ - F2: 113, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F3 - * @type {integer} - * @since 3.0.0 - */ - F3: 114, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F4 - * @type {integer} - * @since 3.0.0 - */ - F4: 115, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F5 - * @type {integer} - * @since 3.0.0 - */ - F5: 116, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F6 - * @type {integer} - * @since 3.0.0 - */ - F6: 117, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F7 - * @type {integer} - * @since 3.0.0 - */ - F7: 118, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F8 - * @type {integer} - * @since 3.0.0 - */ - F8: 119, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F9 - * @type {integer} - * @since 3.0.0 - */ - F9: 120, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F10 - * @type {integer} - * @since 3.0.0 - */ - F10: 121, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F11 - * @type {integer} - * @since 3.0.0 - */ - F11: 122, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.F12 - * @type {integer} - * @since 3.0.0 - */ - F12: 123, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON - * @type {integer} - * @since 3.0.0 - */ - SEMICOLON: 186, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PLUS - * @type {integer} - * @since 3.0.0 - */ - PLUS: 187, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.COMMA - * @type {integer} - * @since 3.0.0 - */ - COMMA: 188, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.MINUS - * @type {integer} - * @since 3.0.0 - */ - MINUS: 189, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.PERIOD - * @type {integer} - * @since 3.0.0 - */ - PERIOD: 190, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH - * @type {integer} - * @since 3.0.0 - */ - FORWARD_SLASH: 191, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH - * @type {integer} - * @since 3.0.0 - */ - BACK_SLASH: 220, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.QUOTES - * @type {integer} - * @since 3.0.0 - */ - QUOTES: 222, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK - * @type {integer} - * @since 3.0.0 - */ - BACKTICK: 192, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET - * @type {integer} - * @since 3.0.0 - */ - OPEN_BRACKET: 219, - - /** - * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET - * @type {integer} - * @since 3.0.0 - */ - CLOSED_BRACKET: 221 - -}; - - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(83); -var GetPhysicsPlugins = __webpack_require__(529); -var GetScenePlugins = __webpack_require__(530); -var Plugins = __webpack_require__(233); -var Settings = __webpack_require__(254); - -/** - * @classdesc - * The Scene Systems class. - * - * This class is available from within a Scene under the property `sys`. - * It is responsible for managing all of the plugins a Scene has running, including the display list, and - * handling the update step and renderer. It also contains references to global systems belonging to Game. - * - * @class Systems - * @memberOf Phaser.Scenes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. - * @param {object} config - Scene specific configuration settings. - */ -var Systems = new Class({ - - initialize: - - function Systems (scene, config) - { /** - * [description] + * The rendering height of this Frame, taking trim into account. * - * @name Phaser.Scenes.Systems#scene - * @type {Phaser.Scene} + * @name Phaser.Textures.Frame#height + * @type {integer} * @since 3.0.0 */ - this.scene = scene; + this.height = height; /** - * [description] + * Half the width, floored. + * Precalculated for the renderer. * - * @name Phaser.Scenes.Systems#game - * @type {Phaser.Game} + * @name Phaser.Textures.Frame#halfWidth + * @type {integer} * @since 3.0.0 */ - this.game; + this.halfWidth = Math.floor(width * 0.5); /** - * [description] + * Half the height, floored. + * Precalculated for the renderer. * - * @name Phaser.Scenes.Systems#config - * @type {object} + * @name Phaser.Textures.Frame#halfHeight + * @type {integer} * @since 3.0.0 */ - this.config = config; + this.halfHeight = Math.floor(height * 0.5); /** - * [description] + * The x center of this frame, floored. * - * @name Phaser.Scenes.Systems#settings - * @type {[type]} + * @name Phaser.Textures.Frame#centerX + * @type {integer} * @since 3.0.0 */ - this.settings = Settings.create(config); + this.centerX = Math.floor(width / 2); /** - * A handy reference to the Scene canvas / context. + * The y center of this frame, floored. * - * @name Phaser.Scenes.Systems#canvas - * @type {HTMLCanvasElement} + * @name Phaser.Textures.Frame#centerY + * @type {integer} * @since 3.0.0 */ - this.canvas; + this.centerY = Math.floor(height / 2); /** - * [description] + * The horizontal pivot point of this Frame. * - * @name Phaser.Scenes.Systems#context - * @type {CanvasRenderingContext2D} + * @name Phaser.Textures.Frame#pivotX + * @type {number} + * @default 0 * @since 3.0.0 */ - this.context; - - // Global Systems - these are single-instance global managers that belong to Game + this.pivotX = 0; /** - * [description] + * The vertical pivot point of this Frame. * - * @name Phaser.Scenes.Systems#anims - * @type {Phaser.Animations.AnimationManager} + * @name Phaser.Textures.Frame#pivotY + * @type {number} + * @default 0 * @since 3.0.0 */ - this.anims; + this.pivotY = 0; /** - * [description] + * Does this Frame have a custom pivot point? * - * @name Phaser.Scenes.Systems#cache - * @type {Phaser.Cache.CacheManager} + * @name Phaser.Textures.Frame#customPivot + * @type {boolean} + * @default false * @since 3.0.0 */ - this.cache; + this.customPivot = false; /** - * [description] + * **CURRENTLY UNSUPPORTED** + * + * Is this frame is rotated or not in the Texture? + * Rotation allows you to use rotated frames in texture atlas packing. + * It has nothing to do with Sprite rotation. * - * @name Phaser.Scenes.Systems#plugins - * @type {Phaser.Plugins.PluginManager} + * @name Phaser.Textures.Frame#rotated + * @type {boolean} + * @default false * @since 3.0.0 */ - this.plugins; + this.rotated = false; /** - * [description] + * Over-rides the Renderer setting. + * -1 = use Renderer Setting + * 0 = No rounding + * 1 = Round * - * @name Phaser.Scenes.Systems#registry - * @type {[type]} + * @name Phaser.Textures.Frame#autoRound + * @type {integer} + * @default -1 * @since 3.0.0 */ - this.registry; + this.autoRound = -1; /** - * [description] + * Any Frame specific custom data can be stored here. * - * @name Phaser.Scenes.Systems#sound - * @type {Phaser.Sound.BaseSoundManager} + * @name Phaser.Textures.Frame#customData + * @type {object} * @since 3.0.0 */ - this.sound; + this.customData = {}; /** - * [description] + * The un-modified source frame, trim and UV data. * - * @name Phaser.Scenes.Systems#textures - * @type {Phaser.Textures.TextureManager} + * @name Phaser.Textures.Frame#data + * @type {object} + * @private * @since 3.0.0 */ - this.textures; + this.data = { + cut: { + x: x, + y: y, + w: width, + h: height, + r: x + width, + b: y + height + }, + trim: false, + sourceSize: { + w: width, + h: height + }, + spriteSourceSize: { + x: 0, + y: 0, + w: width, + h: height + }, + uvs: { + x0: 0, + y0: 0, + x1: 0, + y1: 0, + x2: 0, + y2: 0, + x3: 0, + y3: 0 + }, + radius: 0.5 * Math.sqrt(width * width + height * height), + drawImage: { + sx: x, + sy: y, + sWidth: width, + sHeight: height, + dWidth: width, + dHeight: height + } + }; - // Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems + this.updateUVs(); + }, - /** - * [description] - * - * @name Phaser.Scenes.Systems#add - * @type {Phaser.GameObjects.GameObjectFactory} - * @since 3.0.0 - */ - this.add; + /** + * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data. + * + * @method Phaser.Textures.Frame#setTrim + * @since 3.0.0 + * + * @param {number} actualWidth - The width of the frame before being trimmed. + * @param {number} actualHeight - The height of the frame before being trimmed. + * @param {number} destX - The destination X position of the trimmed frame for display. + * @param {number} destY - The destination Y position of the trimmed frame for display. + * @param {number} destWidth - The destination width of the trimmed frame for display. + * @param {number} destHeight - The destination height of the trimmed frame for display. + * + * @return {Phaser.Textures.Frame} This Frame object. + */ + setTrim: function (actualWidth, actualHeight, destX, destY, destWidth, destHeight) + { + var data = this.data; + var ss = data.spriteSourceSize; - /** - * [description] - * - * @name Phaser.Scenes.Systems#cameras - * @type {Phaser.Cameras.Scene2D.CameraManager} - * @since 3.0.0 - */ - this.cameras; + // Store actual values - /** - * [description] - * - * @name Phaser.Scenes.Systems#displayList - * @type {null} - * @since 3.0.0 - */ - this.displayList; + data.trim = true; - /** - * [description] - * - * @name Phaser.Scenes.Systems#events - * @type {EventEmitter} - * @since 3.0.0 - */ - this.events; + data.sourceSize.w = actualWidth; + data.sourceSize.h = actualHeight; - /** - * [description] - * - * @name Phaser.Scenes.Systems#make - * @type {Phaser.GameObjects.GameObjectCreator} - * @since 3.0.0 - */ - this.make; + ss.x = destX; + ss.y = destY; + ss.w = destWidth; + ss.h = destHeight; - /** - * [description] - * - * @name Phaser.Scenes.Systems#scenePlugin - * @type {Phaser.Scenes.ScenePlugin} - * @since 3.0.0 - */ - this.scenePlugin; + // Adjust properties + this.x = destX; + this.y = destY; - /** - * [description] - * - * @name Phaser.Scenes.Systems#updateList - * @type {[type]} - * @since 3.0.0 - */ - this.updateList; + this.width = destWidth; + this.height = destHeight; + + this.halfWidth = destWidth * 0.5; + this.halfHeight = destHeight * 0.5; + + this.centerX = Math.floor(destWidth / 2); + this.centerY = Math.floor(destHeight / 2); + + return this.updateUVs(); }, /** - * [description] + * Updates the internal WebGL UV cache and the drawImage cache. * - * @method Phaser.Scenes.Systems#init + * @method Phaser.Textures.Frame#updateUVs * @since 3.0.0 * - * @param {Phaser.Game} game - A reference to the Phaser Game + * @return {Phaser.Textures.Frame} This Frame object. */ - init: function (game) + updateUVs: function () { - this.settings.status = CONST.INIT; - - this.game = game; - - this.canvas = game.canvas; - this.context = game.context; - - var pluginManager = game.plugins; + var cx = this.cutX; + var cy = this.cutY; + var cw = this.cutWidth; + var ch = this.cutHeight; - this.plugins = pluginManager; + // Canvas data - pluginManager.installGlobal(this, Plugins.Global); + var cd = this.data.drawImage; - pluginManager.installLocal(this, Plugins.CoreScene); + cd.sWidth = cw; + cd.sHeight = ch; + cd.dWidth = cw; + cd.dHeight = ch; - pluginManager.installLocal(this, GetScenePlugins(this)); + // WebGL data - pluginManager.installLocal(this, GetPhysicsPlugins(this)); + var tw = this.source.width; + var th = this.source.height; + var uvs = this.data.uvs; + + uvs.x0 = cx / tw; + uvs.y0 = cy / th; - this.events.emit('boot', this); + uvs.x1 = cx / tw; + uvs.y1 = (cy + ch) / th; - this.settings.isBooted = true; - }, + uvs.x2 = (cx + cw) / tw; + uvs.y2 = (cy + ch) / th; - /** - * [description] - * - * @method Phaser.Scenes.Systems#install - * @private - * @since 3.0.0 - * - * @param {array} plugin - An array of plugins to install into this Scene. - */ - install: function (plugin) - { - if (!Array.isArray(plugin)) - { - plugin = [ plugin ]; - } + uvs.x3 = (cx + cw) / tw; + uvs.y3 = cy / th; - this.plugins.installLocal(this, plugin); + return this; }, /** - * [description] + * Updates the internal WebGL UV cache. * - * @method Phaser.Scenes.Systems#step + * @method Phaser.Textures.Frame#updateUVsInverted * @since 3.0.0 * - * @param {number} time - [description] - * @param {number} delta - [description] + * @return {Phaser.Textures.Frame} This Frame object. */ - step: function (time, delta) + updateUVsInverted: function () { - this.events.emit('preupdate', time, delta); - - this.events.emit('update', time, delta); + var tw = this.source.width; + var th = this.source.height; + var uvs = this.data.uvs; + + uvs.x3 = (this.cutX + this.cutHeight) / tw; + uvs.y3 = (this.cutY + this.cutWidth) / th; - this.scene.update.call(this.scene, time, delta); + uvs.x2 = this.cutX / tw; + uvs.y2 = (this.cutY + this.cutWidth) / th; + + uvs.x1 = this.cutX / tw; + uvs.y1 = this.cutY / th; + + uvs.x0 = (this.cutX + this.cutHeight) / tw; + uvs.y0 = this.cutY / th; - this.events.emit('postupdate', time, delta); + return this; }, /** - * [description] + * Clones this Frame into a new Frame object. * - * @method Phaser.Scenes.Systems#render + * @method Phaser.Textures.Frame#clone * @since 3.0.0 * - * @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] + * @return {Phaser.Textures.Frame} A clone of this Frame. */ - render: function (renderer) + clone: function () { - var displayList = this.displayList; + var clone = new Frame(this.texture, this.name, this.sourceIndex); - displayList.depthSort(); + clone.cutX = this.cutX; + clone.cutY = this.cutY; + clone.cutWidth = this.cutWidth; + clone.cutHeight = this.cutHeight; - this.cameras.render(renderer, displayList); + clone.x = this.x; + clone.y = this.y; - this.events.emit('render', renderer); - }, + clone.width = this.width; + clone.height = this.height; - /** - * Force a sort of the display list on the next render. - * - * @method Phaser.Scenes.Systems#queueDepthSort - * @since 3.0.0 - */ - queueDepthSort: function () - { - this.displayList.queueDepthSort(); - }, + clone.halfWidth = this.halfWidth; + clone.halfHeight = this.halfHeight; - /** - * Immediately sorts the display list if the flag is set. - * - * @method Phaser.Scenes.Systems#depthSort - * @since 3.0.0 - */ - depthSort: function () - { - this.displayList.depthSort(); - }, + clone.centerX = this.centerX; + clone.centerY = this.centerY; - /** - * Pause this Scene. - * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. - * - * @method Phaser.Scenes.Systems#pause - * @since 3.0.0 - * - * @return {Phaser.Scenes.Systems} This Systems object. - */ - pause: function () - { - if (this.settings.active) - { - this.settings.status = CONST.PAUSED; + clone.rotated = this.rotated; - this.settings.active = false; + clone.data = Extend(true, clone.data, this.data); - this.events.emit('pause', this); - } + clone.updateUVs(); - return this; + return clone; }, /** - * Resume this Scene. + * Destroys this Frames references. * - * @method Phaser.Scenes.Systems#resume + * @method Phaser.Textures.Frame#destroy * @since 3.0.0 - * - * @return {Phaser.Scenes.Systems} This Systems object. */ - resume: function () + destroy: function () { - if (!this.settings.active) - { - this.settings.status = CONST.RUNNING; - - this.settings.active = true; - - this.events.emit('resume', this); - } + this.texture = null; - return this; + this.source = null; }, /** - * Send this Scene to sleep. - * - * A sleeping Scene doesn't run it's update step or render anything, but it also isn't destroyed, - * or have any of its systems or children removed, meaning it can be re-activated at any point. + * The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, + * before being packed. * - * @method Phaser.Scenes.Systems#sleep + * @name Phaser.Textures.Frame#realWidth + * @type {number} + * @readOnly * @since 3.0.0 - * - * @return {Phaser.Scenes.Systems} This Systems object. */ - sleep: function () - { - this.settings.status = CONST.SLEEPING; - - this.settings.active = false; - this.settings.visible = false; + realWidth: { - this.events.emit('sleep', this); + get: function () + { + return this.data.sourceSize.w; + } - return this; }, /** - * Wake-up this Scene if it was previously asleep. + * The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, + * before being packed. * - * @method Phaser.Scenes.Systems#wake + * @name Phaser.Textures.Frame#realHeight + * @type {number} + * @readOnly * @since 3.0.0 - * - * @return {Phaser.Scenes.Systems} This Systems object. */ - wake: function () - { - this.settings.status = CONST.RUNNING; - - this.settings.active = true; - this.settings.visible = true; + realHeight: { - this.events.emit('wake', this); + get: function () + { + return this.data.sourceSize.h; + } - return this; }, /** - * Is this Scene sleeping? + * The UV data for this Frame. * - * @method Phaser.Scenes.Systems#isSleeping + * @name Phaser.Textures.Frame#uvs + * @type {object} + * @readOnly * @since 3.0.0 - * - * @return {boolean} [description] */ - isSleeping: function () - { - return (this.settings.status === CONST.SLEEPING); - }, + uvs: { - /** - * Is this Scene active? - * - * @method Phaser.Scenes.Systems#isActive - * @since 3.0.0 - * - * @return {boolean} [description] - */ - isActive: function () - { - return (this.settings.status === CONST.RUNNING); - }, + get: function () + { + return this.data.uvs; + } - /** - * Is this Scene visible and rendering? - * - * @method Phaser.Scenes.Systems#isVisible - * @since 3.0.0 - * - * @return {boolean} [description] - */ - isVisible: function () - { - return this.settings.visible; }, /** - * [description] - * - * @method Phaser.Scenes.Systems#setVisible + * The radius of the Frame (derived from sqrt(w * w + h * h) / 2) + * + * @name Phaser.Textures.Frame#radius + * @type {number} + * @readOnly * @since 3.0.0 - * - * @param {boolean} value - [description] - * - * @return {Phaser.Scenes.Systems} This Systems object. */ - setVisible: function (value) - { - this.settings.visible = value; - - return this; - }, + radius: { - /** - * [description] - * - * @method Phaser.Scenes.Systems#setActive - * @since 3.0.0 - * - * @param {boolean} value - [description] - * - * @return {Phaser.Scenes.Systems} This Systems object. - */ - setActive: function (value) - { - if (value) - { - return this.resume(); - } - else + get: function () { - return this.pause(); + return this.data.radius; } - }, - - /** - * Start this Scene running and rendering. - * - * @method Phaser.Scenes.Systems#start - * @since 3.0.0 - * - * @param {object} data - [description] - */ - start: function (data) - { - this.settings.status = CONST.START; - this.settings.data = data; - - this.settings.active = true; - this.settings.visible = true; - - this.events.emit('start', this); }, /** - * Shutdown this Scene and send a shutdown event to all of its systems. - * - * @method Phaser.Scenes.Systems#shutdown + * Is the Frame trimmed or not? + * + * @name Phaser.Textures.Frame#trimmed + * @type {boolean} + * @readOnly * @since 3.0.0 */ - shutdown: function () - { - this.settings.status = CONST.SHUTDOWN; + trimmed: { - this.settings.active = false; - this.settings.visible = false; + get: function () + { + return this.data.trim; + } - this.events.emit('shutdown', this); }, /** - * Destroy this Scene and send a destroy event all of its systems. - * - * @method Phaser.Scenes.Systems#destroy + * The Canvas drawImage data object. + * + * @name Phaser.Textures.Frame#canvasData + * @type {object} + * @readOnly * @since 3.0.0 */ - destroy: function () - { - this.settings.status = CONST.DESTROYED; + canvasData: { - this.settings.active = false; - this.settings.visible = false; + get: function () + { + return this.data.drawImage; + } - this.events.emit('destroy', this); } }); -module.exports = Systems; +module.exports = Frame; /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -23834,583 +24672,275 @@ module.exports = Systems; */ var Class = __webpack_require__(0); -var Extend = __webpack_require__(23); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(1); +var GetBitmapTextSize = __webpack_require__(268); +var ParseFromAtlas = __webpack_require__(548); +var ParseRetroFont = __webpack_require__(549); +var Render = __webpack_require__(550); /** * @classdesc - * A Frame is a section of a Texture. + * [description] * - * @class Frame - * @memberOf Phaser.Textures + * @class BitmapText + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects * @constructor * @since 3.0.0 * - * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. - * @param {integer|string} name - The name of this Frame. The name is unique within the Texture. - * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. - * @param {number} x - The x coordinate of the top-left of this Frame. - * @param {number} y - The y coordinate of the top-left of this Frame. - * @param {number} width - The width of this Frame. - * @param {number} height - The height of this Frame. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. + * @param {number} [x=0] - The x coordinate of this Game Object in world space. + * @param {number} [y=0] - The y coordinate of this Game Object in world space. + * @param {string} font - [description] + * @param {string|string[]} [text] - [description] + * @param {number} [size] - [description] */ -var Frame = new Class({ +var BitmapText = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Origin, + Components.Pipeline, + Components.ScaleMode, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + Render + ], initialize: - function Frame (texture, name, sourceIndex, x, y, width, height) + function BitmapText (scene, x, y, font, text, size) { + if (text === undefined) { text = ''; } + + GameObject.call(this, scene, 'BitmapText'); + /** - * The Texture this Frame is a part of. + * [description] * - * @name Phaser.Textures.Frame#texture - * @type {Phaser.Textures.Texture} + * @name Phaser.GameObjects.BitmapText#font + * @type {string} * @since 3.0.0 */ - this.texture = texture; + this.font = font; + + var entry = this.scene.sys.cache.bitmapFont.get(font); /** - * The name of this Frame. - * The name is unique within the Texture. + * [description] * - * @name Phaser.Textures.Frame#name - * @type {string} + * @name Phaser.GameObjects.BitmapText#fontData + * @type {object} * @since 3.0.0 */ - this.name = name; + this.fontData = entry.data; /** - * The TextureSource this Frame is part of. + * [description] * - * @name Phaser.Textures.Frame#source - * @type {Phaser.Textures.TextureSource} + * @name Phaser.GameObjects.BitmapText#text + * @type {string} * @since 3.0.0 */ - this.source = texture.source[sourceIndex]; + this.text = (Array.isArray(text)) ? text.join('\n') : text; /** - * The index of the TextureSource in the Texture sources array. + * [description] * - * @name Phaser.Textures.Frame#sourceIndex - * @type {integer} + * @name Phaser.GameObjects.BitmapText#fontSize + * @type {number} * @since 3.0.0 */ - this.sourceIndex = sourceIndex; + this.fontSize = size || this.fontData.size; - /** - * X position within the source image to cut from. - * - * @name Phaser.Textures.Frame#cutX - * @type {integer} - * @since 3.0.0 - */ - this.cutX = x; - - /** - * Y position within the source image to cut from. - * - * @name Phaser.Textures.Frame#cutY - * @type {integer} - * @since 3.0.0 - */ - this.cutY = y; - - /** - * The width of the area in the source image to cut. - * - * @name Phaser.Textures.Frame#cutWidth - * @type {integer} - * @since 3.0.0 - */ - this.cutWidth = width; - - /** - * The height of the area in the source image to cut. - * - * @name Phaser.Textures.Frame#cutHeight - * @type {integer} - * @since 3.0.0 - */ - this.cutHeight = height; - - /** - * The X rendering offset of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#x - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The Y rendering offset of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#y - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The rendering width of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#width - * @type {integer} - * @since 3.0.0 - */ - this.width = width; - - /** - * The rendering height of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#height - * @type {integer} - * @since 3.0.0 - */ - this.height = height; - - /** - * Half the width, floored. - * Precalculated for the renderer. - * - * @name Phaser.Textures.Frame#halfWidth - * @type {integer} - * @since 3.0.0 - */ - this.halfWidth = Math.floor(width * 0.5); - - /** - * Half the height, floored. - * Precalculated for the renderer. - * - * @name Phaser.Textures.Frame#halfHeight - * @type {integer} - * @since 3.0.0 - */ - this.halfHeight = Math.floor(height * 0.5); - - /** - * The x center of this frame, floored. - * - * @name Phaser.Textures.Frame#centerX - * @type {integer} - * @since 3.0.0 - */ - this.centerX = Math.floor(width / 2); - - /** - * The y center of this frame, floored. - * - * @name Phaser.Textures.Frame#centerY - * @type {integer} - * @since 3.0.0 - */ - this.centerY = Math.floor(height / 2); - - /** - * The horizontal pivot point of this Frame. - * - * @name Phaser.Textures.Frame#pivotX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.pivotX = 0; - - /** - * The vertical pivot point of this Frame. - * - * @name Phaser.Textures.Frame#pivotY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.pivotY = 0; - - /** - * Does this Frame have a custom pivot point? - * - * @name Phaser.Textures.Frame#customPivot - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customPivot = false; - - /** - * **CURRENTLY UNSUPPORTED** - * - * Is this frame is rotated or not in the Texture? - * Rotation allows you to use rotated frames in texture atlas packing. - * It has nothing to do with Sprite rotation. - * - * @name Phaser.Textures.Frame#rotated - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.rotated = false; - - /** - * Over-rides the Renderer setting. - * -1 = use Renderer Setting - * 0 = No rounding - * 1 = Round - * - * @name Phaser.Textures.Frame#autoRound - * @type {integer} - * @default -1 - * @since 3.0.0 - */ - this.autoRound = -1; - - /** - * Any Frame specific custom data can be stored here. - * - * @name Phaser.Textures.Frame#customData - * @type {object} - * @since 3.0.0 - */ - this.customData = {}; + this.setTexture(entry.texture, entry.frame); + this.setPosition(x, y); + this.setOrigin(0, 0); + this.initPipeline('TextureTintPipeline'); /** - * The un-modified source frame, trim and UV data. + * [description] * - * @name Phaser.Textures.Frame#data + * @name Phaser.GameObjects.BitmapText#_bounds * @type {object} * @private * @since 3.0.0 */ - this.data = { - cut: { - x: x, - y: y, - w: width, - h: height, - r: x + width, - b: y + height - }, - trim: false, - sourceSize: { - w: width, - h: height - }, - spriteSourceSize: { - x: 0, - y: 0, - w: width, - h: height - }, - uvs: { - x0: 0, - y0: 0, - x1: 0, - y1: 0, - x2: 0, - y2: 0, - x3: 0, - y3: 0 - }, - radius: 0.5 * Math.sqrt(width * width + height * height), - drawImage: { - sx: x, - sy: y, - sWidth: width, - sHeight: height, - dWidth: width, - dHeight: height - } - }; - - this.updateUVs(); + this._bounds = this.getTextBounds(); }, /** - * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data. + * [description] * - * @method Phaser.Textures.Frame#setTrim + * @method Phaser.GameObjects.BitmapText#setFontSize * @since 3.0.0 * - * @param {number} actualWidth - The width of the frame before being trimmed. - * @param {number} actualHeight - The height of the frame before being trimmed. - * @param {number} destX - The destination X position of the trimmed frame for display. - * @param {number} destY - The destination Y position of the trimmed frame for display. - * @param {number} destWidth - The destination width of the trimmed frame for display. - * @param {number} destHeight - The destination height of the trimmed frame for display. + * @param {number} size - [description] * - * @return {Phaser.Textures.Frame} This Frame object. + * @return {Phaser.GameObjects.BitmapText} This Game Object. */ - setTrim: function (actualWidth, actualHeight, destX, destY, destWidth, destHeight) + setFontSize: function (size) { - var data = this.data; - var ss = data.spriteSourceSize; - - // Store actual values - - data.trim = true; - - data.sourceSize.w = actualWidth; - data.sourceSize.h = actualHeight; - - ss.x = destX; - ss.y = destY; - ss.w = destWidth; - ss.h = destHeight; - - // Adjust properties - this.x = destX; - this.y = destY; - - this.width = destWidth; - this.height = destHeight; - - this.halfWidth = destWidth * 0.5; - this.halfHeight = destHeight * 0.5; - - this.centerX = Math.floor(destWidth / 2); - this.centerY = Math.floor(destHeight / 2); + this.fontSize = size; - return this.updateUVs(); + return this; }, /** - * Updates the internal WebGL UV cache and the drawImage cache. + * [description] * - * @method Phaser.Textures.Frame#updateUVs + * @method Phaser.GameObjects.BitmapText#setText * @since 3.0.0 * - * @return {Phaser.Textures.Frame} This Frame object. + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this BitmapText. + * + * @return {Phaser.GameObjects.BitmapText} This Game Object. */ - updateUVs: function () + setText: function (value) { - var cx = this.cutX; - var cy = this.cutY; - var cw = this.cutWidth; - var ch = this.cutHeight; - - // Canvas data - - var cd = this.data.drawImage; - - cd.sWidth = cw; - cd.sHeight = ch; - cd.dWidth = cw; - cd.dHeight = ch; - - // WebGL data - - var tw = this.source.width; - var th = this.source.height; - var uvs = this.data.uvs; - - uvs.x0 = cx / tw; - uvs.y0 = cy / th; - - uvs.x1 = cx / tw; - uvs.y1 = (cy + ch) / th; + if (!value && value !== 0) + { + value = ''; + } - uvs.x2 = (cx + cw) / tw; - uvs.y2 = (cy + ch) / th; + if (Array.isArray(value)) + { + value = value.join('\n'); + } - uvs.x3 = (cx + cw) / tw; - uvs.y3 = cy / th; + if (value !== this.text) + { + this.text = value.toString(); + } return this; }, - /** - * Updates the internal WebGL UV cache. - * - * @method Phaser.Textures.Frame#updateUVsInverted - * @since 3.0.0 - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - updateUVsInverted: function () - { - var tw = this.source.width; - var th = this.source.height; - var uvs = this.data.uvs; - - uvs.x3 = (this.cutX + this.cutHeight) / tw; - uvs.y3 = (this.cutY + this.cutWidth) / th; - - uvs.x2 = this.cutX / tw; - uvs.y2 = (this.cutY + this.cutWidth) / th; - - uvs.x1 = this.cutX / tw; - uvs.y1 = this.cutY / th; - - uvs.x0 = (this.cutX + this.cutHeight) / tw; - uvs.y0 = this.cutY / th; - - return this; - }, + // { + // local: { + // x, + // y, + // width, + // height + // }, + // global: { + // x, + // y, + // width, + // height + // } + // } /** - * Clones this Frame into a new Frame object. + * [description] * - * @method Phaser.Textures.Frame#clone + * @method Phaser.GameObjects.BitmapText#getTextBounds * @since 3.0.0 * - * @return {Phaser.Textures.Frame} A clone of this Frame. - */ - clone: function () - { - var clone = new Frame(this.texture, this.name, this.sourceIndex); - - clone.cutX = this.cutX; - clone.cutY = this.cutY; - clone.cutWidth = this.cutWidth; - clone.cutHeight = this.cutHeight; - - clone.x = this.x; - clone.y = this.y; - - clone.width = this.width; - clone.height = this.height; - - clone.halfWidth = this.halfWidth; - clone.halfHeight = this.halfHeight; - - clone.centerX = this.centerX; - clone.centerY = this.centerY; - - clone.rotated = this.rotated; - - clone.data = Extend(true, clone.data, this.data); - - clone.updateUVs(); - - return clone; - }, - - /** - * Destroys this Frames references. + * @param {boolean} round - [description] * - * @method Phaser.Textures.Frame#destroy - * @since 3.0.0 + * @return {object} [description] */ - destroy: function () + getTextBounds: function (round) { - this.texture = null; + // local = the BitmapText based on fontSize and 0x0 coords + // global = the BitmapText, taking into account scale and world position - this.source = null; + this._bounds = GetBitmapTextSize(this, round); + + return this._bounds; }, /** - * The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, - * before being packed. - * - * @name Phaser.Textures.Frame#realWidth + * [description] + * + * @name Phaser.GameObjects.BitmapText#width * @type {number} - * @readOnly * @since 3.0.0 */ - realWidth: { + width: { get: function () { - return this.data.sourceSize.w; + this.getTextBounds(false); + return this._bounds.global.width; } }, /** - * The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, - * before being packed. - * - * @name Phaser.Textures.Frame#realHeight + * [description] + * + * @name Phaser.GameObjects.BitmapText#height * @type {number} - * @readOnly * @since 3.0.0 */ - realHeight: { + height: { get: function () { - return this.data.sourceSize.h; + this.getTextBounds(false); + return this._bounds.global.height; } }, /** - * The UV data for this Frame. + * [description] * - * @name Phaser.Textures.Frame#uvs - * @type {object} - * @readOnly + * @method Phaser.GameObjects.BitmapText#toJSON * @since 3.0.0 + * + * @return {object} [description] */ - uvs: { + toJSON: function () + { + var out = Components.ToJSON(this); - get: function () - { - return this.data.uvs; - } + // Extra data is added here - }, + var data = { + font: this.font, + text: this.text, + fontSize: this.fontSize + }; - /** - * The radius of the Frame (derived from sqrt(w * w + h * h) / 2) - * - * @name Phaser.Textures.Frame#radius - * @type {number} - * @readOnly - * @since 3.0.0 - */ - radius: { + out.data = data; - get: function () - { - return this.data.radius; - } + return out; + } - }, +}); - /** - * Is the Frame trimmed or not? - * - * @name Phaser.Textures.Frame#trimmed - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - trimmed: { +BitmapText.ParseRetroFont = ParseRetroFont; +BitmapText.ParseFromAtlas = ParseFromAtlas; - get: function () - { - return this.data.trim; - } +module.exports = BitmapText; - }, - /** - * The Canvas drawImage data object. - * - * @name Phaser.Textures.Frame#canvasData - * @type {object} - * @readOnly - * @since 3.0.0 - */ - canvasData: { - - get: function () - { - return this.data.drawImage; - } - - } - -}); - -module.exports = Frame; - - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -24418,277 +24948,8 @@ module.exports = Frame; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(1); -var GetBitmapTextSize = __webpack_require__(267); -var ParseFromAtlas = __webpack_require__(546); -var ParseRetroFont = __webpack_require__(547); -var Render = __webpack_require__(548); - -/** - * @classdesc - * [description] - * - * @class BitmapText - * @extends Phaser.GameObjects.GameObject - * @memberOf Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScaleMode - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. - * @param {number} [x=0] - The x coordinate of this Game Object in world space. - * @param {number} [y=0] - The y coordinate of this Game Object in world space. - * @param {string} font - [description] - * @param {string|string[]} [text] - [description] - * @param {number} [size] - [description] - */ -var BitmapText = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Origin, - Components.Pipeline, - Components.ScaleMode, - Components.Texture, - Components.Tint, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - Render - ], - - initialize: - - function BitmapText (scene, x, y, font, text, size) - { - if (text === undefined) { text = ''; } - - GameObject.call(this, scene, 'BitmapText'); - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#font - * @type {string} - * @since 3.0.0 - */ - this.font = font; - - var entry = this.scene.sys.cache.bitmapFont.get(font); - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#fontData - * @type {object} - * @since 3.0.0 - */ - this.fontData = entry.data; - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#text - * @type {string} - * @since 3.0.0 - */ - this.text = (Array.isArray(text)) ? text.join('\n') : text; - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#fontSize - * @type {number} - * @since 3.0.0 - */ - this.fontSize = size || this.fontData.size; - - this.setTexture(entry.texture, entry.frame); - this.setPosition(x, y); - this.setOrigin(0, 0); - this.initPipeline('TextureTintPipeline'); - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#_bounds - * @type {object} - * @private - * @since 3.0.0 - */ - this._bounds = this.getTextBounds(); - }, - - /** - * [description] - * - * @method Phaser.GameObjects.BitmapText#setFontSize - * @since 3.0.0 - * - * @param {number} size - [description] - * - * @return {Phaser.GameObjects.BitmapText} This Game Object. - */ - setFontSize: function (size) - { - this.fontSize = size; - - return this; - }, - - /** - * [description] - * - * @method Phaser.GameObjects.BitmapText#setText - * @since 3.0.0 - * - * @param {string|string[]} text - [description] - * - * @return {Phaser.GameObjects.BitmapText} This Game Object. - */ - setText: function (value) - { - if (Array.isArray(value)) - { - value = value.join('\n'); - } - - this.text = value; - - return this; - }, - - // { - // local: { - // x, - // y, - // width, - // height - // }, - // global: { - // x, - // y, - // width, - // height - // } - // } - - /** - * [description] - * - * @method Phaser.GameObjects.BitmapText#getTextBounds - * @since 3.0.0 - * - * @param {boolean} round - [description] - * - * @return {object} [description] - */ - getTextBounds: function (round) - { - // local = the BitmapText based on fontSize and 0x0 coords - // global = the BitmapText, taking into account scale and world position - - this._bounds = GetBitmapTextSize(this, round); - - return this._bounds; - }, - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#width - * @type {number} - * @since 3.0.0 - */ - width: { - - get: function () - { - this.getTextBounds(false); - return this._bounds.global.width; - } - - }, - - /** - * [description] - * - * @name Phaser.GameObjects.BitmapText#height - * @type {number} - * @since 3.0.0 - */ - height: { - - get: function () - { - this.getTextBounds(false); - return this._bounds.global.height; - } - - }, - - /** - * [description] - * - * @method Phaser.GameObjects.BitmapText#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () - { - var out = Components.ToJSON(this); - - // Extra data is added here - - var data = { - font: this.font, - text: this.text, - fontSize: this.fontSize - }; - - out.data = data; - - return out; - } - -}); - -BitmapText.ParseRetroFont = ParseRetroFont; -BitmapText.ParseFromAtlas = ParseFromAtlas; - -module.exports = BitmapText; - - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var BlitterRender = __webpack_require__(551); -var Bob = __webpack_require__(554); +var BlitterRender = __webpack_require__(553); +var Bob = __webpack_require__(556); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var Frame = __webpack_require__(130); @@ -24948,8 +25209,8 @@ module.exports = Blitter; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetBitmapTextSize = __webpack_require__(267); -var Render = __webpack_require__(555); +var GetBitmapTextSize = __webpack_require__(268); +var Render = __webpack_require__(557); /** * @classdesc @@ -25167,18 +25428,26 @@ var DynamicBitmapText = new Class({ * @method Phaser.GameObjects.DynamicBitmapText#setText * @since 3.0.0 * - * @param {string|string[]} text - [description] + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this BitmapText. * * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object. */ setText: function (value) { + if (!value && value !== 0) + { + value = ''; + } + if (Array.isArray(value)) { value = value.join('\n'); } - this.text = value; + if (value !== this.text) + { + this.text = value.toString(); + } return this; }, @@ -25326,15 +25595,15 @@ module.exports = DynamicBitmapText; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(114); +var Camera = __webpack_require__(115); var Class = __webpack_require__(0); var Commands = __webpack_require__(127); var Components = __webpack_require__(11); -var Ellipse = __webpack_require__(269); +var Ellipse = __webpack_require__(270); var GameObject = __webpack_require__(1); var GetValue = __webpack_require__(4); var MATH_CONST = __webpack_require__(16); -var Render = __webpack_require__(567); +var Render = __webpack_require__(569); /** * @classdesc @@ -25672,7 +25941,6 @@ var Graphics = new Class({ { this.beginPath(); this.arc(x, y, radius, 0, MATH_CONST.PI2); - this.closePath(); this.fillPath(); return this; @@ -25694,7 +25962,6 @@ var Graphics = new Class({ { this.beginPath(); this.arc(x, y, radius, 0, MATH_CONST.PI2); - this.closePath(); this.strokePath(); return this; @@ -25776,25 +26043,21 @@ var Graphics = new Class({ this.moveTo(x, y); this.lineTo(x, y + height); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(x + width, y); this.lineTo(x + width, y + height); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(minx, y); this.lineTo(maxx + width, y); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(minx, y + height); this.lineTo(maxx + width, y + height); this.strokePath(); - this.closePath(); return this; }, @@ -26461,9 +26724,9 @@ module.exports = Graphics; var Class = __webpack_require__(0); var Contains = __webpack_require__(68); -var GetPoint = __webpack_require__(270); -var GetPoints = __webpack_require__(271); -var Random = __webpack_require__(109); +var GetPoint = __webpack_require__(271); +var GetPoints = __webpack_require__(272); +var Random = __webpack_require__(110); /** * @classdesc @@ -26866,10 +27129,10 @@ module.exports = CircumferencePoint; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GravityWell = __webpack_require__(572); +var GravityWell = __webpack_require__(574); var List = __webpack_require__(86); -var ParticleEmitter = __webpack_require__(573); -var Render = __webpack_require__(612); +var ParticleEmitter = __webpack_require__(575); +var Render = __webpack_require__(614); /** * @classdesc @@ -27315,12 +27578,52 @@ module.exports = GetRandomElement; /* 139 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); +var CONST = __webpack_require__(22); var GameObject = __webpack_require__(1); -var RenderTextureWebGL = __webpack_require__(615); -var Render = __webpack_require__(616); +var Render = __webpack_require__(617); +var RenderTextureCanvas = __webpack_require__(620); +var RenderTextureWebGL = __webpack_require__(621); +/** + * @classdesc + * A Render Texture. + * + * @class RenderTexture + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects + * @constructor + * @since 3.2.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.MatrixStack + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {integer} [width=32] - The width of the Render Texture. + * @param {integer} [height=32] - The height of the Render Texture. + */ var RenderTexture = new Class({ Extends: GameObject, @@ -27345,14 +27648,20 @@ var RenderTexture = new Class({ initialize: - function RenderTexture(scene, x, y, width, height) + function RenderTexture (scene, x, y, width, height) { + if (width === undefined) { width = 32; } + if (height === undefined) { height = 32; } + GameObject.call(this, scene, 'RenderTexture'); + this.initMatrixStack(); this.renderer = scene.sys.game.renderer; + this.globalTint = 0xFFFFFFF; + this.globalAlpha = 1.0; - if (this.renderer.type === Phaser.WEBGL) + if (this.renderer.type === CONST.WEBGL) { var gl = this.renderer.gl; this.gl = gl; @@ -27363,13 +27672,14 @@ var RenderTexture = new Class({ this.texture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false); this.framebuffer = this.renderer.createFramebuffer(width, height, this.texture, false); } - else + else if (this.renderer.type === CONST.CANVAS) { - // For now we'll just add canvas stubs - this.fill = function () {}; - this.clear = function () {}; - this.draw = function () {}; - this.drawFrame = function () {}; + this.fill = RenderTextureCanvas.fill; + this.clear = RenderTextureCanvas.clear; + this.draw = RenderTextureCanvas.draw; + this.drawFrame = RenderTextureCanvas.drawFrame; + this.canvas = CanvasPool.create2D(null, width, height); + this.context = this.canvas.getContext('2d'); } this.setPosition(x, y); @@ -27377,15 +27687,88 @@ var RenderTexture = new Class({ this.initPipeline('TextureTintPipeline'); }, + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#destroy + * @since 3.2.0 + */ destroy: function () { GameObject.destroy.call(this); - if (this.renderer.type === Phaser.WEBGL) + + if (this.renderer.type === CONST.WEBGL) { this.renderer.deleteTexture(this.texture); this.renderer.deleteFramebuffer(this.framebuffer); } - } + }, + + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#setGlobalTint + * @since 3.2.0 + * + * @param {int} tint [description] + * + * @return {Phaser.GameObjects.RenderTexture} [description] + */ + setGlobalTint: function (tint) + { + this.globalTint = tint; + return this; + }, + + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#setGlobalAlpha + * @since 3.2.0 + * + * @param {float} alpha [description] + * + * @return {Phaser.GameObjects.RenderTexture} [description] + */ + setGlobalAlpha: function (alpha) + { + this.globalAlpha = alpha; + return this; + } + + /** + * Fills the Render Texture with the given color. + * + * @method Phaser.GameObjects.RenderTexture#fill + * @since 3.2.0 + * + * @param {number} rgb - The color to fill the Render Texture with. + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ + + /** + * Clears the Render Texture. + * + * @method Phaser.GameObjects.RenderTexture#clear + * @since 3.2.0 + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ + + /** + * Draws a texture frame to the Render Texture at the given position. + * + * @method Phaser.GameObjects.RenderTexture#draw + * @since 3.2.0 + * + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number} x - The x position to draw the frame at. + * @param {number} y - The y position to draw the frame at. + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ }); @@ -27402,16 +27785,16 @@ module.exports = RenderTexture; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(123); -var CanvasPool = __webpack_require__(21); +var AddToDOM = __webpack_require__(124); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetTextSize = __webpack_require__(619); +var GetTextSize = __webpack_require__(622); var GetValue = __webpack_require__(4); -var RemoveFromDOM = __webpack_require__(231); -var TextRender = __webpack_require__(620); -var TextStyle = __webpack_require__(623); +var RemoveFromDOM = __webpack_require__(234); +var TextRender = __webpack_require__(623); +var TextStyle = __webpack_require__(626); /** * @classdesc @@ -27598,6 +27981,11 @@ var Text = new Class({ { this.setPadding(style.padding); } + + if (style && style.lineSpacing) + { + this._lineSpacing = style.lineSpacing; + } this.setText(text); @@ -27888,13 +28276,13 @@ var Text = new Class({ * @method Phaser.GameObjects.Text#setText * @since 3.0.0 * - * @param {string|string[]} value - The text to set. + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this Text object. * * @return {Phaser.GameObjects.Text} This Text object. */ setText: function (value) { - if (!value) + if (!value && value !== 0) { value = ''; } @@ -28504,12 +28892,12 @@ module.exports = Text; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetPowerOfTwo = __webpack_require__(290); -var TileSpriteRender = __webpack_require__(625); +var GetPowerOfTwo = __webpack_require__(291); +var TileSpriteRender = __webpack_require__(628); /** * @classdesc @@ -28675,6 +29063,8 @@ var TileSprite = new Class({ */ this.canvasBufferCtx = this.canvasBuffer.getContext('2d'); + this.oldFrame = null; + this.updateTileTexture(); scene.sys.game.renderer.onContextRestored(function (renderer) @@ -28694,11 +29084,15 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty && this.oldFrame === this.frame) { return; } + this.oldFrame = this.frame; + + this.canvasBufferCtx.clearRect(0, 0, this.canvasBuffer.width, this.canvasBuffer.height); + this.canvasBufferCtx.drawImage( this.frame.source.image, this.frame.cutX, this.frame.cutY, @@ -28751,95 +29145,6 @@ module.exports = TileSprite; /* 142 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetAdvancedValue = __webpack_require__(10); - -/** - * Adds an Animation component to a Sprite and populates it based on the given config. - * - * @function Phaser.Gameobjects.BuildGameObjectAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {object} config - [description] - * - * @return {Phaser.GameObjects.Sprite} The updated Sprite. - */ -var BuildGameObjectAnimation = function (sprite, config) -{ - var animConfig = GetAdvancedValue(config, 'anims', null); - - if (animConfig === null) - { - return sprite; - } - - if (typeof animConfig === 'string') - { - // { anims: 'key' } - sprite.anims.play(animConfig); - } - else if (typeof animConfig === 'object') - { - // { anims: { - // key: string - // startFrame: [string|integer] - // delay: [float] - // repeat: [integer] - // repeatDelay: [float] - // yoyo: [boolean] - // play: [boolean] - // delayedPlay: [boolean] - // } - // } - - var anims = sprite.anims; - - var key = GetAdvancedValue(animConfig, 'key', undefined); - var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); - - var delay = GetAdvancedValue(animConfig, 'delay', 0); - var repeat = GetAdvancedValue(animConfig, 'repeat', 0); - var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); - var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); - - var play = GetAdvancedValue(animConfig, 'play', false); - var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); - - anims.delay(delay); - anims.repeat(repeat); - anims.repeatDelay(repeatDelay); - anims.yoyo(yoyo); - - if (play) - { - anims.play(key, startFrame); - } - else if (delayedPlay > 0) - { - anims.delayedPlay(delayedPlay, key, startFrame); - } - else - { - anims.load(key); - } - } - - return sprite; -}; - -module.exports = BuildGameObjectAnimation; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -29436,7 +29741,7 @@ module.exports = Quad; /***/ }), -/* 144 */ +/* 143 */ /***/ (function(module, exports) { /** @@ -29522,7 +29827,7 @@ module.exports = ContainsArray; /***/ }), -/* 145 */ +/* 144 */ /***/ (function(module, exports) { /** @@ -29568,7 +29873,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 146 */ +/* 145 */ /***/ (function(module, exports) { /** @@ -29617,7 +29922,7 @@ module.exports = Contains; /***/ }), -/* 147 */ +/* 146 */ /***/ (function(module, exports) { /** @@ -29645,7 +29950,7 @@ module.exports = GetAspectRatio; /***/ }), -/* 148 */ +/* 147 */ /***/ (function(module, exports) { /** @@ -29697,7 +30002,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 149 */ +/* 148 */ /***/ (function(module, exports) { /** @@ -29738,7 +30043,7 @@ module.exports = GetURL; /***/ }), -/* 150 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29786,8 +30091,8 @@ module.exports = MergeXHRSettings; /***/ }), -/* 151 */, -/* 152 */ +/* 150 */, +/* 151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29862,7 +30167,7 @@ module.exports = CalculateFacesAt; /***/ }), -/* 153 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29873,7 +30178,7 @@ module.exports = CalculateFacesAt; var Tile = __webpack_require__(44); var IsInLayerBounds = __webpack_require__(74); -var CalculateFacesAt = __webpack_require__(152); +var CalculateFacesAt = __webpack_require__(151); var SetTileCollision = __webpack_require__(43); /** @@ -29941,7 +30246,7 @@ module.exports = PutTileAt; /***/ }), -/* 154 */ +/* 153 */ /***/ (function(module, exports) { /** @@ -29979,7 +30284,7 @@ module.exports = SetLayerCollisionIndex; /***/ }), -/* 155 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29988,7 +30293,7 @@ module.exports = SetLayerCollisionIndex; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var LayerData = __webpack_require__(75); var MapData = __webpack_require__(76); var Tile = __webpack_require__(44); @@ -30071,7 +30376,7 @@ module.exports = Parse2DArray; /***/ }), -/* 156 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -30080,10 +30385,10 @@ module.exports = Parse2DArray; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var Parse = __webpack_require__(346); -var Tilemap = __webpack_require__(354); +var Parse = __webpack_require__(348); +var Tilemap = __webpack_require__(356); /** * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When @@ -30157,7 +30462,7 @@ module.exports = ParseToTilemap; /***/ }), -/* 157 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -30204,7 +30509,7 @@ module.exports = GetTargets; /***/ }), -/* 158 */ +/* 157 */ /***/ (function(module, exports) { /** @@ -30377,7 +30682,7 @@ module.exports = GetValueOp; /***/ }), -/* 159 */ +/* 158 */ /***/ (function(module, exports) { /** @@ -30419,7 +30724,7 @@ module.exports = TWEEN_DEFAULTS; /***/ }), -/* 160 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -31248,6 +31553,43 @@ var Tween = new Class({ return this; }, + /** + * Flags the Tween as being complete, whatever stage of progress it is at. + * + * If an onComplete callback has been defined it will automatically invoke it, unless a `delay` + * argument is provided, in which case the Tween will delay for that period of time before calling the callback. + * + * If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead. + * + * @method Phaser.Tweens.Tween#complete + * @since 3.2.0 + * + * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. + */ + complete: function (delay) + { + if (delay === undefined) { delay = 0; } + + if (delay) + { + this.countdown = delay; + this.state = TWEEN_CONST.COMPLETE_DELAY; + } + else + { + var onComplete = this.callbacks.onComplete; + + if (onComplete) + { + onComplete.params[1] = this.targets; + + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + }, + /** * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. * @@ -31753,7 +32095,7 @@ module.exports = Tween; /***/ }), -/* 161 */ +/* 160 */ /***/ (function(module, exports) { /** @@ -31867,7 +32209,7 @@ module.exports = TweenData; /***/ }), -/* 162 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -31897,7 +32239,7 @@ module.exports = Wrap; /***/ }), -/* 163 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -31927,37 +32269,8 @@ module.exports = WrapDegrees; /***/ }), -/* 164 */, -/* 165 */, -/* 166 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 167 */ -/***/ (function(module, exports) { +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -31965,342 +32278,395 @@ module.exports = g; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); +var ShaderSourceFS = __webpack_require__(516); +var TextureTintPipeline = __webpack_require__(164); + +var LIGHT_COUNT = 10; + /** - * This is a slightly modified version of jQuery.isPlainObject. - * A plain object is an object whose internal class property is [object Object]. + * @classdesc + * [description] * - * @function Phaser.Utils.Object.IsPlainObject + * @class ForwardDiffuseLightPipeline + * @extends Phaser.Renderer.WebGL.TextureTintPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 * - * @param {object} obj - The object to inspect. - * - * @return {boolean} `true` if the object is plain, otherwise `false`. + * @param {object} config - [description] */ -var IsPlainObject = function (obj) -{ - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if (typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) - { - return false; - } - - // Support: Firefox <20 - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects, ie. |window.location| - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 - try - { - if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) - { - return false; - } - } - catch (e) - { - return false; - } - - // If the function hasn't returned already, we're confident that - // |obj| is a plain object, created by {} or constructed with new Object - return true; -}; - -module.exports = IsPlainObject; +var ForwardDiffuseLightPipeline = new Class({ + Extends: TextureTintPipeline, -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + function ForwardDiffuseLightPipeline (config) + { + config.fragShader = ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); -/** - * @namespace Phaser.Actions - */ + TextureTintPipeline.call(this, config); + }, -module.exports = { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] + */ + onBind: function () + { + TextureTintPipeline.prototype.onBind.call(this); - Angle: __webpack_require__(376), - Call: __webpack_require__(377), - GetFirst: __webpack_require__(378), - GridAlign: __webpack_require__(379), - IncAlpha: __webpack_require__(397), - IncX: __webpack_require__(398), - IncXY: __webpack_require__(399), - IncY: __webpack_require__(400), - PlaceOnCircle: __webpack_require__(401), - PlaceOnEllipse: __webpack_require__(402), - PlaceOnLine: __webpack_require__(403), - PlaceOnRectangle: __webpack_require__(404), - PlaceOnTriangle: __webpack_require__(405), - PlayAnimation: __webpack_require__(406), - RandomCircle: __webpack_require__(407), - RandomEllipse: __webpack_require__(408), - RandomLine: __webpack_require__(409), - RandomRectangle: __webpack_require__(410), - RandomTriangle: __webpack_require__(411), - Rotate: __webpack_require__(412), - RotateAround: __webpack_require__(413), - RotateAroundDistance: __webpack_require__(414), - ScaleX: __webpack_require__(415), - ScaleXY: __webpack_require__(416), - ScaleY: __webpack_require__(417), - SetAlpha: __webpack_require__(418), - SetBlendMode: __webpack_require__(419), - SetDepth: __webpack_require__(420), - SetHitArea: __webpack_require__(421), - SetOrigin: __webpack_require__(422), - SetRotation: __webpack_require__(423), - SetScale: __webpack_require__(424), - SetScaleX: __webpack_require__(425), - SetScaleY: __webpack_require__(426), - SetTint: __webpack_require__(427), - SetVisible: __webpack_require__(428), - SetX: __webpack_require__(429), - SetXY: __webpack_require__(430), - SetY: __webpack_require__(431), - ShiftPosition: __webpack_require__(432), - Shuffle: __webpack_require__(433), - SmootherStep: __webpack_require__(434), - SmoothStep: __webpack_require__(435), - Spread: __webpack_require__(436), - ToggleVisible: __webpack_require__(437) + var renderer = this.renderer; + var program = this.program; -}; + this.mvpUpdate(); + renderer.setInt1(program, 'uNormSampler', 1); + renderer.setFloat2(program, 'uResolution', this.width, this.height); -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onRender + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] + */ + onRender: function (scene, camera) + { + var lightManager = scene.lights; -var ALIGN_CONST = __webpack_require__(170); + lightManager.culledLights.length = 0; -var AlignInMap = []; + if (lightManager.lights.length <= 0 || !lightManager.active) + { + return this; // If not visible lights just passthrough + } -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(171); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(172); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(173); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(174); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(176); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(177); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(178); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(179); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(180); + var renderer = this.renderer; + var program = this.program; + var lights = scene.lights.cull(camera); + var lightCount = Math.min(lights.length, LIGHT_COUNT); + var cameraMatrix = camera.matrix; + var point = {x: 0, y: 0}; + var height = renderer.height; + var index; -/** - * Takes given Game Object and aligns it so that it is positioned relative to the other. - * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. - * - * @function Phaser.Display.Align.In.QuickSet - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var QuickSet = function (child, alignIn, position, offsetX, offsetY) -{ - return AlignInMap[position](child, alignIn, offsetX, offsetY); -}; + for (index = 0; index < LIGHT_COUNT; ++index) + { + renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); // reset lights + } -module.exports = QuickSet; + if (lightCount <= 0) { return this; } + renderer.setFloat4(program, 'uCamera', camera.x, camera.y, camera.rotation, camera.zoom); + renderer.setFloat3(program, 'uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); -/***/ }), -/* 170 */ -/***/ (function(module, exports) { + for (index = 0; index < lightCount; ++index) + { + var light = lights[index]; + var lightName = 'uLights[' + index + '].'; + cameraMatrix.transformPoint(light.x, light.y, point); + renderer.setFloat2(program, lightName + 'position', point.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (point.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); + renderer.setFloat3(program, lightName + 'color', light.r, light.g, light.b); + renderer.setFloat1(program, lightName + 'intensity', light.intensity); + renderer.setFloat1(program, lightName + 'radius', light.radius); + } + + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + drawStaticTilemapLayer: function (tilemap, camera) + { + var normalTexture = tilemap.texture.dataSource[0]; -var ALIGN_CONST = { + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawStaticTilemapLayer.call(this, tilemap, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. StaticTilemapLayer rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawStaticTilemapLayer(tilemap, camera); + } + }, /** - * A constant representing a top-left alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_LEFT - * @since 3.0.0 - * @type {integer} - */ - TOP_LEFT: 0, + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + drawEmitterManager: function (emitterManager, camera) + { + var normalTexture = emitterManager.texture.dataSource[0]; - /** - * A constant representing a top-center alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_CENTER - * @since 3.0.0 - * @type {integer} - */ - TOP_CENTER: 1, + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawEmitterManager.call(this, emitterManager, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. EmitterManager rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawEmitterManager(emitterManager, camera); + } + }, /** - * A constant representing a top-right alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_RIGHT - * @since 3.0.0 - * @type {integer} - */ - TOP_RIGHT: 2, - - /** - * A constant representing a left-top alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_TOP - * @since 3.0.0 - * @type {integer} - */ - LEFT_TOP: 3, + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + drawBlitter: function (blitter, camera) + { + var normalTexture = blitter.texture.dataSource[0]; - /** - * A constant representing a left-center alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_CENTER - * @since 3.0.0 - * @type {integer} - */ - LEFT_CENTER: 4, + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawBlitter.call(this, blitter, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Blitter rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawBlitter(blitter, camera); + } + }, /** - * A constant representing a left-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_BOTTOM - * @since 3.0.0 - * @type {integer} - */ - LEFT_BOTTOM: 5, + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchSprite: function (sprite, camera) + { + var normalTexture = sprite.texture.dataSource[0]; - /** - * A constant representing a center alignment or position. - * @constant - * @name Phaser.Display.Align.CENTER - * @since 3.0.0 - * @type {integer} - */ - CENTER: 6, + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Sprite rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchSprite(sprite, camera); + } + }, /** - * A constant representing a right-top alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_TOP - * @since 3.0.0 - * @type {integer} - */ - RIGHT_TOP: 7, + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchMesh: function (mesh, camera) + { + var normalTexture = mesh.texture.dataSource[0]; - /** - * A constant representing a right-center alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_CENTER - * @since 3.0.0 - * @type {integer} - */ - RIGHT_CENTER: 8, + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchMesh.call(this, mesh, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Mesh rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchMesh(mesh, camera); - /** - * A constant representing a right-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_BOTTOM - * @since 3.0.0 - * @type {integer} - */ - RIGHT_BOTTOM: 9, + } + }, /** - * A constant representing a bottom-left alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_LEFT - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_LEFT: 10, + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchBitmapText: function (bitmapText, camera) + { + var normalTexture = bitmapText.texture.dataSource[0]; - /** - * A constant representing a bottom-center alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_CENTER - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_CENTER: 11, + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchBitmapText.call(this, bitmapText, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. BitmapText rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchBitmapText(bitmapText, camera); + } + }, /** - * A constant representing a bottom-right alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_RIGHT - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_RIGHT: 12 + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchDynamicBitmapText: function (bitmapText, camera) + { + var normalTexture = bitmapText.texture.dataSource[0]; -}; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchDynamicBitmapText.call(this, bitmapText, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. DynamicBitmapText rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchDynamicBitmapText(bitmapText, camera); + } + }, -module.exports = ALIGN_CONST; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchText: function (text, camera) + { + var normalTexture = text.texture.dataSource[0]; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchText.call(this, text, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Text rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchText(text, camera); + } + }, -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchDynamicTilemapLayer: function (tilemapLayer, camera) + { + var normalTexture = tilemapLayer.texture.dataSource[0]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchDynamicTilemapLayer.call(this, tilemapLayer, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. DynamicTilemapLayer rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchDynamicTilemapLayer(tilemapLayer, camera); + } + }, -var GetBottom = __webpack_require__(24); -var GetCenterX = __webpack_require__(46); -var SetBottom = __webpack_require__(25); -var SetCenterX = __webpack_require__(47); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchTileSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchTileSprite: function (tileSprite, camera) + { + var normalTexture = tileSprite.texture.dataSource[0]; -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. - * - * @function Phaser.Display.Align.In.BottomCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchTileSprite.call(this, tileSprite, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. TileSprite rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchTileSprite(tileSprite, camera); + } + } - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); +}); - return gameObject; -}; +ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; -module.exports = BottomCenter; +module.exports = ForwardDiffuseLightPipeline; /***/ }), -/* 172 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32309,1100 +32675,1860 @@ module.exports = BottomCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); +var Class = __webpack_require__(0); +var ModelViewProjection = __webpack_require__(239); +var ShaderSourceFS = __webpack_require__(517); +var ShaderSourceVS = __webpack_require__(518); +var Utils = __webpack_require__(41); +var WebGLPipeline = __webpack_require__(103); /** - * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. + * @classdesc + * [description] * - * @function Phaser.Display.Align.In.BottomLeft + * @class TextureTintPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {object} config - [description] */ -var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); +var TextureTintPipeline = new Class({ - return gameObject; -}; + Extends: WebGLPipeline, -module.exports = BottomLeft; + Mixins: [ + ModelViewProjection + ], + initialize: -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { + function TextureTintPipeline (config) + { + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapacity ? config.vertexCapacity : 6 * 2000), + + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2 + + Float32Array.BYTES_PER_ELEMENT * 2 + + Uint8Array.BYTES_PER_ELEMENT * 4), -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + }, + { + name: 'inTexCoord', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: Float32Array.BYTES_PER_ELEMENT * 2 + }, + { + name: 'inTint', + size: 4, + type: config.renderer.gl.UNSIGNED_BYTE, + normalized: true, + offset: Float32Array.BYTES_PER_ELEMENT * 4 + } + ] + }); -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. - * - * @function Phaser.Display.Align.In.BottomRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32 = new Uint32Array(this.vertexData); - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#maxQuads + * @type {integer} + * @default 2000 + * @since 3.0.0 + */ + this.maxQuads = 2000; - return gameObject; -}; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#batches + * @type {array} + * @since 3.1.0 + */ + this.batches = []; -module.exports = BottomRight; + this.mvpInit(); + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#setTexture2D + * @since 3.1.0 + * + * @param {WebGLTexture} texture - [description] + * @param {integer} textureUnit - [description] + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + setTexture2D: function (texture, unit) + { + if (!texture) + { + return this; + } -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { + var batches = this.batches; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (batches.length === 0) + { + this.pushBatch(); + } -var CenterOn = __webpack_require__(175); -var GetCenterX = __webpack_require__(46); -var GetCenterY = __webpack_require__(49); + var batch = batches[batches.length - 1]; -/** - * Takes given Game Object and aligns it so that it is positioned in the center of the other. - * - * @function Phaser.Display.Align.In.Center - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var Center = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (unit > 0) + { + if (batch.textures[unit - 1] && + batch.textures[unit - 1] !== texture) + { + this.pushBatch(); + } - CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); + batches[batches.length - 1].textures[unit - 1] = texture; + } + else + { + if (batch.texture !== null && + batch.texture !== texture) + { + this.pushBatch(); + } - return gameObject; -}; + batches[batches.length - 1].texture = texture; + } -module.exports = Center; + return this; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#pushBatch + * @since 3.1.0 + */ + pushBatch: function () + { + var batch = { + first: this.vertexCount, + texture: null, + textures: [] + }; -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { + this.batches.push(batch); + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#flush + * @since 3.1.0 + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} This Pipeline. + */ + flush: function () + { + if (this.flushLocked) + { + return this; + } -var SetCenterX = __webpack_require__(47); -var SetCenterY = __webpack_require__(48); + this.flushLocked = true; -/** - * Positions the Game Object so that it is centered on the given coordinates. - * - * @function Phaser.Display.Bounds.CenterOn - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} x - The horizontal coordinate to position the Game Object on. - * @param {number} y - The vertical coordinate to position the Game Object on. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. - */ -var CenterOn = function (gameObject, x, y) -{ - SetCenterX(gameObject, x); + var gl = this.gl; + var renderer = this.renderer; + var vertexCount = this.vertexCount; + var topology = this.topology; + var vertexSize = this.vertexSize; + var batches = this.batches; + var batchCount = batches.length; + var batchVertexCount = 0; + var batch = null; + var batchNext; + var textureIndex; + var nTexture; - return SetCenterY(gameObject, y); -}; + if (batchCount === 0 || vertexCount === 0) + { + this.flushLocked = false; + return this; + } -module.exports = CenterOn; + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + for (var index = 0; index < batches.length - 1; ++index) + { + batch = batches[index]; + batchNext = batches[index + 1]; -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { + if (batch.textures.length > 0) + { + for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) + { + nTexture = batch.textures[textureIndex]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (nTexture) + { + renderer.setTexture2D(nTexture, 1 + textureIndex); + } + } -var GetCenterY = __webpack_require__(49); -var GetLeft = __webpack_require__(26); -var SetCenterY = __webpack_require__(48); -var SetLeft = __webpack_require__(27); + gl.activeTexture(gl.TEXTURE0); + } -/** - * Takes given Game Object and aligns it so that it is positioned in the left center of the other. - * - * @function Phaser.Display.Align.In.LeftCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + batchVertexCount = batchNext.first - batch.first; - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + if (batch.texture === null || batchVertexCount <= 0) { continue; } - return gameObject; -}; + renderer.setTexture2D(batch.texture, 0); + gl.drawArrays(topology, batch.first, batchVertexCount); + } -module.exports = LeftCenter; + // Left over data + batch = batches[batches.length - 1]; + if (batch.textures.length > 0) + { + for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) + { + nTexture = batch.textures[textureIndex]; -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { + if (nTexture) + { + renderer.setTexture2D(nTexture, 1 + textureIndex); + } + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + gl.activeTexture(gl.TEXTURE0); + } -var GetCenterY = __webpack_require__(49); -var GetRight = __webpack_require__(28); -var SetCenterY = __webpack_require__(48); -var SetRight = __webpack_require__(29); + batchVertexCount = vertexCount - batch.first; -/** - * Takes given Game Object and aligns it so that it is positioned in the right center of the other. - * - * @function Phaser.Display.Align.In.RightCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var RightCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (batch.texture && batchVertexCount > 0) + { + renderer.setTexture2D(batch.texture, 0); + gl.drawArrays(topology, batch.first, batchVertexCount); + } - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + this.vertexCount = 0; + batches.length = 0; + this.pushBatch(); + this.flushLocked = false; - return gameObject; -}; + return this; + }, -module.exports = RightCenter; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + onBind: function () + { + WebGLPipeline.prototype.onBind.call(this); + this.mvpUpdate(); + if (this.batches.length === 0) + { + this.pushBatch(); + } -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + resize: function (width, height, resolution) + { + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); + return this; + }, -var GetCenterX = __webpack_require__(46); -var GetTop = __webpack_require__(30); -var SetCenterX = __webpack_require__(47); -var SetTop = __webpack_require__(31); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawStaticTilemapLayer: function (tilemap) + { + if (tilemap.vertexCount > 0) + { + var pipelineVertexBuffer = this.vertexBuffer; + var gl = this.gl; + var renderer = this.renderer; + var frame = tilemap.tileset.image.get(); -/** - * Takes given Game Object and aligns it so that it is positioned in the top center of the other. - * - * @function Phaser.Display.Align.In.TopCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (renderer.currentPipeline && + renderer.currentPipeline.vertexCount > 0) + { + renderer.flush(); + } - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + this.vertexBuffer = tilemap.vertexBuffer; + renderer.setPipeline(this); + renderer.setTexture2D(frame.source.glTexture, 0); + gl.drawArrays(this.topology, 0, tilemap.vertexCount); + this.vertexBuffer = pipelineVertexBuffer; + } - return gameObject; -}; + this.viewIdentity(); + this.modelIdentity(); + }, -module.exports = TopCenter; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawEmitterManager: function (emitterManager, camera) + { + this.renderer.setPipeline(this); + var roundPixels = this.renderer.config.roundPixels; + var emitters = emitterManager.emitters.list; + var emitterCount = emitters.length; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var renderer = this.renderer; + var maxQuads = this.maxQuads; + var cameraScrollX = camera.scrollX; + var cameraScrollY = camera.scrollY; + var cameraMatrix = camera.matrix.matrix; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var sin = Math.sin; + var cos = Math.cos; + var vertexComponentCount = this.vertexComponentCount; + var vertexCapacity = this.vertexCapacity; + var texture = emitterManager.defaultFrame.source.glTexture; -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { + this.setTexture2D(texture, 0); + + for (var emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex) + { + var emitter = emitters[emitterIndex]; + var particles = emitter.alive; + var aliveLength = particles.length; + var batchCount = Math.ceil(aliveLength / maxQuads); + var particleOffset = 0; + var scrollX = cameraScrollX * emitter.scrollFactorX; + var scrollY = cameraScrollY * emitter.scrollFactorY; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (!emitter.visible || aliveLength === 0) + { + continue; + } -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); + renderer.setBlendMode(emitter.blendMode); -/** - * Takes given Game Object and aligns it so that it is positioned in the top left of the other. - * - * @function Phaser.Display.Align.In.TopLeft - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (this.vertexCount >= vertexCapacity) + { + this.flush(); + this.setTexture2D(texture, 0); + } - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) + { + var batchSize = Math.min(aliveLength, maxQuads); - return gameObject; -}; + for (var index = 0; index < batchSize; ++index) + { + var particle = particles[particleOffset + index]; -module.exports = TopLeft; + if (particle.alpha <= 0) + { + continue; + } + var frame = particle.frame; + var uvs = frame.uvs; + var x = -(frame.halfWidth); + var y = -(frame.halfHeight); + var color = particle.color; + var xw = x + frame.width; + var yh = y + frame.height; + var sr = sin(particle.rotation); + var cr = cos(particle.rotation); + var sra = cr * particle.scaleX; + var srb = -sr * particle.scaleX; + var src = sr * particle.scaleY; + var srd = cr * particle.scaleY; + var sre = particle.x - scrollX * particle.scrollFactorX; + var srf = particle.y - scrollY * particle.scrollFactorY; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = this.vertexCount * vertexComponentCount; -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = color; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = color; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = color; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = color; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = color; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = color; -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); + this.vertexCount += 6; + } -/** - * Takes given Game Object and aligns it so that it is positioned in the top right of the other. - * - * @function Phaser.Display.Align.In.TopRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + particleOffset += batchSize; + aliveLength -= batchSize; - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + if (this.vertexCount >= vertexCapacity) + { + this.flush(); + this.setTexture2D(texture, 0); + } + } + } + + this.setTexture2D(texture, 0); + }, - return gameObject; -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawBlitter: function (blitter, camera) + { + this.renderer.setPipeline(this); -module.exports = TopRight; - - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var CircumferencePoint = __webpack_require__(104); -var FromPercent = __webpack_require__(64); -var MATH_CONST = __webpack_require__(16); -var Point = __webpack_require__(5); - -/** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @function Phaser.Geom.Circle.GetPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. - * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. - * @param {Phaser.Geom.Point|object} [out] - An object to store the return values in. If not given a Point object will be created. - * - * @return {Phaser.Geom.Point|object} A Point, or point-like object, containing the coordinates of the point around the circle. - */ -var GetPoint = function (circle, position, out) -{ - if (out === undefined) { out = new Point(); } - - var angle = FromPercent(position, 0, MATH_CONST.PI2); + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var list = blitter.getRenderList(); + var length = list.length; + var cameraMatrix = camera.matrix.matrix; + var a = cameraMatrix[0]; + var b = cameraMatrix[1]; + var c = cameraMatrix[2]; + var d = cameraMatrix[3]; + var e = cameraMatrix[4]; + var f = cameraMatrix[5]; + var cameraScrollX = camera.scrollX * blitter.scrollFactorX; + var cameraScrollY = camera.scrollY * blitter.scrollFactorY; + var batchCount = Math.ceil(length / this.maxQuads); + var batchOffset = 0; + var blitterX = blitter.x - cameraScrollX; + var blitterY = blitter.y - cameraScrollY; - return CircumferencePoint(circle, angle, out); -}; + for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) + { + var batchSize = Math.min(length, this.maxQuads); -module.exports = GetPoint; + for (var index = 0; index < batchSize; ++index) + { + var bob = list[batchOffset + index]; + var frame = bob.frame; + var alpha = bob.alpha; + var tint = getTint(0xffffff, alpha); + var uvs = frame.uvs; + var flipX = bob.flipX; + var flipY = bob.flipY; + var width = frame.width * (flipX ? -1.0 : 1.0); + var height = frame.height * (flipY ? -1.0 : 1.0); + var x = blitterX + bob.x + frame.x + (frame.width * ((flipX) ? 1.0 : 0.0)); + var y = blitterY + bob.y + frame.y + (frame.height * ((flipY) ? 1.0 : 0.0)); + var xw = x + width; + var yh = y + height; + var tx0 = x * a + y * c + e; + var ty0 = x * b + y * d + f; + var tx1 = xw * a + yh * c + e; + var ty1 = xw * b + yh * d + f; + + // Bind Texture if texture wasn't bound. + // This needs to be here because of multiple + // texture atlas. + this.setTexture2D(frame.texture.source[frame.sourceIndex].glTexture, 0); + var vertexOffset = this.vertexCount * this.vertexComponentCount; -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + } + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = tint; + vertexViewF32[vertexOffset + 5] = tx0; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = tint; + vertexViewF32[vertexOffset + 10] = tx1; + vertexViewF32[vertexOffset + 11] = ty1; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = tint; + vertexViewF32[vertexOffset + 20] = tx1; + vertexViewF32[vertexOffset + 21] = ty1; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = tint; + vertexViewF32[vertexOffset + 25] = tx1; + vertexViewF32[vertexOffset + 26] = ty0; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = tint; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.vertexCount += 6; -var Circumference = __webpack_require__(183); -var CircumferencePoint = __webpack_require__(104); -var FromPercent = __webpack_require__(64); -var MATH_CONST = __webpack_require__(16); + if (this.vertexCount >= this.vertexCapacity) + { + this.flush(); + } + } -/** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, - * based on the given quantity or stepRate values. - * - * @function Phaser.Geom.Circle.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. - * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. - */ -var GetPoints = function (circle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + batchOffset += batchSize; + length -= batchSize; - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity) - { - quantity = Circumference(circle) / stepRate; - } + if (this.vertexCount >= this.vertexCapacity) + { + this.flush(); + } + } + }, - for (var i = 0; i < quantity; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchSprite: function (sprite, camera) { - var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - - out.push(CircumferencePoint(circle, angle)); - } - - return out; -}; - -module.exports = GetPoints; - - -/***/ }), -/* 183 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Returns the circumference of the given Circle. - * - * @function Phaser.Geom.Circle.Circumference - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. - * - * @return {number} The circumference of the Circle. - */ -var Circumference = function (circle) -{ - return 2 * (Math.PI * circle.radius); -}; - -module.exports = Circumference; + this.renderer.setPipeline(this); + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var frame = sprite.frame; + var texture = frame.texture.source[frame.sourceIndex].glTexture; + var forceFlipY = (texture.isRenderTexture ? true : false); + var flipX = sprite.flipX; + var flipY = sprite.flipY ^ forceFlipY; + var uvs = frame.uvs; + var width = frame.width * (flipX ? -1.0 : 1.0); + var height = frame.height * (flipY ? -1.0 : 1.0); + var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0)); + var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0)); + var xw = (roundPixels ? (x|0) : x) + width; + var yh = (roundPixels ? (y|0) : y) + height; + var translateX = sprite.x - camera.scrollX * sprite.scrollFactorX; + var translateY = sprite.y - camera.scrollY * sprite.scrollFactorY; + var scaleX = sprite.scaleX; + var scaleY = sprite.scaleY; + var rotation = -sprite.rotation; + var alphaTL = sprite._alphaTL; + var alphaTR = sprite._alphaTR; + var alphaBL = sprite._alphaBL; + var alphaBR = sprite._alphaBR; + var tintTL = sprite._tintTL; + var tintTR = sprite._tintTR; + var tintBL = sprite._tintBL; + var tintBR = sprite._tintBR; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vTintTL = getTint(tintTL, alphaTL); + var vTintTR = getTint(tintTR, alphaTR); + var vTintBL = getTint(tintBL, alphaBL); + var vTintBR = getTint(tintBR, alphaBR); + var vertexOffset = 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } -var GetPoint = __webpack_require__(106); -var Perimeter = __webpack_require__(78); + this.setTexture2D(texture, 0); -// Return an array of points from the perimeter of the rectangle -// each spaced out based on the quantity or step required + vertexOffset = this.vertexCount * this.vertexComponentCount; -/** - * [description] - * - * @function Phaser.Geom.Rectangle.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectangle - [description] - * @param {number} step - [description] - * @param {integer} quantity - [description] - * @param {array} [out] - [description] - * - * @return {Phaser.Geom.Point[]} [description] - */ -var GetPoints = function (rectangle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = vTintTR; - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity) - { - quantity = Perimeter(rectangle) / stepRate; - } + this.vertexCount += 6; + }, - for (var i = 0; i < quantity; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchMesh: function (mesh, camera) { - var position = i / quantity; - - out.push(GetPoint(rectangle, position)); - } - - return out; -}; - -module.exports = GetPoints; - - -/***/ }), -/* 185 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var vertices = mesh.vertices; + var length = vertices.length; + var vertexCount = (length / 2)|0; -/** - * [description] - * - * @function Phaser.Math.RotateAround - * @since 3.0.0 - * - * @param {Phaser.Geom.Point|object} point - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} angle - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var RotateAround = function (point, x, y, angle) -{ - var c = Math.cos(angle); - var s = Math.sin(angle); + this.renderer.setPipeline(this); - var tx = point.x - x; - var ty = point.y - y; + if (this.vertexCount + vertexCount > this.vertexCapacity) + { + this.flush(); + } - point.x = tx * c - ty * s + x; - point.y = tx * s + ty * c + y; + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var uvs = mesh.uv; + var colors = mesh.colors; + var alphas = mesh.alphas; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var frame = mesh.frame; + var texture = mesh.texture.source[frame.sourceIndex].glTexture; + var translateX = mesh.x - camera.scrollX * mesh.scrollFactorX; + var translateY = mesh.y - camera.scrollY * mesh.scrollFactorY; + var scaleX = mesh.scaleX; + var scaleY = mesh.scaleY; + var rotation = -mesh.rotation; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var vertexOffset = 0; - return point; -}; + this.setTexture2D(texture, 0); -module.exports = RotateAround; + vertexOffset = this.vertexCount * this.vertexComponentCount; + for (var index = 0, index0 = 0; index < length; index += 2) + { + var x = vertices[index + 0]; + var y = vertices[index + 1]; + var tx = x * mva + y * mvc + mve; + var ty = x * mvb + y * mvd + mvf; -/***/ }), -/* 186 */ -/***/ (function(module, exports) { + if (roundPixels) + { + tx |= 0; + ty |= 0; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + vertexViewF32[vertexOffset + 0] = tx; + vertexViewF32[vertexOffset + 1] = ty; + vertexViewF32[vertexOffset + 2] = uvs[index + 0]; + vertexViewF32[vertexOffset + 3] = uvs[index + 1]; + vertexViewU32[vertexOffset + 4] = getTint(colors[index0], alphas[index0]); -/** - * Provides methods used for setting the WebGL rendering pipeline of a Game Object. - * - * @name Phaser.GameObjects.Components.Pipeline - * @webglOnly - * @since 3.0.0 - */ + vertexOffset += 5; + index0 += 1; + } -var Pipeline = { - - /** - * [description] - * - * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - defaultPipeline: null, + this.vertexCount += vertexCount; + }, /** * [description] - * - * @name Phaser.GameObjects.Components.Pipeline#pipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - pipeline: null, - - /** - * Sets the initial WebGL Pipeline of this Game Object. - * This should only be called during the instantiation of the Game Object. - * - * @method Phaser.GameObjects.Components.Pipeline#initPipeline - * @webglOnly + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchBitmapText * @since 3.0.0 * - * @param {string} pipelineName - The name of the pipeline to set on this Game Object. - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - initPipeline: function (pipelineName) + batchBitmapText: function (bitmapText, camera) { - var renderer = this.scene.sys.game.renderer; + this.renderer.setPipeline(this); - if (renderer.gl && renderer.hasPipeline(pipelineName)) + if (this.vertexCount + 6 > this.vertexCapacity) { - this.defaultPipeline = renderer.getPipeline(pipelineName); - this.pipeline = this.defaultPipeline; - return true; + this.flush(); } - return false; - }, + var roundPixels = this.renderer.config.roundPixels; + var text = bitmapText.text; + var textLength = text.length; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var cameraWidth = camera.width + 50; + var cameraHeight = camera.height + 50; + var cameraX = -50; + var cameraY = -50; + var frame = bitmapText.frame; + var textureSource = bitmapText.texture.source[frame.sourceIndex]; + var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; + var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; + var fontData = bitmapText.fontData; + var lineHeight = fontData.lineHeight; + var scale = (bitmapText.fontSize / fontData.size); + var chars = fontData.chars; + var alpha = bitmapText.alpha; + var vTintTL = getTint(bitmapText._tintTL, alpha); + var vTintTR = getTint(bitmapText._tintTR, alpha); + var vTintBL = getTint(bitmapText._tintBL, alpha); + var vTintBR = getTint(bitmapText._tintBR, alpha); + var srcX = bitmapText.x; + var srcY = bitmapText.y; + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = textureSource.width; + var textureHeight = textureSource.height; + var texture = textureSource.glTexture; + var xAdvance = 0; + var yAdvance = 0; + var indexCount = 0; + var charCode = 0; + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + var x = 0; + var y = 0; + var xw = 0; + var yh = 0; - /** - * Sets the active WebGL Pipeline of this Game Object. - * - * @method Phaser.GameObjects.Components.Pipeline#setPipeline - * @webglOnly - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline to set on this Game Object. - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - setPipeline: function (pipelineName) - { - var renderer = this.scene.sys.game.renderer; + var tx0; + var ty0; + var tx1; + var ty1; + var tx2; + var ty2; + var tx3; + var ty3; - if (renderer.gl && renderer.hasPipeline(pipelineName)) - { - this.pipeline = renderer.getPipeline(pipelineName); - return true; - } - - return false; - }, + var umin = 0; + var umax = 0; + var vmin = 0; + var vmax = 0; + var lastGlyph = null; + var lastCharCode = 0; + var translateX = (srcX - cameraScrollX) + frame.x; + var translateY = (srcY - cameraScrollY) + frame.y; + var rotation = -bitmapText.rotation; + var scaleX = bitmapText.scaleX; + var scaleY = bitmapText.scaleY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var vertexOffset = 0; - /** - * Resets the WebGL Pipeline of this Game Object back to the default it was created with. - * - * @method Phaser.GameObjects.Components.Pipeline#resetPipeline - * @webglOnly - * @since 3.0.0 - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - resetPipeline: function () - { - this.pipeline = this.defaultPipeline; - return (this.pipeline !== null); - }, + this.setTexture2D(texture, 0); - /** - * Gets the name of the WebGL Pipeline this Game Object is currently using. - * - * @method Phaser.GameObjects.Components.Pipeline#getPipelineName - * @webglOnly - * @since 3.0.0 - * - * @return {string} The string-based name of the pipeline being used by this Game Object. - */ - getPipelineName: function () - { - return this.pipeline.name; - } + for (var index = 0; index < textLength; ++index) + { + charCode = text.charCodeAt(index); -}; + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } -module.exports = Pipeline; + glyph = chars[charCode]; + if (!glyph) + { + continue; + } -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + glyphW = glyph.width; + glyphH = glyph.height; -var Class = __webpack_require__(0); + x = (indexCount + glyph.xOffset + xAdvance) * scale; + y = (glyph.yOffset + yAdvance) * scale; -/** - * @classdesc - * [description] - * - * @class TransformMatrix - * @memberOf Phaser.GameObjects.Components - * @constructor - * @since 3.0.0 - * - * @param {number} [a=1] - [description] - * @param {number} [b=0] - [description] - * @param {number} [c=0] - [description] - * @param {number} [d=1] - [description] - * @param {number} [tx=0] - [description] - * @param {number} [ty=0] - [description] - */ -var TransformMatrix = new Class({ + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } - initialize: + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; - function TransformMatrix (a, b, c, d, tx, ty) - { - if (a === undefined) { a = 1; } - if (b === undefined) { b = 0; } - if (c === undefined) { c = 0; } - if (d === undefined) { d = 1; } - if (tx === undefined) { tx = 0; } - if (ty === undefined) { ty = 0; } + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } - /** - * [description] - * - * @name Phaser.GameObjects.Components.TransformMatrix#matrix - * @type {Float32Array} - * @since 3.0.0 - */ - this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); + x -= bitmapText.displayOriginX; + y -= bitmapText.displayOriginY; - /** - * [description] - * - * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix - * @type {object} - * @since 3.0.0 - */ - this.decomposedMatrix = { - translateX: 0, - translateY: 0, - scaleX: 1, - scaleY: 1, - rotation: 0 - }; - }, + xw = x + glyphW * scale; + yh = y + glyphH * scale; + tx0 = x * mva + y * mvc + mve; + ty0 = x * mvb + y * mvd + mvf; + tx1 = x * mva + yh * mvc + mve; + ty1 = x * mvb + yh * mvd + mvf; + tx2 = xw * mva + yh * mvc + mve; + ty2 = xw * mvb + yh * mvd + mvf; + tx3 = xw * mva + y * mvc + mve; + ty3 = xw * mvb + y * mvd + mvf; - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity - * @since 3.0.0 - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - loadIdentity: function () - { - var matrix = this.matrix; - - matrix[0] = 1; - matrix[1] = 0; - matrix[2] = 0; - matrix[3] = 1; - matrix[4] = 0; - matrix[5] = 0; + umin = glyphX / textureWidth; + umax = (glyphX + glyphW) / textureWidth; + vmin = glyphY / textureHeight; + vmax = (glyphY + glyphH) / textureHeight; - return this; - }, + if ((tx0 < cameraX || tx0 > cameraWidth || ty0 < cameraY || ty0 > cameraHeight) && + (tx1 < cameraX || tx1 > cameraWidth || ty1 < cameraY || ty1 > cameraHeight) && + (tx2 < cameraX || tx2 > cameraWidth || ty2 < cameraY || ty2 > cameraHeight) && + (tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight)) + { + continue; + } - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#translate - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - translate: function (x, y) - { - var matrix = this.matrix; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + vertexOffset = this.vertexCount * this.vertexComponentCount; - matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; - matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } - return this; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = umin; + vertexViewF32[vertexOffset + 3] = vmin; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = umin; + vertexViewF32[vertexOffset + 8] = vmax; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = umax; + vertexViewF32[vertexOffset + 13] = vmax; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = umin; + vertexViewF32[vertexOffset + 18] = vmin; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = umax; + vertexViewF32[vertexOffset + 23] = vmax; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = umax; + vertexViewF32[vertexOffset + 28] = vmin; + vertexViewU32[vertexOffset + 29] = vTintTR; + + this.vertexCount += 6; + } }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#scale + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicBitmapText * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - scale: function (x, y) + batchDynamicBitmapText: function (bitmapText, camera) { - var matrix = this.matrix; + this.renderer.setPipeline(this); - matrix[0] *= x; - matrix[1] *= x; - matrix[2] *= y; - matrix[3] *= y; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - return this; - }, + var roundPixels = this.renderer.config.roundPixels; + var displayCallback = bitmapText.displayCallback; + var text = bitmapText.text; + var textLength = text.length; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var renderer = this.renderer; + var cameraMatrix = camera.matrix.matrix; + var frame = bitmapText.frame; + var textureSource = bitmapText.texture.source[frame.sourceIndex]; + var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; + var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; + var scrollX = bitmapText.scrollX; + var scrollY = bitmapText.scrollY; + var fontData = bitmapText.fontData; + var lineHeight = fontData.lineHeight; + var scale = (bitmapText.fontSize / fontData.size); + var chars = fontData.chars; + var alpha = bitmapText.alpha; + var vTintTL = getTint(bitmapText._tintTL, alpha); + var vTintTR = getTint(bitmapText._tintTR, alpha); + var vTintBL = getTint(bitmapText._tintBL, alpha); + var vTintBR = getTint(bitmapText._tintBR, alpha); + var srcX = bitmapText.x; + var srcY = bitmapText.y; + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = textureSource.width; + var textureHeight = textureSource.height; + var texture = textureSource.glTexture; + var xAdvance = 0; + var yAdvance = 0; + var indexCount = 0; + var charCode = 0; + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + var x = 0; + var y = 0; + var xw = 0; + var tx0; + var ty0; + var tx1; + var ty1; + var tx2; + var ty2; + var tx3; + var ty3; + var yh = 0; + var umin = 0; + var umax = 0; + var vmin = 0; + var vmax = 0; + var lastGlyph = null; + var lastCharCode = 0; + var translateX = srcX + frame.x; + var translateY = srcY + frame.y; + var rotation = -bitmapText.rotation; + var scaleX = bitmapText.scaleX; + var scaleY = bitmapText.scaleY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var crop = (bitmapText.cropWidth > 0 || bitmapText.cropHeight > 0); + var uta, utb, utc, utd, ute, utf; + var vertexOffset = 0; - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#rotate - * @since 3.0.0 - * - * @param {number} radian - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - rotate: function (radian) - { - var radianSin = Math.sin(radian); - var radianCos = Math.cos(radian); + this.setTexture2D(texture, 0); - return this.transform(radianCos, radianSin, -radianSin, radianCos, 0, 0); - }, + if (crop) + { + renderer.pushScissor( + bitmapText.x, + bitmapText.y, + bitmapText.cropWidth * bitmapText.scaleX, + bitmapText.cropHeight * bitmapText.scaleY + ); + } - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#multiply - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - multiply: function (rhs) - { - var matrix = this.matrix; - var otherMatrix = rhs.matrix; + for (var index = 0; index < textLength; ++index) + { + scale = (bitmapText.fontSize / bitmapText.fontData.size); + rotation = 0; - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; + charCode = text.charCodeAt(index); - var a1 = otherMatrix[0]; - var b1 = otherMatrix[1]; - var c1 = otherMatrix[2]; - var d1 = otherMatrix[3]; - var tx1 = otherMatrix[4]; - var ty1 = otherMatrix[5]; + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } - matrix[0] = a1 * a0 + b1 * c0; - matrix[1] = a1 * b0 + b1 * d0; - matrix[2] = c1 * a0 + d1 * c0; - matrix[3] = c1 * b0 + d1 * d0; - matrix[4] = tx1 * a0 + ty1 * c0 + tx0; - matrix[5] = tx1 * b0 + ty1 * d0 + ty0; + glyph = chars[charCode]; - return this; - }, + if (!glyph) + { + continue; + } - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#transform - * @since 3.0.0 - * - * @param {number} a - [description] - * @param {number} b - [description] - * @param {number} c - [description] - * @param {number} d - [description] - * @param {number} tx - [description] - * @param {number} ty - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - transform: function (a, b, c, d, tx, ty) - { - var matrix = this.matrix; + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; + glyphW = glyph.width; + glyphH = glyph.height; + + x = (indexCount + glyph.xOffset + xAdvance) - scrollX; + y = (glyph.yOffset + yAdvance) - scrollY; - matrix[0] = a * a0 + b * c0; - matrix[1] = a * b0 + b * d0; - matrix[2] = c * a0 + d * c0; - matrix[3] = c * b0 + d * d0; - matrix[4] = tx * a0 + ty * c0 + tx0; - matrix[5] = tx * b0 + ty * d0 + ty0; + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } - return this; + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; + + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } + + if (displayCallback) + { + var output = displayCallback({ + color: 0, + tint: { + topLeft: vTintTL, + topRight: vTintTR, + bottomLeft: vTintBL, + bottomRight: vTintBR + }, + index: index, + charCode: charCode, + x: x, + y: y, + scale: scale, + rotation: 0, + data: glyph.data + }); + + x = output.x; + y = output.y; + scale = output.scale; + rotation = output.rotation; + + if (output.color) + { + vTintTL = output.color; + vTintTR = output.color; + vTintBL = output.color; + vTintBR = output.color; + } + else + { + vTintTL = output.tint.topLeft; + vTintTR = output.tint.topRight; + vTintBL = output.tint.bottomLeft; + vTintBR = output.tint.bottomRight; + } + + vTintTL = getTint(vTintTL, alpha); + vTintTR = getTint(vTintTR, alpha); + vTintBL = getTint(vTintBL, alpha); + vTintBR = getTint(vTintBR, alpha); + } + + x -= bitmapText.displayOriginX; + y -= bitmapText.displayOriginY; + x *= scale; + y *= scale; + x -= cameraScrollX; + y -= cameraScrollY; + + sr = Math.sin(-rotation); + cr = Math.cos(-rotation); + uta = cr * scale; + utb = -sr * scale; + utc = sr * scale; + utd = cr * scale; + ute = x; + utf = y; + + sra = uta * mva + utb * mvc; + srb = uta * mvb + utb * mvd; + src = utc * mva + utd * mvc; + srd = utc * mvb + utd * mvd; + sre = ute * mva + utf * mvc + mve; + srf = ute * mvb + utf * mvd + mvf; + + xw = glyphW; + yh = glyphH; + tx0 = sre; + ty0 = srf; + tx1 = yh * src + sre; + ty1 = yh * srd + srf; + tx2 = xw * sra + yh * src + sre; + ty2 = xw * srb + yh * srd + srf; + tx3 = xw * sra + sre; + ty3 = xw * srb + srf; + + umin = glyphX / textureWidth; + umax = (glyphX + glyphW) / textureWidth; + vmin = glyphY / textureHeight; + vmax = (glyphY + glyphH) / textureHeight; + + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + vertexOffset = this.vertexCount * this.vertexComponentCount; + + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = umin; + vertexViewF32[vertexOffset + 3] = vmin; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = umin; + vertexViewF32[vertexOffset + 8] = vmax; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = umax; + vertexViewF32[vertexOffset + 13] = vmax; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = umin; + vertexViewF32[vertexOffset + 18] = vmin; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = umax; + vertexViewF32[vertexOffset + 23] = vmax; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = umax; + vertexViewF32[vertexOffset + 28] = vmin; + vertexViewU32[vertexOffset + 29] = vTintTR; + + this.vertexCount += 6; + } + + if (crop) + { + renderer.popScissor(); + } }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchText * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {Phaser.Geom.Point|Phaser.Math.Vec2|object} point - [description] - * - * @return {Phaser.Geom.Point|Phaser.Math.Vec2|object} [description] + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - transformPoint: function (x, y, point) + batchText: function (text, camera) { - if (point === undefined) { point = { x: 0, y: 0 }; } - - var matrix = this.matrix; - - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; - - point.x = x * a + y * c + tx; - point.y = x * b + y * d + ty; + var getTint = Utils.getTintAppendFloatAlpha; - return point; + this.batchTexture( + text, + text.canvasTexture, + text.canvasTexture.width, text.canvasTexture.height, + text.x, text.y, + text.canvasTexture.width, text.canvasTexture.height, + text.scaleX, text.scaleY, + text.rotation, + text.flipX, text.flipY, + text.scrollFactorX, text.scrollFactorY, + text.displayOriginX, text.displayOriginY, + 0, 0, text.canvasTexture.width, text.canvasTexture.height, + getTint(text._tintTL, text._alphaTL), + getTint(text._tintTR, text._alphaTR), + getTint(text._tintBL, text._alphaBL), + getTint(text._tintBR, text._alphaBR), + 0, 0, + camera + ); }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#invert + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicTilemapLayer * @since 3.0.0 * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - invert: function () + batchDynamicTilemapLayer: function (tilemapLayer, camera) { - var matrix = this.matrix; + var renderTiles = tilemapLayer.culledTiles; + var length = renderTiles.length; + var texture = tilemapLayer.tileset.image.get().source.glTexture; + var tileset = tilemapLayer.tileset; + var scrollFactorX = tilemapLayer.scrollFactorX; + var scrollFactorY = tilemapLayer.scrollFactorY; + var alpha = tilemapLayer.alpha; + var x = tilemapLayer.x; + var y = tilemapLayer.y; + var sx = tilemapLayer.scaleX; + var sy = tilemapLayer.scaleY; + var getTint = Utils.getTintAppendFloatAlpha; - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; + for (var index = 0; index < length; ++index) + { + var tile = renderTiles[index]; - var n = a * d - b * c; + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + if (tileTexCoords === null) { continue; } - matrix[0] = d / n; - matrix[1] = -b / n; - matrix[2] = -c / n; - matrix[3] = a / n; - matrix[4] = (c * ty - d * tx) / n; - matrix[5] = -(a * ty - b * tx) / n; + var frameWidth = tile.width; + var frameHeight = tile.height; + var frameX = tileTexCoords.x; + var frameY = tileTexCoords.y; + var tint = getTint(tile.tint, alpha * tile.alpha); - return this; + this.batchTexture( + tilemapLayer, + texture, + texture.width, texture.height, + (tile.width / 2) + x + tile.pixelX * sx, (tile.height / 2) + y + tile.pixelY * sy, + tile.width * sx, tile.height * sy, + 1, 1, + tile.rotation, + tile.flipX, tile.flipY, + scrollFactorX, scrollFactorY, + (tile.width / 2), (tile.height / 2), + frameX, frameY, frameWidth, frameHeight, + tint, tint, tint, tint, + 0, 0, + camera + ); + } }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#setTransform + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTileSprite * @since 3.0.0 * - * @param {number} a - [description] - * @param {number} b - [description] - * @param {number} c - [description] - * @param {number} d - [description] - * @param {number} tx - [description] - * @param {number} ty - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setTransform: function (a, b, c, d, tx, ty) + batchTileSprite: function (tileSprite, camera) { - var matrix = this.matrix; - - matrix[0] = a; - matrix[1] = b; - matrix[2] = c; - matrix[3] = d; - matrix[4] = tx; - matrix[5] = ty; + var getTint = Utils.getTintAppendFloatAlpha; - return this; + this.batchTexture( + tileSprite, + tileSprite.tileTexture, + tileSprite.frame.width, tileSprite.frame.height, + tileSprite.x, tileSprite.y, + tileSprite.width, tileSprite.height, + tileSprite.scaleX, tileSprite.scaleY, + tileSprite.rotation, + tileSprite.flipX, tileSprite.flipY, + tileSprite.scrollFactorX, tileSprite.scrollFactorY, + tileSprite.originX * tileSprite.width, tileSprite.originY * tileSprite.height, + 0, 0, tileSprite.width, tileSprite.height, + getTint(tileSprite._tintTL, tileSprite._alphaTL), + getTint(tileSprite._tintTR, tileSprite._alphaTR), + getTint(tileSprite._tintBL, tileSprite._alphaBL), + getTint(tileSprite._tintBR, tileSprite._alphaBR), + tileSprite.tilePositionX / tileSprite.frame.width, + tileSprite.tilePositionY / tileSprite.frame.height, + camera + ); }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTexture * @since 3.0.0 * - * @return {object} [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {WebGLTexture} texture - [description] + * @param {integer} textureWidth - [description] + * @param {integer} textureHeight - [description] + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcWidth - [description] + * @param {float} srcHeight - [description] + * @param {float} scaleX - [description] + * @param {float} scaleY - [description] + * @param {float} rotation - [description] + * @param {boolean} flipX - [description] + * @param {boolean} flipY - [description] + * @param {float} scrollFactorX - [description] + * @param {float} scrollFactorY - [description] + * @param {float} displayOriginX - [description] + * @param {float} displayOriginY - [description] + * @param {float} frameX - [description] + * @param {float} frameY - [description] + * @param {float} frameWidth - [description] + * @param {float} frameHeight - [description] + * @param {integer} tintTL - [description] + * @param {integer} tintTR - [description] + * @param {integer} tintBL - [description] + * @param {integer} tintBR - [description] + * @param {float} uOffset - [description] + * @param {float} vOffset - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - decomposeMatrix: function () + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, + uOffset, vOffset, + camera) { - var decomposedMatrix = this.decomposedMatrix; - - var matrix = this.matrix; + this.renderer.setPipeline(this); - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - var a2 = a * a; - var b2 = b * b; - var c2 = c * c; - var d2 = d * d; + flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); + rotation = -rotation; - var sx = Math.sqrt(a2 + c2); - var sy = Math.sqrt(b2 + d2); + var roundPixels = this.renderer.config.roundPixels; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var width = srcWidth * (flipX ? -1.0 : 1.0); + var height = srcHeight * (flipY ? -1.0 : 1.0); + var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0)); + var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0)); + var xw = x + width; + var yh = y + height; + var translateX = srcX - camera.scrollX * scrollFactorX; + var translateY = srcY - camera.scrollY * scrollFactorY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = 0; + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + this.setTexture2D(texture, 0); - decomposedMatrix.translateX = matrix[4]; - decomposedMatrix.translateY = matrix[5]; + vertexOffset = this.vertexCount * this.vertexComponentCount; - decomposedMatrix.scaleX = sx; - decomposedMatrix.scaleY = sy; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } - decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = u0; + vertexViewF32[vertexOffset + 3] = v0; + vertexViewU32[vertexOffset + 4] = tintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = u0; + vertexViewF32[vertexOffset + 8] = v1; + vertexViewU32[vertexOffset + 9] = tintTR; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = u1; + vertexViewF32[vertexOffset + 13] = v1; + vertexViewU32[vertexOffset + 14] = tintBL; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = u0; + vertexViewF32[vertexOffset + 18] = v0; + vertexViewU32[vertexOffset + 19] = tintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = u1; + vertexViewF32[vertexOffset + 23] = v1; + vertexViewU32[vertexOffset + 24] = tintBL; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = u1; + vertexViewF32[vertexOffset + 28] = v0; + vertexViewU32[vertexOffset + 29] = tintBR; - return decomposedMatrix; + this.vertexCount += 6; }, /** - * Identity + Translate + Rotate + Scale + * Immediately draws a texture with no batching. * - * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawTexture + * @since 3.2.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} rotation - [description] - * @param {number} scaleX - [description] - * @param {number} scaleY - [description] + * @param {WebGLTexture} texture [description] + * @param {number} srcX - [description] + * @param {number} srcY - [description] + * @param {number} tint - [description] + * @param {number} alpha - [description] + * @param {number} frameX - [description] + * @param {number} frameY - [description] + * @param {number} frameWidth - [description] + * @param {number} frameHeight - [description] + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - [description] * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} This Pipeline. */ - applyITRS: function (x, y, rotation, scaleX, scaleY) - { - var matrix = this.matrix; + drawTexture: function ( + texture, + srcX, srcY, + tint, alpha, + frameX, frameY, frameWidth, frameHeight, + transformMatrix + ) + { + this.renderer.setPipeline(this); - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - // Translate - matrix[4] = x; - matrix[5] = y; + var roundPixels = this.renderer.config.roundPixels; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var width = frameWidth; + var height = frameHeight; + var x = srcX; + var y = srcY; + var xw = x + width; + var yh = y + height; + var mva = transformMatrix[0]; + var mvb = transformMatrix[1]; + var mvc = transformMatrix[2]; + var mvd = transformMatrix[3]; + var mve = transformMatrix[4]; + var mvf = transformMatrix[5]; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = 0; + var textureWidth = texture.width; + var textureHeight = texture.height; + var u0 = (frameX / textureWidth); + var v0 = (frameY / textureHeight); + var u1 = (frameX + frameWidth) / textureWidth; + var v1 = (frameY + frameHeight) / textureHeight; + tint = Utils.getTintAppendFloatAlpha(tint, alpha); + + this.setTexture2D(texture, 0); - // Rotate and Scale - matrix[0] = cr * scaleX; - matrix[1] = -sr * scaleX; - matrix[2] = sr * scaleY; - matrix[3] = cr * scaleY; + vertexOffset = this.vertexCount * this.vertexComponentCount; - return this; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = u0; + vertexViewF32[vertexOffset + 3] = v0; + vertexViewU32[vertexOffset + 4] = tint; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = u0; + vertexViewF32[vertexOffset + 8] = v1; + vertexViewU32[vertexOffset + 9] = tint; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = u1; + vertexViewF32[vertexOffset + 13] = v1; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = u0; + vertexViewF32[vertexOffset + 18] = v0; + vertexViewU32[vertexOffset + 19] = tint; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = u1; + vertexViewF32[vertexOffset + 23] = v1; + vertexViewU32[vertexOffset + 24] = tint; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = u1; + vertexViewF32[vertexOffset + 28] = v0; + vertexViewU32[vertexOffset + 29] = tint; + + this.vertexCount += 6; + + // Force an immediate draw + this.flush(); + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchGraphics + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchGraphics: function () + { + // Stub } }); -module.exports = TransformMatrix; +module.exports = TextureTintPipeline; /***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { +/* 165 */, +/* 166 */, +/* 167 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 168 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -33410,117 +34536,55 @@ module.exports = TransformMatrix; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Perimeter = __webpack_require__(78); -var Point = __webpack_require__(5); - -// Return an array of points from the perimeter of the rectangle -// each spaced out based on the quantity or step required - /** - * [description] + * This is a slightly modified version of jQuery.isPlainObject. + * A plain object is an object whose internal class property is [object Object]. * - * @function Phaser.Geom.Rectangle.MarchingAnts + * @function Phaser.Utils.Object.IsPlainObject * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} step - [description] - * @param {integer} quantity - [description] - * @param {array} [out] - [description] + * @param {object} obj - The object to inspect. * - * @return {Phaser.Geom.Point[]} [description] + * @return {boolean} `true` if the object is plain, otherwise `false`. */ -var MarchingAnts = function (rect, step, quantity, out) +var IsPlainObject = function (obj) { - if (out === undefined) { out = []; } - - if (!step && !quantity) - { - // Bail out - return out; - } - - // If step is a falsey value (false, null, 0, undefined, etc) then we calculate - // it based on the quantity instead, otherwise we always use the step value - if (!step) - { - step = Perimeter(rect) / quantity; - } - else + // Not plain objects: + // - Any object or value whose internal [[Class]] property is not "[object Object]" + // - DOM nodes + // - window + if (typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) { - quantity = Math.round(Perimeter(rect) / step); + return false; } - var x = rect.x; - var y = rect.y; - var face = 0; - - // Loop across each face of the rectangle - - for (var i = 0; i < quantity; i++) + // Support: Firefox <20 + // The try/catch suppresses exceptions thrown when attempting to access + // the "constructor" property of certain host objects, ie. |window.location| + // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 + try { - out.push(new Point(x, y)); - - switch (face) + if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) { - - // Top face - case 0: - x += step; - - if (x >= rect.right) - { - face = 1; - y += (x - rect.right); - x = rect.right; - } - break; - - // Right face - case 1: - y += step; - - if (y >= rect.bottom) - { - face = 2; - x -= (y - rect.bottom); - y = rect.bottom; - } - break; - - // Bottom face - case 2: - x -= step; - - if (x <= rect.left) - { - face = 3; - y -= (rect.left - x); - x = rect.left; - } - break; - - // Left face - case 3: - y -= step; - - if (y <= rect.top) - { - face = 0; - y = rect.top; - } - break; + return false; } } + catch (e) + { + return false; + } - return out; + // If the function hasn't returned already, we're confident that + // |obj| is a plain object, created by {} or constructed with new Object + return true; }; -module.exports = MarchingAnts; +module.exports = IsPlainObject; /***/ }), -/* 189 */ -/***/ (function(module, exports) { +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -33529,38 +34593,63 @@ module.exports = MarchingAnts; */ /** - * Moves the element at the start of the array to the end, shifting all items in the process. - * The "rotation" happens to the left. - * - * @function Phaser.Utils.Array.RotateLeft - * @since 3.0.0 - * - * @param {array} array - The array to shift to the left. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {any} The most recently shifted element. + * @namespace Phaser.Actions */ -var RotateLeft = function (array, total) -{ - if (total === undefined) { total = 1; } - var element = null; +module.exports = { - for (var i = 0; i < total; i++) - { - element = array.shift(); - array.push(element); - } + Angle: __webpack_require__(387), + Call: __webpack_require__(388), + GetFirst: __webpack_require__(389), + GridAlign: __webpack_require__(390), + IncAlpha: __webpack_require__(408), + IncX: __webpack_require__(409), + IncXY: __webpack_require__(410), + IncY: __webpack_require__(411), + PlaceOnCircle: __webpack_require__(412), + PlaceOnEllipse: __webpack_require__(413), + PlaceOnLine: __webpack_require__(414), + PlaceOnRectangle: __webpack_require__(415), + PlaceOnTriangle: __webpack_require__(416), + PlayAnimation: __webpack_require__(417), + RandomCircle: __webpack_require__(418), + RandomEllipse: __webpack_require__(419), + RandomLine: __webpack_require__(420), + RandomRectangle: __webpack_require__(421), + RandomTriangle: __webpack_require__(422), + Rotate: __webpack_require__(423), + RotateAround: __webpack_require__(424), + RotateAroundDistance: __webpack_require__(425), + ScaleX: __webpack_require__(426), + ScaleXY: __webpack_require__(427), + ScaleY: __webpack_require__(428), + SetAlpha: __webpack_require__(429), + SetBlendMode: __webpack_require__(430), + SetDepth: __webpack_require__(431), + SetHitArea: __webpack_require__(432), + SetOrigin: __webpack_require__(433), + SetRotation: __webpack_require__(434), + SetScale: __webpack_require__(435), + SetScaleX: __webpack_require__(436), + SetScaleY: __webpack_require__(437), + SetTint: __webpack_require__(438), + SetVisible: __webpack_require__(439), + SetX: __webpack_require__(440), + SetXY: __webpack_require__(441), + SetY: __webpack_require__(442), + ShiftPosition: __webpack_require__(443), + Shuffle: __webpack_require__(444), + SmootherStep: __webpack_require__(445), + SmoothStep: __webpack_require__(446), + Spread: __webpack_require__(447), + ToggleVisible: __webpack_require__(448) - return element; }; -module.exports = RotateLeft; - /***/ }), -/* 190 */ -/***/ (function(module, exports) { +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -33568,38 +34657,45 @@ module.exports = RotateLeft; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var ALIGN_CONST = __webpack_require__(171); + +var AlignInMap = []; + +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(172); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(173); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(174); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(175); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(177); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(178); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(179); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(180); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(181); + /** - * Moves the element at the end of the array to the start, shifting all items in the process. - * The "rotation" happens to the right. + * Takes given Game Object and aligns it so that it is positioned relative to the other. + * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. * - * @function Phaser.Utils.Array.RotateRight + * @function Phaser.Display.Align.In.QuickSet * @since 3.0.0 * - * @param {array} array - The array to shift to the right. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. + * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. * - * @return {any} The most recently shifted element. + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var RotateRight = function (array, total) +var QuickSet = function (child, alignIn, position, offsetX, offsetY) { - if (total === undefined) { total = 1; } - - var element = null; - - for (var i = 0; i < total; i++) - { - element = array.pop(); - array.unshift(element); - } - - return element; + return AlignInMap[position](child, alignIn, offsetX, offsetY); }; -module.exports = RotateRight; +module.exports = QuickSet; /***/ }), -/* 191 */ +/* 171 */ /***/ (function(module, exports) { /** @@ -33608,72 +34704,133 @@ module.exports = RotateRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * Using Bresenham's line algorithm this will return an array of all coordinates on this line. - * The start and end points are rounded before this runs as the algorithm works on integers. - * - * @function Phaser.Geom.Line.BresenhamPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - [description] - * @param {integer} [stepRate=1] - [description] - * @param {array} [results] - [description] - * - * @return {array} [description] - */ -var BresenhamPoints = function (line, stepRate, results) -{ - if (stepRate === undefined) { stepRate = 1; } - if (results === undefined) { results = []; } +var ALIGN_CONST = { - var x1 = Math.round(line.x1); - var y1 = Math.round(line.y1); - var x2 = Math.round(line.x2); - var y2 = Math.round(line.y2); + /** + * A constant representing a top-left alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_LEFT + * @since 3.0.0 + * @type {integer} + */ + TOP_LEFT: 0, - var dx = Math.abs(x2 - x1); - var dy = Math.abs(y2 - y1); - var sx = (x1 < x2) ? 1 : -1; - var sy = (y1 < y2) ? 1 : -1; - var err = dx - dy; + /** + * A constant representing a top-center alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_CENTER + * @since 3.0.0 + * @type {integer} + */ + TOP_CENTER: 1, - results.push({ x: x1, y: y1 }); + /** + * A constant representing a top-right alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_RIGHT + * @since 3.0.0 + * @type {integer} + */ + TOP_RIGHT: 2, - var i = 1; + /** + * A constant representing a left-top alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_TOP + * @since 3.0.0 + * @type {integer} + */ + LEFT_TOP: 3, - while (!((x1 === x2) && (y1 === y2))) - { - var e2 = err << 1; + /** + * A constant representing a left-center alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_CENTER + * @since 3.0.0 + * @type {integer} + */ + LEFT_CENTER: 4, - if (e2 > -dy) - { - err -= dy; - x1 += sx; - } + /** + * A constant representing a left-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_BOTTOM + * @since 3.0.0 + * @type {integer} + */ + LEFT_BOTTOM: 5, - if (e2 < dx) - { - err += dx; - y1 += sy; - } + /** + * A constant representing a center alignment or position. + * @constant + * @name Phaser.Display.Align.CENTER + * @since 3.0.0 + * @type {integer} + */ + CENTER: 6, - if (i % stepRate === 0) - { - results.push({ x: x1, y: y1 }); - } + /** + * A constant representing a right-top alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_TOP + * @since 3.0.0 + * @type {integer} + */ + RIGHT_TOP: 7, - i++; - } + /** + * A constant representing a right-center alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_CENTER + * @since 3.0.0 + * @type {integer} + */ + RIGHT_CENTER: 8, + + /** + * A constant representing a right-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_BOTTOM + * @since 3.0.0 + * @type {integer} + */ + RIGHT_BOTTOM: 9, + + /** + * A constant representing a bottom-left alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_LEFT + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_LEFT: 10, + + /** + * A constant representing a bottom-center alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_CENTER + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_CENTER: 11, + + /** + * A constant representing a bottom-right alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_RIGHT + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_RIGHT: 12 - return results; }; -module.exports = BresenhamPoints; +module.exports = ALIGN_CONST; /***/ }), -/* 192 */ -/***/ (function(module, exports) { +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -33681,31 +34838,41 @@ module.exports = BresenhamPoints; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var GetBottom = __webpack_require__(24); +var GetCenterX = __webpack_require__(46); +var SetBottom = __webpack_require__(25); +var SetCenterX = __webpack_require__(47); + /** - * [description] + * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. * - * @function Phaser.Math.SmootherStep + * @function Phaser.Display.Align.In.BottomCenter * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} min - [description] - * @param {number} max - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. * - * @return {number} [description] + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var SmootherStep = function (x, min, max) +var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) { - x = Math.max(0, Math.min(1, (x - min) / (max - min))); + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - return x * x * x * (x * (x * 6 - 15) + 10); + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); + + return gameObject; }; -module.exports = SmootherStep; +module.exports = BottomCenter; /***/ }), -/* 193 */ -/***/ (function(module, exports) { +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -33713,30 +34880,40 @@ module.exports = SmootherStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); + /** - * [description] + * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. * - * @function Phaser.Math.SmoothStep + * @function Phaser.Display.Align.In.BottomLeft * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} min - [description] - * @param {number} max - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. * - * @return {number} [description] + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var SmoothStep = function (x, min, max) +var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) { - x = Math.max(0, Math.min(1, (x - min) / (max - min))); + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - return x * x * (3 - 2 * x); + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); + + return gameObject; }; -module.exports = SmoothStep; +module.exports = BottomLeft; /***/ }), -/* 194 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33745,900 +34922,667 @@ module.exports = SmoothStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Frame = __webpack_require__(195); -var GetValue = __webpack_require__(4); +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); /** - * @classdesc - * A Frame based Animation. - * - * This consists of a key, some default values (like the frame rate) and a bunch of Frame objects. - * - * The Animation Manager creates these. Game Objects don't own an instance of these directly. - * Game Objects have the Animation Component, which are like playheads to global Animations (these objects) - * So multiple Game Objects can have playheads all pointing to this one Animation instance. + * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. * - * @class Animation - * @memberOf Phaser.Animations - * @constructor + * @function Phaser.Display.Align.In.BottomRight * @since 3.0.0 * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {object} config - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var Animation = new Class({ +var BottomRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - initialize: + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - function Animation (manager, key, config) - { - /** - * [description] - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Animations.Animation#key - * @type {string} - * @since 3.0.0 - */ - this.key = key; +module.exports = BottomRight; - /** - * A frame based animation (as opposed to a bone based animation) - * - * @name Phaser.Animations.Animation#type - * @type {string} - * @default frame - * @since 3.0.0 - */ - this.type = 'frame'; - /** - * Extract all the frame data into the frames array - * - * @name Phaser.Animations.Animation#frames - * @type {array} - * @since 3.0.0 - */ - this.frames = this.getFrames( - manager.textureManager, - GetValue(config, 'frames', []), - GetValue(config, 'defaultTextureKey', null) - ); +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * The frame rate of playback in frames per second (default 24 if duration is null) - * - * @name Phaser.Animations.Animation#frameRate - * @type {integer} - * @default 24 - * @since 3.0.0 - */ - this.frameRate = GetValue(config, 'frameRate', null); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * How long the animation should play for. - * If frameRate is set it overrides this value otherwise frameRate is derived from duration. - * - * @name Phaser.Animations.Animation#duration - * @type {integer} - * @since 3.0.0 - */ - this.duration = GetValue(config, 'duration', null); +var CenterOn = __webpack_require__(176); +var GetCenterX = __webpack_require__(46); +var GetCenterY = __webpack_require__(49); - if (this.duration === null && this.frameRate === null) - { - // No duration or frameRate given, use default frameRate of 24fps - this.frameRate = 24; - this.duration = this.frameRate / this.frames.length; - } - else if (this.duration && this.frameRate === null) - { - // Duration given but no frameRate, so set the frameRate based on duration - // I.e. 12 frames in the animation, duration = 4 (4000 ms) - // So frameRate is 12 / 4 = 3 fps - this.frameRate = this.frames.length / this.duration; - } - else - { - // frameRate given, derive duration from it (even if duration also specified) - // I.e. 15 frames in the animation, frameRate = 30 fps - // So duration is 15 / 30 = 0.5 (half a second) - this.duration = this.frames.length / this.frameRate; - } +/** + * Takes given Game Object and aligns it so that it is positioned in the center of the other. + * + * @function Phaser.Display.Align.In.Center + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var Center = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * ms per frame (without including frame specific modifiers) - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} - * @since 3.0.0 - */ - this.msPerFrame = 1000 / this.frameRate; + CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.Animations.Animation#skipMissedFrames - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); + return gameObject; +}; - /** - * Delay before starting playback (in seconds) - * - * @name Phaser.Animations.Animation#delay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.delay = GetValue(config, 'delay', 0); +module.exports = Center; - /** - * Number of times to repeat the animation (-1 for infinity) - * - * @name Phaser.Animations.Animation#repeat - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); - /** - * Delay before the repeat starts (in seconds) - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); +/***/ }), +/* 176 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Should the animation yoyo? (reverse back down to the start) before repeating? - * - * @name Phaser.Animations.Animation#yoyo - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.yoyo = GetValue(config, 'yoyo', false); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Should sprite.visible = true when the animation starts to play? - * - * @name Phaser.Animations.Animation#showOnStart - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.showOnStart = GetValue(config, 'showOnStart', false); +var SetCenterX = __webpack_require__(47); +var SetCenterY = __webpack_require__(48); - /** - * Should sprite.visible = false when the animation finishes? - * - * @name Phaser.Animations.Animation#hideOnComplete - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.hideOnComplete = GetValue(config, 'hideOnComplete', false); +/** + * Positions the Game Object so that it is centered on the given coordinates. + * + * @function Phaser.Display.Bounds.CenterOn + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} x - The horizontal coordinate to position the Game Object on. + * @param {number} y - The vertical coordinate to position the Game Object on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var CenterOn = function (gameObject, x, y) +{ + SetCenterX(gameObject, x); - /** - * [description] - * - * @name Phaser.Animations.Animation#callbackScope - * @type {object} - * @since 3.0.0 - */ - this.callbackScope = GetValue(config, 'callbackScope', this); + return SetCenterY(gameObject, y); +}; - /** - * [description] - * - * @name Phaser.Animations.Animation#onStart - * @type {function} - * @since 3.0.0 - */ - this.onStart = GetValue(config, 'onStart', false); +module.exports = CenterOn; - /** - * [description] - * - * @name Phaser.Animations.Animation#onStartParams - * @type {array} - * @since 3.0.0 - */ - this.onStartParams = GetValue(config, 'onStartParams', []); - /** - * [description] - * - * @name Phaser.Animations.Animation#onRepeat - * @type {function} - * @since 3.0.0 - */ - this.onRepeat = GetValue(config, 'onRepeat', false); +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Animations.Animation#onRepeatParams - * @type {array} - * @since 3.0.0 - */ - this.onRepeatParams = GetValue(config, 'onRepeatParams', []); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Called for EVERY frame of the animation. - * See AnimationFrame.onUpdate for a frame specific callback. - * - * @name Phaser.Animations.Animation#onUpdate - * @type {function} - * @since 3.0.0 - */ - this.onUpdate = GetValue(config, 'onUpdate', false); +var GetCenterY = __webpack_require__(49); +var GetLeft = __webpack_require__(26); +var SetCenterY = __webpack_require__(48); +var SetLeft = __webpack_require__(27); - /** - * [description] - * - * @name Phaser.Animations.Animation#onUpdateParams - * @type {array} - * @since 3.0.0 - */ - this.onUpdateParams = GetValue(config, 'onUpdateParams', []); +/** + * Takes given Game Object and aligns it so that it is positioned in the left center of the other. + * + * @function Phaser.Display.Align.In.LeftCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @name Phaser.Animations.Animation#onComplete - * @type {function} - * @since 3.0.0 - */ - this.onComplete = GetValue(config, 'onComplete', false); + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - /** - * [description] - * - * @name Phaser.Animations.Animation#onCompleteParams - * @type {array} - * @since 3.0.0 - */ - this.onCompleteParams = GetValue(config, 'onCompleteParams', []); + return gameObject; +}; - /** - * Global pause, effects all Game Objects using this Animation instance - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; +module.exports = LeftCenter; - this.manager.on('pauseall', this.pause.bind(this)); - this.manager.on('resumeall', this.resume.bind(this)); - }, - // config = Array of Animation config objects, like: - // [ - // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } - // ] +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { - // Add frames to the end of the animation +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.Animation#addFrame - * @since 3.0.0 - * - * @param {[type]} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrame: function (config) - { - return this.addFrameAt(this.frames.length, config); - }, +var GetCenterY = __webpack_require__(49); +var GetRight = __webpack_require__(28); +var SetCenterY = __webpack_require__(48); +var SetRight = __webpack_require__(29); - // config = Array of Animation config objects, like: - // [ - // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } - // ] +/** + * Takes given Game Object and aligns it so that it is positioned in the right center of the other. + * + * @function Phaser.Display.Align.In.RightCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - // Add frame/s into the animation + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - /** - * [description] - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * @param {[type]} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrameAt: function (index, config) - { - var newFrames = this.getFrames(this.manager.textureManager, config); + return gameObject; +}; - if (newFrames.length > 0) - { - if (index === 0) - { - this.frames = newFrames.concat(this.frames); - } - else if (index === this.frames.length) - { - this.frames = this.frames.concat(newFrames); - } - else - { - var pre = this.frames.slice(0, index); - var post = this.frames.slice(index); +module.exports = RightCenter; - this.frames = pre.concat(newFrames, post); - } - this.updateFrameSequence(); - } +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {boolean} [description] - */ - checkFrame: function (index) - { - return (index < this.frames.length); - }, +var GetCenterX = __webpack_require__(46); +var GetTop = __webpack_require__(30); +var SetCenterX = __webpack_require__(47); +var SetTop = __webpack_require__(31); - /** - * [description] - * - * @method Phaser.Animations.Animation#completeAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - completeAnimation: function (component) - { - if (this.hideOnComplete) - { - component.parent.visible = false; - } +/** + * Takes given Game Object and aligns it so that it is positioned in the top center of the other. + * + * @function Phaser.Display.Align.In.TopCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - component.stop(true); - }, + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - /** - * [description] - * - * @method Phaser.Animations.Animation#getFirstTick - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - * @param {boolean} [includeDelay=true] - [description] - */ - getFirstTick: function (component, includeDelay) - { - if (includeDelay === undefined) { includeDelay = true; } + return gameObject; +}; - // When is the first update due? - component.accumulator = 0; - component.nextTick = component.msPerFrame + component.currentFrame.duration; +module.exports = TopCenter; - if (includeDelay) - { - component.nextTick += (component._delay * 1000); - } - }, - /** - * [description] - * - * @method Phaser.Animations.Animation#getFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {Phaser.Animations.AnimationFrame} [description] - */ - getFrameAt: function (index) - { - return this.frames[index]; - }, +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Animations.Animation#getFrames - * @since 3.0.0 - * - * @param {[type]} textureManager - [description] - * @param {[type]} frames - [description] - * - * @return {Phaser.Animations.AnimationFrame[]} [description] - */ - getFrames: function (textureManager, frames, defaultTextureKey) - { - // frames: [ - // { key: textureKey, frame: textureFrame }, - // { key: textureKey, frame: textureFrame, duration: float }, - // { key: textureKey, frame: textureFrame, onUpdate: function } - // { key: textureKey, frame: textureFrame, visible: boolean } - // ], +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var out = []; - var prev; - var animationFrame; - var index = 1; - var i; - var textureKey; +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); - // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet - if (typeof frames === 'string') - { - textureKey = frames; +/** + * Takes given Game Object and aligns it so that it is positioned in the top left of the other. + * + * @function Phaser.Display.Align.In.TopLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - var texture = textureManager.get(textureKey); - var frameKeys = texture.getFrameNames(); + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - frames = []; + return gameObject; +}; - frameKeys.forEach(function (idx, value) - { - frames.push({ key: textureKey, frame: value }); - }); - } +module.exports = TopLeft; - if (!Array.isArray(frames) || frames.length === 0) - { - return out; - } - for (i = 0; i < frames.length; i++) - { - var item = frames[i]; +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { - var key = GetValue(item, 'key', defaultTextureKey); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (!key) - { - continue; - } +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); - // Could be an integer or a string - var frame = GetValue(item, 'frame', 0); +/** + * Takes given Game Object and aligns it so that it is positioned in the top right of the other. + * + * @function Phaser.Display.Align.In.TopRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - // The actual texture frame - var textureFrame = textureManager.getFrame(key, frame); + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - animationFrame = new Frame(key, frame, index, textureFrame); + return gameObject; +}; - animationFrame.duration = GetValue(item, 'duration', 0); - animationFrame.onUpdate = GetValue(item, 'onUpdate', null); +module.exports = TopRight; - animationFrame.isFirst = (!prev); - // The previously created animationFrame - if (prev) - { - prev.nextFrame = animationFrame; +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { - animationFrame.prevFrame = prev; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - out.push(animationFrame); +var CircumferencePoint = __webpack_require__(105); +var FromPercent = __webpack_require__(65); +var MATH_CONST = __webpack_require__(16); +var Point = __webpack_require__(5); - prev = animationFrame; +/** + * Returns a Point object containing the coordinates of a point on the circumference of the Circle + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. + * + * @function Phaser.Geom.Circle.GetPoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. + * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. + * @param {Phaser.Geom.Point|object} [out] - An object to store the return values in. If not given a Point object will be created. + * + * @return {Phaser.Geom.Point|object} A Point, or point-like object, containing the coordinates of the point around the circle. + */ +var GetPoint = function (circle, position, out) +{ + if (out === undefined) { out = new Point(); } - index++; - } + var angle = FromPercent(position, 0, MATH_CONST.PI2); - if (out.length > 0) - { - animationFrame.isLast = true; + return CircumferencePoint(circle, angle, out); +}; - // Link them end-to-end, so they loop - animationFrame.nextFrame = out[0]; +module.exports = GetPoint; - out[0].prevFrame = animationFrame; - // Generate the progress data +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { - var slice = 1 / (out.length - 1); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (i = 0; i < out.length; i++) - { - out[i].progress = i * slice; - } - } +var Circumference = __webpack_require__(184); +var CircumferencePoint = __webpack_require__(105); +var FromPercent = __webpack_require__(65); +var MATH_CONST = __webpack_require__(16); - return out; - }, +/** + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, + * based on the given quantity or stepRate values. + * + * @function Phaser.Geom.Circle.GetPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. + * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. + * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. + */ +var GetPoints = function (circle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } - /** - * [description] - * - * @method Phaser.Animations.Animation#getNextTick - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - getNextTick: function (component) + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity) { - // accumulator += delta * _timeScale - // after a large delta surge (perf issue for example) we need to adjust for it here + quantity = Circumference(circle) / stepRate; + } - // When is the next update due? - component.accumulator -= component.nextTick; + for (var i = 0; i < quantity; i++) + { + var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - component.nextTick = component.msPerFrame + component.currentFrame.duration; - }, + out.push(CircumferencePoint(circle, angle)); + } - /** - * [description] - * - * @method Phaser.Animations.Animation#load - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - * @param {integer} startFrame - [description] - */ - load: function (component, startFrame) - { - if (startFrame >= this.frames.length) - { - startFrame = 0; - } + return out; +}; - if (component.currentAnim !== this) - { - component.currentAnim = this; +module.exports = GetPoints; - component._timeScale = 1; - component.frameRate = this.frameRate; - component.duration = this.duration; - component.msPerFrame = this.msPerFrame; - component.skipMissedFrames = this.skipMissedFrames; - component._delay = this.delay; - component._repeat = this.repeat; - component._repeatDelay = this.repeatDelay; - component._yoyo = this.yoyo; - component._callbackArgs[1] = this; - component._updateParams = component._callbackArgs.concat(this.onUpdateParams); - } - component.updateFrame(this.frames[startFrame]); - }, +/***/ }), +/* 184 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - nextFrame: function (component) - { - var frame = component.currentFrame; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // TODO: Add frame skip support +/** + * Returns the circumference of the given Circle. + * + * @function Phaser.Geom.Circle.Circumference + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. + * + * @return {number} The circumference of the Circle. + */ +var Circumference = function (circle) +{ + return 2 * (Math.PI * circle.radius); +}; - if (frame.isLast) - { - // We're at the end of the animation +module.exports = Circumference; - // Yoyo? (happens before repeat) - if (this.yoyo) - { - component.forward = false; - component.updateFrame(frame.prevFrame); +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { - // Delay for the current frame - this.getNextTick(component); - } - else if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - this.repeatAnimation(component); - } - else - { - this.completeAnimation(component); - } - } - else - { - component.updateFrame(frame.nextFrame); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.getNextTick(component); - } - }, +var GetPoint = __webpack_require__(107); +var Perimeter = __webpack_require__(78); - /** - * [description] - * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - previousFrame: function (component) +// Return an array of points from the perimeter of the rectangle +// each spaced out based on the quantity or step required + +/** + * [description] + * + * @function Phaser.Geom.Rectangle.GetPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectangle - [description] + * @param {number} step - [description] + * @param {integer} quantity - [description] + * @param {array} [out] - [description] + * + * @return {Phaser.Geom.Point[]} [description] + */ +var GetPoints = function (rectangle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity) { - var frame = component.currentFrame; + quantity = Perimeter(rectangle) / stepRate; + } - // TODO: Add frame skip support + for (var i = 0; i < quantity; i++) + { + var position = i / quantity; - if (frame.isFirst) - { - // We're at the start of the animation + out.push(GetPoint(rectangle, position)); + } - if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - this.repeatAnimation(component); - } - else - { - this.completeAnimation(component); - } - } - else - { - component.updateFrame(frame.prevFrame); + return out; +}; - this.getNextTick(component); - } - }, +module.exports = GetPoints; - /** - * [description] - * - * @method Phaser.Animations.Animation#removeFrame - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrame: function (frame) - { - var index = this.frames.indexOf(frame); - if (index !== -1) - { - this.removeFrameAt(index); - } +/***/ }), +/* 186 */ +/***/ (function(module, exports) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrameAt: function (index) - { - this.frames.splice(index, 1); +/** + * [description] + * + * @function Phaser.Math.RotateAround + * @since 3.0.0 + * + * @param {Phaser.Geom.Point|object} point - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} angle - [description] + * + * @return {Phaser.Geom.Point} [description] + */ +var RotateAround = function (point, x, y, angle) +{ + var c = Math.cos(angle); + var s = Math.sin(angle); - this.updateFrameSequence(); + var tx = point.x - x; + var ty = point.y - y; - return this; - }, + point.x = tx * c - ty * s + x; + point.y = tx * s + ty * c + y; - /** - * [description] - * - * @method Phaser.Animations.Animation#repeatAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - repeatAnimation: function (component) - { - if (component._repeatDelay > 0 && component.pendingRepeat === false) - { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += (component._repeatDelay * 1000); - } - else - { - component.repeatCounter--; + return point; +}; - component.forward = true; +module.exports = RotateAround; - component.updateFrame(component.currentFrame.nextFrame); - this.getNextTick(component); +/***/ }), +/* 187 */ +/***/ (function(module, exports) { - component.pendingRepeat = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (this.onRepeat) - { - this.onRepeat.apply(this.callbackScope, component._callbackArgs.concat(this.onRepeatParams)); - } - } - }, +/** + * Provides methods used for setting the WebGL rendering pipeline of a Game Object. + * + * @name Phaser.GameObjects.Components.Pipeline + * @webglOnly + * @since 3.0.0 + */ +var Pipeline = { + /** * [description] - * - * @method Phaser.Animations.Animation#setFrame + * + * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - setFrame: function (component) - { - // Work out which frame should be set next on the child, and set it - if (component.forward) - { - this.nextFrame(component); - } - else - { - this.previousFrame(component); - } - }, + defaultPipeline: null, /** * [description] - * - * @method Phaser.Animations.Animation#toJSON + * + * @name Phaser.GameObjects.Components.Pipeline#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly * @since 3.0.0 - * - * @return {object} [description] */ - toJSON: function () - { - var output = { - key: this.key, - type: this.type, - frames: [], - frameRate: this.frameRate, - duration: this.duration, - skipMissedFrames: this.skipMissedFrames, - delay: this.delay, - repeat: this.repeat, - repeatDelay: this.repeatDelay, - yoyo: this.yoyo, - showOnStart: this.showOnStart, - hideOnComplete: this.hideOnComplete - }; - - this.frames.forEach(function (frame) - { - output.frames.push(frame.toJSON()); - }); - - return output; - }, + pipeline: null, /** - * [description] - * - * @method Phaser.Animations.Animation#updateFrameSequence + * Sets the initial WebGL Pipeline of this Game Object. + * This should only be called during the instantiation of the Game Object. + * + * @method Phaser.GameObjects.Components.Pipeline#initPipeline + * @webglOnly * @since 3.0.0 * - * @return {Phaser.Animations.Animation} This Animation object. + * @param {string} pipelineName - The name of the pipeline to set on this Game Object. + * + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - updateFrameSequence: function () + initPipeline: function (pipelineName) { - var len = this.frames.length; - var slice = 1 / (len - 1); + var renderer = this.scene.sys.game.renderer; - for (var i = 0; i < len; i++) + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) { - var frame = this.frames[i]; - - frame.index = i + 1; - frame.isFirst = false; - frame.isLast = false; - frame.progress = i * slice; + this.defaultPipeline = renderer.getPipeline(pipelineName); + this.pipeline = this.defaultPipeline; - if (i === 0) - { - frame.isFirst = true; - frame.isLast = (len === 1); - frame.prevFrame = this.frames[len - 1]; - frame.nextFrame = this.frames[i + 1]; - } - else if (i === len - 1) - { - frame.isLast = true; - frame.prevFrame = this.frames[len - 2]; - frame.nextFrame = this.frames[0]; - } - else if (len > 1) - { - frame.prevFrame = this.frames[i - 1]; - frame.nextFrame = this.frames[i + 1]; - } + return true; } - return this; + return false; }, /** - * [description] - * - * @method Phaser.Animations.Animation#pause + * Sets the active WebGL Pipeline of this Game Object. + * + * @method Phaser.GameObjects.Components.Pipeline#setPipeline + * @webglOnly * @since 3.0.0 * - * @return {Phaser.Animations.Animation} This Animation object. + * @param {string} pipelineName - The name of the pipeline to set on this Game Object. + * + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - pause: function () + setPipeline: function (pipelineName) { - this.paused = true; + var renderer = this.scene.sys.game.renderer; - return this; + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) + { + this.pipeline = renderer.getPipeline(pipelineName); + + return true; + } + + return false; }, /** - * [description] - * - * @method Phaser.Animations.Animation#resume + * Resets the WebGL Pipeline of this Game Object back to the default it was created with. + * + * @method Phaser.GameObjects.Components.Pipeline#resetPipeline + * @webglOnly * @since 3.0.0 * - * @return {Phaser.Animations.Animation} This Animation object. + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - resume: function () + resetPipeline: function () { - this.paused = false; + this.pipeline = this.defaultPipeline; - return this; + return (this.pipeline !== null); }, /** - * [description] - * - * @method Phaser.Animations.Animation#destroy + * Gets the name of the WebGL Pipeline this Game Object is currently using. + * + * @method Phaser.GameObjects.Components.Pipeline#getPipelineName + * @webglOnly * @since 3.0.0 + * + * @return {string} The string-based name of the pipeline being used by this Game Object. */ - destroy: function () + getPipelineName: function () { - // TODO + return this.pipeline.name; } -}); +}; -module.exports = Animation; +module.exports = Pipeline; /***/ }), -/* 195 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -34651,323 +35595,275 @@ var Class = __webpack_require__(0); /** * @classdesc - * A single frame in an Animation sequence. - * - * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other - * frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback - * and modify the animation timing. - * - * AnimationFrames are generated automatically by the Animation class. + * [description] * - * @class AnimationFrame - * @memberOf Phaser.Animations + * @class TransformMatrix + * @memberOf Phaser.GameObjects.Components * @constructor * @since 3.0.0 * - * @param {string} textureKey - The key of the Texture this AnimationFrame uses. - * @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. - * @param {integer} index - The index of this AnimationFrame within the Animation sequence. - * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {number} [a=1] - [description] + * @param {number} [b=0] - [description] + * @param {number} [c=0] - [description] + * @param {number} [d=1] - [description] + * @param {number} [tx=0] - [description] + * @param {number} [ty=0] - [description] */ -var AnimationFrame = new Class({ +var TransformMatrix = new Class({ initialize: - function AnimationFrame (textureKey, textureFrame, index, frame) + function TransformMatrix (a, b, c, d, tx, ty) { - /** - * The key of the Texture this AnimationFrame uses. - * - * @name Phaser.Animations.AnimationFrame#textureKey - * @type {string} - * @since 3.0.0 - */ - this.textureKey = textureKey; + if (a === undefined) { a = 1; } + if (b === undefined) { b = 0; } + if (c === undefined) { c = 0; } + if (d === undefined) { d = 1; } + if (tx === undefined) { tx = 0; } + if (ty === undefined) { ty = 0; } /** - * The key of the Frame within the Texture that this AnimationFrame uses. + * [description] * - * @name Phaser.Animations.AnimationFrame#textureFrame - * @type {string|integer} + * @name Phaser.GameObjects.Components.TransformMatrix#matrix + * @type {Float32Array} * @since 3.0.0 */ - this.textureFrame = textureFrame; + this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); /** - * The index of this AnimationFrame within the Animation sequence. + * [description] * - * @name Phaser.Animations.AnimationFrame#index - * @type {integer} + * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix + * @type {object} * @since 3.0.0 */ - this.index = index; + this.decomposedMatrix = { + translateX: 0, + translateY: 0, + scaleX: 1, + scaleY: 1, + rotation: 0 + }; + }, - /** - * A reference to the Texture Frame this AnimationFrame uses for rendering. - * - * @name Phaser.Animations.AnimationFrame#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - this.frame = frame; + /** + * [description] + * + * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity + * @since 3.0.0 + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + */ + loadIdentity: function () + { + var matrix = this.matrix; + + matrix[0] = 1; + matrix[1] = 0; + matrix[2] = 0; + matrix[3] = 1; + matrix[4] = 0; + matrix[5] = 0; - /** - * Is this the first frame in an animation sequence? - * - * @name Phaser.Animations.AnimationFrame#isFirst - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isFirst = false; + return this; + }, - /** - * Is this the last frame in an animation sequence? - * - * @name Phaser.Animations.AnimationFrame#isLast - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isLast = false; + /** + * [description] + * + * @method Phaser.GameObjects.Components.TransformMatrix#translate + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + */ + translate: function (x, y) + { + var matrix = this.matrix; - /** - * A reference to the AnimationFrame that comes before this one in the animation, if any. - * - * @name Phaser.Animations.AnimationFrame#prevFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readOnly - * @since 3.0.0 - */ - this.prevFrame = null; + matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; + matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; - /** - * A reference to the AnimationFrame that comes after this one in the animation, if any. - * - * @name Phaser.Animations.AnimationFrame#nextFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readOnly - * @since 3.0.0 - */ - this.nextFrame = null; + return this; + }, - /** - * Additional time (in ms) that this frame should appear for during playback. - * The value is added onto the msPerFrame set by the animation. - * - * @name Phaser.Animations.AnimationFrame#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; + /** + * [description] + * + * @method Phaser.GameObjects.Components.TransformMatrix#scale + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + */ + scale: function (x, y) + { + var matrix = this.matrix; - /** - * What % through the animation does this frame come? - * This value is generated when the animation is created and cached here. - * - * @name Phaser.Animations.AnimationFrame#progress - * @type {number} - * @default 0 - * @readOnly - * @since 3.0.0 - */ - this.progress = 0; + matrix[0] *= x; + matrix[1] *= x; + matrix[2] *= y; + matrix[3] *= y; - /** - * A frame specific callback, invoked if this frame gets displayed and the callback is set. - * - * @name Phaser.Animations.AnimationFrame#onUpdate - * @type {?function} - * @default null - * @since 3.0.0 - */ - this.onUpdate = null; + return this; }, /** - * Generates a JavaScript object suitable for converting to JSON. + * [description] * - * @method Phaser.Animations.AnimationFrame#toJSON + * @method Phaser.GameObjects.Components.TransformMatrix#rotate * @since 3.0.0 - * - * @return {object} The AnimationFrame data. + * + * @param {number} radian - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - toJSON: function () + rotate: function (radian) { - return { - key: this.textureKey, - frame: this.textureFrame, - duration: this.duration - }; + var radianSin = Math.sin(radian); + var radianCos = Math.cos(radian); + + return this.transform(radianCos, radianSin, -radianSin, radianCos, 0, 0); }, /** - * Destroys this object by removing references to external resources and callbacks. + * [description] * - * @method Phaser.Animations.AnimationFrame#destroy + * @method Phaser.GameObjects.Components.TransformMatrix#multiply * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - destroy: function () + multiply: function (rhs) { - this.frame = undefined; - this.onUpdate = undefined; - } - -}); + var matrix = this.matrix; + var otherMatrix = rhs.matrix; -module.exports = AnimationFrame; + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; + var a1 = otherMatrix[0]; + var b1 = otherMatrix[1]; + var c1 = otherMatrix[2]; + var d1 = otherMatrix[3]; + var tx1 = otherMatrix[4]; + var ty1 = otherMatrix[5]; -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { + matrix[0] = a1 * a0 + b1 * c0; + matrix[1] = a1 * b0 + b1 * d0; + matrix[2] = c1 * a0 + d1 * c0; + matrix[3] = c1 * b0 + d1 * d0; + matrix[4] = tx1 * a0 + ty1 * c0 + tx0; + matrix[5] = tx1 * b0 + ty1 * d0 + ty0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + }, -var Animation = __webpack_require__(194); -var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(113); -var EventEmitter = __webpack_require__(14); -var GetValue = __webpack_require__(4); -var Pad = __webpack_require__(197); - -/** - * @classdesc - * The Animation Manager. - * - * Animations are managed by the global Animation Manager. This is a singleton class that is - * responsible for creating and delivering animations and their corresponding data to all Game Objects. - * Unlike plugins it is owned by the Game instance, not the Scene. - * - * Sprites and other Game Objects get the data they need from the AnimationManager. - * - * @class AnimationManager - * @extends EventEmitter - * @memberOf Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] - */ -var AnimationManager = new Class({ - - Extends: EventEmitter, - - initialize: - - function AnimationManager (game) + /** + * [description] + * + * @method Phaser.GameObjects.Components.TransformMatrix#transform + * @since 3.0.0 + * + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + */ + transform: function (a, b, c, d, tx, ty) { - EventEmitter.call(this); - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#game - * @type {Phaser.Game} - * @protected - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#textureManager - * @type {Phaser.Textures.TextureManager} - * @protected - * @since 3.0.0 - */ - this.textureManager = null; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#globalTimeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.globalTimeScale = 1; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#anims - * @type {Phaser.Structs.Map} - * @protected - * @since 3.0.0 - */ - this.anims = new CustomMap(); + var matrix = this.matrix; - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#name - * @type {string} - * @since 3.0.0 - */ - this.name = 'AnimationManager'; + matrix[0] = a * a0 + b * c0; + matrix[1] = a * b0 + b * d0; + matrix[2] = c * a0 + d * c0; + matrix[3] = c * b0 + d * d0; + matrix[4] = tx * a0 + ty * c0 + tx0; + matrix[5] = tx * b0 + ty * d0 + ty0; - game.events.once('boot', this.boot, this); + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#boot + * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {Phaser.Geom.Point|Phaser.Math.Vec2|object} point - [description] + * + * @return {Phaser.Geom.Point|Phaser.Math.Vec2|object} [description] */ - boot: function () + transformPoint: function (x, y, point) { - this.textureManager = this.game.textures; + if (point === undefined) { point = { x: 0, y: 0 }; } - this.game.events.once('destroy', this.destroy, this); + var matrix = this.matrix; + + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; + + point.x = x * a + y * c + tx; + point.y = x * b + y * d + ty; + + return point; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @method Phaser.GameObjects.Components.TransformMatrix#invert * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.Animations.Animation} animation - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - add: function (key, animation) + invert: function () { - if (this.anims.has(key)) - { - console.warn('Animation with key', key, 'already exists'); - return; - } + var matrix = this.matrix; - animation.key = key; + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; - this.anims.set(key, animation); + var n = a * d - b * c; - this.emit('add', key, animation); + matrix[0] = d / n; + matrix[1] = -b / n; + matrix[2] = -c / n; + matrix[3] = a / n; + matrix[4] = (c * ty - d * tx) / n; + matrix[5] = -(a * ty - b * tx) / n; return this; }, @@ -34975,453 +35871,382 @@ var AnimationManager = new Class({ /** * [description] * - * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @method Phaser.GameObjects.Components.TransformMatrix#setTransform * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.Animations.Animation} The Animation that was created. + * + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - create: function (config) + setTransform: function (a, b, c, d, tx, ty) { - var key = config.key; - - if (!key || this.anims.has(key)) - { - console.warn('Invalid Animation Key, or Key already in use: ' + key); - return; - } - - var anim = new Animation(this, key, config); - - this.anims.set(key, anim); + var matrix = this.matrix; - this.emit('add', key, anim); + matrix[0] = a; + matrix[1] = b; + matrix[2] = c; + matrix[3] = d; + matrix[4] = tx; + matrix[5] = ty; - return anim; + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#fromJSON + * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix * @since 3.0.0 - * - * @param {string|object} data - [description] - * @param {boolean} [clearCurrentAnimations=false] - [description] - * - * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. + * + * @return {object} [description] */ - fromJSON: function (data, clearCurrentAnimations) + decomposeMatrix: function () { - if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } + var decomposedMatrix = this.decomposedMatrix; - if (clearCurrentAnimations) - { - this.anims.clear(); - } + var matrix = this.matrix; - // Do we have a String (i.e. from JSON, or an Object?) - if (typeof data === 'string') - { - data = JSON.parse(data); - } + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; - var output = []; + var a2 = a * a; + var b2 = b * b; + var c2 = c * c; + var d2 = d * d; - // Array of animations, or a single animation? - if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) - { - for (var i = 0; i < data.anims.length; i++) - { - output.push(this.create(data.anims[i])); - } + var sx = Math.sqrt(a2 + c2); + var sy = Math.sqrt(b2 + d2); - if (data.hasOwnProperty('globalTimeScale')) - { - this.globalTimeScale = data.globalTimeScale; - } - } - else if (data.hasOwnProperty('key') && data.type === 'frame') - { - output.push(this.create(data)); - } + decomposedMatrix.translateX = matrix[4]; + decomposedMatrix.translateY = matrix[5]; - return output; + decomposedMatrix.scaleX = sx; + decomposedMatrix.scaleY = sy; + + decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + + return decomposedMatrix; }, /** - * [description] + * Identity + Translate + Rotate + Scale * - * @method Phaser.Animations.AnimationManager#generateFrameNames + * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS * @since 3.0.0 - * - * @param {string} key - [description] - * @param {object} config - [description] - * @param {string} [config.prefix=''] - [description] - * @param {integer} [config.start=0] - [description] - * @param {integer} [config.end=0] - [description] - * @param {string} [config.suffix=''] - [description] - * @param {integer} [config.zeroPad=0] - [description] - * @param {array} [config.outputArray=[]] - [description] - * @param {boolean} [config.frames=false] - [description] - * - * @return {object[]} [description] + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} rotation - [description] + * @param {number} scaleX - [description] + * @param {number} scaleY - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - generateFrameNames: function (key, config) + applyITRS: function (x, y, rotation, scaleX, scaleY) { - var prefix = GetValue(config, 'prefix', ''); - var start = GetValue(config, 'start', 0); - var end = GetValue(config, 'end', 0); - var suffix = GetValue(config, 'suffix', ''); - var zeroPad = GetValue(config, 'zeroPad', 0); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); + var matrix = this.matrix; - var texture = this.textureManager.get(key); + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); - if (!texture) - { - return out; - } + // Translate + matrix[4] = x; + matrix[5] = y; - var diff = (start < end) ? 1 : -1; + // Rotate and Scale + matrix[0] = cr * scaleX; + matrix[1] = -sr * scaleX; + matrix[2] = sr * scaleY; + matrix[3] = cr * scaleY; - // Adjust because we use i !== end in the for loop - end += diff; + return this; + } - var i; - var frame; +}); - // Have they provided their own custom frame sequence array? - if (Array.isArray(frames)) - { - for (i = 0; i < frames.length; i++) - { - frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; +module.exports = TransformMatrix; - if (texture.has(frame)) - { - out.push({ key: key, frame: frame }); - } - } - } - else - { - for (i = start; i !== end; i += diff) - { - frame = prefix + Pad(i, zeroPad, '0', 1) + suffix; - if (texture.has(frame)) - { - out.push({ key: key, frame: frame }); - } - } - } +/***/ }), +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Perimeter = __webpack_require__(78); +var Point = __webpack_require__(5); + +// Return an array of points from the perimeter of the rectangle +// each spaced out based on the quantity or step required + +/** + * [description] + * + * @function Phaser.Geom.Rectangle.MarchingAnts + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {number} step - [description] + * @param {integer} quantity - [description] + * @param {array} [out] - [description] + * + * @return {Phaser.Geom.Point[]} [description] + */ +var MarchingAnts = function (rect, step, quantity, out) +{ + if (out === undefined) { out = []; } + if (!step && !quantity) + { + // Bail out return out; - }, + } - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#generateFrameNumbers - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {object} config - [description] - * @param {integer} [config.start=0] - [description] - * @param {integer} [config.end=-1] - [description] - * @param {boolean} [config.first=false] - [description] - * @param {array} [config.outputArray=[]] - [description] - * @param {boolean} [config.frames=false] - [description] - * - * @return {object[]} [description] - */ - generateFrameNumbers: function (key, config) + // If step is a falsey value (false, null, 0, undefined, etc) then we calculate + // it based on the quantity instead, otherwise we always use the step value + if (!step) { - var startFrame = GetValue(config, 'start', 0); - var endFrame = GetValue(config, 'end', -1); - var firstFrame = GetValue(config, 'first', false); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); + step = Perimeter(rect) / quantity; + } + else + { + quantity = Math.round(Perimeter(rect) / step); + } - var texture = this.textureManager.get(key); + var x = rect.x; + var y = rect.y; + var face = 0; - if (!texture) - { - return out; - } + // Loop across each face of the rectangle - if (firstFrame && texture.has(firstFrame)) + for (var i = 0; i < quantity; i++) + { + out.push(new Point(x, y)); + + switch (face) { - out.push({ key: key, frame: firstFrame }); - } - var i; + // Top face + case 0: + x += step; - // Have they provided their own custom frame sequence array? - if (Array.isArray(frames)) - { - for (i = 0; i < frames.length; i++) - { - if (texture.has(frames[i])) + if (x >= rect.right) { - out.push({ key: key, frame: frames[i] }); + face = 1; + y += (x - rect.right); + x = rect.right; } - } - } - else - { - // No endFrame then see if we can get it + break; - if (endFrame === -1) - { - endFrame = texture.frameTotal; - } + // Right face + case 1: + y += step; - for (i = startFrame; i <= endFrame; i++) - { - if (texture.has(i)) + if (y >= rect.bottom) { - out.push({ key: key, frame: i }); + face = 2; + x -= (y - rect.bottom); + y = rect.bottom; } - } - } + break; - return out; - }, + // Bottom face + case 2: + x -= step; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#get - * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {Phaser.Animations.Animation} [description] - */ - get: function (key) - { - return this.anims.get(key); - }, + if (x <= rect.left) + { + face = 3; + y -= (rect.left - x); + x = rect.left; + } + break; - /** - * Load an Animation into a Game Objects Animation Component. - * - * @method Phaser.Animations.AnimationManager#load - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {string} key - [description] - * @param {string|integer} [startFrame] - [description] - * - * @return {Phaser.GameObjects.GameObject} [description] - */ - load: function (child, key, startFrame) - { - var anim = this.get(key); + // Left face + case 3: + y -= step; - if (anim) - { - anim.load(child, startFrame); + if (y <= rect.top) + { + face = 0; + y = rect.top; + } + break; } + } - return child; - }, + return out; +}; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent - * @since 3.0.0 - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. - */ - pauseAll: function () - { - if (!this.paused) - { - this.paused = true; +module.exports = MarchingAnts; - this.emit('pauseall'); - } - return this; - }, +/***/ }), +/* 190 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#play - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.GameObjects.GameObject} child - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. - */ - play: function (key, child) - { - if (!Array.isArray(child)) - { - child = [ child ]; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var anim = this.get(key); +/** + * Moves the element at the start of the array to the end, shifting all items in the process. + * The "rotation" happens to the left. + * + * @function Phaser.Utils.Array.RotateLeft + * @since 3.0.0 + * + * @param {array} array - The array to shift to the left. This array is modified in place. + * @param {integer} [total=1] - The number of times to shift the array. + * + * @return {any} The most recently shifted element. + */ +var RotateLeft = function (array, total) +{ + if (total === undefined) { total = 1; } - if (!anim) - { - return; - } + var element = null; - for (var i = 0; i < child.length; i++) - { - child[i].anims.play(key); - } + for (var i = 0; i < total; i++) + { + element = array.shift(); + array.push(element); + } - return this; - }, + return element; +}; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent - * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {Phaser.Animations.Animation} [description] - */ - remove: function (key) - { - var anim = this.get(key); +module.exports = RotateLeft; - if (anim) - { - this.emit('remove', key, anim); - this.anims.delete(key); - } +/***/ }), +/* 191 */ +/***/ (function(module, exports) { - return anim; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent - * @since 3.0.0 - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. - */ - resumeAll: function () +/** + * Moves the element at the end of the array to the start, shifting all items in the process. + * The "rotation" happens to the right. + * + * @function Phaser.Utils.Array.RotateRight + * @since 3.0.0 + * + * @param {array} array - The array to shift to the right. This array is modified in place. + * @param {integer} [total=1] - The number of times to shift the array. + * + * @return {any} The most recently shifted element. + */ +var RotateRight = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) { - if (this.paused) - { - this.paused = false; + element = array.pop(); + array.unshift(element); + } - this.emit('resumeall'); - } + return element; +}; - return this; - }, +module.exports = RotateRight; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#staggerPlay - * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {number} [stagger=0] - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. - */ - staggerPlay: function (key, child, stagger) - { - if (stagger === undefined) { stagger = 0; } - if (!Array.isArray(child)) - { - child = [ child ]; - } +/***/ }), +/* 192 */ +/***/ (function(module, exports) { - var anim = this.get(key); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (!anim) - { - return; - } +/** + * Using Bresenham's line algorithm this will return an array of all coordinates on this line. + * The start and end points are rounded before this runs as the algorithm works on integers. + * + * @function Phaser.Geom.Line.BresenhamPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - [description] + * @param {integer} [stepRate=1] - [description] + * @param {array} [results] - [description] + * + * @return {array} [description] + */ +var BresenhamPoints = function (line, stepRate, results) +{ + if (stepRate === undefined) { stepRate = 1; } + if (results === undefined) { results = []; } - for (var i = 0; i < child.length; i++) - { - child[i].anims.delayedPlay(stagger * i, key); - } + var x1 = Math.round(line.x1); + var y1 = Math.round(line.y1); + var x2 = Math.round(line.x2); + var y2 = Math.round(line.y2); - return this; - }, + var dx = Math.abs(x2 - x1); + var dy = Math.abs(y2 - y1); + var sx = (x1 < x2) ? 1 : -1; + var sy = (y1 < y2) ? 1 : -1; + var err = dx - dy; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#toJSON - * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {object} [description] - */ - toJSON: function (key) + results.push({ x: x1, y: y1 }); + + var i = 1; + + while (!((x1 === x2) && (y1 === y2))) { - if (key !== undefined && key !== '') + var e2 = err << 1; + + if (e2 > -dy) { - return this.anims.get(key).toJSON(); + err -= dy; + x1 += sx; } - else - { - var output = { - anims: [], - globalTimeScale: this.globalTimeScale - }; - - this.anims.each(function (animationKey, animation) - { - output.anims.push(animation.toJSON()); - }); - return output; + if (e2 < dx) + { + err += dx; + y1 += sy; } - }, - - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.anims.clear(); - this.textureManager = null; + if (i % stepRate === 0) + { + results.push({ x: x1, y: y1 }); + } - this.game = null; + i++; } -}); + return results; +}; -module.exports = AnimationManager; +module.exports = BresenhamPoints; /***/ }), -/* 197 */ +/* 193 */ /***/ (function(module, exports) { /** @@ -35431,73 +36256,61 @@ module.exports = AnimationManager; */ /** - * Takes the given string and pads it out, to the length required, using the character - * specified. For example if you need a string to be 6 characters long, you can call: - * - * `pad('bob', 6, '-', 2)` - * - * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. - * - * You can also use it to pad numbers (they are always returned as strings): - * - * `pad(512, 6, '0', 1)` - * - * Would return: `000512` with the string padded to the left. - * - * If you don't specify a direction it'll pad to both sides: - * - * `pad('c64', 7, '*')` - * - * Would return: `**c64**` + * [description] * - * @function Phaser.Utils.String.Pad + * @function Phaser.Math.SmootherStep * @since 3.0.0 * - * @param {string} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. - * @param {integer} [len=0] - The number of characters to be added. - * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). - * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). - * - * @return {string} The padded string. + * @param {number} x - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * + * @return {number} [description] */ -var Pad = function (str, len, pad, dir) +var SmootherStep = function (x, min, max) { - if (len === undefined) { len = 0; } - if (pad === undefined) { pad = ' '; } - if (dir === undefined) { dir = 3; } + x = Math.max(0, Math.min(1, (x - min) / (max - min))); - str = str.toString(); + return x * x * x * (x * (x * 6 - 15) + 10); +}; - var padlen = 0; +module.exports = SmootherStep; - if (len + 1 >= str.length) - { - switch (dir) - { - case 1: - str = new Array(len + 1 - str.length).join(pad) + str; - break; - case 3: - var right = Math.ceil((padlen = len - str.length) / 2); - var left = padlen - right; - str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); - break; +/***/ }), +/* 194 */ +/***/ (function(module, exports) { - default: - str = str + new Array(len + 1 - str.length).join(pad); - break; - } - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return str; +/** + * [description] + * + * @function Phaser.Math.SmoothStep + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * + * @return {number} [description] + */ +var SmoothStep = function (x, min, max) +{ + x = Math.max(0, Math.min(1, (x - min) / (max - min))); + + return x * x * (3 - 2 * x); }; -module.exports = Pad; +module.exports = SmoothStep; /***/ }), -/* 198 */ +/* 195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35507,764 +36320,899 @@ module.exports = Pad; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(113); -var EventEmitter = __webpack_require__(14); +var Frame = __webpack_require__(196); +var GetValue = __webpack_require__(4); /** * @classdesc - * The BaseCache is a base Cache class that can be used for storing references to any kind of data. - * - * Data can be added, retrieved and removed based on the given keys. - * - * Keys are string-based. + * A Frame based Animation. + * + * This consists of a key, some default values (like the frame rate) and a bunch of Frame objects. + * + * The Animation Manager creates these. Game Objects don't own an instance of these directly. + * Game Objects have the Animation Component, which are like playheads to global Animations (these objects) + * So multiple Game Objects can have playheads all pointing to this one Animation instance. * - * @class BaseCache - * @memberOf Phaser.Cache + * @class Animation + * @memberOf Phaser.Animations * @constructor * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationManager} manager - [description] + * @param {string} key - [description] + * @param {object} config - [description] */ -var BaseCache = new Class({ +var Animation = new Class({ initialize: - function BaseCache () + function Animation (manager, key, config) { /** - * The Map in which the cache objects are stored. - * - * You can query the Map directly or use the BaseCache methods. + * [description] * - * @name Phaser.Cache.BaseCache#entries - * @type {Phaser.Structs.Map} + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} * @since 3.0.0 */ - this.entries = new CustomMap(); + this.manager = manager; /** - * An instance of EventEmitter used by the cache to emit related events. + * [description] * - * @name Phaser.Cache.BaseCache#events - * @type {EventEmitter} + * @name Phaser.Animations.Animation#key + * @type {string} * @since 3.0.0 */ - this.events = new EventEmitter(); - }, + this.key = key; - /** - * Cache add event. - * - * This event is fired by the Cache each time a new object is added to it. - * - * @event Phaser.Cache.BaseCache#addEvent - * @param {Phaser.Cache.BaseCache} The BaseCache to which the object was added. - * @param {string} The key of the object added to the cache. - * @param {any} A reference to the object added to the cache. - */ + /** + * A frame based animation (as opposed to a bone based animation) + * + * @name Phaser.Animations.Animation#type + * @type {string} + * @default frame + * @since 3.0.0 + */ + this.type = 'frame'; - /** - * Adds an item to this cache. The item is referenced by a unique string, which you are responsible - * for setting and keeping track of. The item can only be retrieved by using this string. - * - * @method Phaser.Cache.BaseCache#add - * @fires Phaser.Cache.BaseCache#addEvent - * @since 3.0.0 - * - * @param {string} key - The unique key by which the data added to the cache will be referenced. - * @param {any} data - The data to be stored in the cache. - * - * @return {Phaser.Cache.BaseCache} This BaseCache object. - */ - add: function (key, data) - { - this.entries.set(key, data); + /** + * Extract all the frame data into the frames array + * + * @name Phaser.Animations.Animation#frames + * @type {array} + * @since 3.0.0 + */ + this.frames = this.getFrames( + manager.textureManager, + GetValue(config, 'frames', []), + GetValue(config, 'defaultTextureKey', null) + ); - this.events.emit('add', this, key, data); + /** + * The frame rate of playback in frames per second (default 24 if duration is null) + * + * @name Phaser.Animations.Animation#frameRate + * @type {integer} + * @default 24 + * @since 3.0.0 + */ + this.frameRate = GetValue(config, 'frameRate', null); - return this; - }, + /** + * How long the animation should play for. + * If frameRate is set it overrides this value otherwise frameRate is derived from duration. + * + * @name Phaser.Animations.Animation#duration + * @type {integer} + * @since 3.0.0 + */ + this.duration = GetValue(config, 'duration', null); - /** - * Checks if this cache contains an item matching the given key. - * - * @method Phaser.Cache.BaseCache#has - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be checked in this cache. - * - * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. - */ - has: function (key) - { - return this.entries.has(key); - }, - - /** - * Gets an item from this cache based on the given key. - * - * @method Phaser.Cache.BaseCache#get - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be retrieved from this cache. - * - * @return {any} The item in the cache, or `null` if no item matching the given key was found. - */ - get: function (key) - { - return this.entries.get(key); - }, - - /** - * Cache remove event. - * - * This event is fired by the Cache each time an object is removed from it. - * - * @event Phaser.Cache.BaseCache#removeEvent - * @param {Phaser.Cache.BaseCache} The BaseCache from which the object was removed. - * @param {string} The key of the object removed from the cache. - * @param {any} The object that was removed from the cache. - */ - - /** - * Removes and item from this cache based on the given key. - * - * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. - * No additional checks are done on the item removed. If other systems or parts of your game code - * are relying on this item, it is up to you to sever those relationships prior to removing the item. - * - * @method Phaser.Cache.BaseCache#remove - * @fires Phaser.Cache.BaseCache#removeEvent - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to remove from the cache. - * - * @return {Phaser.Cache.BaseCache} This BaseCache object. - */ - remove: function (key) - { - var entry = this.get(key); - - if (entry) + if (this.duration === null && this.frameRate === null) { - this.entries.delete(key); - - this.events.emit('remove', this, key, entry.data); + // No duration or frameRate given, use default frameRate of 24fps + this.frameRate = 24; + this.duration = this.frameRate / this.frames.length; + } + else if (this.duration && this.frameRate === null) + { + // Duration given but no frameRate, so set the frameRate based on duration + // I.e. 12 frames in the animation, duration = 4 (4000 ms) + // So frameRate is 12 / 4 = 3 fps + this.frameRate = this.frames.length / this.duration; + } + else + { + // frameRate given, derive duration from it (even if duration also specified) + // I.e. 15 frames in the animation, frameRate = 30 fps + // So duration is 15 / 30 = 0.5 (half a second) + this.duration = this.frames.length / this.frameRate; } - return this; - }, - - /** - * Destroys this cache and all items within it. - * - * @method Phaser.Cache.BaseCache#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.entries.clear(); - this.events.removeAllListeners(); - - this.entries = null; - this.events = null; - } - -}); - -module.exports = BaseCache; - + /** + * ms per frame (without including frame specific modifiers) + * + * @name Phaser.Animations.Animation#msPerFrame + * @type {integer} + * @since 3.0.0 + */ + this.msPerFrame = 1000 / this.frameRate; -/***/ }), -/* 199 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Skip frames if the time lags, or always advanced anyway? + * + * @name Phaser.Animations.Animation#skipMissedFrames + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * Delay before starting playback (in seconds) + * + * @name Phaser.Animations.Animation#delay + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.delay = GetValue(config, 'delay', 0); -var BaseCache = __webpack_require__(198); -var Class = __webpack_require__(0); + /** + * Number of times to repeat the animation (-1 for infinity) + * + * @name Phaser.Animations.Animation#repeat + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeat = GetValue(config, 'repeat', 0); -/** - * @classdesc - * The Cache Manager is the global cache owned and maintained by the Game instance. - * - * Various systems, such as the file Loader, rely on this cache in order to store the files - * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache - * instances, one per type of file. You can also add your own custom caches. - * - * @class CacheManager - * @memberOf Phaser.Cache - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. - */ -var CacheManager = new Class({ + /** + * Delay before the repeat starts (in seconds) + * + * @name Phaser.Animations.Animation#repeatDelay + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.repeatDelay = GetValue(config, 'repeatDelay', 0); - initialize: + /** + * Should the animation yoyo? (reverse back down to the start) before repeating? + * + * @name Phaser.Animations.Animation#yoyo + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.yoyo = GetValue(config, 'yoyo', false); - function CacheManager (game) - { /** - * A reference to the Phaser.Game instance that owns this CacheManager. + * Should sprite.visible = true when the animation starts to play? * - * @name Phaser.Cache.CacheManager#game - * @type {Phaser.Game} - * @protected + * @name Phaser.Animations.Animation#showOnStart + * @type {boolean} + * @default false * @since 3.0.0 */ - this.game = game; + this.showOnStart = GetValue(config, 'showOnStart', false); /** - * A Cache storing all binary files, typically added via the Loader. + * Should sprite.visible = false when the animation finishes? * - * @name Phaser.Cache.CacheManager#binary - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false * @since 3.0.0 */ - this.binary = new BaseCache(); + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); /** - * A Cache storing all bitmap font data files, typically added via the Loader. - * Only the font data is stored in this cache, the textures are part of the Texture Manager. + * [description] * - * @name Phaser.Cache.CacheManager#bitmapFont - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#callbackScope + * @type {object} * @since 3.0.0 */ - this.bitmapFont = new BaseCache(); + this.callbackScope = GetValue(config, 'callbackScope', this); /** - * A Cache storing all JSON data files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#json - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onStart + * @type {function} * @since 3.0.0 */ - this.json = new BaseCache(); + this.onStart = GetValue(config, 'onStart', false); /** - * A Cache storing all physics data files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#physics - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onStartParams + * @type {array} * @since 3.0.0 */ - this.physics = new BaseCache(); + this.onStartParams = GetValue(config, 'onStartParams', []); /** - * A Cache storing all shader source files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#shader - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onRepeat + * @type {function} * @since 3.0.0 */ - this.shader = new BaseCache(); + this.onRepeat = GetValue(config, 'onRepeat', false); /** - * A Cache storing all non-streaming audio files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#audio - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onRepeatParams + * @type {array} * @since 3.0.0 */ - this.audio = new BaseCache(); + this.onRepeatParams = GetValue(config, 'onRepeatParams', []); /** - * A Cache storing all text files, typically added via the Loader. + * Called for EVERY frame of the animation. + * See AnimationFrame.onUpdate for a frame specific callback. * - * @name Phaser.Cache.CacheManager#text - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onUpdate + * @type {function} * @since 3.0.0 */ - this.text = new BaseCache(); + this.onUpdate = GetValue(config, 'onUpdate', false); /** - * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#obj - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onUpdateParams + * @type {array} * @since 3.0.0 */ - this.obj = new BaseCache(); + this.onUpdateParams = GetValue(config, 'onUpdateParams', []); /** - * A Cache storing all tilemap data files, typically added via the Loader. - * Only the data is stored in this cache, the textures are part of the Texture Manager. + * [description] * - * @name Phaser.Cache.CacheManager#tilemap - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onComplete + * @type {function} * @since 3.0.0 */ - this.tilemap = new BaseCache(); + this.onComplete = GetValue(config, 'onComplete', false); /** - * A Cache storing all xml data files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#xml - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#onCompleteParams + * @type {array} * @since 3.0.0 */ - this.xml = new BaseCache(); + this.onCompleteParams = GetValue(config, 'onCompleteParams', []); /** - * An object that contains your own custom BaseCache entries. - * Add to this via the `addCustom` method. + * Global pause, effects all Game Objects using this Animation instance * - * @name Phaser.Cache.CacheManager#custom - * @type {object.} - * @protected + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false * @since 3.0.0 */ - this.custom = {}; + this.paused = false; - this.game.events.once('destroy', this.destroy, this); + this.manager.on('pauseall', this.pause.bind(this)); + this.manager.on('resumeall', this.resume.bind(this)); }, + // config = Array of Animation config objects, like: + // [ + // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } + // ] + + // Add frames to the end of the animation + /** - * Add your own custom Cache for storing your own files. - * The cache will be available under `Cache.custom.key`. - * The cache will only be created if the key is not already in use. + * [description] * - * @method Phaser.Cache.CacheManager#addCustom + * @method Phaser.Animations.Animation#addFrame * @since 3.0.0 * - * @param {string} key - The unique key of your custom cache. + * @param {[type]} config - [description] * - * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. + * @return {Phaser.Animations.Animation} This Animation object. */ - addCustom: function (key) + addFrame: function (config) { - if (!this.custom.hasOwnProperty(key)) + return this.addFrameAt(this.frames.length, config); + }, + + // config = Array of Animation config objects, like: + // [ + // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } + // ] + + // Add frame/s into the animation + + /** + * [description] + * + * @method Phaser.Animations.Animation#addFrameAt + * @since 3.0.0 + * + * @param {integer} index - [description] + * @param {[type]} config - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + addFrameAt: function (index, config) + { + var newFrames = this.getFrames(this.manager.textureManager, config); + + if (newFrames.length > 0) { - this.custom[key] = new BaseCache(); + if (index === 0) + { + this.frames = newFrames.concat(this.frames); + } + else if (index === this.frames.length) + { + this.frames = this.frames.concat(newFrames); + } + else + { + var pre = this.frames.slice(0, index); + var post = this.frames.slice(index); + + this.frames = pre.concat(newFrames, post); + } + + this.updateFrameSequence(); } - return this.custom[key]; + return this; }, /** - * Removes all entries from all BaseCaches and destroys all custom caches. + * [description] * - * @method Phaser.Cache.CacheManager#destroy + * @method Phaser.Animations.Animation#checkFrame * @since 3.0.0 + * + * @param {integer} index - [description] + * + * @return {boolean} [description] */ - destroy: function () + checkFrame: function (index) { - var keys = [ - 'binary', - 'bitmapFont', - 'json', - 'physics', - 'shader', - 'audio', - 'text', - 'obj', - 'tilemap', - 'xml' - ]; + return (index < this.frames.length); + }, - for (var i = 0; i < keys.length; i++) + /** + * [description] + * + * @method Phaser.Animations.Animation#completeAnimation + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + completeAnimation: function (component) + { + if (this.hideOnComplete) { - this[keys[i]].destroy(); - this[keys[i]] = null; + component.parent.visible = false; } - for (var key in this.custom) + component.stop(true); + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#getFirstTick + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + * @param {boolean} [includeDelay=true] - [description] + */ + getFirstTick: function (component, includeDelay) + { + if (includeDelay === undefined) { includeDelay = true; } + + // When is the first update due? + component.accumulator = 0; + component.nextTick = component.msPerFrame + component.currentFrame.duration; + + if (includeDelay) { - this.custom[key].destroy(); + component.nextTick += (component._delay * 1000); } + }, - this.custom = null; + /** + * [description] + * + * @method Phaser.Animations.Animation#getFrameAt + * @since 3.0.0 + * + * @param {integer} index - [description] + * + * @return {Phaser.Animations.AnimationFrame} [description] + */ + getFrameAt: function (index) + { + return this.frames[index]; + }, - this.game = null; - } + /** + * [description] + * + * @method Phaser.Animations.Animation#getFrames + * @since 3.0.0 + * + * @param {[type]} textureManager - [description] + * @param {[type]} frames - [description] + * + * @return {Phaser.Animations.AnimationFrame[]} [description] + */ + getFrames: function (textureManager, frames, defaultTextureKey) + { + // frames: [ + // { key: textureKey, frame: textureFrame }, + // { key: textureKey, frame: textureFrame, duration: float }, + // { key: textureKey, frame: textureFrame, onUpdate: function } + // { key: textureKey, frame: textureFrame, visible: boolean } + // ], -}); + var out = []; + var prev; + var animationFrame; + var index = 1; + var i; + var textureKey; -module.exports = CacheManager; + // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet + if (typeof frames === 'string') + { + textureKey = frames; + var texture = textureManager.get(textureKey); + var frameKeys = texture.getFrameNames(); -/***/ }), -/* 200 */ -/***/ (function(module, exports, __webpack_require__) { + frames = []; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + frameKeys.forEach(function (idx, value) + { + frames.push({ key: textureKey, frame: value }); + }); + } -var Color = __webpack_require__(36); + if (!Array.isArray(frames) || frames.length === 0) + { + return out; + } -/** - * Converts a hex string into a Phaser Color object. - * - * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. - * - * An alpha channel is _not_ supported. - * - * @function Phaser.Display.Color.HexStringToColor - * @since 3.0.0 - * - * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. - * - * @return {Phaser.Display.Color} A Color object populated by the values of the given string. - */ -var HexStringToColor = function (hex) -{ - var color = new Color(); - - // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) - { - return r + r + g + g + b + b; - }); - - var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); + for (i = 0; i < frames.length; i++) + { + var item = frames[i]; - if (result) - { - var r = parseInt(result[1], 16); - var g = parseInt(result[2], 16); - var b = parseInt(result[3], 16); + var key = GetValue(item, 'key', defaultTextureKey); - color.setTo(r, g, b); - } + if (!key) + { + continue; + } - return color; -}; + // Could be an integer or a string + var frame = GetValue(item, 'frame', 0); -module.exports = HexStringToColor; + // The actual texture frame + var textureFrame = textureManager.getFrame(key, frame); + animationFrame = new Frame(key, frame, index, textureFrame); -/***/ }), -/* 201 */ -/***/ (function(module, exports) { + animationFrame.duration = GetValue(item, 'duration', 0); + animationFrame.onUpdate = GetValue(item, 'onUpdate', null); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + animationFrame.isFirst = (!prev); -/** - * Given an alpha and 3 color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor32 - * @since 3.0.0 - * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} alpha - The alpha color value. A number between 0 and 255. - * - * @return {number} The combined color value. - */ -var GetColor32 = function (red, green, blue, alpha) -{ - return alpha << 24 | red << 16 | green << 8 | blue; -}; + // The previously created animationFrame + if (prev) + { + prev.nextFrame = animationFrame; -module.exports = GetColor32; + animationFrame.prevFrame = prev; + } + out.push(animationFrame); -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { + prev = animationFrame; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + index++; + } -var Color = __webpack_require__(36); -var IntegerToRGB = __webpack_require__(203); + if (out.length > 0) + { + animationFrame.isLast = true; -/** - * Converts the given color value into an instance of a Color object. - * - * @function Phaser.Display.Color.IntegerToColor - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {Phaser.Display.Color} A Color object. - */ -var IntegerToColor = function (input) -{ - var rgb = IntegerToRGB(input); + // Link them end-to-end, so they loop + animationFrame.nextFrame = out[0]; - return new Color(rgb.r, rgb.g, rgb.b, rgb.a); -}; + out[0].prevFrame = animationFrame; -module.exports = IntegerToColor; + // Generate the progress data + var slice = 1 / (out.length - 1); -/***/ }), -/* 203 */ -/***/ (function(module, exports) { + for (i = 0; i < out.length; i++) + { + out[i].progress = i * slice; + } + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return out; + }, -/** - * Return the component parts of a color as an Object with the properties alpha, red, green, blue. - * - * Alpha will only be set if it exists in the given color (0xAARRGGBB) - * - * @function Phaser.Display.Color.IntegerToRGB - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var IntegerToRGB = function (color) -{ - if (color > 16777215) - { - // The color value has an alpha component - return { - a: color >>> 24, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } - else + /** + * [description] + * + * @method Phaser.Animations.Animation#getNextTick + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + getNextTick: function (component) { - return { - a: 255, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } -}; + // accumulator += delta * _timeScale + // after a large delta surge (perf issue for example) we need to adjust for it here -module.exports = IntegerToRGB; + // When is the next update due? + component.accumulator -= component.nextTick; + component.nextTick = component.msPerFrame + component.currentFrame.duration; + }, -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Animations.Animation#load + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + * @param {integer} startFrame - [description] + */ + load: function (component, startFrame) + { + if (startFrame >= this.frames.length) + { + startFrame = 0; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (component.currentAnim !== this) + { + component.currentAnim = this; -var Color = __webpack_require__(36); + component._timeScale = 1; + component.frameRate = this.frameRate; + component.duration = this.duration; + component.msPerFrame = this.msPerFrame; + component.skipMissedFrames = this.skipMissedFrames; + component._delay = this.delay; + component._repeat = this.repeat; + component._repeatDelay = this.repeatDelay; + component._yoyo = this.yoyo; + component._callbackArgs[1] = this; + component._updateParams = component._callbackArgs.concat(this.onUpdateParams); + } -/** - * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. - * - * @function Phaser.Display.Color.ObjectToColor - * @since 3.0.0 - * - * @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. - * - * @return {Phaser.Display.Color} A Color object. - */ -var ObjectToColor = function (input) -{ - return new Color(input.r, input.g, input.b, input.a); -}; + component.updateFrame(this.frames[startFrame]); + }, -module.exports = ObjectToColor; + /** + * [description] + * + * @method Phaser.Animations.Animation#nextFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + nextFrame: function (component) + { + var frame = component.currentFrame; + // TODO: Add frame skip support -/***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { + if (frame.isLast) + { + // We're at the end of the animation -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Yoyo? (happens before repeat) + if (this.yoyo) + { + component.forward = false; -var Color = __webpack_require__(36); + component.updateFrame(frame.prevFrame); -/** - * Converts a CSS 'web' string into a Phaser Color object. - * - * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. - * - * @function Phaser.Display.Color.RGBStringToColor - * @since 3.0.0 - * - * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. - * - * @return {Phaser.Display.Color} A Color object. - */ -var RGBStringToColor = function (rgb) -{ - var color = new Color(); + // Delay for the current frame + this.getNextTick(component); + } + else if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + this.repeatAnimation(component); + } + else + { + this.completeAnimation(component); + } + } + else + { + component.updateFrame(frame.nextFrame); - var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); + this.getNextTick(component); + } + }, - if (result) + /** + * [description] + * + * @method Phaser.Animations.Animation#previousFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + previousFrame: function (component) { - var r = parseInt(result[1], 10); - var g = parseInt(result[2], 10); - var b = parseInt(result[3], 10); - var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; + var frame = component.currentFrame; - color.setTo(r, g, b, a * 255); - } + // TODO: Add frame skip support - return color; -}; + if (frame.isFirst) + { + // We're at the start of the animation -module.exports = RGBStringToColor; + if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + this.repeatAnimation(component); + } + else + { + this.completeAnimation(component); + } + } + else + { + component.updateFrame(frame.prevFrame); + this.getNextTick(component); + } + }, -/***/ }), -/* 206 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Animations.Animation#removeFrame + * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + removeFrame: function (frame) + { + var index = this.frames.indexOf(frame); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (index !== -1) + { + this.removeFrameAt(index); + } -// Position Vector randomly in a spherical area defined by the given radius -/** - * [description] - * - * @function Phaser.Math.RandomXYZ - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec3 - [description] - * @param {number} [radius=1] - [description] - * - * @return {Phaser.Math.Vector3} [description] - */ -var RandomXYZ = function (vec3, radius) -{ - if (radius === undefined) { radius = 1; } + return this; + }, - var r = Math.random() * 2 * Math.PI; - var z = (Math.random() * 2) - 1; - var zScale = Math.sqrt(1 - z * z) * radius; - - vec3.x = Math.cos(r) * zScale; - vec3.y = Math.sin(r) * zScale; - vec3.z = z * radius; + /** + * [description] + * + * @method Phaser.Animations.Animation#removeFrameAt + * @since 3.0.0 + * + * @param {integer} index - [description] + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + removeFrameAt: function (index) + { + this.frames.splice(index, 1); - return vec3; -}; + this.updateFrameSequence(); -module.exports = RandomXYZ; + return this; + }, + /** + * [description] + * + * @method Phaser.Animations.Animation#repeatAnimation + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + repeatAnimation: function (component) + { + if (component._repeatDelay > 0 && component.pendingRepeat === false) + { + component.pendingRepeat = true; + component.accumulator -= component.nextTick; + component.nextTick += (component._repeatDelay * 1000); + } + else + { + component.repeatCounter--; -/***/ }), -/* 207 */ -/***/ (function(module, exports) { + component.forward = true; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + component.updateFrame(component.currentFrame.nextFrame); -/** - * [description] - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - [description] - * @param {float} [scale=1] - [description] - * - * @return {Phaser.Math.Vector4} [description] - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } + this.getNextTick(component); - // Not spherical; should fix this for more uniform distribution - vec4.x = (Math.random() * 2 - 1) * scale; - vec4.y = (Math.random() * 2 - 1) * scale; - vec4.z = (Math.random() * 2 - 1) * scale; - vec4.w = (Math.random() * 2 - 1) * scale; + component.pendingRepeat = false; - return vec4; -}; + if (this.onRepeat) + { + this.onRepeat.apply(this.callbackScope, component._callbackArgs.concat(this.onRepeatParams)); + } + } + }, -module.exports = RandomXYZW; + /** + * [description] + * + * @method Phaser.Animations.Animation#setFrame + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.Animation} component - [description] + */ + setFrame: function (component) + { + // Work out which frame should be set next on the child, and set it + if (component.forward) + { + this.nextFrame(component); + } + else + { + this.previousFrame(component); + } + }, + /** + * [description] + * + * @method Phaser.Animations.Animation#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () + { + var output = { + key: this.key, + type: this.type, + frames: [], + frameRate: this.frameRate, + duration: this.duration, + skipMissedFrames: this.skipMissedFrames, + delay: this.delay, + repeat: this.repeat, + repeatDelay: this.repeatDelay, + yoyo: this.yoyo, + showOnStart: this.showOnStart, + hideOnComplete: this.hideOnComplete + }; -/***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { + this.frames.forEach(function (frame) + { + output.frames.push(frame.toJSON()); + }); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return output; + }, -var Vector3 = __webpack_require__(51); -var Matrix4 = __webpack_require__(118); -var Quaternion = __webpack_require__(209); + /** + * [description] + * + * @method Phaser.Animations.Animation#updateFrameSequence + * @since 3.0.0 + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + updateFrameSequence: function () + { + var len = this.frames.length; + var slice = 1 / (len - 1); -var tmpMat4 = new Matrix4(); -var tmpQuat = new Quaternion(); -var tmpVec3 = new Vector3(); + for (var i = 0; i < len; i++) + { + var frame = this.frames[i]; -/** - * Rotates a vector in place by axis angle. - * - * This is the same as transforming a point by an - * axis-angle quaternion, but it has higher precision. - * - * @function Phaser.Math.RotateVec3 - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec - [description] - * @param {Phaser.Math.Vector3} axis - [description] - * @param {float} radians - [description] - * - * @return {Phaser.Math.Vector3} [description] - */ -var RotateVec3 = function (vec, axis, radians) -{ - // Set the quaternion to our axis angle - tmpQuat.setAxisAngle(axis, radians); + frame.index = i + 1; + frame.isFirst = false; + frame.isLast = false; + frame.progress = i * slice; - // Create a rotation matrix from the axis angle - tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); + if (i === 0) + { + frame.isFirst = true; + frame.isLast = (len === 1); + frame.prevFrame = this.frames[len - 1]; + frame.nextFrame = this.frames[i + 1]; + } + else if (i === len - 1) + { + frame.isLast = true; + frame.prevFrame = this.frames[len - 2]; + frame.nextFrame = this.frames[0]; + } + else if (len > 1) + { + frame.prevFrame = this.frames[i - 1]; + frame.nextFrame = this.frames[i + 1]; + } + } - // Multiply our vector by the rotation matrix - return vec.transformMat4(tmpMat4); -}; + return this; + }, -module.exports = RotateVec3; + /** + * [description] + * + * @method Phaser.Animations.Animation#pause + * @since 3.0.0 + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + pause: function () + { + this.paused = true; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#resume + * @since 3.0.0 + * + * @return {Phaser.Animations.Animation} This Animation object. + */ + resume: function () + { + this.paused = false; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Animations.Animation#destroy + * @since 3.0.0 + */ + destroy: function () + { + // TODO + } + +}); + +module.exports = Animation; /***/ }), -/* 209 */ +/* 196 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -36273,186 +37221,327 @@ module.exports = RotateVec3; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(51); -var Matrix3 = __webpack_require__(210); - -var EPSILON = 0.000001; - -// Some shared 'private' arrays -var siNext = new Int8Array([ 1, 2, 0 ]); -var tmp = new Float32Array([ 0, 0, 0 ]); - -var xUnitVec3 = new Vector3(1, 0, 0); -var yUnitVec3 = new Vector3(0, 1, 0); - -var tmpvec = new Vector3(); -var tmpMat3 = new Matrix3(); /** * @classdesc - * [description] + * A single frame in an Animation sequence. * - * @class Quaternion - * @memberOf Phaser.Math + * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other + * frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback + * and modify the animation timing. + * + * AnimationFrames are generated automatically by the Animation class. + * + * @class AnimationFrame + * @memberOf Phaser.Animations * @constructor * @since 3.0.0 * - * @param {number} [x] - [description] - * @param {number} [y] - [description] - * @param {number} [z] - [description] - * @param {number} [w] - [description] + * @param {string} textureKey - The key of the Texture this AnimationFrame uses. + * @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. + * @param {integer} index - The index of this AnimationFrame within the Animation sequence. + * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. */ -var Quaternion = new Class({ +var AnimationFrame = new Class({ initialize: - function Quaternion (x, y, z, w) + function AnimationFrame (textureKey, textureFrame, index, frame) { /** - * The x component of this Quaternion. + * The key of the Texture this AnimationFrame uses. * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 + * @name Phaser.Animations.AnimationFrame#textureKey + * @type {string} * @since 3.0.0 */ + this.textureKey = textureKey; /** - * The y component of this Quaternion. + * The key of the Frame within the Texture that this AnimationFrame uses. * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 + * @name Phaser.Animations.AnimationFrame#textureFrame + * @type {string|integer} * @since 3.0.0 */ + this.textureFrame = textureFrame; /** - * The z component of this Quaternion. + * The index of this AnimationFrame within the Animation sequence. * - * @name Phaser.Math.Quaternion#z + * @name Phaser.Animations.AnimationFrame#index + * @type {integer} + * @since 3.0.0 + */ + this.index = index; + + /** + * A reference to the Texture Frame this AnimationFrame uses for rendering. + * + * @name Phaser.Animations.AnimationFrame#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + this.frame = frame; + + /** + * Is this the first frame in an animation sequence? + * + * @name Phaser.Animations.AnimationFrame#isFirst + * @type {boolean} + * @default false + * @readOnly + * @since 3.0.0 + */ + this.isFirst = false; + + /** + * Is this the last frame in an animation sequence? + * + * @name Phaser.Animations.AnimationFrame#isLast + * @type {boolean} + * @default false + * @readOnly + * @since 3.0.0 + */ + this.isLast = false; + + /** + * A reference to the AnimationFrame that comes before this one in the animation, if any. + * + * @name Phaser.Animations.AnimationFrame#prevFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readOnly + * @since 3.0.0 + */ + this.prevFrame = null; + + /** + * A reference to the AnimationFrame that comes after this one in the animation, if any. + * + * @name Phaser.Animations.AnimationFrame#nextFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readOnly + * @since 3.0.0 + */ + this.nextFrame = null; + + /** + * Additional time (in ms) that this frame should appear for during playback. + * The value is added onto the msPerFrame set by the animation. + * + * @name Phaser.Animations.AnimationFrame#duration * @type {number} * @default 0 * @since 3.0.0 */ + this.duration = 0; /** - * The w component of this Quaternion. + * What % through the animation does this frame come? + * This value is generated when the animation is created and cached here. * - * @name Phaser.Math.Quaternion#w + * @name Phaser.Animations.AnimationFrame#progress * @type {number} * @default 0 + * @readOnly * @since 3.0.0 */ + this.progress = 0; - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + /** + * A frame specific callback, invoked if this frame gets displayed and the callback is set. + * + * @name Phaser.Animations.AnimationFrame#onUpdate + * @type {?function} + * @default null + * @since 3.0.0 + */ + this.onUpdate = null; }, /** - * [description] + * Generates a JavaScript object suitable for converting to JSON. * - * @method Phaser.Math.Quaternion#copy + * @method Phaser.Animations.AnimationFrame#toJSON * @since 3.0.0 - * - * @param {[type]} src - [description] - * - * @return {[type]} [description] + * + * @return {object} The AnimationFrame data. */ - copy: function (src) + toJSON: function () { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; + return { + key: this.textureKey, + frame: this.textureFrame, + duration: this.duration + }; }, /** - * [description] + * Destroys this object by removing references to external resources and callbacks. * - * @method Phaser.Math.Quaternion#set + * @method Phaser.Animations.AnimationFrame#destroy * @since 3.0.0 - * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] - * @param {[type]} w - [description] - * - * @return {[type]} [description] */ - set: function (x, y, z, w) + destroy: function () { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + this.frame = undefined; + this.onUpdate = undefined; + } - return this; +}); + +module.exports = AnimationFrame; + + +/***/ }), +/* 197 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Animation = __webpack_require__(195); +var Class = __webpack_require__(0); +var CustomMap = __webpack_require__(114); +var EventEmitter = __webpack_require__(14); +var GetValue = __webpack_require__(4); +var Pad = __webpack_require__(198); + +/** + * @classdesc + * The Animation Manager. + * + * Animations are managed by the global Animation Manager. This is a singleton class that is + * responsible for creating and delivering animations and their corresponding data to all Game Objects. + * Unlike plugins it is owned by the Game instance, not the Scene. + * + * Sprites and other Game Objects get the data they need from the AnimationManager. + * + * @class AnimationManager + * @extends EventEmitter + * @memberOf Phaser.Animations + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - [description] + */ +var AnimationManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function AnimationManager (game) + { + EventEmitter.call(this); + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#game + * @type {Phaser.Game} + * @protected + * @since 3.0.0 + */ + this.game = game; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#textureManager + * @type {Phaser.Textures.TextureManager} + * @protected + * @since 3.0.0 + */ + this.textureManager = null; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#globalTimeScale + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.globalTimeScale = 1; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#anims + * @type {Phaser.Structs.Map} + * @protected + * @since 3.0.0 + */ + this.anims = new CustomMap(); + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#name + * @type {string} + * @since 3.0.0 + */ + this.name = 'AnimationManager'; + + game.events.once('boot', this.boot, this); }, /** * [description] * - * @method Phaser.Math.Quaternion#add + * @method Phaser.Animations.AnimationManager#boot * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] */ - add: function (v) + boot: function () { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; + this.textureManager = this.game.textures; - return this; + this.game.events.once('destroy', this.destroy, this); }, /** * [description] * - * @method Phaser.Math.Quaternion#subtract + * @method Phaser.Animations.AnimationManager#add + * @fires AddAnimationEvent * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.Animations.Animation} animation - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - subtract: function (v) + add: function (key, animation) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; + if (this.anims.has(key)) + { + console.warn('Animation with key', key, 'already exists'); + return; + } + + animation.key = key; + + this.anims.set(key, animation); + + this.emit('add', key, animation); return this; }, @@ -36460,280 +37549,280 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#scale + * @method Phaser.Animations.AnimationManager#create + * @fires AddAnimationEvent * @since 3.0.0 - * - * @param {[type]} scale - [description] - * - * @return {[type]} [description] + * + * @param {object} config - [description] + * + * @return {Phaser.Animations.Animation} The Animation that was created. */ - scale: function (scale) + create: function (config) { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + var key = config.key; - return this; + if (!key || this.anims.has(key)) + { + console.warn('Invalid Animation Key, or Key already in use: ' + key); + return; + } + + var anim = new Animation(this, key, config); + + this.anims.set(key, anim); + + this.emit('add', key, anim); + + return anim; }, /** * [description] * - * @method Phaser.Math.Quaternion#length + * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string|object} data - [description] + * @param {boolean} [clearCurrentAnimations=false] - [description] + * + * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. */ - length: function () + fromJSON: function (data, clearCurrentAnimations) { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return Math.sqrt(x * x + y * y + z * z + w * w); - }, + if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } - /** - * [description] - * - * @method Phaser.Math.Quaternion#lengthSq - * @since 3.0.0 - * - * @return {[type]} [description] - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + if (clearCurrentAnimations) + { + this.anims.clear(); + } - return x * x + y * y + z * z + w * w; - }, + // Do we have a String (i.e. from JSON, or an Object?) + if (typeof data === 'string') + { + data = JSON.parse(data); + } - /** - * [description] - * - * @method Phaser.Math.Quaternion#normalize - * @since 3.0.0 - * - * @return {[type]} [description] - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var len = x * x + y * y + z * z + w * w; + var output = []; - if (len > 0) + // Array of animations, or a single animation? + if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) { - len = 1 / Math.sqrt(len); + for (var i = 0; i < data.anims.length; i++) + { + output.push(this.create(data.anims[i])); + } - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; + if (data.hasOwnProperty('globalTimeScale')) + { + this.globalTimeScale = data.globalTimeScale; + } + } + else if (data.hasOwnProperty('key') && data.type === 'frame') + { + output.push(this.create(data)); } - return this; + return output; }, /** * [description] * - * @method Phaser.Math.Quaternion#dot + * @method Phaser.Animations.AnimationManager#generateFrameNames * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {object} config - [description] + * @param {string} [config.prefix=''] - [description] + * @param {integer} [config.start=0] - [description] + * @param {integer} [config.end=0] - [description] + * @param {string} [config.suffix=''] - [description] + * @param {integer} [config.zeroPad=0] - [description] + * @param {array} [config.outputArray=[]] - [description] + * @param {boolean} [config.frames=false] - [description] + * + * @return {object[]} [description] */ - dot: function (v) + generateFrameNames: function (key, config) { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, + var prefix = GetValue(config, 'prefix', ''); + var start = GetValue(config, 'start', 0); + var end = GetValue(config, 'end', 0); + var suffix = GetValue(config, 'suffix', ''); + var zeroPad = GetValue(config, 'zeroPad', 0); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - /** - * [description] - * - * @method Phaser.Math.Quaternion#lerp - * @since 3.0.0 - * - * @param {[type]} v - [description] - * @param {[type]} t - [description] - * - * @return {[type]} [description] - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } + var texture = this.textureManager.get(key); - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + if (!texture) + { + return out; + } - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); + var diff = (start < end) ? 1 : -1; - return this; - }, + // Adjust because we use i !== end in the for loop + end += diff; - /** - * [description] - * - * @method Phaser.Math.Quaternion#rotationTo - * @since 3.0.0 - * - * @param {[type]} a - [description] - * @param {[type]} b - [description] - * - * @return {[type]} [description] - */ - rotationTo: function (a, b) - { - var dot = a.x * b.x + a.y * b.y + a.z * b.z; + var i; + var frame; - if (dot < -0.999999) + // Have they provided their own custom frame sequence array? + if (Array.isArray(frames)) { - if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) + for (i = 0; i < frames.length; i++) { - tmpvec.copy(yUnitVec3).cross(a); - } - - tmpvec.normalize(); - - return this.setAxisAngle(tmpvec, Math.PI); - - } - else if (dot > 0.999999) - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; + frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; - return this; + if (texture.has(frame)) + { + out.push({ key: key, frame: frame }); + } + } } else { - tmpvec.copy(a).cross(b); - - this.x = tmpvec.x; - this.y = tmpvec.y; - this.z = tmpvec.z; - this.w = 1 + dot; + for (i = start; i !== end; i += diff) + { + frame = prefix + Pad(i, zeroPad, '0', 1) + suffix; - return this.normalize(); + if (texture.has(frame)) + { + out.push({ key: key, frame: frame }); + } + } } + + return out; }, /** * [description] * - * @method Phaser.Math.Quaternion#setAxes + * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 - * - * @param {[type]} view - [description] - * @param {[type]} right - [description] - * @param {[type]} up - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {object} config - [description] + * @param {integer} [config.start=0] - [description] + * @param {integer} [config.end=-1] - [description] + * @param {boolean} [config.first=false] - [description] + * @param {array} [config.outputArray=[]] - [description] + * @param {boolean} [config.frames=false] - [description] + * + * @return {object[]} [description] */ - setAxes: function (view, right, up) + generateFrameNumbers: function (key, config) { - var m = tmpMat3.val; + var startFrame = GetValue(config, 'start', 0); + var endFrame = GetValue(config, 'end', -1); + var firstFrame = GetValue(config, 'first', false); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - m[0] = right.x; - m[3] = right.y; - m[6] = right.z; + var texture = this.textureManager.get(key); - m[1] = up.x; - m[4] = up.y; - m[7] = up.z; + if (!texture) + { + return out; + } - m[2] = -view.x; - m[5] = -view.y; - m[8] = -view.z; + if (firstFrame && texture.has(firstFrame)) + { + out.push({ key: key, frame: firstFrame }); + } - return this.fromMat3(tmpMat3).normalize(); + var i; + + // Have they provided their own custom frame sequence array? + if (Array.isArray(frames)) + { + for (i = 0; i < frames.length; i++) + { + if (texture.has(frames[i])) + { + out.push({ key: key, frame: frames[i] }); + } + } + } + else + { + // No endFrame then see if we can get it + + if (endFrame === -1) + { + endFrame = texture.frameTotal; + } + + for (i = startFrame; i <= endFrame; i++) + { + if (texture.has(i)) + { + out.push({ key: key, frame: i }); + } + } + } + + return out; }, /** * [description] * - * @method Phaser.Math.Quaternion#identity + * @method Phaser.Animations.AnimationManager#get * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {Phaser.Animations.Animation} [description] */ - identity: function () + get: function (key) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; + return this.anims.get(key); }, /** - * [description] + * Load an Animation into a Game Objects Animation Component. * - * @method Phaser.Math.Quaternion#setAxisAngle + * @method Phaser.Animations.AnimationManager#load * @since 3.0.0 - * - * @param {[type]} axis - [description] - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {string} key - [description] + * @param {string|integer} [startFrame] - [description] + * + * @return {Phaser.GameObjects.GameObject} [description] */ - setAxisAngle: function (axis, rad) + load: function (child, key, startFrame) { - rad = rad * 0.5; - - var s = Math.sin(rad); + var anim = this.get(key); - this.x = s * axis.x; - this.y = s * axis.y; - this.z = s * axis.z; - this.w = Math.cos(rad); + if (anim) + { + anim.load(child, startFrame); + } - return this; + return child; }, /** * [description] * - * @method Phaser.Math.Quaternion#multiply + * @method Phaser.Animations.AnimationManager#pauseAll + * @fires PauseAllAnimationEvent * @since 3.0.0 - * - * @param {[type]} b - [description] - * - * @return {[type]} [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - multiply: function (b) + pauseAll: function () { - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; + if (!this.paused) + { + this.paused = true; - this.x = ax * bw + aw * bx + ay * bz - az * by; - this.y = ay * bw + aw * by + az * bx - ax * bz; - this.z = az * bw + aw * bz + ax * by - ay * bx; - this.w = aw * bw - ax * bx - ay * by - az * bz; + this.emit('pauseall'); + } return this; }, @@ -36741,62 +37830,32 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#slerp + * @method Phaser.Animations.AnimationManager#play * @since 3.0.0 - * - * @param {[type]} b - [description] - * @param {[type]} t - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - slerp: function (b, t) + play: function (key, child) { - // benchmarks: http://jsperf.com/quaternion-slerp-implementations - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; - - // calc cosine - var cosom = ax * bx + ay * by + az * bz + aw * bw; - - // adjust signs (if necessary) - if (cosom < 0) + if (!Array.isArray(child)) { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; + child = [ child ]; } - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - var scale0 = 1 - t; - var scale1 = t; + var anim = this.get(key); - // calculate coefficients - if ((1 - cosom) > EPSILON) + if (!anim) { - // standard case (slerp) - var omega = Math.acos(cosom); - var sinom = Math.sin(omega); - - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; + return; } - // calculate final values - this.x = scale0 * ax + scale1 * bx; - this.y = scale0 * ay + scale1 * by; - this.z = scale0 * az + scale1 * bz; - this.w = scale0 * aw + scale1 * bw; + for (var i = 0; i < child.length; i++) + { + child[i].anims.play(key); + } return this; }, @@ -36804,44 +37863,45 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#invert + * @method Phaser.Animations.AnimationManager#remove + * @fires RemoveAnimationEvent * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {Phaser.Animations.Animation} [description] */ - invert: function () + remove: function (key) { - var a0 = this.x; - var a1 = this.y; - var a2 = this.z; - var a3 = this.w; + var anim = this.get(key); - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = (dot) ? 1 / dot : 0; - - // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 + if (anim) + { + this.emit('remove', key, anim); - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; + this.anims.delete(key); + } - return this; + return anim; }, /** * [description] * - * @method Phaser.Math.Quaternion#conjugate + * @method Phaser.Animations.AnimationManager#resumeAll + * @fires ResumeAllAnimationEvent * @since 3.0.0 - * - * @return {[type]} [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - conjugate: function () + resumeAll: function () { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; + if (this.paused) + { + this.paused = false; + + this.emit('resumeall'); + } return this; }, @@ -36849,29 +37909,35 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#rotateX + * @method Phaser.Animations.AnimationManager#staggerPlay * @since 3.0.0 - * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {number} [stagger=0] - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - rotateX: function (rad) + staggerPlay: function (key, child, stagger) { - rad *= 0.5; + if (stagger === undefined) { stagger = 0; } - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + if (!Array.isArray(child)) + { + child = [ child ]; + } - var bx = Math.sin(rad); - var bw = Math.cos(rad); + var anim = this.get(key); - this.x = ax * bw + aw * bx; - this.y = ay * bw + az * bx; - this.z = az * bw - ay * bx; - this.w = aw * bw - ax * bx; + if (!anim) + { + return; + } + + for (var i = 0; i < child.length; i++) + { + child[i].anims.delayedPlay(stagger * i, key); + } return this; }, @@ -36879,160 +37945,133 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#rotateY + * @method Phaser.Animations.AnimationManager#toJSON * @since 3.0.0 - * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] - */ - rotateY: function (rad) - { - rad *= 0.5; - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var by = Math.sin(rad); - var bw = Math.cos(rad); - - this.x = ax * bw - az * by; - this.y = ay * bw + aw * by; - this.z = az * bw + ax * by; - this.w = aw * bw - ay * by; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Math.Quaternion#rotateZ - * @since 3.0.0 - * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {object} [description] */ - rotateZ: function (rad) + toJSON: function (key) { - rad *= 0.5; - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var bz = Math.sin(rad); - var bw = Math.cos(rad); + if (key !== undefined && key !== '') + { + return this.anims.get(key).toJSON(); + } + else + { + var output = { + anims: [], + globalTimeScale: this.globalTimeScale + }; - this.x = ax * bw + ay * bz; - this.y = ay * bw - ax * bz; - this.z = az * bw + aw * bz; - this.w = aw * bw - az * bz; + this.anims.each(function (animationKey, animation) + { + output.anims.push(animation.toJSON()); + }); - return this; + return output; + } }, /** * [description] * - * @method Phaser.Math.Quaternion#calculateW + * @method Phaser.Animations.AnimationManager#destroy * @since 3.0.0 - * - * @return {[type]} [description] */ - calculateW: function () + destroy: function () { - var x = this.x; - var y = this.y; - var z = this.z; - - this.w = -Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); + this.anims.clear(); - return this; - }, + this.textureManager = null; - /** - * [description] - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {[type]} mat - [description] - * - * @return {[type]} [description] - */ - fromMat3: function (mat) - { - // benchmarks: - // http://jsperf.com/typed-array-access-speed - // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion + this.game = null; + } - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var m = mat.val; - var fTrace = m[0] + m[4] + m[8]; - var fRoot; +}); - if (fTrace > 0) - { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w +module.exports = AnimationManager; - this.w = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) +/***/ }), +/* 198 */ +/***/ (function(module, exports) { - this.x = (m[7] - m[5]) * fRoot; - this.y = (m[2] - m[6]) * fRoot; - this.z = (m[3] - m[1]) * fRoot; - } - else - { - // |w| <= 1/2 - var i = 0; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (m[4] > m[0]) - { - i = 1; - } +/** + * Takes the given string and pads it out, to the length required, using the character + * specified. For example if you need a string to be 6 characters long, you can call: + * + * `pad('bob', 6, '-', 2)` + * + * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. + * + * You can also use it to pad numbers (they are always returned as strings): + * + * `pad(512, 6, '0', 1)` + * + * Would return: `000512` with the string padded to the left. + * + * If you don't specify a direction it'll pad to both sides: + * + * `pad('c64', 7, '*')` + * + * Would return: `**c64**` + * + * @function Phaser.Utils.String.Pad + * @since 3.0.0 + * + * @param {string} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. + * @param {integer} [len=0] - The number of characters to be added. + * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). + * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). + * + * @return {string} The padded string. + */ +var Pad = function (str, len, pad, dir) +{ + if (len === undefined) { len = 0; } + if (pad === undefined) { pad = ' '; } + if (dir === undefined) { dir = 3; } - if (m[8] > m[i * 3 + i]) - { - i = 2; - } + str = str.toString(); - var j = siNext[i]; - var k = siNext[j]; - - // This isn't quite as clean without array access - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); - tmp[i] = 0.5 * fRoot; + var padlen = 0; - fRoot = 0.5 / fRoot; + if (len + 1 >= str.length) + { + switch (dir) + { + case 1: + str = new Array(len + 1 - str.length).join(pad) + str; + break; - tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + case 3: + var right = Math.ceil((padlen = len - str.length) / 2); + var left = padlen - right; + str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); + break; - this.x = tmp[0]; - this.y = tmp[1]; - this.z = tmp[2]; - this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; + default: + str = str + new Array(len + 1 - str.length).join(pad); + break; } - - return this; } -}); + return str; +}; -module.exports = Quaternion; +module.exports = Pad; /***/ }), -/* 210 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37041,588 +38080,483 @@ module.exports = Quaternion; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - var Class = __webpack_require__(0); +var CustomMap = __webpack_require__(114); +var EventEmitter = __webpack_require__(14); /** * @classdesc - * [description] + * The BaseCache is a base Cache class that can be used for storing references to any kind of data. * - * @class Matrix3 - * @memberOf Phaser.Math + * Data can be added, retrieved and removed based on the given keys. + * + * Keys are string-based. + * + * @class BaseCache + * @memberOf Phaser.Cache * @constructor * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - [description] */ - -var Matrix3 = new Class({ +var BaseCache = new Class({ initialize: - function Matrix3 (m) + function BaseCache () { /** - * [description] + * The Map in which the cache objects are stored. * - * @name Phaser.Math.Matrix3#val - * @type {Float32Array} + * You can query the Map directly or use the BaseCache methods. + * + * @name Phaser.Cache.BaseCache#entries + * @type {Phaser.Structs.Map} * @since 3.0.0 */ - this.val = new Float32Array(9); - - if (m) - { - // Assume Matrix3 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, + this.entries = new CustomMap(); - /** - * [description] - * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 - * - * @return {[type]} [description] - */ - clone: function () - { - return new Matrix3(this); + /** + * An instance of EventEmitter used by the cache to emit related events. + * + * @name Phaser.Cache.BaseCache#events + * @type {EventEmitter} + * @since 3.0.0 + */ + this.events = new EventEmitter(); }, /** - * [description] - * - * @method Phaser.Math.Matrix3#set - * @since 3.0.0 + * Cache add event. * - * @param {[type]} src - [description] + * This event is fired by the Cache each time a new object is added to it. * - * @return {[type]} [description] + * @event Phaser.Cache.BaseCache#addEvent + * @param {Phaser.Cache.BaseCache} The BaseCache to which the object was added. + * @param {string} The key of the object added to the cache. + * @param {any} A reference to the object added to the cache. */ - set: function (src) - { - return this.copy(src); - }, /** - * [description] + * Adds an item to this cache. The item is referenced by a unique string, which you are responsible + * for setting and keeping track of. The item can only be retrieved by using this string. * - * @method Phaser.Math.Matrix3#copy + * @method Phaser.Cache.BaseCache#add + * @fires Phaser.Cache.BaseCache#addEvent * @since 3.0.0 * - * @param {[type]} src - [description] + * @param {string} key - The unique key by which the data added to the cache will be referenced. + * @param {any} data - The data to be stored in the cache. * - * @return {[type]} [description] + * @return {Phaser.Cache.BaseCache} This BaseCache object. */ - copy: function (src) + add: function (key, data) { - var out = this.val; - var a = src.val; + this.entries.set(key, data); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; + this.events.emit('add', this, key, data); return this; }, /** - * [description] + * Checks if this cache contains an item matching the given key. * - * @method Phaser.Math.Matrix3#fromMat4 + * @method Phaser.Cache.BaseCache#has * @since 3.0.0 * - * @param {[type]} m - [description] - * - * @return {[type]} [description] + * @param {string} key - The unique key of the item to be checked in this cache. + * + * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. */ - fromMat4: function (m) + has: function (key) { - var a = m.val; - var out = this.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - - return this; + return this.entries.has(key); }, /** - * [description] + * Gets an item from this cache based on the given key. * - * @method Phaser.Math.Matrix3#fromArray + * @method Phaser.Cache.BaseCache#get * @since 3.0.0 * - * @param {[type]} a - [description] - * - * @return {[type]} [description] + * @param {string} key - The unique key of the item to be retrieved from this cache. + * + * @return {any} The item in the cache, or `null` if no item matching the given key was found. */ - fromArray: function (a) + get: function (key) { - var out = this.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - - return this; + return this.entries.get(key); }, /** - * [description] + * Cache remove event. * - * @method Phaser.Math.Matrix3#identity - * @since 3.0.0 + * This event is fired by the Cache each time an object is removed from it. * - * @return {[type]} [description] + * @event Phaser.Cache.BaseCache#removeEvent + * @param {Phaser.Cache.BaseCache} The BaseCache from which the object was removed. + * @param {string} The key of the object removed from the cache. + * @param {any} The object that was removed from the cache. */ - identity: function () - { - var out = this.val; - - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - - return this; - }, /** - * [description] + * Removes and item from this cache based on the given key. * - * @method Phaser.Math.Matrix3#transpose + * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. + * No additional checks are done on the item removed. If other systems or parts of your game code + * are relying on this item, it is up to you to sever those relationships prior to removing the item. + * + * @method Phaser.Cache.BaseCache#remove + * @fires Phaser.Cache.BaseCache#removeEvent * @since 3.0.0 * - * @return {[type]} [description] + * @param {string} key - The unique key of the item to remove from the cache. + * + * @return {Phaser.Cache.BaseCache} This BaseCache object. */ - transpose: function () + remove: function (key) { - var a = this.val; - var a01 = a[1]; - var a02 = a[2]; - var a12 = a[5]; + var entry = this.get(key); - a[1] = a[3]; - a[2] = a[6]; - a[3] = a01; - a[5] = a[7]; - a[6] = a02; - a[7] = a12; + if (entry) + { + this.entries.delete(key); + + this.events.emit('remove', this, key, entry.data); + } return this; }, /** - * [description] + * Destroys this cache and all items within it. * - * @method Phaser.Math.Matrix3#invert + * @method Phaser.Cache.BaseCache#destroy * @since 3.0.0 - * - * @return {[type]} [description] */ - invert: function () + destroy: function () { - var a = this.val; + this.entries.clear(); + this.events.removeAllListeners(); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + this.entries = null; + this.events = null; + } - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; +}); - // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; +module.exports = BaseCache; - if (!det) - { - return null; - } - det = 1 / det; +/***/ }), +/* 200 */ +/***/ (function(module, exports, __webpack_require__) { - a[0] = b01 * det; - a[1] = (-a22 * a01 + a02 * a21) * det; - a[2] = (a12 * a01 - a02 * a11) * det; - a[3] = b11 * det; - a[4] = (a22 * a00 - a02 * a20) * det; - a[5] = (-a12 * a00 + a02 * a10) * det; - a[6] = b21 * det; - a[7] = (-a21 * a00 + a01 * a20) * det; - a[8] = (a11 * a00 - a01 * a10) * det; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +var BaseCache = __webpack_require__(199); +var Class = __webpack_require__(0); - /** - * [description] - * - * @method Phaser.Math.Matrix3#adjoint - * @since 3.0.0 - * - * @return {[type]} [description] - */ - adjoint: function () - { - var a = this.val; +/** + * @classdesc + * The Cache Manager is the global cache owned and maintained by the Game instance. + * + * Various systems, such as the file Loader, rely on this cache in order to store the files + * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache + * instances, one per type of file. You can also add your own custom caches. + * + * @class CacheManager + * @memberOf Phaser.Cache + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. + */ +var CacheManager = new Class({ - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; - - a[0] = (a11 * a22 - a12 * a21); - a[1] = (a02 * a21 - a01 * a22); - a[2] = (a01 * a12 - a02 * a11); - a[3] = (a12 * a20 - a10 * a22); - a[4] = (a00 * a22 - a02 * a20); - a[5] = (a02 * a10 - a00 * a12); - a[6] = (a10 * a21 - a11 * a20); - a[7] = (a01 * a20 - a00 * a21); - a[8] = (a00 * a11 - a01 * a10); - - return this; - }, + initialize: - /** - * [description] - * - * @method Phaser.Math.Matrix3#determinant - * @since 3.0.0 - * - * @return {[type]} [description] - */ - determinant: function () + function CacheManager (game) { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + /** + * A reference to the Phaser.Game instance that owns this CacheManager. + * + * @name Phaser.Cache.CacheManager#game + * @type {Phaser.Game} + * @protected + * @since 3.0.0 + */ + this.game = game; - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); - }, + /** + * A Cache storing all binary files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#binary + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.binary = new BaseCache(); - /** - * [description] - * - * @method Phaser.Math.Matrix3#multiply - * @since 3.0.0 - * - * @param {[type]} src - [description] - * - * @return {[type]} [description] - */ - multiply: function (src) - { - var a = this.val; + /** + * A Cache storing all bitmap font data files, typically added via the Loader. + * Only the font data is stored in this cache, the textures are part of the Texture Manager. + * + * @name Phaser.Cache.CacheManager#bitmapFont + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.bitmapFont = new BaseCache(); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + /** + * A Cache storing all JSON data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#json + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.json = new BaseCache(); - var b = src.val; + /** + * A Cache storing all physics data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#physics + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.physics = new BaseCache(); - var b00 = b[0]; - var b01 = b[1]; - var b02 = b[2]; - var b10 = b[3]; - var b11 = b[4]; - var b12 = b[5]; - var b20 = b[6]; - var b21 = b[7]; - var b22 = b[8]; + /** + * A Cache storing all shader source files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#shader + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.shader = new BaseCache(); - a[0] = b00 * a00 + b01 * a10 + b02 * a20; - a[1] = b00 * a01 + b01 * a11 + b02 * a21; - a[2] = b00 * a02 + b01 * a12 + b02 * a22; + /** + * A Cache storing all non-streaming audio files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#audio + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.audio = new BaseCache(); - a[3] = b10 * a00 + b11 * a10 + b12 * a20; - a[4] = b10 * a01 + b11 * a11 + b12 * a21; - a[5] = b10 * a02 + b11 * a12 + b12 * a22; + /** + * A Cache storing all text files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#text + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.text = new BaseCache(); - a[6] = b20 * a00 + b21 * a10 + b22 * a20; - a[7] = b20 * a01 + b21 * a11 + b22 * a21; - a[8] = b20 * a02 + b21 * a12 + b22 * a22; + /** + * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#obj + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.obj = new BaseCache(); - return this; - }, + /** + * A Cache storing all tilemap data files, typically added via the Loader. + * Only the data is stored in this cache, the textures are part of the Texture Manager. + * + * @name Phaser.Cache.CacheManager#tilemap + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.tilemap = new BaseCache(); - /** - * [description] - * - * @method Phaser.Math.Matrix3#translate - * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] - */ - translate: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; + /** + * A Cache storing all xml data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#xml + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.xml = new BaseCache(); - a[6] = x * a[0] + y * a[3] + a[6]; - a[7] = x * a[1] + y * a[4] + a[7]; - a[8] = x * a[2] + y * a[5] + a[8]; + /** + * An object that contains your own custom BaseCache entries. + * Add to this via the `addCustom` method. + * + * @name Phaser.Cache.CacheManager#custom + * @type {object.} + * @protected + * @since 3.0.0 + */ + this.custom = {}; - return this; + this.game.events.once('destroy', this.destroy, this); }, /** - * [description] + * Add your own custom Cache for storing your own files. + * The cache will be available under `Cache.custom.key`. + * The cache will only be created if the key is not already in use. * - * @method Phaser.Math.Matrix3#rotate + * @method Phaser.Cache.CacheManager#addCustom * @since 3.0.0 * - * @param {[type]} rad - [description] + * @param {string} key - The unique key of your custom cache. * - * @return {[type]} [description] + * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. */ - rotate: function (rad) + addCustom: function (key) { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - - var s = Math.sin(rad); - var c = Math.cos(rad); - - a[0] = c * a00 + s * a10; - a[1] = c * a01 + s * a11; - a[2] = c * a02 + s * a12; - - a[3] = c * a10 - s * a00; - a[4] = c * a11 - s * a01; - a[5] = c * a12 - s * a02; + if (!this.custom.hasOwnProperty(key)) + { + this.custom[key] = new BaseCache(); + } - return this; + return this.custom[key]; }, /** - * [description] + * Removes all entries from all BaseCaches and destroys all custom caches. * - * @method Phaser.Math.Matrix3#scale + * @method Phaser.Cache.CacheManager#destroy * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] */ - scale: function (v) + destroy: function () { - var a = this.val; - var x = v.x; - var y = v.y; - - a[0] = x * a[0]; - a[1] = x * a[1]; - a[2] = x * a[2]; - - a[3] = y * a[3]; - a[4] = y * a[4]; - a[5] = y * a[5]; + var keys = [ + 'binary', + 'bitmapFont', + 'json', + 'physics', + 'shader', + 'audio', + 'text', + 'obj', + 'tilemap', + 'xml' + ]; - return this; - }, + for (var i = 0; i < keys.length; i++) + { + this[keys[i]].destroy(); + this[keys[i]] = null; + } - /** - * [description] - * - * @method Phaser.Math.Matrix3#fromQuat - * @since 3.0.0 - * - * @param {[type]} q - [description] - * - * @return {[type]} [description] - */ - fromQuat: function (q) - { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; + for (var key in this.custom) + { + this.custom[key].destroy(); + } - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; + this.custom = null; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; + this.game = null; + } - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; +}); - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; +module.exports = CacheManager; - var out = this.val; - out[0] = 1 - (yy + zz); - out[3] = xy + wz; - out[6] = xz - wy; +/***/ }), +/* 201 */ +/***/ (function(module, exports, __webpack_require__) { - out[1] = xy - wz; - out[4] = 1 - (xx + zz); - out[7] = yz + wx; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); +var Color = __webpack_require__(36); - return this; - }, +/** + * Converts a hex string into a Phaser Color object. + * + * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. + * + * An alpha channel is _not_ supported. + * + * @function Phaser.Display.Color.HexStringToColor + * @since 3.0.0 + * + * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. + * + * @return {Phaser.Display.Color} A Color object populated by the values of the given string. + */ +var HexStringToColor = function (hex) +{ + var color = new Color(); - /** - * [description] - * - * @method Phaser.Math.Matrix3#normalFromMat4 - * @since 3.0.0 - * - * @param {[type]} m - [description] - * - * @return {[type]} [description] - */ - normalFromMat4: function (m) + // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") + hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) { - var a = m.val; - var out = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; + return r + r + g + g + b + b; + }); - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; + var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (result) + { + var r = parseInt(result[1], 16); + var g = parseInt(result[2], 16); + var b = parseInt(result[3], 16); - if (!det) - { - return null; - } + color.setTo(r, g, b); + } - det = 1 / det; + return color; +}; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; +module.exports = HexStringToColor; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; +/***/ }), +/* 202 */ +/***/ (function(module, exports) { - return this; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -}); +/** + * Given an alpha and 3 color values this will return an integer representation of it. + * + * @function Phaser.Display.Color.GetColor32 + * @since 3.0.0 + * + * @param {integer} red - The red color value. A number between 0 and 255. + * @param {integer} green - The green color value. A number between 0 and 255. + * @param {integer} blue - The blue color value. A number between 0 and 255. + * @param {integer} alpha - The alpha color value. A number between 0 and 255. + * + * @return {number} The combined color value. + */ +var GetColor32 = function (red, green, blue, alpha) +{ + return alpha << 24 | red << 16 | green << 8 | blue; +}; -module.exports = Matrix3; +module.exports = GetColor32; /***/ }), -/* 211 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37631,185 +38565,232 @@ module.exports = Matrix3; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(117); -var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(51); - -// Local cache vars -var tmpVec3 = new Vector3(); +var Color = __webpack_require__(36); +var IntegerToRGB = __webpack_require__(204); /** - * @classdesc - * [description] + * Converts the given color value into an instance of a Color object. * - * @class OrthographicCamera - * @extends Phaser.Cameras.Sprite3D.Camera - * @memberOf Phaser.Cameras.Sprite3D - * @constructor + * @function Phaser.Display.Color.IntegerToColor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {integer} viewportWidth - [description] - * @param {integer} viewportHeight - [description] + * @param {integer} input - The color value to convert into a Color object. + * + * @return {Phaser.Display.Color} A Color object. */ -var OrthographicCamera = new Class({ +var IntegerToColor = function (input) +{ + var rgb = IntegerToRGB(input); - Extends: Camera, + return new Color(rgb.r, rgb.g, rgb.b, rgb.a); +}; - initialize: +module.exports = IntegerToColor; - function OrthographicCamera (scene, viewportWidth, viewportHeight) - { - if (viewportWidth === undefined) { viewportWidth = 0; } - if (viewportHeight === undefined) { viewportHeight = 0; } - Camera.call(this, scene); +/***/ }), +/* 204 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportWidth - * @type {integer} - * @since 3.0.0 - */ - this.viewportWidth = viewportWidth; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportHeight - * @type {integer} - * @since 3.0.0 - */ - this.viewportHeight = viewportHeight; +/** + * Return the component parts of a color as an Object with the properties alpha, red, green, blue. + * + * Alpha will only be set if it exists in the given color (0xAARRGGBB) + * + * @function Phaser.Display.Color.IntegerToRGB + * @since 3.0.0 + * + * @param {integer} input - The color value to convert into a Color object. + * + * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. + */ +var IntegerToRGB = function (color) +{ + if (color > 16777215) + { + // The color value has an alpha component + return { + a: color >>> 24, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } + else + { + return { + a: 255, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } +}; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom - * @type {float} - * @private - * @since 3.0.0 - */ - this._zoom = 1.0; +module.exports = IntegerToRGB; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#near - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.near = 0; - this.update(); - }, +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.OrthographicCamera#setToOrtho - * @since 3.0.0 - * - * @param {[type]} yDown - [description] - * @param {[type]} viewportWidth - [description] - * @param {[type]} viewportHeight - [description] - * - * @return {[type]} [description] - */ - setToOrtho: function (yDown, viewportWidth, viewportHeight) - { - if (viewportWidth === undefined) { viewportWidth = this.viewportWidth; } - if (viewportHeight === undefined) { viewportHeight = this.viewportHeight; } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var zoom = this.zoom; +var Color = __webpack_require__(36); - this.up.set(0, (yDown) ? -1 : 1, 0); - this.direction.set(0, 0, (yDown) ? 1 : -1); - this.position.set(zoom * viewportWidth / 2, zoom * viewportHeight / 2, 0); +/** + * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. + * + * @function Phaser.Display.Color.ObjectToColor + * @since 3.0.0 + * + * @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. + * + * @return {Phaser.Display.Color} A Color object. + */ +var ObjectToColor = function (input) +{ + return new Color(input.r, input.g, input.b, input.a); +}; - this.viewportWidth = viewportWidth; - this.viewportHeight = viewportHeight; +module.exports = ObjectToColor; - return this.update(); - }, - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.OrthographicCamera#update - * @since 3.0.0 - * - * @return {[type]} [description] - */ - update: function () +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Color = __webpack_require__(36); + +/** + * Converts a CSS 'web' string into a Phaser Color object. + * + * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. + * + * @function Phaser.Display.Color.RGBStringToColor + * @since 3.0.0 + * + * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. + * + * @return {Phaser.Display.Color} A Color object. + */ +var RGBStringToColor = function (rgb) +{ + var color = new Color(); + + var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); + + if (result) { - var w = this.viewportWidth; - var h = this.viewportHeight; - var near = Math.abs(this.near); - var far = Math.abs(this.far); - var zoom = this.zoom; + var r = parseInt(result[1], 10); + var g = parseInt(result[2], 10); + var b = parseInt(result[3], 10); + var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; - if (w === 0 || h === 0) - { - // What to do here... hmm? - return this; - } + color.setTo(r, g, b, a * 255); + } - this.projection.ortho( - zoom * -w / 2, zoom * w / 2, - zoom * -h / 2, zoom * h / 2, - near, - far - ); + return color; +}; - // Build the view matrix - tmpVec3.copy(this.position).add(this.direction); +module.exports = RGBStringToColor; - this.view.lookAt(this.position, tmpVec3, this.up); - // Projection * view matrix - this.combined.copy(this.projection).multiply(this.view); +/***/ }), +/* 207 */ +/***/ (function(module, exports) { - // Invert combined matrix, used for unproject - this.invProjectionView.copy(this.combined).invert(); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.billboardMatrixDirty = true; +// Position Vector randomly in a spherical area defined by the given radius +/** + * [description] + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - [description] + * @param {number} [radius=1] - [description] + * + * @return {Phaser.Math.Vector3} [description] + */ +var RandomXYZ = function (vec3, radius) +{ + if (radius === undefined) { radius = 1; } - this.updateChildren(); + var r = Math.random() * 2 * Math.PI; + var z = (Math.random() * 2) - 1; + var zScale = Math.sqrt(1 - z * z) * radius; + + vec3.x = Math.cos(r) * zScale; + vec3.y = Math.sin(r) * zScale; + vec3.z = z * radius; - return this; - }, + return vec3; +}; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#zoom - * @type {number} - * @since 3.0.0 - */ - zoom: { +module.exports = RandomXYZ; - get: function () - { - return this._zoom; - }, - set: function (value) - { - this._zoom = value; - this.update(); - } - } +/***/ }), +/* 208 */ +/***/ (function(module, exports) { -}); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -module.exports = OrthographicCamera; +/** + * [description] + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - [description] + * @param {float} [scale=1] - [description] + * + * @return {Phaser.Math.Vector4} [description] + */ +var RandomXYZW = function (vec4, scale) +{ + if (scale === undefined) { scale = 1; } + + // Not spherical; should fix this for more uniform distribution + vec4.x = (Math.random() * 2 - 1) * scale; + vec4.y = (Math.random() * 2 - 1) * scale; + vec4.z = (Math.random() * 2 - 1) * scale; + vec4.w = (Math.random() * 2 - 1) * scale; + + return vec4; +}; + +module.exports = RandomXYZW; /***/ }), -/* 212 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37818,89 +38799,161 @@ module.exports = OrthographicCamera; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(117); -var Class = __webpack_require__(0); var Vector3 = __webpack_require__(51); +var Matrix4 = __webpack_require__(119); +var Quaternion = __webpack_require__(210); -// Local cache vars +var tmpMat4 = new Matrix4(); +var tmpQuat = new Quaternion(); var tmpVec3 = new Vector3(); +/** + * Rotates a vector in place by axis angle. + * + * This is the same as transforming a point by an + * axis-angle quaternion, but it has higher precision. + * + * @function Phaser.Math.RotateVec3 + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec - [description] + * @param {Phaser.Math.Vector3} axis - [description] + * @param {float} radians - [description] + * + * @return {Phaser.Math.Vector3} [description] + */ +var RotateVec3 = function (vec, axis, radians) +{ + // Set the quaternion to our axis angle + tmpQuat.setAxisAngle(axis, radians); + + // Create a rotation matrix from the axis angle + tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); + + // Multiply our vector by the rotation matrix + return vec.transformMat4(tmpMat4); +}; + +module.exports = RotateVec3; + + +/***/ }), +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(0); +var Vector3 = __webpack_require__(51); +var Matrix3 = __webpack_require__(211); + +var EPSILON = 0.000001; + +// Some shared 'private' arrays +var siNext = new Int8Array([ 1, 2, 0 ]); +var tmp = new Float32Array([ 0, 0, 0 ]); + +var xUnitVec3 = new Vector3(1, 0, 0); +var yUnitVec3 = new Vector3(0, 1, 0); + +var tmpvec = new Vector3(); +var tmpMat3 = new Matrix3(); + /** * @classdesc * [description] * - * @class PerspectiveCamera - * @extends Phaser.Cameras.Sprite3D.Camera - * @memberOf Phaser.Cameras.Sprite3D + * @class Quaternion + * @memberOf Phaser.Math * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {integer} fieldOfView - [description] - * @param {integer} viewportWidth - [description] - * @param {integer} viewportHeight - [description] + * @param {number} [x] - [description] + * @param {number} [y] - [description] + * @param {number} [z] - [description] + * @param {number} [w] - [description] */ -var PerspectiveCamera = new Class({ - - Extends: Camera, +var Quaternion = new Class({ - // FOV is converted to radians automatically initialize: - function PerspectiveCamera (scene, fieldOfView, viewportWidth, viewportHeight) + function Quaternion (x, y, z, w) { - if (fieldOfView === undefined) { fieldOfView = 80; } - if (viewportWidth === undefined) { viewportWidth = 0; } - if (viewportHeight === undefined) { viewportHeight = 0; } - - Camera.call(this, scene); + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ /** - * [description] + * The y component of this Quaternion. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportWidth - * @type {integer} + * @name Phaser.Math.Quaternion#y + * @type {number} * @default 0 * @since 3.0.0 */ - this.viewportWidth = viewportWidth; /** - * [description] + * The z component of this Quaternion. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportHeight - * @type {integer} + * @name Phaser.Math.Quaternion#z + * @type {number} * @default 0 * @since 3.0.0 */ - this.viewportHeight = viewportHeight; /** - * [description] + * The w component of this Quaternion. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#fieldOfView - * @type {integer} - * @default 80 + * @name Phaser.Math.Quaternion#w + * @type {number} + * @default 0 * @since 3.0.0 */ - this.fieldOfView = fieldOfView * Math.PI / 180; - this.update(); + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } }, /** * [description] * - * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#setFOV + * @method Phaser.Math.Quaternion#copy * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - setFOV: function (value) + copy: function (src) { - this.fieldOfView = value * Math.PI / 180; + this.x = src.x; + this.y = src.y; + this.z = src.z; + this.w = src.w; return this; }, @@ -37908,765 +38961,756 @@ var PerspectiveCamera = new Class({ /** * [description] * - * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#update + * @method Phaser.Math.Quaternion#set * @since 3.0.0 * + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] + * @param {[type]} w - [description] + * * @return {[type]} [description] */ - update: function () + set: function (x, y, z, w) { - var aspect = this.viewportWidth / this.viewportHeight; - - // Create a perspective matrix for our camera - this.projection.perspective( - this.fieldOfView, - aspect, - Math.abs(this.near), - Math.abs(this.far) - ); - - // Build the view matrix - tmpVec3.copy(this.position).add(this.direction); - - this.view.lookAt(this.position, tmpVec3, this.up); + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } - // Projection * view matrix - this.combined.copy(this.projection).multiply(this.view); + return this; + }, - // Invert combined matrix, used for unproject - this.invProjectionView.copy(this.combined).invert(); + /** + * [description] + * + * @method Phaser.Math.Quaternion#add + * @since 3.0.0 + * + * @param {[type]} v - [description] + * + * @return {[type]} [description] + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z; + this.w += v.w; - this.billboardMatrixDirty = true; + return this; + }, - this.updateChildren(); + /** + * [description] + * + * @method Phaser.Math.Quaternion#subtract + * @since 3.0.0 + * + * @param {[type]} v - [description] + * + * @return {[type]} [description] + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + this.w -= v.w; return this; - } + }, -}); - -module.exports = PerspectiveCamera; - - -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Arne16 = __webpack_require__(214); -var CanvasPool = __webpack_require__(21); -var GetValue = __webpack_require__(4); - -/** - * [description] - * - * @function Phaser.Create.GenerateTexture - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {HTMLCanvasElement} [description] - */ -var GenerateTexture = function (config) -{ - var data = GetValue(config, 'data', []); - var canvas = GetValue(config, 'canvas', null); - var palette = GetValue(config, 'palette', Arne16); - var pixelWidth = GetValue(config, 'pixelWidth', 1); - var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); - var resizeCanvas = GetValue(config, 'resizeCanvas', true); - var clearCanvas = GetValue(config, 'clearCanvas', true); - var preRender = GetValue(config, 'preRender', null); - var postRender = GetValue(config, 'postRender', null); - - var width = Math.floor(Math.abs(data[0].length * pixelWidth)); - var height = Math.floor(Math.abs(data.length * pixelHeight)); - - if (!canvas) + /** + * [description] + * + * @method Phaser.Math.Quaternion#scale + * @since 3.0.0 + * + * @param {[type]} scale - [description] + * + * @return {[type]} [description] + */ + scale: function (scale) { - canvas = CanvasPool.create2D(this, width, height); - resizeCanvas = false; - clearCanvas = false; - } + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; - if (resizeCanvas) + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#length + * @since 3.0.0 + * + * @return {[type]} [description] + */ + length: function () { - canvas.width = width; - canvas.height = height; - } + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - var ctx = canvas.getContext('2d'); + return Math.sqrt(x * x + y * y + z * z + w * w); + }, - if (clearCanvas) + /** + * [description] + * + * @method Phaser.Math.Quaternion#lengthSq + * @since 3.0.0 + * + * @return {[type]} [description] + */ + lengthSq: function () { - ctx.clearRect(0, 0, width, height); - } + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - // preRender Callback? - if (preRender) - { - preRender(canvas, ctx); - } + return x * x + y * y + z * z + w * w; + }, - // Draw it - for (var y = 0; y < data.length; y++) + /** + * [description] + * + * @method Phaser.Math.Quaternion#normalize + * @since 3.0.0 + * + * @return {[type]} [description] + */ + normalize: function () { - var row = data[y]; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var len = x * x + y * y + z * z + w * w; - for (var x = 0; x < row.length; x++) + if (len > 0) { - var d = row[x]; + len = 1 / Math.sqrt(len); - if (d !== '.' && d !== ' ') - { - ctx.fillStyle = palette[d]; - ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); - } + this.x = x * len; + this.y = y * len; + this.z = z * len; + this.w = w * len; } - } - - // postRender Callback? - if (postRender) - { - postRender(canvas, ctx); - } - return canvas; -}; - -module.exports = GenerateTexture; + return this; + }, + /** + * [description] + * + * @method Phaser.Math.Quaternion#dot + * @since 3.0.0 + * + * @param {[type]} v - [description] + * + * @return {[type]} [description] + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + }, -/***/ }), -/* 214 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Math.Quaternion#lerp + * @since 3.0.0 + * + * @param {[type]} v - [description] + * @param {[type]} t - [description] + * + * @return {[type]} [description] + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; -/** - * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.ARNE16 - * @since 3.0.0 - * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. - */ -module.exports = { - 0: '#000', - 1: '#9D9D9D', - 2: '#FFF', - 3: '#BE2633', - 4: '#E06F8B', - 5: '#493C2B', - 6: '#A46422', - 7: '#EB8931', - 8: '#F7E26B', - 9: '#2F484E', - A: '#44891A', - B: '#A3CE27', - C: '#1B2632', - D: '#005784', - E: '#31A2F2', - F: '#B2DCEF' -}; + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + this.w = aw + t * (v.w - aw); + return this; + }, -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotationTo + * @since 3.0.0 + * + * @param {[type]} a - [description] + * @param {[type]} b - [description] + * + * @return {[type]} [description] + */ + rotationTo: function (a, b) + { + var dot = a.x * b.x + a.y * b.y + a.z * b.z; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (dot < -0.999999) + { + if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) + { + tmpvec.copy(yUnitVec3).cross(a); + } + + tmpvec.normalize(); -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + return this.setAxisAngle(tmpvec, Math.PI); -var Class = __webpack_require__(0); -var CubicBezier = __webpack_require__(216); -var Curve = __webpack_require__(66); -var Vector2 = __webpack_require__(6); + } + else if (dot > 0.999999) + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; -/** - * @classdesc - * [description] - * - * @class CubicBezierCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. - * @param {Phaser.Math.Vector2} p1 - Control Point 1. - * @param {Phaser.Math.Vector2} p2 - Control Point 2. - * @param {Phaser.Math.Vector2} p3 - End Point. - */ -var CubicBezierCurve = new Class({ + return this; + } + else + { + tmpvec.copy(a).cross(b); - Extends: Curve, + this.x = tmpvec.x; + this.y = tmpvec.y; + this.z = tmpvec.z; + this.w = 1 + dot; - initialize: + return this.normalize(); + } + }, - function CubicBezierCurve (p0, p1, p2, p3) + /** + * [description] + * + * @method Phaser.Math.Quaternion#setAxes + * @since 3.0.0 + * + * @param {[type]} view - [description] + * @param {[type]} right - [description] + * @param {[type]} up - [description] + * + * @return {[type]} [description] + */ + setAxes: function (view, right, up) { - Curve.call(this, 'CubicBezierCurve'); - - if (Array.isArray(p0)) - { - p3 = new Vector2(p0[6], p0[7]); - p2 = new Vector2(p0[4], p0[5]); - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } + var m = tmpMat3.val; - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = p0; + m[0] = right.x; + m[3] = right.y; + m[6] = right.z; - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p1 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p1 = p1; + m[1] = up.x; + m[4] = up.y; + m[7] = up.z; - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p2 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p2 = p2; + m[2] = -view.x; + m[5] = -view.y; + m[8] = -view.z; - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p3 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p3 = p3; + return this.fromMat3(tmpMat3).normalize(); }, /** * [description] * - * @method Phaser.Curves.CubicBezierCurve#getStartPoint + * @method Phaser.Math.Quaternion#identity * @since 3.0.0 * - * @param {Phaser.Math.Vector2} out - [description] - * - * @return {Phaser.Math.Vector2} [description] + * @return {[type]} [description] */ - getStartPoint: function (out) + identity: function () { - if (out === undefined) { out = new Vector2(); } + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; - return out.copy(this.p0); + return this; }, /** * [description] * - * @method Phaser.Curves.CubicBezierCurve#getResolution + * @method Phaser.Math.Quaternion#setAxisAngle * @since 3.0.0 * - * @param {[type]} divisions - [description] + * @param {[type]} axis - [description] + * @param {[type]} rad - [description] * * @return {[type]} [description] */ - getResolution: function (divisions) + setAxisAngle: function (axis, rad) { - return divisions; + rad = rad * 0.5; + + var s = Math.sin(rad); + + this.x = s * axis.x; + this.y = s * axis.y; + this.z = s * axis.z; + this.w = Math.cos(rad); + + return this; }, /** * [description] * - * @method Phaser.Curves.CubicBezierCurve#getPoint + * @method Phaser.Math.Quaternion#multiply * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] + * @param {[type]} b - [description] * * @return {[type]} [description] */ - getPoint: function (t, out) + multiply: function (b) { - if (out === undefined) { out = new Vector2(); } + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - var p0 = this.p0; - var p1 = this.p1; - var p2 = this.p2; - var p3 = this.p3; + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; - return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); + this.x = ax * bw + aw * bx + ay * bz - az * by; + this.y = ay * bw + aw * by + az * bx - ax * bz; + this.z = az * bw + aw * bz + ax * by - ay * bx; + this.w = aw * bw - ax * bx - ay * by - az * bz; + + return this; }, /** * [description] * - * @method Phaser.Curves.CubicBezierCurve#draw + * @method Phaser.Math.Quaternion#slerp * @since 3.0.0 * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {integer} [pointsTotal=32] - [description] + * @param {[type]} b - [description] + * @param {[type]} t - [description] * - * @return {Phaser.GameObjects.Graphics} [description] + * @return {[type]} [description] */ - draw: function (graphics, pointsTotal) + slerp: function (b, t) { - if (pointsTotal === undefined) { pointsTotal = 32; } + // benchmarks: http://jsperf.com/quaternion-slerp-implementations - var points = this.getPoints(pointsTotal); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - graphics.beginPath(); - graphics.moveTo(this.p0.x, this.p0.y); + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; - for (var i = 1; i < points.length; i++) + // calc cosine + var cosom = ax * bx + ay * by + az * bz + aw * bw; + + // adjust signs (if necessary) + if (cosom < 0) { - graphics.lineTo(points[i].x, points[i].y); + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; } - graphics.strokePath(); + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + var scale0 = 1 - t; + var scale1 = t; - // So you can chain graphics calls - return graphics; + // calculate coefficients + if ((1 - cosom) > EPSILON) + { + // standard case (slerp) + var omega = Math.acos(cosom); + var sinom = Math.sin(omega); + + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } + + // calculate final values + this.x = scale0 * ax + scale1 * bx; + this.y = scale0 * ay + scale1 * by; + this.z = scale0 * az + scale1 * bz; + this.w = scale0 * aw + scale1 * bw; + + return this; }, /** * [description] * - * @method Phaser.Curves.CubicBezierCurve#toJSON + * @method Phaser.Math.Quaternion#invert * @since 3.0.0 * - * @return {object} [description] + * @return {[type]} [description] */ - toJSON: function () + invert: function () { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y, - this.p2.x, this.p2.y, - this.p3.x, this.p3.y - ] - }; - } - -}); - -CubicBezierCurve.fromJSON = function (data) -{ - var points = data.points; - - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); - var p2 = new Vector2(points[4], points[5]); - var p3 = new Vector2(points[6], points[7]); - - return new CubicBezierCurve(p0, p1, p2, p3); -}; - -module.exports = CubicBezierCurve; - - -/***/ }), -/* 216 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -function P0 (t, p) -{ - var k = 1 - t; - - return k * k * k * p; -} - -function P1 (t, p) -{ - var k = 1 - t; - - return 3 * k * k * t * p; -} - -function P2 (t, p) -{ - return 3 * (1 - t) * t * t * p; -} - -function P3 (t, p) -{ - return t * t * t * p; -} - -// p0 = start point -// p1 = control point 1 -// p2 = control point 2 -// p3 = end point - -// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a - -/** - * [description] - * - * @function Phaser.Math.Interpolation.CubicBezier - * @since 3.0.0 - * - * @param {float} t - [description] - * @param {number} p0 - [description] - * @param {number} p1 - [description] - * @param {number} p2 - [description] - * @param {number} p3 - [description] - * - * @return {number} [description] - */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); -}; - -module.exports = CubicBezierInterpolation; - - -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var DegToRad = __webpack_require__(35); -var GetValue = __webpack_require__(4); -var RadToDeg = __webpack_require__(218); -var Vector2 = __webpack_require__(6); + var a0 = this.x; + var a1 = this.y; + var a2 = this.z; + var a3 = this.w; -/** - * @classdesc - * [description] - * - * @class EllipseCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] - * @param {number} [xRadius=0] - [description] - * @param {number} [yRadius=0] - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=360] - [description] - * @param {boolean} [clockwise=false] - [description] - * @param {number} [rotation=0] - [description] - */ -var EllipseCurve = new Class({ + var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + var invDot = (dot) ? 1 / dot : 0; + + // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - Extends: Curve, + this.x = -a0 * invDot; + this.y = -a1 * invDot; + this.z = -a2 * invDot; + this.w = a3 * invDot; - initialize: + return this; + }, - function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + /** + * [description] + * + * @method Phaser.Math.Quaternion#conjugate + * @since 3.0.0 + * + * @return {[type]} [description] + */ + conjugate: function () { - if (typeof x === 'object') - { - var config = x; + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; - x = GetValue(config, 'x', 0); - y = GetValue(config, 'y', 0); - xRadius = GetValue(config, 'xRadius', 0); - yRadius = GetValue(config, 'yRadius', xRadius); - startAngle = GetValue(config, 'startAngle', 0); - endAngle = GetValue(config, 'endAngle', 360); - clockwise = GetValue(config, 'clockwise', false); - rotation = GetValue(config, 'rotation', 0); - } - else - { - if (yRadius === undefined) { yRadius = xRadius; } - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 360; } - if (clockwise === undefined) { clockwise = false; } - if (rotation === undefined) { rotation = 0; } - } + return this; + }, - Curve.call(this, 'EllipseCurve'); + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotateX + * @since 3.0.0 + * + * @param {[type]} rad - [description] + * + * @return {[type]} [description] + */ + rotateX: function (rad) + { + rad *= 0.5; - // Center point + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.EllipseCurve#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = new Vector2(x, y); + var bx = Math.sin(rad); + var bw = Math.cos(rad); - /** - * [description] - * - * @name Phaser.Curves.EllipseCurve#_xRadius - * @type {number} - * @private - * @since 3.0.0 - */ - this._xRadius = xRadius; + this.x = ax * bw + aw * bx; + this.y = ay * bw + az * bx; + this.z = az * bw - ay * bx; + this.w = aw * bw - ax * bx; - /** - * [description] - * - * @name Phaser.Curves.EllipseCurve#_yRadius - * @type {number} - * @private - * @since 3.0.0 - */ - this._yRadius = yRadius; + return this; + }, - // Radians + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotateY + * @since 3.0.0 + * + * @param {[type]} rad - [description] + * + * @return {[type]} [description] + */ + rotateY: function (rad) + { + rad *= 0.5; - /** - * [description] - * - * @name Phaser.Curves.EllipseCurve#_startAngle - * @type {number} - * @private - * @since 3.0.0 - */ - this._startAngle = DegToRad(startAngle); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - /** - * [description] - * - * @name Phaser.Curves.EllipseCurve#_endAngle - * @type {number} - * @private - * @since 3.0.0 - */ - this._endAngle = DegToRad(endAngle); + var by = Math.sin(rad); + var bw = Math.cos(rad); - /** - * Anti-clockwise direction. - * - * @name Phaser.Curves.EllipseCurve#_clockwise - * @type {boolean} - * @private - * @since 3.0.0 - */ - this._clockwise = clockwise; + this.x = ax * bw - az * by; + this.y = ay * bw + aw * by; + this.z = az * bw + ax * by; + this.w = aw * bw - ay * by; - /** - * The rotation of the arc. - * - * @name Phaser.Curves.EllipseCurve#_rotation - * @type {number} - * @private - * @since 3.0.0 - */ - this._rotation = DegToRad(rotation); + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getStartPoint + * @method Phaser.Math.Quaternion#rotateZ * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} rad - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + rotateZ: function (rad) { - if (out === undefined) { out = new Vector2(); } + rad *= 0.5; - return this.getPoint(0, out); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + var bz = Math.sin(rad); + var bw = Math.cos(rad); + + this.x = ax * bw + ay * bz; + this.y = ay * bw - ax * bz; + this.z = az * bw + aw * bz; + this.w = aw * bw - az * bz; + + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getResolution + * @method Phaser.Math.Quaternion#calculateW * @since 3.0.0 * - * @param {[type]} divisions - [description] - * * @return {[type]} [description] */ - getResolution: function (divisions) + calculateW: function () { - return divisions * 2; + var x = this.x; + var y = this.y; + var z = this.z; + + this.w = -Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); + + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getPoint + * @method Phaser.Math.Quaternion#fromMat3 * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] + * @param {[type]} mat - [description] * * @return {[type]} [description] */ - getPoint: function (t, out) + fromMat3: function (mat) { - if (out === undefined) { out = new Vector2(); } + // benchmarks: + // http://jsperf.com/typed-array-access-speed + // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion - var twoPi = Math.PI * 2; - var deltaAngle = this._endAngle - this._startAngle; - var samePoints = Math.abs(deltaAngle) < Number.EPSILON; + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var m = mat.val; + var fTrace = m[0] + m[4] + m[8]; + var fRoot; - // ensures that deltaAngle is 0 .. 2 PI - while (deltaAngle < 0) + if (fTrace > 0) { - deltaAngle += twoPi; - } + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w - while (deltaAngle > twoPi) - { - deltaAngle -= twoPi; - } + this.w = 0.5 * fRoot; - if (deltaAngle < Number.EPSILON) - { - if (samePoints) - { - deltaAngle = 0; - } - else - { - deltaAngle = twoPi; - } - } + fRoot = 0.5 / fRoot; // 1/(4w) - if (this._clockwise && !samePoints) + this.x = (m[7] - m[5]) * fRoot; + this.y = (m[2] - m[6]) * fRoot; + this.z = (m[3] - m[1]) * fRoot; + } + else { - if (deltaAngle === twoPi) + // |w| <= 1/2 + var i = 0; + + if (m[4] > m[0]) { - deltaAngle = - twoPi; + i = 1; } - else + + if (m[8] > m[i * 3 + i]) { - deltaAngle = deltaAngle - twoPi; + i = 2; } - } - var angle = this._startAngle + t * deltaAngle; - var x = this.p0.x + this._xRadius * Math.cos(angle); - var y = this.p0.y + this._yRadius * Math.sin(angle); + var j = siNext[i]; + var k = siNext[j]; + + // This isn't quite as clean without array access + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + tmp[i] = 0.5 * fRoot; - if (this._rotation !== 0) - { - var cos = Math.cos(this._rotation); - var sin = Math.sin(this._rotation); + fRoot = 0.5 / fRoot; - var tx = x - this.p0.x; - var ty = y - this.p0.y; + tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.p0.x; - y = tx * sin + ty * cos + this.p0.y; + this.x = tmp[0]; + this.y = tmp[1]; + this.z = tmp[2]; + this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; } + + return this; + } - return out.set(x, y); +}); + +module.exports = Quaternion; + + +/***/ }), +/* 211 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(0); + +/** + * @classdesc + * [description] + * + * @class Matrix3 + * @memberOf Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} [m] - [description] + */ + +var Matrix3 = new Class({ + + initialize: + + function Matrix3 (m) + { + /** + * [description] + * + * @name Phaser.Math.Matrix3#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(9); + + if (m) + { + // Assume Matrix3 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setXRadius + * @method Phaser.Math.Matrix3#clone * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setXRadius: function (value) + clone: function () { - this.xRadius = value; - - return this; + return new Matrix3(this); }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setYRadius + * @method Phaser.Math.Matrix3#set * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - setYRadius: function (value) + set: function (src) { - this.yRadius = value; - - return this; + return this.copy(src); }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setWidth + * @method Phaser.Math.Matrix3#copy * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - setWidth: function (value) + copy: function (src) { - this.xRadius = value * 2; + var out = this.val; + var a = src.val; + + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; return this; }, @@ -38674,16 +39718,27 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setHeight + * @method Phaser.Math.Matrix3#fromMat4 * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} m - [description] * * @return {[type]} [description] */ - setHeight: function (value) + fromMat4: function (m) { - this.yRadius = value * 2; + var a = m.val; + var out = this.val; + + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; return this; }, @@ -38691,16 +39746,26 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setStartAngle + * @method Phaser.Math.Matrix3#fromArray * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} a - [description] * * @return {[type]} [description] */ - setStartAngle: function (value) + fromArray: function (a) { - this.startAngle = value; + var out = this.val; + + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; return this; }, @@ -38708,16 +39773,24 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setEndAngle + * @method Phaser.Math.Matrix3#identity * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setEndAngle: function (value) + identity: function () { - this.endAngle = value; + var out = this.val; + + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; return this; }, @@ -38725,16 +39798,24 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setClockwise + * @method Phaser.Math.Matrix3#transpose * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setClockwise: function (value) + transpose: function () { - this.clockwise = value; + var a = this.val; + var a01 = a[1]; + var a02 = a[2]; + var a12 = a[5]; + + a[1] = a[3]; + a[2] = a[6]; + a[3] = a01; + a[5] = a[7]; + a[6] = a02; + a[7] = a12; return this; }, @@ -38742,253 +39823,380 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setRotation + * @method Phaser.Math.Matrix3#invert * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setRotation: function (value) + invert: function () { - this.rotation = value; + var a = this.val; - return this; - }, + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - /** - * [description] - * - * @name Phaser.Curves.EllipseCurve#x - * @type {number} - * @since 3.0.0 - */ - x: { + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; - get: function () - { - return this.p0.x; - }, + // Calculate the determinant + var det = a00 * b01 + a01 * b11 + a02 * b21; - set: function (value) + if (!det) { - this.p0.x = value; + return null; } + det = 1 / det; + + a[0] = b01 * det; + a[1] = (-a22 * a01 + a02 * a21) * det; + a[2] = (a12 * a01 - a02 * a11) * det; + a[3] = b11 * det; + a[4] = (a22 * a00 - a02 * a20) * det; + a[5] = (-a12 * a00 + a02 * a10) * det; + a[6] = b21 * det; + a[7] = (-a21 * a00 + a01 * a20) * det; + a[8] = (a11 * a00 - a01 * a10) * det; + + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#y - * @type {number} + * @method Phaser.Math.Matrix3#adjoint * @since 3.0.0 + * + * @return {[type]} [description] */ - y: { + adjoint: function () + { + var a = this.val; - get: function () - { - return this.p0.y; - }, + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - set: function (value) - { - this.p0.y = value; - } + a[0] = (a11 * a22 - a12 * a21); + a[1] = (a02 * a21 - a01 * a22); + a[2] = (a01 * a12 - a02 * a11); + a[3] = (a12 * a20 - a10 * a22); + a[4] = (a00 * a22 - a02 * a20); + a[5] = (a02 * a10 - a00 * a12); + a[6] = (a10 * a21 - a11 * a20); + a[7] = (a01 * a20 - a00 * a21); + a[8] = (a00 * a11 - a01 * a10); + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#xRadius - * @type {number} + * @method Phaser.Math.Matrix3#determinant * @since 3.0.0 + * + * @return {[type]} [description] */ - xRadius: { - - get: function () - { - return this._xRadius; - }, + determinant: function () + { + var a = this.val; - set: function (value) - { - this._xRadius = value; - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#yRadius - * @type {number} + * @method Phaser.Math.Matrix3#multiply * @since 3.0.0 + * + * @param {[type]} src - [description] + * + * @return {[type]} [description] */ - yRadius: { + multiply: function (src) + { + var a = this.val; - get: function () - { - return this._yRadius; - }, + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - set: function (value) - { - this._yRadius = value; - } + var b = src.val; + + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b10 = b[3]; + var b11 = b[4]; + var b12 = b[5]; + var b20 = b[6]; + var b21 = b[7]; + var b22 = b[8]; + + a[0] = b00 * a00 + b01 * a10 + b02 * a20; + a[1] = b00 * a01 + b01 * a11 + b02 * a21; + a[2] = b00 * a02 + b01 * a12 + b02 * a22; + + a[3] = b10 * a00 + b11 * a10 + b12 * a20; + a[4] = b10 * a01 + b11 * a11 + b12 * a21; + a[5] = b10 * a02 + b11 * a12 + b12 * a22; + + a[6] = b20 * a00 + b21 * a10 + b22 * a20; + a[7] = b20 * a01 + b21 * a11 + b22 * a21; + a[8] = b20 * a02 + b21 * a12 + b22 * a22; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#startAngle - * @type {number} + * @method Phaser.Math.Matrix3#translate * @since 3.0.0 + * + * @param {[type]} v - [description] + * + * @return {[type]} [description] */ - startAngle: { - - get: function () - { - return RadToDeg(this._startAngle); - }, + translate: function (v) + { + var a = this.val; + var x = v.x; + var y = v.y; - set: function (value) - { - this._startAngle = DegToRad(value); - } + a[6] = x * a[0] + y * a[3] + a[6]; + a[7] = x * a[1] + y * a[4] + a[7]; + a[8] = x * a[2] + y * a[5] + a[8]; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#endAngle - * @type {number} + * @method Phaser.Math.Matrix3#rotate * @since 3.0.0 + * + * @param {[type]} rad - [description] + * + * @return {[type]} [description] */ - endAngle: { + rotate: function (rad) + { + var a = this.val; - get: function () - { - return RadToDeg(this._endAngle); - }, + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; - set: function (value) - { - this._endAngle = DegToRad(value); - } + var s = Math.sin(rad); + var c = Math.cos(rad); + a[0] = c * a00 + s * a10; + a[1] = c * a01 + s * a11; + a[2] = c * a02 + s * a12; + + a[3] = c * a10 - s * a00; + a[4] = c * a11 - s * a01; + a[5] = c * a12 - s * a02; + + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#clockwise - * @type {number} + * @method Phaser.Math.Matrix3#scale * @since 3.0.0 + * + * @param {[type]} v - [description] + * + * @return {[type]} [description] */ - clockwise: { + scale: function (v) + { + var a = this.val; + var x = v.x; + var y = v.y; - get: function () - { - return this._clockwise; - }, + a[0] = x * a[0]; + a[1] = x * a[1]; + a[2] = x * a[2]; - set: function (value) - { - this._clockwise = value; - } + a[3] = y * a[3]; + a[4] = y * a[4]; + a[5] = y * a[5]; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#rotation - * @type {number} + * @method Phaser.Math.Matrix3#fromQuat * @since 3.0.0 + * + * @param {[type]} q - [description] + * + * @return {[type]} [description] */ - rotation: { + fromQuat: function (q) + { + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - get: function () - { - return this._rotation; - }, + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - set: function (value) - { - this._rotation = DegToRad(value); - } + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + var out = this.val; + + out[0] = 1 - (yy + zz); + out[3] = xy + wz; + out[6] = xz - wy; + + out[1] = xy - wz; + out[4] = 1 - (xx + zz); + out[7] = yz + wx; + + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#toJSON + * @method Phaser.Math.Matrix3#normalFromMat4 * @since 3.0.0 * - * @return {object} [description] + * @param {[type]} m - [description] + * + * @return {[type]} [description] */ - toJSON: function () + normalFromMat4: function (m) { - return { - type: this.type, - x: this.p0.x, - y: this.p0.y, - xRadius: this._xRadius, - yRadius: this._yRadius, - startAngle: RadToDeg(this._startAngle), - endAngle: RadToDeg(this._endAngle), - clockwise: this._clockwise, - rotation: RadToDeg(this._rotation) - }; - } + var a = m.val; + var out = this.val; -}); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; -EllipseCurve.fromJSON = function (data) -{ - return new EllipseCurve(data); -}; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; -module.exports = EllipseCurve; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; -/***/ }), -/* 218 */ -/***/ (function(module, exports, __webpack_require__) { + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; -var CONST = __webpack_require__(16); + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; -/** - * [description] - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {float} radians - [description] - * - * @return {integer} [description] - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -module.exports = RadToDeg; + if (!det) + { + return null; + } + + det = 1 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + + return this; + } + +}); + +module.exports = Matrix3; /***/ }), -/* 219 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -38997,224 +40205,185 @@ module.exports = RadToDeg; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - +var Camera = __webpack_require__(118); var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var FromPoints = __webpack_require__(121); -var Rectangle = __webpack_require__(8); -var Vector2 = __webpack_require__(6); +var Vector3 = __webpack_require__(51); -var tmpVec2 = new Vector2(); +// Local cache vars +var tmpVec3 = new Vector3(); /** * @classdesc * [description] * - * @class LineCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves + * @class OrthographicCamera + * @extends Phaser.Cameras.Sprite3D.Camera + * @memberOf Phaser.Cameras.Sprite3D * @constructor * @since 3.0.0 * - * @param {Phaser.Math.Vector2} p0 - [description] - * @param {Phaser.Math.Vector2} p1 - [description] + * @param {Phaser.Scene} scene - [description] + * @param {integer} viewportWidth - [description] + * @param {integer} viewportHeight - [description] */ -var LineCurve = new Class({ +var OrthographicCamera = new Class({ - Extends: Curve, + Extends: Camera, initialize: - // vec2s or array - function LineCurve (p0, p1) + function OrthographicCamera (scene, viewportWidth, viewportHeight) { - Curve.call(this, 'LineCurve'); + if (viewportWidth === undefined) { viewportWidth = 0; } + if (viewportHeight === undefined) { viewportHeight = 0; } - if (Array.isArray(p0)) - { - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } + Camera.call(this, scene); /** * [description] * - * @name Phaser.Curves.LineCurve#p0 - * @type {Phaser.Math.Vector2} + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportWidth + * @type {integer} * @since 3.0.0 */ - this.p0 = p0; + this.viewportWidth = viewportWidth; /** * [description] * - * @property Phaser.Curves.LineCurve#p1 - * @type {Phaser.Math.Vector2} + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportHeight + * @type {integer} * @since 3.0.0 */ - this.p1 = p1; - }, + this.viewportHeight = viewportHeight; - /** - * [description] - * - * @method Phaser.Curves.LineCurve#getBounds - * @since 3.0.0 - * - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getBounds: function (out) - { - if (out === undefined) { out = new Rectangle(); } + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom + * @type {float} + * @private + * @since 3.0.0 + */ + this._zoom = 1.0; - return FromPoints([ this.p0, this.p1 ], out); + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#near + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.near = 0; + + this.update(); }, /** * [description] * - * @method Phaser.Curves.LineCurve#getStartPoint + * @method Phaser.Cameras.Sprite3D.OrthographicCamera#setToOrtho * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} yDown - [description] + * @param {[type]} viewportWidth - [description] + * @param {[type]} viewportHeight - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + setToOrtho: function (yDown, viewportWidth, viewportHeight) { - if (out === undefined) { out = new Vector2(); } + if (viewportWidth === undefined) { viewportWidth = this.viewportWidth; } + if (viewportHeight === undefined) { viewportHeight = this.viewportHeight; } - return out.copy(this.p0); - }, + var zoom = this.zoom; - /** - * [description] - * - * @method Phaser.Curves.LineCurve#getResolution - * @since 3.0.0 - * - * @return {integer} [description] - */ - getResolution: function () - { - return 1; + this.up.set(0, (yDown) ? -1 : 1, 0); + this.direction.set(0, 0, (yDown) ? 1 : -1); + this.position.set(zoom * viewportWidth / 2, zoom * viewportHeight / 2, 0); + + this.viewportWidth = viewportWidth; + this.viewportHeight = viewportHeight; + + return this.update(); }, /** * [description] * - * @method Phaser.Curves.LineCurve#getPoint + * @method Phaser.Cameras.Sprite3D.OrthographicCamera#update * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] - * * @return {[type]} [description] */ - getPoint: function (t, out) + update: function () { - if (out === undefined) { out = new Vector2(); } + var w = this.viewportWidth; + var h = this.viewportHeight; + var near = Math.abs(this.near); + var far = Math.abs(this.far); + var zoom = this.zoom; - if (t === 1) + if (w === 0 || h === 0) { - return out.copy(this.p1); + // What to do here... hmm? + return this; } - out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); + this.projection.ortho( + zoom * -w / 2, zoom * w / 2, + zoom * -h / 2, zoom * h / 2, + near, + far + ); - return out; - }, + // Build the view matrix + tmpVec3.copy(this.position).add(this.direction); - // Line curve is linear, so we can overwrite default getPointAt - /** - * [description] - * - * @method Phaser.Curves.LineCurve#getPointAt - * @since 3.0.0 - * - * @param {[type]} u - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, + this.view.lookAt(this.position, tmpVec3, this.up); - /** - * [description] - * - * @method Phaser.Curves.LineCurve#getTangent - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getTangent: function () - { - var tangent = tmpVec2.copy(this.p1).subtract(this.p0); + // Projection * view matrix + this.combined.copy(this.projection).multiply(this.view); - return tangent.normalize(); - }, + // Invert combined matrix, used for unproject + this.invProjectionView.copy(this.combined).invert(); - // Override default Curve.draw because this is better than calling getPoints on a line! - /** - * [description] - * - * @method Phaser.Curves.LineCurve#draw - * @since 3.0.0 - * - * @param {[type]} graphics - [description] - * - * @return {[type]} [description] - */ - draw: function (graphics) - { - graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); + this.billboardMatrixDirty = true; - // So you can chain graphics calls - return graphics; + this.updateChildren(); + + return this; }, /** * [description] * - * @method Phaser.Curves.LineCurve#toJSON + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#zoom + * @type {number} * @since 3.0.0 - * - * @return {[type]} [description] */ - toJSON: function () - { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y - ] - }; - } - -}); + zoom: { -LineCurve.fromJSON = function (data) -{ - var points = data.points; + get: function () + { + return this._zoom; + }, - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); + set: function (value) + { + this._zoom = value; + this.update(); + } + } - return new LineCurve(p0, p1); -}; +}); -module.exports = LineCurve; +module.exports = OrthographicCamera; /***/ }), -/* 220 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39223,210 +40392,139 @@ module.exports = LineCurve; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var CatmullRom = __webpack_require__(122); +var Camera = __webpack_require__(118); var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var Vector2 = __webpack_require__(6); +var Vector3 = __webpack_require__(51); + +// Local cache vars +var tmpVec3 = new Vector3(); /** * @classdesc * [description] * - * @class SplineCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves + * @class PerspectiveCamera + * @extends Phaser.Cameras.Sprite3D.Camera + * @memberOf Phaser.Cameras.Sprite3D * @constructor * @since 3.0.0 * - * @param {Phaser.Math.Vector2[]} [points] - [description] + * @param {Phaser.Scene} scene - [description] + * @param {integer} fieldOfView - [description] + * @param {integer} viewportWidth - [description] + * @param {integer} viewportHeight - [description] */ -var SplineCurve = new Class({ +var PerspectiveCamera = new Class({ - Extends: Curve, + Extends: Camera, + // FOV is converted to radians automatically initialize: - function SplineCurve (points) + function PerspectiveCamera (scene, fieldOfView, viewportWidth, viewportHeight) { - if (points === undefined) { points = []; } + if (fieldOfView === undefined) { fieldOfView = 80; } + if (viewportWidth === undefined) { viewportWidth = 0; } + if (viewportHeight === undefined) { viewportHeight = 0; } - Curve.call(this, 'SplineCurve'); + Camera.call(this, scene); /** * [description] * - * @name Phaser.Curves.SplineCurve#points - * @type {Phaser.Math.Vector2[]} - * @default [] + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportWidth + * @type {integer} + * @default 0 * @since 3.0.0 */ - this.points = []; - - this.addPoints(points); - }, - - /** - * [description] - * - * @method Phaser.Curves.SplineCurve#addPoints - * @since 3.0.0 - * - * @param {[type]} points - [description] - * - * @return {[type]} [description] - */ - addPoints: function (points) - { - for (var i = 0; i < points.length; i++) - { - var p = new Vector2(); - - if (typeof points[i] === 'number') - { - p.x = points[i]; - p.y = points[i + 1]; - i++; - } - else if (Array.isArray(points[i])) - { - // An array of arrays? - p.x = points[i][0]; - p.y = points[i][1]; - } - else - { - p.x = points[i].x; - p.y = points[i].y; - } - - this.points.push(p); - } - - return this; - }, + this.viewportWidth = viewportWidth; - /** - * [description] - * - * @method Phaser.Curves.SplineCurve#addPoint - * @since 3.0.0 - * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * - * @return {[type]} [description] - */ - addPoint: function (x, y) - { - var vec = new Vector2(x, y); + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportHeight + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.viewportHeight = viewportHeight; - this.points.push(vec); + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#fieldOfView + * @type {integer} + * @default 80 + * @since 3.0.0 + */ + this.fieldOfView = fieldOfView * Math.PI / 180; - return vec; + this.update(); }, /** * [description] * - * @method Phaser.Curves.SplineCurve#getStartPoint + * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#setFOV * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} value - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + setFOV: function (value) { - if (out === undefined) { out = new Vector2(); } - - return out.copy(this.points[0]); - }, + this.fieldOfView = value * Math.PI / 180; - /** - * [description] - * - * @method Phaser.Curves.SplineCurve#getResolution - * @since 3.0.0 - * - * @param {[type]} divisions - [description] - * - * @return {[type]} [description] - */ - getResolution: function (divisions) - { - return divisions * this.points.length; + return this; }, /** * [description] * - * @method Phaser.Curves.SplineCurve#getPoint + * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#update * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] - * * @return {[type]} [description] */ - getPoint: function (t, out) + update: function () { - if (out === undefined) { out = new Vector2(); } - - var points = this.points; + var aspect = this.viewportWidth / this.viewportHeight; - var point = (points.length - 1) * t; + // Create a perspective matrix for our camera + this.projection.perspective( + this.fieldOfView, + aspect, + Math.abs(this.near), + Math.abs(this.far) + ); - var intPoint = Math.floor(point); + // Build the view matrix + tmpVec3.copy(this.position).add(this.direction); - var weight = point - intPoint; + this.view.lookAt(this.position, tmpVec3, this.up); - var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; - var p1 = points[intPoint]; - var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; - var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; + // Projection * view matrix + this.combined.copy(this.projection).multiply(this.view); - return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); - }, + // Invert combined matrix, used for unproject + this.invProjectionView.copy(this.combined).invert(); - /** - * [description] - * - * @method Phaser.Curves.SplineCurve#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () - { - var points = []; + this.billboardMatrixDirty = true; - for (var i = 0; i < this.points.length; i++) - { - points.push(this.points[i].x); - points.push(this.points[i].y); - } + this.updateChildren(); - return { - type: this.type, - points: points - }; + return this; } }); -SplineCurve.fromJSON = function (data) -{ - return new SplineCurve(data.points); -}; - -module.exports = SplineCurve; +module.exports = PerspectiveCamera; /***/ }), -/* 221 */ -/***/ (function(module, exports) { +/* 214 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -39434,99 +40532,92 @@ module.exports = SplineCurve; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Arne16 = __webpack_require__(215); +var CanvasPool = __webpack_require__(19); +var GetValue = __webpack_require__(4); + /** - * @namespace Phaser.Display.Canvas.CanvasInterpolation + * [description] + * + * @function Phaser.Create.GenerateTexture * @since 3.0.0 + * + * @param {object} config - [description] + * + * @return {HTMLCanvasElement} [description] */ -var CanvasInterpolation = { +var GenerateTexture = function (config) +{ + var data = GetValue(config, 'data', []); + var canvas = GetValue(config, 'canvas', null); + var palette = GetValue(config, 'palette', Arne16); + var pixelWidth = GetValue(config, 'pixelWidth', 1); + var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); + var resizeCanvas = GetValue(config, 'resizeCanvas', true); + var clearCanvas = GetValue(config, 'clearCanvas', true); + var preRender = GetValue(config, 'preRender', null); + var postRender = GetValue(config, 'postRender', null); - /** - * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). - * - * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. - */ - setCrisp: function (canvas) - { - var types = [ 'optimizeSpeed', 'crisp-edges', '-moz-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'pixelated' ]; + var width = Math.floor(Math.abs(data[0].length * pixelWidth)); + var height = Math.floor(Math.abs(data.length * pixelHeight)); - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); + if (!canvas) + { + canvas = CanvasPool.create2D(this, width, height); + resizeCanvas = false; + clearCanvas = false; + } - canvas.style.msInterpolationMode = 'nearest-neighbor'; + if (resizeCanvas) + { + canvas.width = width; + canvas.height = height; + } - return canvas; - }, + var ctx = canvas.getContext('2d'); - /** - * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). - * - * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. - */ - setBicubic: function (canvas) + if (clearCanvas) { - canvas.style['image-rendering'] = 'auto'; - canvas.style.msInterpolationMode = 'bicubic'; - - return canvas; + ctx.clearRect(0, 0, width, height); } -}; - -module.exports = CanvasInterpolation; + // preRender Callback? + if (preRender) + { + preRender(canvas, ctx); + } + // Draw it + for (var y = 0; y < data.length; y++) + { + var row = data[y]; -/***/ }), -/* 222 */ -/***/ (function(module, exports, __webpack_require__) { + for (var x = 0; x < row.length; x++) + { + var d = row[x]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Display.Color - */ + if (d !== '.' && d !== ' ') + { + ctx.fillStyle = palette[d]; + ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); + } + } + } -var Color = __webpack_require__(36); + // postRender Callback? + if (postRender) + { + postRender(canvas, ctx); + } -Color.ColorToRGBA = __webpack_require__(484); -Color.ComponentToHex = __webpack_require__(223); -Color.GetColor = __webpack_require__(116); -Color.GetColor32 = __webpack_require__(201); -Color.HexStringToColor = __webpack_require__(200); -Color.HSLToColor = __webpack_require__(485); -Color.HSVColorWheel = __webpack_require__(487); -Color.HSVToRGB = __webpack_require__(225); -Color.HueToComponent = __webpack_require__(224); -Color.IntegerToColor = __webpack_require__(202); -Color.IntegerToRGB = __webpack_require__(203); -Color.Interpolate = __webpack_require__(488); -Color.ObjectToColor = __webpack_require__(204); -Color.RandomRGB = __webpack_require__(489); -Color.RGBStringToColor = __webpack_require__(205); -Color.RGBToHSV = __webpack_require__(490); -Color.RGBToString = __webpack_require__(491); -Color.ValueToColor = __webpack_require__(115); + return canvas; +}; -module.exports = Color; +module.exports = GenerateTexture; /***/ }), -/* 223 */ +/* 215 */ /***/ (function(module, exports) { /** @@ -39536,169 +40627,263 @@ module.exports = Color; */ /** - * Returns a string containing a hex representation of the given color component. - * - * @function Phaser.Display.Color.ComponentToHex + * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.ARNE16 * @since 3.0.0 - * - * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. - * - * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. + * + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ -var ComponentToHex = function (color) -{ - var hex = color.toString(16); - - return (hex.length === 1) ? '0' + hex : hex; +module.exports = { + 0: '#000', + 1: '#9D9D9D', + 2: '#FFF', + 3: '#BE2633', + 4: '#E06F8B', + 5: '#493C2B', + 6: '#A46422', + 7: '#EB8931', + 8: '#F7E26B', + 9: '#2F484E', + A: '#44891A', + B: '#A3CE27', + C: '#1B2632', + D: '#005784', + E: '#31A2F2', + F: '#B2DCEF' }; -module.exports = ComponentToHex; - /***/ }), -/* 224 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(module) {/** +/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(0); +var CubicBezier = __webpack_require__(217); +var Curve = __webpack_require__(52); +var Vector2 = __webpack_require__(6); + /** - * Converts a hue to an RGB color. - * Based on code by Michael Jackson (https://github.com/mjijackson) + * @classdesc + * [description] * - * @function Phaser.Display.Color.HueToComponent + * @class CubicBezierCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor * @since 3.0.0 * - * @param {number} p - * @param {number} q - * @param {number} t - * - * @return {number} The combined color value. + * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. + * @param {Phaser.Math.Vector2} p3 - End Point. */ -var HueToComponent = function (p, q, t) -{ - if (t < 0) - { - t += 1; - } +var CubicBezierCurve = new Class({ - if (t > 1) - { - t -= 1; - } + Extends: Curve, - if (t < 1 / 6) - { - return p + (q - p) * 6 * t; - } + initialize: - if (t < 1 / 2) + function CubicBezierCurve (p0, p1, p2, p3) { - return q; - } + Curve.call(this, 'CubicBezierCurve'); - if (t < 2 / 3) - { - return p + (q - p) * (2 / 3 - t) * 6; - } + if (Array.isArray(p0)) + { + p3 = new Vector2(p0[6], p0[7]); + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } - return p; -}; + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; -module.export = HueToComponent; + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(486)(module))) + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p2 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p2 = p2; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p3 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p3 = p3; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getStartPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} out - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -var GetColor = __webpack_require__(116); + return out.copy(this.p0); + }, -/** - * Converts an HSV (hue, saturation and value) color value to RGB. - * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes HSV values are contained in the set [0, 1]. - * Based on code by Michael Jackson (https://github.com/mjijackson) - * - * @function Phaser.Display.Color.HSVToRGB - * @since 3.0.0 - * - * @param {number} h - The hue, in the range 0 - 1. - * @param {number} s - The saturation, in the range 0 - 1. - * @param {number} v - The value, in the range 0 - 1. - * - * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var HSVToRGB = function (h, s, v) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) + { + return divisions; + }, - var i = Math.floor(h * 6); - var f = h * 6 - i; + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - var p = Math.floor((v * (1 - s)) * 255); - var q = Math.floor((v * (1 - f * s)) * 255); - var t = Math.floor((v * (1 - (1 - f) * s)) * 255); + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; + var p3 = this.p3; - v = Math.floor(v *= 255); + return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); + }, - var output = { r: v, g: v, b: v, color: 0 }; + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#draw + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] + */ + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } - var r = i % 6; + var points = this.getPoints(pointsTotal); - if (r === 0) - { - output.g = t; - output.b = p; - } - else if (r === 1) - { - output.r = q; - output.b = p; - } - else if (r === 2) - { - output.r = p; - output.b = t; - } - else if (r === 3) - { - output.r = p; - output.g = q; - } - else if (r === 4) - { - output.r = t; - output.g = p; - } - else if (r === 5) + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); + + for (var i = 1; i < points.length; i++) + { + graphics.lineTo(points[i].x, points[i].y); + } + + graphics.strokePath(); + + // So you can chain graphics calls + return graphics; + }, + + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () { - output.g = p; - output.b = q; + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y, + this.p3.x, this.p3.y + ] + }; } - output.color = GetColor(output.r, output.g, output.b); +}); - return output; +CubicBezierCurve.fromJSON = function (data) +{ + var points = data.points; + + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); + var p3 = new Vector2(points[6], points[7]); + + return new CubicBezierCurve(p0, p1, p2, p3); }; -module.exports = HSVToRGB; +module.exports = CubicBezierCurve; /***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { +/* 217 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -39706,74 +40891,62 @@ module.exports = HSVToRGB; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Linear = __webpack_require__(227); - -/** - * [description] - * - * @function Phaser.Math.Interpolation.Linear - * @since 3.0.0 - * - * @param {float} v - [description] - * @param {number} k - [description] - * - * @return {number} [description] - */ -var LinearInterpolation = function (v, k) +function P0 (t, p) { - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); + var k = 1 - t; - if (k < 0) - { - return Linear(v[0], v[1], f); - } + return k * k * k * p; +} - if (k > 1) - { - return Linear(v[m], v[m - 1], m - f); - } +function P1 (t, p) +{ + var k = 1 - t; - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); -}; + return 3 * k * k * t * p; +} -module.exports = LinearInterpolation; +function P2 (t, p) +{ + return 3 * (1 - t) * t * t * p; +} +function P3 (t, p) +{ + return t * t * t * p; +} -/***/ }), -/* 227 */ -/***/ (function(module, exports) { +// p0 = start point +// p1 = control point 1 +// p2 = control point 2 +// p3 = end point -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a /** * [description] * - * @function Phaser.Math.Linear + * @function Phaser.Math.Interpolation.CubicBezier * @since 3.0.0 * + * @param {float} t - [description] * @param {number} p0 - [description] * @param {number} p1 - [description] - * @param {float} t - [description] + * @param {number} p2 - [description] + * @param {number} p3 - [description] * * @return {number} [description] */ -var Linear = function (p0, p1, t) +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) { - return (p1 - p0) * t + p0; + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); }; -module.exports = Linear; +module.exports = CubicBezierInterpolation; /***/ }), -/* 228 */ -/***/ (function(module, exports) { +/* 218 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -39781,1253 +40954,1405 @@ module.exports = Linear; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var DegToRad = __webpack_require__(35); +var GetValue = __webpack_require__(4); +var RadToDeg = __webpack_require__(219); +var Vector2 = __webpack_require__(6); + /** + * @classdesc * [description] * - * @function Phaser.Math.Between + * @class EllipseCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor * @since 3.0.0 * - * @param {integer} min - [description] - * @param {integer} max - [description] - * - * @return {integer} [description] + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] + * @param {number} [xRadius=0] - [description] + * @param {number} [yRadius=0] - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=360] - [description] + * @param {boolean} [clockwise=false] - [description] + * @param {number} [rotation=0] - [description] */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -module.exports = Between; +var EllipseCurve = new Class({ + Extends: Curve, -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + { + if (typeof x === 'object') + { + var config = x; -var OS = __webpack_require__(67); + x = GetValue(config, 'x', 0); + y = GetValue(config, 'y', 0); + xRadius = GetValue(config, 'xRadius', 0); + yRadius = GetValue(config, 'yRadius', xRadius); + startAngle = GetValue(config, 'startAngle', 0); + endAngle = GetValue(config, 'endAngle', 360); + clockwise = GetValue(config, 'clockwise', false); + rotation = GetValue(config, 'rotation', 0); + } + else + { + if (yRadius === undefined) { yRadius = xRadius; } + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 360; } + if (clockwise === undefined) { clockwise = false; } + if (rotation === undefined) { rotation = 0; } + } -/** - * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. - * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. - * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. - * - * @function Phaser.DOM.DOMContentLoaded - * @since 3.0.0 - * - * @param {function} callback - The callback to be invoked when the device is ready and the DOM content is loaded. - */ -var DOMContentLoaded = function (callback) -{ - if (document.readyState === 'complete' || document.readyState === 'interactive') - { - callback(); + Curve.call(this, 'EllipseCurve'); - return; - } + // Center point - var check = function () - { - document.removeEventListener('deviceready', check, true); - document.removeEventListener('DOMContentLoaded', check, true); - window.removeEventListener('load', check, true); - - callback(); - }; - - if (!document.body) - { - window.setTimeout(check, 20); - } - else if (OS.cordova && !OS.cocoonJS) - { - // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready - document.addEventListener('deviceready', check, false); - } - else - { - document.addEventListener('DOMContentLoaded', check, true); - window.addEventListener('load', check, true); - } -}; - -module.exports = DOMContentLoaded; - - -/***/ }), -/* 230 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Takes the given data string and parses it as XML. - * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. - * The parsed XML object is returned, or `null` if there was an error while parsing the data. - * - * @function Phaser.DOM.ParseXML - * @since 3.0.0 - * - * @param {string} data - The XML source stored in a string. - * - * @return {any} The parsed XML data, or `null` if the data could not be parsed. - */ -var ParseXML = function (data) -{ - var xml = ''; - - try - { - if (window['DOMParser']) - { - var domparser = new DOMParser(); - xml = domparser.parseFromString(data, 'text/xml'); - } - else - { - xml = new ActiveXObject('Microsoft.XMLDOM'); - xml.loadXML(data); - } - } - catch (e) - { - xml = null; - } - - if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) - { - return null; - } - else - { - return xml; - } -}; - -module.exports = ParseXML; - - -/***/ }), -/* 231 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Attempts to remove the element from its parentNode in the DOM. - * - * @function Phaser.DOM.RemoveFromDOM - * @since 3.0.0 - * - * @param {any} element - The DOM element to remove from its parent node. - */ -var RemoveFromDOM = function (element) -{ - if (element.parentNode) - { - element.parentNode.removeChild(element); - } -}; - -module.exports = RemoveFromDOM; - - -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(3); - -/** - * @classdesc - * Abstracts away the use of RAF or setTimeOut for the core game update loop. - * This is invoked automatically by the Phaser.Game instance. - * - * @class RequestAnimationFrame - * @memberOf Phaser.DOM - * @constructor - * @since 3.0.0 - */ -var RequestAnimationFrame = new Class({ - - initialize: - - function RequestAnimationFrame () - { /** - * True if RequestAnimationFrame is running, otherwise false. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false + * @name {Phaser.MathPhaser.Curves.EllipseCurve#p0 + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.isRunning = false; + this.p0 = new Vector2(x, y); /** - * The callback to be invoked each step. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {function} + * @name Phaser.Curves.EllipseCurve#_xRadius + * @type {number} + * @private * @since 3.0.0 */ - this.callback = NOOP; + this._xRadius = xRadius; /** - * The most recent timestamp. Either a DOMHighResTimeStamp under RAF or `Date.now` under SetTimeout. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#tick - * @type {DOMHighResTimeStamp|number} - * @default 0 + * @name Phaser.Curves.EllipseCurve#_yRadius + * @type {number} + * @private * @since 3.0.0 */ - this.tick = 0; + this._yRadius = yRadius; - /** - * True if the step is using setTimeout instead of RAF. - * - * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isSetTimeOut = false; + // Radians /** - * The setTimeout or RAF callback ID used when canceling them. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#timeOutID - * @type {?number} - * @default null + * @name Phaser.Curves.EllipseCurve#_startAngle + * @type {number} + * @private * @since 3.0.0 */ - this.timeOutID = null; + this._startAngle = DegToRad(startAngle); /** - * The previous time the step was called. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#lastTime + * @name Phaser.Curves.EllipseCurve#_endAngle * @type {number} - * @default 0 + * @private * @since 3.0.0 */ - this.lastTime = 0; - - var _this = this; + this._endAngle = DegToRad(endAngle); /** - * The RAF step function. - * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. + * Anti-clockwise direction. * - * @name Phaser.DOM.RequestAnimationFrame#step - * @type {function} + * @name Phaser.Curves.EllipseCurve#_clockwise + * @type {boolean} + * @private * @since 3.0.0 */ - this.step = function step (timestamp) - { - // DOMHighResTimeStamp - _this.lastTime = _this.tick; - - _this.tick = timestamp; - - _this.callback(timestamp); - - _this.timeOutID = window.requestAnimationFrame(step); - }; + this._clockwise = clockwise; /** - * The SetTimeout step function. - * Updates the local tick value, invokes the callback and schedules another call to setTimeout. + * The rotation of the arc. * - * @name Phaser.DOM.RequestAnimationFrame#stepTimeout - * @type {function} + * @name Phaser.Curves.EllipseCurve#_rotation + * @type {number} + * @private * @since 3.0.0 */ - this.stepTimeout = function stepTimeout () - { - var d = Date.now(); - - var delay = Math.max(16 + _this.lastTime - d, 0); - - _this.lastTime = _this.tick; + this._rotation = DegToRad(rotation); + }, - _this.tick = d; + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - _this.callback(d); + return this.getPoint(0, out); + }, - _this.timeOutID = window.setTimeout(stepTimeout, delay); - }; + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) + { + return divisions * 2; }, /** - * Starts the requestAnimationFrame or setTimeout process running. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#start + * @method Phaser.Curves.EllipseCurve#getPoint * @since 3.0.0 * - * @param {function} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] */ - start: function (callback, forceSetTimeOut) + getPoint: function (t, out) { - if (this.isRunning) + if (out === undefined) { out = new Vector2(); } + + var twoPi = Math.PI * 2; + var deltaAngle = this._endAngle - this._startAngle; + var samePoints = Math.abs(deltaAngle) < Number.EPSILON; + + // ensures that deltaAngle is 0 .. 2 PI + while (deltaAngle < 0) { - return; + deltaAngle += twoPi; } - this.callback = callback; + while (deltaAngle > twoPi) + { + deltaAngle -= twoPi; + } - this.isSetTimeOut = forceSetTimeOut; + if (deltaAngle < Number.EPSILON) + { + if (samePoints) + { + deltaAngle = 0; + } + else + { + deltaAngle = twoPi; + } + } - this.isRunning = true; + if (this._clockwise && !samePoints) + { + if (deltaAngle === twoPi) + { + deltaAngle = - twoPi; + } + else + { + deltaAngle = deltaAngle - twoPi; + } + } - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + var angle = this._startAngle + t * deltaAngle; + var x = this.p0.x + this._xRadius * Math.cos(angle); + var y = this.p0.y + this._yRadius * Math.sin(angle); + + if (this._rotation !== 0) + { + var cos = Math.cos(this._rotation); + var sin = Math.sin(this._rotation); + + var tx = x - this.p0.x; + var ty = y - this.p0.y; + + // Rotate the point about the center of the ellipse. + x = tx * cos - ty * sin + this.p0.x; + y = tx * sin + ty * cos + this.p0.y; + } + + return out.set(x, y); }, /** - * Stops the requestAnimationFrame or setTimeout from running. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#stop + * @method Phaser.Curves.EllipseCurve#setXRadius * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - stop: function () + setXRadius: function (value) { - this.isRunning = false; + this.xRadius = value; - if (this.isSetTimeOut) - { - clearTimeout(this.timeOutID); - } - else - { - window.cancelAnimationFrame(this.timeOutID); - } + return this; }, /** - * Stops the step from running and clears the callback reference. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#destroy + * @method Phaser.Curves.EllipseCurve#setYRadius * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - destroy: function () + setYRadius: function (value) { - this.stop(); - - this.callback = NOOP; - } - -}); - -module.exports = RequestAnimationFrame; - + this.yRadius = value; -/***/ }), -/* 233 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setWidth + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setWidth: function (value) + { + this.xRadius = value * 2; -/** - * @namespace Phaser.Plugins - */ -var Plugins = { + return this; + }, /** - * These are the Global Managers that are created by the Phaser.Game instance. - * They are referenced from Scene.Systems so that plugins can use them. - * - * @name Phaser.Plugins.Global - * @type {array} + * [description] + * + * @method Phaser.Curves.EllipseCurve#setHeight * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - Global: [ - - 'anims', - 'cache', - 'registry', - 'sound', - 'textures' + setHeight: function (value) + { + this.yRadius = value * 2; - ], + return this; + }, /** - * These are the core plugins that are installed into every Scene.Systems instance, no matter what. - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are created in the order in which they appear in this array and EventEmitter is always first. - * - * @name Phaser.Plugins.CoreScene - * @type {array} + * [description] + * + * @method Phaser.Curves.EllipseCurve#setStartAngle * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - CoreScene: [ + setStartAngle: function (value) + { + this.startAngle = value; - 'EventEmitter', + return this; + }, - 'CameraManager', - 'GameObjectCreator', - 'GameObjectFactory', - 'ScenePlugin', - 'DisplayList', - 'UpdateList' + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setEndAngle + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setEndAngle: function (value) + { + this.endAngle = value; - ], + return this; + }, /** - * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. - * - * You can elect not to have these plugins by either creating a DefaultPlugins object as part - * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array - * and building your own bundle. - * - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are always created in the order in which they appear in the array. - * - * @name Phaser.Plugins.DefaultScene - * @type {array} + * [description] + * + * @method Phaser.Curves.EllipseCurve#setClockwise * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - DefaultScene: [ - - 'CameraManager3D', - 'Clock', - 'DataManagerPlugin', - 'InputPlugin', - 'Loader', - 'TweenManager', - 'LightsPlugin' + setClockwise: function (value) + { + this.clockwise = value; - ] + return this; + }, -}; + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setRotation + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setRotation: function (value) + { + this.rotation = value; -/* - * "Sometimes, the elegant implementation is just a function. - * Not a method. Not a class. Not a framework. Just a function." - * -- John Carmack - */ + return this; + }, -module.exports = Plugins; + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#x + * @type {number} + * @since 3.0.0 + */ + x: { + get: function () + { + return this.p0.x; + }, -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this.p0.x = value; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -var CanvasPool = __webpack_require__(21); + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#y + * @type {number} + * @since 3.0.0 + */ + y: { -/** - * Determines the canvas features of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.canvasFeatures` from within any Scene. - * - * @name Phaser.Device.CanvasFeatures - * @since 3.0.0 - * - * @type {object} - * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. - * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. - */ -var CanvasFeatures = { + get: function () + { + return this.p0.y; + }, - supportInverseAlpha: false, - supportNewBlendModes: false + set: function (value) + { + this.p0.y = value; + } -}; + }, -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#xRadius + * @type {number} + * @since 3.0.0 + */ + xRadius: { - var magenta = new Image(); + get: function () + { + return this._xRadius; + }, - magenta.onload = function () - { - var yellow = new Image(); + set: function (value) + { + this._xRadius = value; + } - yellow.onload = function () + }, + + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#yRadius + * @type {number} + * @since 3.0.0 + */ + yRadius: { + + get: function () { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); + return this._yRadius; + }, - context.globalCompositeOperation = 'multiply'; + set: function (value) + { + this._yRadius = value; + } - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); + }, - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#startAngle + * @type {number} + * @since 3.0.0 + */ + startAngle: { - var data = context.getImageData(2, 0, 1, 1).data; + get: function () + { + return RadToDeg(this._startAngle); + }, - CanvasPool.remove(yellow); + set: function (value) + { + this._startAngle = DegToRad(value); + } - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; + }, - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#endAngle + * @type {number} + * @since 3.0.0 + */ + endAngle: { - magenta.src = pngHead + 'AP804Oa6' + pngEnd; + get: function () + { + return RadToDeg(this._endAngle); + }, - return false; -} + set: function (value) + { + this._endAngle = DegToRad(value); + } -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); + }, - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#clockwise + * @type {number} + * @since 3.0.0 + */ + clockwise: { - // Draw a single pixel - context.fillRect(0, 0, 1, 1); + get: function () + { + return this._clockwise; + }, - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); + set: function (value) + { + this._clockwise = value; + } - if (s1 === null) - { - return false; - } + }, - // Plot them to x2 - context.putImageData(s1, 1, 0); + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#rotation + * @type {number} + * @since 3.0.0 + */ + rotation: { - // Get those values - var s2 = context.getImageData(1, 0, 1, 1); + get: function () + { + return this._rotation; + }, - // Compare and return - return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); -} + set: function (value) + { + this._rotation = DegToRad(value); + } -function init () -{ - if (document !== undefined) + }, + + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + return { + type: this.type, + x: this.p0.x, + y: this.p0.y, + xRadius: this._xRadius, + yRadius: this._yRadius, + startAngle: RadToDeg(this._startAngle), + endAngle: RadToDeg(this._endAngle), + clockwise: this._clockwise, + rotation: RadToDeg(this._rotation) + }; } - return CanvasFeatures; -} +}); -module.exports = init(); +EllipseCurve.fromJSON = function (data) +{ + return new EllipseCurve(data); +}; + +module.exports = EllipseCurve; /***/ }), -/* 235 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// 2.1.1 (Mar 17, 2016) - -/* -ISC License - -Copyright (c) 2016, Mapbox - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. +var CONST = __webpack_require__(16); -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. +/** + * [description] + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {float} radians - [description] + * + * @return {integer} [description] */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; +module.exports = RadToDeg; -module.exports = earcut; +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { -/* -vertices is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]. -holes is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11). -dimensions is the number of coordinates per vertice in the input array (2 by default). -Each group of three vertice indices in the resulting array forms a triangle. +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -function earcut(data, holeIndices, dim) { +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - dim = dim || 2; +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var FromPoints = __webpack_require__(122); +var Rectangle = __webpack_require__(8); +var Vector2 = __webpack_require__(6); - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; +var tmpVec2 = new Vector2(); - if (!outerNode) return triangles; +/** + * @classdesc + * [description] + * + * @class LineCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} p0 - [description] + * @param {Phaser.Math.Vector2} p1 - [description] + */ +var LineCurve = new Class({ - var minX, minY, maxX, maxY, x, y, size; + Extends: Curve, - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + initialize: - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; + // vec2s or array + function LineCurve (p0, p1) + { + Curve.call(this, 'LineCurve'); - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; + if (Array.isArray(p0)) + { + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); } - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); - } - - earcutLinked(outerNode, triangles, dim, minX, minY, size); - - return triangles; -} + /** + * [description] + * + * @name Phaser.Curves.LineCurve#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList(data, start, end, dim, clockwise) { - var i, last; + /** + * [description] + * + * @property Phaser.Curves.LineCurve#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; + }, - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getBounds + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } + return FromPoints([ this.p0, this.p1 ], out); + }, - return last; -} + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -// eliminate colinear or duplicate points -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; + return out.copy(this.p0); + }, - var p = start, - again; - do { - again = false; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getResolution + * @since 3.0.0 + * + * @return {integer} [description] + */ + getResolution: function () + { + return 1; + }, - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) return null; - again = true; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - } else { - p = p.next; + if (t === 1) + { + return out.copy(this.p1); } - } while (again || p !== end); - - return end; -} - -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { - if (!ear) return; - // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); + out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); - var stop = ear, - prev, next; + return out; + }, - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; + // Line curve is linear, so we can overwrite default getPointAt + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getPointAt + * @since 3.0.0 + * + * @param {[type]} u - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getTangent + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getTangent: function () + { + var tangent = tmpVec2.copy(this.p1).subtract(this.p0); - removeNode(ear); + return tangent.normalize(); + }, - // skipping the next vertice leads to less sliver triangles - ear = next.next; - stop = next.next; + // Override default Curve.draw because this is better than calling getPoints on a line! + /** + * [description] + * + * @method Phaser.Curves.LineCurve#draw + * @since 3.0.0 + * + * @param {[type]} graphics - [description] + * + * @return {[type]} [description] + */ + draw: function (graphics) + { + graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); - continue; - } + // So you can chain graphics calls + return graphics; + }, - ear = next; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#toJSON + * @since 3.0.0 + * + * @return {[type]} [description] + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y + ] + }; + } - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); +}); - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(ear, triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, size, 2); +LineCurve.fromJSON = function (data) +{ + var points = data.points; - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); - } + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); - break; - } - } -} + return new LineCurve(p0, p1); +}; -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; +module.exports = LineCurve; - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; +/***/ }), +/* 221 */ +/***/ (function(module, exports, __webpack_require__) { - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return true; -} +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var QuadraticBezierInterpolation = __webpack_require__(222); +var Vector2 = __webpack_require__(6); -function isEarHashed(ear, minX, minY, size) { - var a = ear.prev, - b = ear, - c = ear.next; +/** + * @classdesc + * [description] + * + * @class QuadraticBezier + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.2.0 + * + * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. + */ +var QuadraticBezier = new Class({ - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + Extends: Curve, - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + initialize: - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, size), - maxZ = zOrder(maxTX, maxTY, minX, minY, size); + function QuadraticBezier (p0, p1, p2) + { + Curve.call(this, 'QuadraticBezier'); - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; + if (Array.isArray(p0)) + { + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } - while (p && p.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.nextZ; - } + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p0 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p0 = p0; - // then look for points in decreasing z-order - p = ear.prevZ; + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p1 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p1 = p1; - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p2 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p2 = p2; + }, - return true; -} + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getStartPoint + * @since 3.2.0 + * + * @param {Phaser.Math.Vector2} out - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; + return out.copy(this.p0); + }, - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getResolution + * @since 3.2.0 + * + * @param {number} divisions - [description] + * + * @return {number} [description] + */ + getResolution: function (divisions) + { + return divisions; + }, - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getPoint + * @since 3.2.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - // remove two nodes involved - removeNode(p); - removeNode(p.next); + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; - p = start = b; - } - p = p.next; - } while (p !== start); + return out.set( + QuadraticBezierInterpolation(t, p0.x, p1.x, p2.x), + QuadraticBezierInterpolation(t, p0.y, p1.y, p2.y) + ); + }, - return p; -} + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#draw + * @since 3.2.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] + */ + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } -// try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); + var points = this.getPoints(pointsTotal); - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); - return; - } - b = b.next; + for (var i = 1; i < points.length; i++) + { + graphics.lineTo(points[i].x, points[i].y); } - a = a.next; - } while (a !== start); -} - -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } + graphics.strokePath(); - queue.sort(compareX); + // So you can chain graphics calls + return graphics; + }, - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#toJSON + * @since 3.2.0 + * + * @return {object} [description] + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y + ] + }; } - return outerNode; -} +}); -function compareX(a, b) { - return a.x - b.x; -} +QuadraticBezier.fromJSON = function (data) +{ + var points = data.points; -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - filterPoints(b, b.next); - } -} + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; + return new QuadraticBezier(p0, p1, p2); +}; - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) return p; - if (hy === p.next.y) return p.next; - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); +module.exports = QuadraticBezier; - if (!m) return null; - if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint +/***/ }), +/* 222 */ +/***/ (function(module, exports) { - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; +function P0 (t, p) +{ + var k = 1 - t; - p = m.next; + return k * k * p; +} - while (p !== stop) { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; +} - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential +function P2 (t, p) +{ + return t * t * p; +} - if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { - m = p; - tanMin = tan; - } - } +// p0 = start point +// p1 = control point 1 +// p2 = end point - p = p.next; - } +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - return m; -} +/** + * [description] + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {float} t - [description] + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {number} p2 - [description] + * + * @return {number} [description] + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; -// interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { - var p = start; - do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); +module.exports = QuadraticBezierInterpolation; - p.prevZ.nextZ = null; - p.prevZ = null; - sortLinked(p); -} +/***/ }), +/* 223 */ +/***/ (function(module, exports, __webpack_require__) { -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - do { - p = list; - list = null; - tail = null; - numMerges = 0; +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; - } - qSize = inSize; +var CatmullRom = __webpack_require__(123); +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var Vector2 = __webpack_require__(6); - while (pSize > 0 || (qSize > 0 && q)) { +/** + * @classdesc + * [description] + * + * @class SplineCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} [points] - [description] + */ +var SplineCurve = new Class({ - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } + Extends: Curve, - if (tail) tail.nextZ = e; - else list = e; + initialize: - e.prevZ = tail; - tail = e; - } + function SplineCurve (points) + { + if (points === undefined) { points = []; } - p = q; - } + Curve.call(this, 'SplineCurve'); - tail.nextZ = null; - inSize *= 2; + /** + * [description] + * + * @name Phaser.Curves.SplineCurve#points + * @type {Phaser.Math.Vector2[]} + * @default [] + * @since 3.0.0 + */ + this.points = []; - } while (numMerges > 1); + this.addPoints(points); + }, - return list; -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#addPoints + * @since 3.0.0 + * + * @param {[type]} points - [description] + * + * @return {[type]} [description] + */ + addPoints: function (points) + { + for (var i = 0; i < points.length; i++) + { + var p = new Vector2(); -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; + if (typeof points[i] === 'number') + { + p.x = points[i]; + p.y = points[i + 1]; + i++; + } + else if (Array.isArray(points[i])) + { + // An array of arrays? + p.x = points[i][0]; + p.y = points[i][1]; + } + else + { + p.x = points[i].x; + p.y = points[i].y; + } - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; + this.points.push(p); + } - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; + return this; + }, - return x | (y << 1); -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#addPoint + * @since 3.0.0 + * + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * + * @return {[type]} [description] + */ + addPoint: function (x, y) + { + var vec = new Vector2(x, y); -// find the leftmost node of a polygon ring -function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x) leftmost = p; - p = p.next; - } while (p !== start); + this.points.push(vec); - return leftmost; -} + return vec; + }, -// check if a point lies within a convex triangle -function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); -} + return out.copy(this.points[0]); + }, -// signed area of a triangle -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) + { + return divisions * this.points.length; + }, -// check if two points are equal -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } -// check if two segments intersect -function intersects(p1, q1, p2, q2) { - if ((equals(p1, q1) && equals(p2, q2)) || - (equals(p1, q2) && equals(p2, q1))) return true; - return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && - area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; -} + var points = this.points; -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); + var point = (points.length - 1) * t; - return false; -} + var intPoint = Math.floor(point); -// check if a polygon diagonal is locally inside the polygon -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} + var weight = point - intPoint; -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - inside = !inside; - p = p.next; - } while (p !== a); + var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; + var p1 = points[intPoint]; + var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; + var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; - return inside; -} + return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); + }, -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () + { + var points = []; - a.next = b; - b.prev = a; + for (var i = 0; i < this.points.length; i++) + { + points.push(this.points[i].x); + points.push(this.points[i].y); + } - a2.next = an; - an.prev = a2; + return { + type: this.type, + points: points + }; + } - b2.next = a2; - a2.prev = b2; +}); - bp.next = b2; - b2.prev = bp; +SplineCurve.fromJSON = function (data) +{ + return new SplineCurve(data.points); +}; - return b2; -} +module.exports = SplineCurve; -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode(i, x, y, last) { - var p = new Node(i, x, y); - if (!last) { - p.prev = p; - p.next = p; +/***/ }), +/* 224 */ +/***/ (function(module, exports) { - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} + /** + * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setCrisp: function (canvas) + { + var types = [ 'optimizeSpeed', 'crisp-edges', '-moz-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'pixelated' ]; -function Node(i, x, y) { - // vertice index in coordinates array - this.i = i; + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); - // vertex coordinates - this.x = x; - this.y = y; + canvas.style.msInterpolationMode = 'nearest-neighbor'; - // previous and next vertice nodes in a polygon ring - this.prev = null; - this.next = null; + return canvas; + }, - // z-order curve value - this.z = null; + /** + * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setBicubic: function (canvas) + { + canvas.style['image-rendering'] = 'auto'; + canvas.style.msInterpolationMode = 'bicubic'; - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; + return canvas; + } - // indicates whether this is a steiner point - this.steiner = false; -} +}; -// return a percentage difference between the polygon area and its triangulation area; -// used to verify correctness of triangulation -earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; +module.exports = CanvasInterpolation; - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } +/***/ }), +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); -}; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} +/** + * @namespace Phaser.Display.Color + */ -// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts -earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; +var Color = __webpack_require__(36); + +Color.ColorToRGBA = __webpack_require__(495); +Color.ComponentToHex = __webpack_require__(226); +Color.GetColor = __webpack_require__(117); +Color.GetColor32 = __webpack_require__(202); +Color.HexStringToColor = __webpack_require__(201); +Color.HSLToColor = __webpack_require__(496); +Color.HSVColorWheel = __webpack_require__(498); +Color.HSVToRGB = __webpack_require__(228); +Color.HueToComponent = __webpack_require__(227); +Color.IntegerToColor = __webpack_require__(203); +Color.IntegerToRGB = __webpack_require__(204); +Color.Interpolate = __webpack_require__(499); +Color.ObjectToColor = __webpack_require__(205); +Color.RandomRGB = __webpack_require__(500); +Color.RGBStringToColor = __webpack_require__(206); +Color.RGBToHSV = __webpack_require__(501); +Color.RGBToString = __webpack_require__(502); +Color.ValueToColor = __webpack_require__(116); + +module.exports = Color; - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - return result; -}; /***/ }), -/* 236 */ +/* 226 */ /***/ (function(module, exports) { /** @@ -41036,502 +42361,215 @@ earcut.flatten = function (data) { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ModelViewProjection = { +/** + * Returns a string containing a hex representation of the given color component. + * + * @function Phaser.Display.Color.ComponentToHex + * @since 3.0.0 + * + * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. + * + * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. + */ +var ComponentToHex = function (color) +{ + var hex = color.toString(16); - modelMatrixDirty: false, - viewMatrixDirty: false, - projectionMatrixDirty: false, - modelMatrix: null, - viewMatrix: null, - projectionMatrix: null, + return (hex.length === 1) ? '0' + hex : hex; +}; - mvpInit: function () - { - this.modelMatrixDirty = true; - this.viewMatrixDirty = true; - this.projectionMatrixDirty = true; - - this.modelMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.viewMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.projectionMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - return this; - }, +module.exports = ComponentToHex; - mvpUpdate: function () - { - var program = this.program; - if (this.modelMatrixDirty) - { - this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); - this.modelMatrixDirty = false; - } - - if (this.viewMatrixDirty) - { - this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - this.viewMatrixDirty = false; - } +/***/ }), +/* 227 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.projectionMatrixDirty) - { - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - this.projectionMatrixDirty = false; - } +/* WEBPACK VAR INJECTION */(function(module) {/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +/** + * Converts a hue to an RGB color. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.HueToComponent + * @since 3.0.0 + * + * @param {number} p + * @param {number} q + * @param {number} t + * + * @return {number} The combined color value. + */ +var HueToComponent = function (p, q, t) +{ + if (t < 0) + { + t += 1; + } - modelIdentity: function () + if (t > 1) { - var modelMatrix = this.modelMatrix; - - modelMatrix[0] = 1; - modelMatrix[1] = 0; - modelMatrix[2] = 0; - modelMatrix[3] = 0; - modelMatrix[4] = 0; - modelMatrix[5] = 1; - modelMatrix[6] = 0; - modelMatrix[7] = 0; - modelMatrix[8] = 0; - modelMatrix[9] = 0; - modelMatrix[10] = 1; - modelMatrix[11] = 0; - modelMatrix[12] = 0; - modelMatrix[13] = 0; - modelMatrix[14] = 0; - modelMatrix[15] = 1; + t -= 1; + } - this.modelMatrixDirty = true; - - return this; - }, - - modelScale: function (x, y, z) + if (t < 1 / 6) { - var modelMatrix = this.modelMatrix; - - modelMatrix[0] = modelMatrix[0] * x; - modelMatrix[1] = modelMatrix[1] * x; - modelMatrix[2] = modelMatrix[2] * x; - modelMatrix[3] = modelMatrix[3] * x; - modelMatrix[4] = modelMatrix[4] * y; - modelMatrix[5] = modelMatrix[5] * y; - modelMatrix[6] = modelMatrix[6] * y; - modelMatrix[7] = modelMatrix[7] * y; - modelMatrix[8] = modelMatrix[8] * z; - modelMatrix[9] = modelMatrix[9] * z; - modelMatrix[10] = modelMatrix[10] * z; - modelMatrix[11] = modelMatrix[11] * z; - - this.modelMatrixDirty = true; - - return this; - }, + return p + (q - p) * 6 * t; + } - modelTranslate: function (x, y, z) + if (t < 1 / 2) { - var modelMatrix = this.modelMatrix; - - modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; - modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; - modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; - modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - - this.modelMatrixDirty = true; - - return this; - }, + return q; + } - modelRotateX: function (radians) + if (t < 2 / 3) { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a10 = modelMatrix[4]; - var a11 = modelMatrix[5]; - var a12 = modelMatrix[6]; - var a13 = modelMatrix[7]; - var a20 = modelMatrix[8]; - var a21 = modelMatrix[9]; - var a22 = modelMatrix[10]; - var a23 = modelMatrix[11]; + return p + (q - p) * (2 / 3 - t) * 6; + } - modelMatrix[4] = a10 * c + a20 * s; - modelMatrix[5] = a11 * c + a21 * s; - modelMatrix[6] = a12 * c + a22 * s; - modelMatrix[7] = a13 * c + a23 * s; - modelMatrix[8] = a20 * c - a10 * s; - modelMatrix[9] = a21 * c - a11 * s; - modelMatrix[10] = a22 * c - a12 * s; - modelMatrix[11] = a23 * c - a13 * s; + return p; +}; - this.modelMatrixDirty = true; +module.export = HueToComponent; - return this; - }, +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(497)(module))) - modelRotateY: function (radians) - { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = modelMatrix[0]; - var a01 = modelMatrix[1]; - var a02 = modelMatrix[2]; - var a03 = modelMatrix[3]; - var a20 = modelMatrix[8]; - var a21 = modelMatrix[9]; - var a22 = modelMatrix[10]; - var a23 = modelMatrix[11]; +/***/ }), +/* 228 */ +/***/ (function(module, exports, __webpack_require__) { - modelMatrix[0] = a00 * c - a20 * s; - modelMatrix[1] = a01 * c - a21 * s; - modelMatrix[2] = a02 * c - a22 * s; - modelMatrix[3] = a03 * c - a23 * s; - modelMatrix[8] = a00 * s + a20 * c; - modelMatrix[9] = a01 * s + a21 * c; - modelMatrix[10] = a02 * s + a22 * c; - modelMatrix[11] = a03 * s + a23 * c; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.modelMatrixDirty = true; - - return this; - }, +var GetColor = __webpack_require__(117); - modelRotateZ: function (radians) - { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = modelMatrix[0]; - var a01 = modelMatrix[1]; - var a02 = modelMatrix[2]; - var a03 = modelMatrix[3]; - var a10 = modelMatrix[4]; - var a11 = modelMatrix[5]; - var a12 = modelMatrix[6]; - var a13 = modelMatrix[7]; +/** + * Converts an HSV (hue, saturation and value) color value to RGB. + * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes HSV values are contained in the set [0, 1]. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.HSVToRGB + * @since 3.0.0 + * + * @param {number} h - The hue, in the range 0 - 1. + * @param {number} s - The saturation, in the range 0 - 1. + * @param {number} v - The value, in the range 0 - 1. + * + * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. + */ +var HSVToRGB = function (h, s, v) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } - modelMatrix[0] = a00 * c + a10 * s; - modelMatrix[1] = a01 * c + a11 * s; - modelMatrix[2] = a02 * c + a12 * s; - modelMatrix[3] = a03 * c + a13 * s; - modelMatrix[4] = a10 * c - a00 * s; - modelMatrix[5] = a11 * c - a01 * s; - modelMatrix[6] = a12 * c - a02 * s; - modelMatrix[7] = a13 * c - a03 * s; + var i = Math.floor(h * 6); + var f = h * 6 - i; - this.modelMatrixDirty = true; + var p = Math.floor((v * (1 - s)) * 255); + var q = Math.floor((v * (1 - f * s)) * 255); + var t = Math.floor((v * (1 - (1 - f) * s)) * 255); - return this; - }, + v = Math.floor(v *= 255); - viewIdentity: function () - { - var viewMatrix = this.viewMatrix; - - viewMatrix[0] = 1; - viewMatrix[1] = 0; - viewMatrix[2] = 0; - viewMatrix[3] = 0; - viewMatrix[4] = 0; - viewMatrix[5] = 1; - viewMatrix[6] = 0; - viewMatrix[7] = 0; - viewMatrix[8] = 0; - viewMatrix[9] = 0; - viewMatrix[10] = 1; - viewMatrix[11] = 0; - viewMatrix[12] = 0; - viewMatrix[13] = 0; - viewMatrix[14] = 0; - viewMatrix[15] = 1; + var output = { r: v, g: v, b: v, color: 0 }; - this.viewMatrixDirty = true; - - return this; - }, + var r = i % 6; - viewScale: function (x, y, z) + if (r === 0) { - var viewMatrix = this.viewMatrix; - - viewMatrix[0] = viewMatrix[0] * x; - viewMatrix[1] = viewMatrix[1] * x; - viewMatrix[2] = viewMatrix[2] * x; - viewMatrix[3] = viewMatrix[3] * x; - viewMatrix[4] = viewMatrix[4] * y; - viewMatrix[5] = viewMatrix[5] * y; - viewMatrix[6] = viewMatrix[6] * y; - viewMatrix[7] = viewMatrix[7] * y; - viewMatrix[8] = viewMatrix[8] * z; - viewMatrix[9] = viewMatrix[9] * z; - viewMatrix[10] = viewMatrix[10] * z; - viewMatrix[11] = viewMatrix[11] * z; - - this.viewMatrixDirty = true; - - return this; - }, - - viewTranslate: function (x, y, z) + output.g = t; + output.b = p; + } + else if (r === 1) { - var viewMatrix = this.viewMatrix; - - viewMatrix[12] = viewMatrix[0] * x + viewMatrix[4] * y + viewMatrix[8] * z + viewMatrix[12]; - viewMatrix[13] = viewMatrix[1] * x + viewMatrix[5] * y + viewMatrix[9] * z + viewMatrix[13]; - viewMatrix[14] = viewMatrix[2] * x + viewMatrix[6] * y + viewMatrix[10] * z + viewMatrix[14]; - viewMatrix[15] = viewMatrix[3] * x + viewMatrix[7] * y + viewMatrix[11] * z + viewMatrix[15]; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateX: function (radians) + output.r = q; + output.b = p; + } + else if (r === 2) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a10 = viewMatrix[4]; - var a11 = viewMatrix[5]; - var a12 = viewMatrix[6]; - var a13 = viewMatrix[7]; - var a20 = viewMatrix[8]; - var a21 = viewMatrix[9]; - var a22 = viewMatrix[10]; - var a23 = viewMatrix[11]; - - viewMatrix[4] = a10 * c + a20 * s; - viewMatrix[5] = a11 * c + a21 * s; - viewMatrix[6] = a12 * c + a22 * s; - viewMatrix[7] = a13 * c + a23 * s; - viewMatrix[8] = a20 * c - a10 * s; - viewMatrix[9] = a21 * c - a11 * s; - viewMatrix[10] = a22 * c - a12 * s; - viewMatrix[11] = a23 * c - a13 * s; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateY: function (radians) + output.r = p; + output.b = t; + } + else if (r === 3) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = viewMatrix[0]; - var a01 = viewMatrix[1]; - var a02 = viewMatrix[2]; - var a03 = viewMatrix[3]; - var a20 = viewMatrix[8]; - var a21 = viewMatrix[9]; - var a22 = viewMatrix[10]; - var a23 = viewMatrix[11]; - - viewMatrix[0] = a00 * c - a20 * s; - viewMatrix[1] = a01 * c - a21 * s; - viewMatrix[2] = a02 * c - a22 * s; - viewMatrix[3] = a03 * c - a23 * s; - viewMatrix[8] = a00 * s + a20 * c; - viewMatrix[9] = a01 * s + a21 * c; - viewMatrix[10] = a02 * s + a22 * c; - viewMatrix[11] = a03 * s + a23 * c; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateZ: function (radians) + output.r = p; + output.g = q; + } + else if (r === 4) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = viewMatrix[0]; - var a01 = viewMatrix[1]; - var a02 = viewMatrix[2]; - var a03 = viewMatrix[3]; - var a10 = viewMatrix[4]; - var a11 = viewMatrix[5]; - var a12 = viewMatrix[6]; - var a13 = viewMatrix[7]; - - viewMatrix[0] = a00 * c + a10 * s; - viewMatrix[1] = a01 * c + a11 * s; - viewMatrix[2] = a02 * c + a12 * s; - viewMatrix[3] = a03 * c + a13 * s; - viewMatrix[4] = a10 * c - a00 * s; - viewMatrix[5] = a11 * c - a01 * s; - viewMatrix[6] = a12 * c - a02 * s; - viewMatrix[7] = a13 * c - a03 * s; - - this.viewMatrixDirty = true; - - return this; - }, - - viewLoad2D: function (matrix2D) + output.r = t; + output.g = p; + } + else if (r === 5) { - var vm = this.viewMatrix; - - vm[0] = matrix2D[0]; - vm[1] = matrix2D[1]; - vm[2] = 0.0; - vm[3] = 0.0; - vm[4] = matrix2D[2]; - vm[5] = matrix2D[3]; - vm[6] = 0.0; - vm[7] = 0.0; - vm[8] = matrix2D[4]; - vm[9] = matrix2D[5]; - vm[10] = 1.0; - vm[11] = 0.0; - vm[12] = 0.0; - vm[13] = 0.0; - vm[14] = 0.0; - vm[15] = 1.0; - - this.viewMatrixDirty = true; + output.g = p; + output.b = q; + } - return this; - }, + output.color = GetColor(output.r, output.g, output.b); - viewLoad: function (matrix) - { - var vm = this.viewMatrix; + return output; +}; - vm[0] = matrix[0]; - vm[1] = matrix[1]; - vm[2] = matrix[2]; - vm[3] = matrix[3]; - vm[4] = matrix[4]; - vm[5] = matrix[5]; - vm[6] = matrix[6]; - vm[7] = matrix[7]; - vm[8] = matrix[8]; - vm[9] = matrix[9]; - vm[10] = matrix[10]; - vm[11] = matrix[11]; - vm[12] = matrix[12]; - vm[13] = matrix[13]; - vm[14] = matrix[14]; - vm[15] = matrix[15]; +module.exports = HSVToRGB; - this.viewMatrixDirty = true; - return this; - }, +/***/ }), +/* 229 */ +/***/ (function(module, exports, __webpack_require__) { - projIdentity: function () - { - var projectionMatrix = this.projectionMatrix; - - projectionMatrix[0] = 1; - projectionMatrix[1] = 0; - projectionMatrix[2] = 0; - projectionMatrix[3] = 0; - projectionMatrix[4] = 0; - projectionMatrix[5] = 1; - projectionMatrix[6] = 0; - projectionMatrix[7] = 0; - projectionMatrix[8] = 0; - projectionMatrix[9] = 0; - projectionMatrix[10] = 1; - projectionMatrix[11] = 0; - projectionMatrix[12] = 0; - projectionMatrix[13] = 0; - projectionMatrix[14] = 0; - projectionMatrix[15] = 1; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.projectionMatrixDirty = true; +var Linear = __webpack_require__(230); - return this; - }, +/** + * [description] + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * + * @param {float} v - [description] + * @param {number} k - [description] + * + * @return {number} [description] + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); - projOrtho: function (left, right, bottom, top, near, far) + if (k < 0) { - var projectionMatrix = this.projectionMatrix; - var leftRight = 1.0 / (left - right); - var bottomTop = 1.0 / (bottom - top); - var nearFar = 1.0 / (near - far); - - projectionMatrix[0] = -2.0 * leftRight; - projectionMatrix[1] = 0.0; - projectionMatrix[2] = 0.0; - projectionMatrix[3] = 0.0; - projectionMatrix[4] = 0.0; - projectionMatrix[5] = -2.0 * bottomTop; - projectionMatrix[6] = 0.0; - projectionMatrix[7] = 0.0; - projectionMatrix[8] = 0.0; - projectionMatrix[9] = 0.0; - projectionMatrix[10] = 2.0 * nearFar; - projectionMatrix[11] = 0.0; - projectionMatrix[12] = (left + right) * leftRight; - projectionMatrix[13] = (top + bottom) * bottomTop; - projectionMatrix[14] = (far + near) * nearFar; - projectionMatrix[15] = 1.0; - - this.projectionMatrixDirty = true; - return this; - }, + return Linear(v[0], v[1], f); + } - projPersp: function (fovy, aspectRatio, near, far) + if (k > 1) { - var projectionMatrix = this.projectionMatrix; - var fov = 1.0 / Math.tan(fovy / 2.0); - var nearFar = 1.0 / (near - far); - - projectionMatrix[0] = fov / aspectRatio; - projectionMatrix[1] = 0.0; - projectionMatrix[2] = 0.0; - projectionMatrix[3] = 0.0; - projectionMatrix[4] = 0.0; - projectionMatrix[5] = fov; - projectionMatrix[6] = 0.0; - projectionMatrix[7] = 0.0; - projectionMatrix[8] = 0.0; - projectionMatrix[9] = 0.0; - projectionMatrix[10] = (far + near) * nearFar; - projectionMatrix[11] = -1.0; - projectionMatrix[12] = 0.0; - projectionMatrix[13] = 0.0; - projectionMatrix[14] = (2.0 * far * near) * nearFar; - projectionMatrix[15] = 0.0; - - this.projectionMatrixDirty = true; - return this; + return Linear(v[m], v[m - 1], m - f); } + + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); }; -module.exports = ModelViewProjection; +module.exports = LinearInterpolation; /***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { +/* 230 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -41539,395 +42577,202 @@ module.exports = ModelViewProjection; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var ShaderSourceFS = __webpack_require__(514); -var TextureTintPipeline = __webpack_require__(238); - -var LIGHT_COUNT = 10; - /** - * @classdesc * [description] * - * @class ForwardDiffuseLightPipeline - * @extends Phaser.Renderer.WebGL.TextureTintPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor + * @function Phaser.Math.Linear * @since 3.0.0 * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {float} t - [description] + * + * @return {number} [description] */ -var ForwardDiffuseLightPipeline = new Class({ +var Linear = function (p0, p1, t) +{ + return (p1 - p0) * t + p0; +}; - Extends: TextureTintPipeline, +module.exports = Linear; - initialize: - function ForwardDiffuseLightPipeline (game, gl, renderer) - { - TextureTintPipeline.call(this, game, gl, renderer, ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString())); - }, +/***/ }), +/* 231 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] - */ - onBind: function () - { - TextureTintPipeline.prototype.onBind.call(this); - - var renderer = this.renderer; - var program = this.program; - - this.mvpUpdate(); - - renderer.setInt1(program, 'uNormSampler', 1); - renderer.setFloat2(program, 'uResolution', this.width, this.height); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] - */ - onRender: function (scene, camera) - { - var lightManager = scene.lights; - - lightManager.culledLights.length = 0; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (lightManager.lights.length <= 0 || !lightManager.active) - { - return this; // If not visible lights just passthrough - } +/** + * [description] + * + * @function Phaser.Math.Between + * @since 3.0.0 + * + * @param {integer} min - [description] + * @param {integer} max - [description] + * + * @return {integer} [description] + */ +var Between = function (min, max) +{ + return Math.floor(Math.random() * (max - min + 1) + min); +}; - var renderer = this.renderer; - var program = this.program; - var lights = scene.lights.cull(camera); - var lightCount = Math.min(lights.length, LIGHT_COUNT); - var cameraMatrix = camera.matrix; - var point = {x: 0, y: 0}; - var height = renderer.height; - var index; +module.exports = Between; - for (index = 0; index < LIGHT_COUNT; ++index) - { - renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); // reset lights - } - if (lightCount <= 0) { return this; } +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { - renderer.setFloat4(program, 'uCamera', camera.x, camera.y, camera.rotation, camera.zoom); - renderer.setFloat3(program, 'uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (index = 0; index < lightCount; ++index) - { - var light = lights[index]; - var lightName = 'uLights[' + index + '].'; - cameraMatrix.transformPoint(light.x, light.y, point); - renderer.setFloat2(program, lightName + 'position', point.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (point.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); - renderer.setFloat3(program, lightName + 'color', light.r, light.g, light.b); - renderer.setFloat1(program, lightName + 'intensity', light.intensity); - renderer.setFloat1(program, lightName + 'radius', light.radius); - } - - return this; - }, +var OS = __webpack_require__(67); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawStaticTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawStaticTilemapLayer: function (tilemap, camera) +/** + * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. + * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. + * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. + * + * @function Phaser.DOM.DOMContentLoaded + * @since 3.0.0 + * + * @param {function} callback - The callback to be invoked when the device is ready and the DOM content is loaded. + */ +var DOMContentLoaded = function (callback) +{ + if (document.readyState === 'complete' || document.readyState === 'interactive') { - var normalTexture = tilemap.texture.dataSource[0]; + callback(); - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawStaticTilemapLayer.call(this, tilemap, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. StaticTilemapLayer rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawStaticTilemapLayer(tilemap, camera); - } - }, + return; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawEmitterManager - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawEmitterManager: function (emitterManager, camera) + var check = function () { - var normalTexture = emitterManager.texture.dataSource[0]; + document.removeEventListener('deviceready', check, true); + document.removeEventListener('DOMContentLoaded', check, true); + window.removeEventListener('load', check, true); - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawEmitterManager.call(this, emitterManager, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. EmitterManager rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawEmitterManager(emitterManager, camera); - } - }, + callback(); + }; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawBlitter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawBlitter: function (blitter, camera) + if (!document.body) { - var normalTexture = blitter.texture.dataSource[0]; - - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawBlitter.call(this, blitter, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Blitter rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawBlitter(blitter, camera); - } - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchSprite: function (sprite, camera) + window.setTimeout(check, 20); + } + else if (OS.cordova && !OS.cocoonJS) { - var normalTexture = sprite.texture.dataSource[0]; - - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Sprite rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchSprite(sprite, camera); - } - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchMesh - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchMesh: function (mesh, camera) + // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready + document.addEventListener('deviceready', check, false); + } + else { - var normalTexture = mesh.texture.dataSource[0]; - - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchMesh.call(this, mesh, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Mesh rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchMesh(mesh, camera); + document.addEventListener('DOMContentLoaded', check, true); + window.addEventListener('load', check, true); + } +}; - } - }, +module.exports = DOMContentLoaded; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchBitmapText: function (bitmapText, camera) - { - var normalTexture = bitmapText.texture.dataSource[0]; - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchBitmapText.call(this, bitmapText, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. BitmapText rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchBitmapText(bitmapText, camera); - } - }, +/***/ }), +/* 233 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchDynamicBitmapText: function (bitmapText, camera) - { - var normalTexture = bitmapText.texture.dataSource[0]; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchDynamicBitmapText.call(this, bitmapText, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. DynamicBitmapText rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchDynamicBitmapText(bitmapText, camera); - } - }, +/** + * Takes the given data string and parses it as XML. + * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. + * The parsed XML object is returned, or `null` if there was an error while parsing the data. + * + * @function Phaser.DOM.ParseXML + * @since 3.0.0 + * + * @param {string} data - The XML source stored in a string. + * + * @return {any} The parsed XML data, or `null` if the data could not be parsed. + */ +var ParseXML = function (data) +{ + var xml = ''; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchText: function (text, camera) + try { - var normalTexture = text.texture.dataSource[0]; - - if (normalTexture) + if (window['DOMParser']) { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchText.call(this, text, camera); + var domparser = new DOMParser(); + xml = domparser.parseFromString(data, 'text/xml'); } else { - console.warn('Normal map texture missing for using Light2D pipeline. Text rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchText(text, camera); + xml = new ActiveXObject('Microsoft.XMLDOM'); + xml.loadXML(data); } - }, + } + catch (e) + { + xml = null; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchDynamicTilemapLayer: function (tilemapLayer, camera) + if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) { - var normalTexture = tilemapLayer.texture.dataSource[0]; + return null; + } + else + { + return xml; + } +}; - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchDynamicTilemapLayer.call(this, tilemapLayer, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. DynamicTilemapLayer rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchDynamicTilemapLayer(tilemapLayer, camera); - } - }, +module.exports = ParseXML; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchTileSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchTileSprite: function (tileSprite, camera) - { - var normalTexture = tileSprite.texture.dataSource[0]; - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchTileSprite.call(this, tileSprite, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. TileSprite rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchTileSprite(tileSprite, camera); - } - } +/***/ }), +/* 234 */ +/***/ (function(module, exports) { -}); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; +/** + * Attempts to remove the element from its parentNode in the DOM. + * + * @function Phaser.DOM.RemoveFromDOM + * @since 3.0.0 + * + * @param {any} element - The DOM element to remove from its parent node. + */ +var RemoveFromDOM = function (element) +{ + if (element.parentNode) + { + element.parentNode.removeChild(element); + } +}; -module.exports = ForwardDiffuseLightPipeline; +module.exports = RemoveFromDOM; /***/ }), -/* 238 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41937,1722 +42782,1581 @@ module.exports = ForwardDiffuseLightPipeline; */ var Class = __webpack_require__(0); -var ModelViewProjection = __webpack_require__(236); -var ShaderSourceFS = __webpack_require__(515); -var ShaderSourceVS = __webpack_require__(516); -var Utils = __webpack_require__(42); -var WebGLPipeline = __webpack_require__(126); +var NOOP = __webpack_require__(3); /** * @classdesc - * [description] + * Abstracts away the use of RAF or setTimeOut for the core game update loop. + * This is invoked automatically by the Phaser.Game instance. * - * @class TextureTintPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL + * @class RequestAnimationFrame + * @memberOf Phaser.DOM * @constructor * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] - * @param {boolean} overrideFragmentShader - [description] */ -var TextureTintPipeline = new Class({ - - Extends: WebGLPipeline, - - Mixins: [ - ModelViewProjection - ], +var RequestAnimationFrame = new Class({ initialize: - function TextureTintPipeline (game, gl, renderer, overrideFragmentShader) + function RequestAnimationFrame () { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: (overrideFragmentShader ? overrideFragmentShader : ShaderSourceFS), - vertexCapacity: 6 * 2000, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2 + - Float32Array.BYTES_PER_ELEMENT * 2 + - Uint8Array.BYTES_PER_ELEMENT * 4, - - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: Float32Array.BYTES_PER_ELEMENT * 2 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: Float32Array.BYTES_PER_ELEMENT * 4 - } - ] - }); - /** - * [description] + * True if RequestAnimationFrame is running, otherwise false. * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewF32 - * @type {Float32Array} + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false * @since 3.0.0 */ - this.vertexViewF32 = new Float32Array(this.vertexData); + this.isRunning = false; /** - * [description] + * The callback to be invoked each step. * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewU32 - * @type {Uint32Array} + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {function} * @since 3.0.0 */ - this.vertexViewU32 = new Uint32Array(this.vertexData); + this.callback = NOOP; /** - * [description] + * The most recent timestamp. Either a DOMHighResTimeStamp under RAF or `Date.now` under SetTimeout. * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#maxQuads - * @type {integer} - * @default 2000 + * @name Phaser.DOM.RequestAnimationFrame#tick + * @type {DOMHighResTimeStamp|number} + * @default 0 * @since 3.0.0 */ - this.maxQuads = 2000; + this.tick = 0; /** - * [description] + * True if the step is using setTimeout instead of RAF. * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#batches - * @type {array} - * @since 3.1.0 + * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut + * @type {boolean} + * @default false + * @since 3.0.0 */ - this.batches = []; + this.isSetTimeOut = false; - this.mvpInit(); + /** + * The setTimeout or RAF callback ID used when canceling them. + * + * @name Phaser.DOM.RequestAnimationFrame#timeOutID + * @type {?number} + * @default null + * @since 3.0.0 + */ + this.timeOutID = null; + + /** + * The previous time the step was called. + * + * @name Phaser.DOM.RequestAnimationFrame#lastTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; + + var _this = this; + + /** + * The RAF step function. + * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. + * + * @name Phaser.DOM.RequestAnimationFrame#step + * @type {function} + * @since 3.0.0 + */ + this.step = function step (timestamp) + { + // DOMHighResTimeStamp + _this.lastTime = _this.tick; + + _this.tick = timestamp; + + _this.callback(timestamp); + + _this.timeOutID = window.requestAnimationFrame(step); + }; + + /** + * The SetTimeout step function. + * Updates the local tick value, invokes the callback and schedules another call to setTimeout. + * + * @name Phaser.DOM.RequestAnimationFrame#stepTimeout + * @type {function} + * @since 3.0.0 + */ + this.stepTimeout = function stepTimeout () + { + var d = Date.now(); + + var delay = Math.max(16 + _this.lastTime - d, 0); + + _this.lastTime = _this.tick; + + _this.tick = d; + + _this.callback(d); + + _this.timeOutID = window.setTimeout(stepTimeout, delay); + }; }, /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#setTexture2D - * @since 3.1.0 + * Starts the requestAnimationFrame or setTimeout process running. * - * @param {WebGLTexture} texture - [description] - * @param {integer} textureUnit - [description] + * @method Phaser.DOM.RequestAnimationFrame#start + * @since 3.0.0 * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + * @param {function} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? */ - setTexture2D: function (texture, unit) + start: function (callback, forceSetTimeOut) { - if (!texture) + if (this.isRunning) { - return this; + return; } - var batches = this.batches; + this.callback = callback; - if (batches.length === 0) - { - this.pushBatch(); - } + this.isSetTimeOut = forceSetTimeOut; - var batch = batches[batches.length - 1]; + this.isRunning = true; - if (unit > 0) - { - if (batch.textures[unit - 1] && - batch.textures[unit - 1] !== texture) - { - this.pushBatch(); - } + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + }, - batches[batches.length - 1].textures[unit - 1] = texture; + /** + * Stops the requestAnimationFrame or setTimeout from running. + * + * @method Phaser.DOM.RequestAnimationFrame#stop + * @since 3.0.0 + */ + stop: function () + { + this.isRunning = false; + + if (this.isSetTimeOut) + { + clearTimeout(this.timeOutID); } else { - if (batch.texture !== null && - batch.texture !== texture) - { - this.pushBatch(); - } - - batches[batches.length - 1].texture = texture; + window.cancelAnimationFrame(this.timeOutID); } - - return this; }, /** - * [description] + * Stops the step from running and clears the callback reference. * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#pushBatch - * @since 3.1.0 + * @method Phaser.DOM.RequestAnimationFrame#destroy + * @since 3.0.0 */ - pushBatch: function () + destroy: function () { - var batch = { - first: this.vertexCount, - texture: null, - textures: [] - }; + this.stop(); - this.batches.push(batch); - }, + this.callback = NOOP; + } + +}); + +module.exports = RequestAnimationFrame; + + +/***/ }), +/* 236 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Plugins + */ +var Plugins = { /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#flush - * @since 3.1.0 + * These are the Global Managers that are created by the Phaser.Game instance. + * They are referenced from Scene.Systems so that plugins can use them. + * + * @name Phaser.Plugins.Global + * @type {array} + * @since 3.0.0 */ - flush: function () - { - if (this.flushLocked) - { - return this; - } - - this.flushLocked = true; + Global: [ - var gl = this.gl; - var renderer = this.renderer; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - var batches = this.batches; - var batchCount = batches.length; - var batchVertexCount = 0; - var batch = null; - var batchNext; - var textureIndex; - var nTexture; + 'anims', + 'cache', + 'registry', + 'sound', + 'textures' - if (batchCount === 0 || vertexCount === 0) - { - this.flushLocked = false; - return this; - } + ], - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + /** + * These are the core plugins that are installed into every Scene.Systems instance, no matter what. + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are created in the order in which they appear in this array and EventEmitter is always first. + * + * @name Phaser.Plugins.CoreScene + * @type {array} + * @since 3.0.0 + */ + CoreScene: [ - for (var index = 0; index < batches.length - 1; ++index) - { - batch = batches[index]; - batchNext = batches[index + 1]; + 'EventEmitter', - if (batch.textures.length > 0) - { - for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) - { - nTexture = batch.textures[textureIndex]; + 'CameraManager', + 'GameObjectCreator', + 'GameObjectFactory', + 'ScenePlugin', + 'DisplayList', + 'UpdateList' - if (nTexture) - { - renderer.setTexture2D(nTexture, 1 + textureIndex); - } - } + ], - gl.activeTexture(gl.TEXTURE0); - } + /** + * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. + * + * You can elect not to have these plugins by either creating a DefaultPlugins object as part + * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array + * and building your own bundle. + * + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are always created in the order in which they appear in the array. + * + * @name Phaser.Plugins.DefaultScene + * @type {array} + * @since 3.0.0 + */ + DefaultScene: [ - batchVertexCount = batchNext.first - batch.first; + 'CameraManager3D', + 'Clock', + 'DataManagerPlugin', + 'InputPlugin', + 'Loader', + 'TweenManager', + 'LightsPlugin' - if (batch.texture === null || batchVertexCount <= 0) { continue; } + ] - renderer.setTexture2D(batch.texture, 0); - gl.drawArrays(topology, batch.first, batchVertexCount); - } +}; - // Left over data - batch = batches[batches.length - 1]; +/* + * "Sometimes, the elegant implementation is just a function. + * Not a method. Not a class. Not a framework. Just a function." + * -- John Carmack + */ - if (batch.textures.length > 0) - { - for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) - { - nTexture = batch.textures[textureIndex]; +module.exports = Plugins; - if (nTexture) - { - renderer.setTexture2D(nTexture, 1 + textureIndex); - } - } - gl.activeTexture(gl.TEXTURE0); - } +/***/ }), +/* 237 */ +/***/ (function(module, exports, __webpack_require__) { - batchVertexCount = vertexCount - batch.first; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (batch.texture && batchVertexCount > 0) - { - renderer.setTexture2D(batch.texture, 0); - gl.drawArrays(topology, batch.first, batchVertexCount); - } +var CanvasPool = __webpack_require__(19); - this.vertexCount = 0; - batches.length = 0; - this.pushBatch(); - this.flushLocked = false; +/** + * Determines the canvas features of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.canvasFeatures` from within any Scene. + * + * @name Phaser.Device.CanvasFeatures + * @since 3.0.0 + * + * @type {object} + * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. + * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. + */ +var CanvasFeatures = { - return this; - }, + supportInverseAlpha: false, + supportNewBlendModes: false - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] - */ - onBind: function () - { - WebGLPipeline.prototype.onBind.call(this); - this.mvpUpdate(); +}; - if (this.batches.length === 0) - { - this.pushBatch(); - } +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - return this; - }, + var magenta = new Image(); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] - */ - resize: function (width, height, resolution) + magenta.onload = function () { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); - return this; - }, + var yellow = new Image(); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawStaticTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawStaticTilemapLayer: function (tilemap) - { - if (tilemap.vertexCount > 0) + yellow.onload = function () { - var pipelineVertexBuffer = this.vertexBuffer; - var gl = this.gl; - var renderer = this.renderer; - var frame = tilemap.tileset.image.get(); + var canvas = CanvasPool.create(yellow, 6, 1); + var context = canvas.getContext('2d'); - if (renderer.currentPipeline && - renderer.currentPipeline.vertexCount > 0) + context.globalCompositeOperation = 'multiply'; + + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + if (!context.getImageData(2, 0, 1, 1)) { - renderer.flush(); + return false; } - this.vertexBuffer = tilemap.vertexBuffer; - renderer.setPipeline(this); - renderer.setTexture2D(frame.source.glTexture, 0); - gl.drawArrays(this.topology, 0, tilemap.vertexCount); - this.vertexBuffer = pipelineVertexBuffer; - } + var data = context.getImageData(2, 0, 1, 1).data; - this.viewIdentity(); - this.modelIdentity(); - }, + CanvasPool.remove(yellow); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawEmitterManager - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawEmitterManager: function (emitterManager, camera) - { - this.renderer.setPipeline(this); + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; - var emitters = emitterManager.emitters.list; - var emitterCount = emitters.length; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var maxQuads = this.maxQuads; - var cameraScrollX = camera.scrollX; - var cameraScrollY = camera.scrollY; - var cameraMatrix = camera.matrix.matrix; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var sin = Math.sin; - var cos = Math.cos; - var vertexComponentCount = this.vertexComponentCount; - var vertexCapacity = this.vertexCapacity; - var texture = emitterManager.defaultFrame.source.glTexture; + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; - this.setTexture2D(texture, 0); - - for (var emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex) - { - var emitter = emitters[emitterIndex]; - var particles = emitter.alive; - var aliveLength = particles.length; - var batchCount = Math.ceil(aliveLength / maxQuads); - var particleOffset = 0; - var scrollX = cameraScrollX * emitter.scrollFactorX; - var scrollY = cameraScrollY * emitter.scrollFactorY; + magenta.src = pngHead + 'AP804Oa6' + pngEnd; - if (!emitter.visible || aliveLength === 0) - { - continue; - } + return false; +} - renderer.setBlendMode(emitter.blendMode); +function checkInverseAlpha () +{ + var canvas = CanvasPool.create(this, 2, 1); + var context = canvas.getContext('2d'); - if (this.vertexCount >= vertexCapacity) - { - this.flush(); - this.setTexture2D(texture, 0); - } + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; - for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) - { - var batchSize = Math.min(aliveLength, maxQuads); + // Draw a single pixel + context.fillRect(0, 0, 1, 1); - for (var index = 0; index < batchSize; ++index) - { - var particle = particles[particleOffset + index]; + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); - if (particle.alpha <= 0) - { - continue; - } + if (s1 === null) + { + return false; + } - var frame = particle.frame; - var uvs = frame.uvs; - var x = -(frame.halfWidth); - var y = -(frame.halfHeight); - var color = particle.color; - var xw = x + frame.width; - var yh = y + frame.height; - var sr = sin(particle.rotation); - var cr = cos(particle.rotation); - var sra = cr * particle.scaleX; - var srb = -sr * particle.scaleX; - var src = sr * particle.scaleY; - var srd = cr * particle.scaleY; - var sre = particle.x - scrollX * particle.scrollFactorX; - var srf = particle.y - scrollY * particle.scrollFactorY; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = this.vertexCount * vertexComponentCount; + // Plot them to x2 + context.putImageData(s1, 1, 0); - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = color; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = color; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = color; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = color; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = color; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = color; + // Get those values + var s2 = context.getImageData(1, 0, 1, 1); - this.vertexCount += 6; - } + // Compare and return + return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); +} - particleOffset += batchSize; - aliveLength -= batchSize; +function init () +{ + if (document !== undefined) + { + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } - if (this.vertexCount >= vertexCapacity) - { - this.flush(); - this.setTexture2D(texture, 0); - } - } - } - - this.setTexture2D(texture, 0); - }, + return CanvasFeatures; +} - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawBlitter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawBlitter: function (blitter, camera) - { - this.renderer.setPipeline(this); +module.exports = init(); - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var list = blitter.getRenderList(); - var length = list.length; - var cameraMatrix = camera.matrix.matrix; - var a = cameraMatrix[0]; - var b = cameraMatrix[1]; - var c = cameraMatrix[2]; - var d = cameraMatrix[3]; - var e = cameraMatrix[4]; - var f = cameraMatrix[5]; - var cameraScrollX = camera.scrollX * blitter.scrollFactorX; - var cameraScrollY = camera.scrollY * blitter.scrollFactorY; - var batchCount = Math.ceil(length / this.maxQuads); - var batchOffset = 0; - var blitterX = blitter.x - cameraScrollX; - var blitterY = blitter.y - cameraScrollY; - for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) - { - var batchSize = Math.min(length, this.maxQuads); +/***/ }), +/* 238 */ +/***/ (function(module, exports, __webpack_require__) { - for (var index = 0; index < batchSize; ++index) - { - var bob = list[batchOffset + index]; - var frame = bob.frame; - var alpha = bob.alpha; - var tint = getTint(0xffffff, alpha); - var uvs = frame.uvs; - var flipX = bob.flipX; - var flipY = bob.flipY; - var width = frame.width * (flipX ? -1.0 : 1.0); - var height = frame.height * (flipY ? -1.0 : 1.0); - var x = blitterX + bob.x + frame.x + (frame.width * ((flipX) ? 1.0 : 0.0)); - var y = blitterY + bob.y + frame.y + (frame.height * ((flipY) ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var tx0 = x * a + y * c + e; - var ty0 = x * b + y * d + f; - var tx1 = xw * a + yh * c + e; - var ty1 = xw * b + yh * d + f; - - // Bind Texture if texture wasn't bound. - // This needs to be here because of multiple - // texture atlas. - this.setTexture2D(frame.texture.source[frame.sourceIndex].glTexture, 0); +"use strict"; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var vertexOffset = this.vertexCount * this.vertexComponentCount; - - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = tint; - vertexViewF32[vertexOffset + 5] = tx0; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = tint; - vertexViewF32[vertexOffset + 10] = tx1; - vertexViewF32[vertexOffset + 11] = ty1; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = tint; - vertexViewF32[vertexOffset + 20] = tx1; - vertexViewF32[vertexOffset + 21] = ty1; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = tint; - vertexViewF32[vertexOffset + 25] = tx1; - vertexViewF32[vertexOffset + 26] = ty0; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = tint; +// 2.1.1 (Mar 17, 2016) - this.vertexCount += 6; +/* +ISC License - if (this.vertexCount >= this.vertexCapacity) - { - this.flush(); - } - } +Copyright (c) 2016, Mapbox - batchOffset += batchSize; - length -= batchSize; +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. - if (this.vertexCount >= this.vertexCapacity) - { - this.flush(); - } - } - }, +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchSprite: function (sprite, camera) - { - this.renderer.setPipeline(this); - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = sprite.frame; - var texture = frame.texture.source[frame.sourceIndex].glTexture; - var forceFlipY = (texture.isRenderTexture ? true : false); - var flipX = sprite.flipX; - var flipY = sprite.flipY ^ forceFlipY; - var uvs = frame.uvs; - var width = frame.width * (flipX ? -1.0 : 1.0); - var height = frame.height * (flipY ? -1.0 : 1.0); - var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0)); - var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var translateX = sprite.x - camera.scrollX * sprite.scrollFactorX; - var translateY = sprite.y - camera.scrollY * sprite.scrollFactorY; - var scaleX = sprite.scaleX; - var scaleY = sprite.scaleY; - var rotation = -sprite.rotation; - var alphaTL = sprite._alphaTL; - var alphaTR = sprite._alphaTR; - var alphaBL = sprite._alphaBL; - var alphaBR = sprite._alphaBR; - var tintTL = sprite._tintTL; - var tintTR = sprite._tintTR; - var tintBL = sprite._tintBL; - var tintBR = sprite._tintBR; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vTintTL = getTint(tintTL, alphaTL); - var vTintTR = getTint(tintTR, alphaTR); - var vTintBL = getTint(tintBL, alphaBL); - var vTintBR = getTint(tintBR, alphaBR); - var vertexOffset = 0; +module.exports = earcut; - this.setTexture2D(texture, 0); +/* +vertices is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]. +holes is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11). +dimensions is the number of coordinates per vertice in the input array (2 by default). +Each group of three vertice indices in the resulting array forms a triangle. + */ - vertexOffset = this.vertexCount * this.vertexComponentCount; +function earcut(data, holeIndices, dim) { - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = vTintTR; + dim = dim || 2; - this.vertexCount += 6; - }, + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchMesh - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchMesh: function (mesh, camera) - { - var vertices = mesh.vertices; - var length = vertices.length; - var vertexCount = (length / 2)|0; + if (!outerNode) return triangles; - this.renderer.setPipeline(this); + var minX, minY, maxX, maxY, x, y, size; - if (this.vertexCount + vertexCount > this.vertexCapacity) - { - this.flush(); + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; } - var getTint = Utils.getTintAppendFloatAlpha; - var uvs = mesh.uv; - var colors = mesh.colors; - var alphas = mesh.alphas; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = mesh.frame; - var texture = mesh.texture.source[frame.sourceIndex].glTexture; - var translateX = mesh.x - camera.scrollX * mesh.scrollFactorX; - var translateY = mesh.y - camera.scrollY * mesh.scrollFactorY; - var scaleX = mesh.scaleX; - var scaleY = mesh.scaleY; - var rotation = -mesh.rotation; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var vertexOffset = 0; + // minX, minY and size are later used to transform coords into integers for z-order calculation + size = Math.max(maxX - minX, maxY - minY); + } - this.setTexture2D(texture, 0); + earcutLinked(outerNode, triangles, dim, minX, minY, size); - vertexOffset = this.vertexCount * this.vertexComponentCount; + return triangles; +} - for (var index = 0, index0 = 0; index < length; index += 2) - { - var x = vertices[index + 0]; - var y = vertices[index + 1]; - var tx = x * mva + y * mvc + mve; - var ty = x * mvb + y * mvd + mvf; +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; - vertexViewF32[vertexOffset + 0] = tx; - vertexViewF32[vertexOffset + 1] = ty; - vertexViewF32[vertexOffset + 2] = uvs[index + 0]; - vertexViewF32[vertexOffset + 3] = uvs[index + 1]; - vertexViewU32[vertexOffset + 4] = getTint(colors[index0], alphas[index0]); + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } - vertexOffset += 5; - index0 += 1; - } + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } - this.vertexCount += vertexCount; - }, + return last; +} - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchBitmapText: function (bitmapText, camera) - { - this.renderer.setPipeline(this); +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) return null; + again = true; + + } else { + p = p.next; } + } while (again || p !== end); - var text = bitmapText.text; - var textLength = text.length; - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var cameraWidth = camera.width + 50; - var cameraHeight = camera.height + 50; - var cameraX = -50; - var cameraY = -50; - var frame = bitmapText.frame; - var textureSource = bitmapText.texture.source[frame.sourceIndex]; - var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; - var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; - var fontData = bitmapText.fontData; - var lineHeight = fontData.lineHeight; - var scale = (bitmapText.fontSize / fontData.size); - var chars = fontData.chars; - var alpha = bitmapText.alpha; - var vTintTL = getTint(bitmapText._tintTL, alpha); - var vTintTR = getTint(bitmapText._tintTR, alpha); - var vTintBL = getTint(bitmapText._tintBL, alpha); - var vTintBR = getTint(bitmapText._tintBR, alpha); - var srcX = bitmapText.x; - var srcY = bitmapText.y; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = textureSource.width; - var textureHeight = textureSource.height; - var texture = textureSource.glTexture; - var xAdvance = 0; - var yAdvance = 0; - var indexCount = 0; - var charCode = 0; - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - var x = 0; - var y = 0; - var xw = 0; - var yh = 0; + return end; +} - var tx0; - var ty0; - var tx1; - var ty1; - var tx2; - var ty2; - var tx3; - var ty3; +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { + if (!ear) return; - var umin = 0; - var umax = 0; - var vmin = 0; - var vmax = 0; - var lastGlyph = null; - var lastCharCode = 0; - var translateX = (srcX - cameraScrollX) + frame.x; - var translateY = (srcY - cameraScrollY) + frame.y; - var rotation = -bitmapText.rotation; - var scaleX = bitmapText.scaleX; - var scaleY = bitmapText.scaleY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var vertexOffset = 0; + // interlink polygon nodes in z-order + if (!pass && size) indexCurve(ear, minX, minY, size); - this.setTexture2D(texture, 0); + var stop = ear, + prev, next; - for (var index = 0; index < textLength; ++index) - { - charCode = text.charCodeAt(index); + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; + if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, size, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, size); } - glyph = chars[charCode]; + break; + } + } +} - if (!glyph) - { - continue; +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, size) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, size), + maxZ = zOrder(maxTX, maxTY, minX, minY, size); + + // first look for points inside the triangle in increasing z-order + var p = ear.nextZ; + + while (p && p.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.nextZ; + } + + // then look for points in decreasing z-order + p = ear.prevZ; + + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, size) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, size); + earcutLinked(c, triangles, dim, minX, minY, size); + return; } + b = b.next; + } + a = a.next; + } while (a !== start); +} - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; - glyphW = glyph.width; - glyphH = glyph.height; + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } - x = (indexCount + glyph.xOffset + xAdvance) * scale; - y = (glyph.yOffset + yAdvance) * scale; + queue.sort(compareX); - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; + } + m = p.x < p.next.x ? p : p.next; } + } + p = p.next; + } while (p !== outerNode); - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; + if (!m) return null; - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; } + } - x -= bitmapText.displayOriginX; - y -= bitmapText.displayOriginY; + p = p.next; + } - xw = x + glyphW * scale; - yh = y + glyphH * scale; - tx0 = x * mva + y * mvc + mve; - ty0 = x * mvb + y * mvd + mvf; - tx1 = x * mva + yh * mvc + mve; - ty1 = x * mvb + yh * mvd + mvf; - tx2 = xw * mva + yh * mvc + mve; - ty2 = xw * mvb + yh * mvd + mvf; - tx3 = xw * mva + y * mvc + mve; - ty3 = xw * mvb + y * mvd + mvf; + return m; +} - umin = glyphX / textureWidth; - umax = (glyphX + glyphW) / textureWidth; - vmin = glyphY / textureHeight; - vmax = (glyphY + glyphH) / textureHeight; +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, size) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); - if ((tx0 < cameraX || tx0 > cameraWidth || ty0 < cameraY || ty0 > cameraHeight) && - (tx1 < cameraX || tx1 > cameraWidth || ty1 < cameraY || ty1 > cameraHeight) && - (tx2 < cameraX || tx2 > cameraWidth || ty2 < cameraY || ty2 > cameraHeight) && - (tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight)) - { - continue; + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; } + qSize = inSize; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; } - - vertexOffset = this.vertexCount * this.vertexComponentCount; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = umin; - vertexViewF32[vertexOffset + 3] = vmin; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = umin; - vertexViewF32[vertexOffset + 8] = vmax; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = umax; - vertexViewF32[vertexOffset + 13] = vmax; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = umin; - vertexViewF32[vertexOffset + 18] = vmin; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = umax; - vertexViewF32[vertexOffset + 23] = vmax; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = umax; - vertexViewF32[vertexOffset + 28] = vmin; - vertexViewU32[vertexOffset + 29] = vTintTR; - - this.vertexCount += 6; + p = q; } - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicBitmapText: function (bitmapText, camera) - { - this.renderer.setPipeline(this); + tail.nextZ = null; + inSize *= 2; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and size of the data bounding box +function zOrder(x, y, minX, minY, size) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) / size; + y = 32767 * (y - minY) / size; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertice index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertice nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); } + } - var displayCallback = bitmapText.displayCallback; - var text = bitmapText.text; - var textLength = text.length; - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = bitmapText.frame; - var textureSource = bitmapText.texture.source[frame.sourceIndex]; - var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; - var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; - var scrollX = bitmapText.scrollX; - var scrollY = bitmapText.scrollY; - var fontData = bitmapText.fontData; - var lineHeight = fontData.lineHeight; - var scale = (bitmapText.fontSize / fontData.size); - var chars = fontData.chars; - var alpha = bitmapText.alpha; - var vTintTL = getTint(bitmapText._tintTL, alpha); - var vTintTR = getTint(bitmapText._tintTR, alpha); - var vTintBL = getTint(bitmapText._tintBL, alpha); - var vTintBR = getTint(bitmapText._tintBR, alpha); - var srcX = bitmapText.x; - var srcY = bitmapText.y; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = textureSource.width; - var textureHeight = textureSource.height; - var texture = textureSource.glTexture; - var xAdvance = 0; - var yAdvance = 0; - var indexCount = 0; - var charCode = 0; - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - var x = 0; - var y = 0; - var xw = 0; - var tx0; - var ty0; - var tx1; - var ty1; - var tx2; - var ty2; - var tx3; - var ty3; - var yh = 0; - var umin = 0; - var umax = 0; - var vmin = 0; - var vmax = 0; - var lastGlyph = null; - var lastCharCode = 0; - var translateX = srcX + frame.x; - var translateY = srcY + frame.y; - var rotation = -bitmapText.rotation; - var scaleX = bitmapText.scaleX; - var scaleY = bitmapText.scaleY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var crop = (bitmapText.cropWidth > 0 || bitmapText.cropHeight > 0); - var uta, utb, utc, utd, ute, utf; - var vertexOffset = 0; + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; + +/***/ }), +/* 239 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ModelViewProjection = { + + modelMatrixDirty: false, + viewMatrixDirty: false, + projectionMatrixDirty: false, + modelMatrix: null, + viewMatrix: null, + projectionMatrix: null, + + mvpInit: function () + { + this.modelMatrixDirty = true; + this.viewMatrixDirty = true; + this.projectionMatrixDirty = true; + + this.modelMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + this.viewMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + this.projectionMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + return this; + }, - this.setTexture2D(texture, 0); + mvpUpdate: function () + { + var program = this.program; - if (crop) + if (this.modelMatrixDirty) { - renderer.pushScissor( - bitmapText.x, - bitmapText.y, - bitmapText.cropWidth * bitmapText.scaleX, - bitmapText.cropHeight * bitmapText.scaleY - ); + this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); + this.modelMatrixDirty = false; + } + + if (this.viewMatrixDirty) + { + this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); + this.viewMatrixDirty = false; } - for (var index = 0; index < textLength; ++index) + if (this.projectionMatrixDirty) { - scale = (bitmapText.fontSize / bitmapText.fontData.size); - rotation = 0; + this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); + this.projectionMatrixDirty = false; + } - charCode = text.charCodeAt(index); + return this; + }, - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; - } + modelIdentity: function () + { + var modelMatrix = this.modelMatrix; + + modelMatrix[0] = 1; + modelMatrix[1] = 0; + modelMatrix[2] = 0; + modelMatrix[3] = 0; + modelMatrix[4] = 0; + modelMatrix[5] = 1; + modelMatrix[6] = 0; + modelMatrix[7] = 0; + modelMatrix[8] = 0; + modelMatrix[9] = 0; + modelMatrix[10] = 1; + modelMatrix[11] = 0; + modelMatrix[12] = 0; + modelMatrix[13] = 0; + modelMatrix[14] = 0; + modelMatrix[15] = 1; - glyph = chars[charCode]; + this.modelMatrixDirty = true; + + return this; + }, - if (!glyph) - { - continue; - } + modelScale: function (x, y, z) + { + var modelMatrix = this.modelMatrix; - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; + modelMatrix[0] = modelMatrix[0] * x; + modelMatrix[1] = modelMatrix[1] * x; + modelMatrix[2] = modelMatrix[2] * x; + modelMatrix[3] = modelMatrix[3] * x; + modelMatrix[4] = modelMatrix[4] * y; + modelMatrix[5] = modelMatrix[5] * y; + modelMatrix[6] = modelMatrix[6] * y; + modelMatrix[7] = modelMatrix[7] * y; + modelMatrix[8] = modelMatrix[8] * z; + modelMatrix[9] = modelMatrix[9] * z; + modelMatrix[10] = modelMatrix[10] * z; + modelMatrix[11] = modelMatrix[11] * z; + + this.modelMatrixDirty = true; - glyphW = glyph.width; - glyphH = glyph.height; - - x = (indexCount + glyph.xOffset + xAdvance) - scrollX; - y = (glyph.yOffset + yAdvance) - scrollY; + return this; + }, - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } + modelTranslate: function (x, y, z) + { + var modelMatrix = this.modelMatrix; - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; + modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; + modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; + modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; + modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } + this.modelMatrixDirty = true; - if (displayCallback) - { - var output = displayCallback({ - color: 0, - tint: { - topLeft: vTintTL, - topRight: vTintTR, - bottomLeft: vTintBL, - bottomRight: vTintBR - }, - index: index, - charCode: charCode, - x: x, - y: y, - scale: scale, - rotation: 0, - data: glyph.data - }); + return this; + }, - x = output.x; - y = output.y; - scale = output.scale; - rotation = output.rotation; + modelRotateX: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a10 = modelMatrix[4]; + var a11 = modelMatrix[5]; + var a12 = modelMatrix[6]; + var a13 = modelMatrix[7]; + var a20 = modelMatrix[8]; + var a21 = modelMatrix[9]; + var a22 = modelMatrix[10]; + var a23 = modelMatrix[11]; - if (output.color) - { - vTintTL = output.color; - vTintTR = output.color; - vTintBL = output.color; - vTintBR = output.color; - } - else - { - vTintTL = output.tint.topLeft; - vTintTR = output.tint.topRight; - vTintBL = output.tint.bottomLeft; - vTintBR = output.tint.bottomRight; - } + modelMatrix[4] = a10 * c + a20 * s; + modelMatrix[5] = a11 * c + a21 * s; + modelMatrix[6] = a12 * c + a22 * s; + modelMatrix[7] = a13 * c + a23 * s; + modelMatrix[8] = a20 * c - a10 * s; + modelMatrix[9] = a21 * c - a11 * s; + modelMatrix[10] = a22 * c - a12 * s; + modelMatrix[11] = a23 * c - a13 * s; - vTintTL = getTint(vTintTL, alpha); - vTintTR = getTint(vTintTR, alpha); - vTintBL = getTint(vTintBL, alpha); - vTintBR = getTint(vTintBR, alpha); - } + this.modelMatrixDirty = true; - x -= bitmapText.displayOriginX; - y -= bitmapText.displayOriginY; - x *= scale; - y *= scale; - x -= cameraScrollX; - y -= cameraScrollY; + return this; + }, - sr = Math.sin(-rotation); - cr = Math.cos(-rotation); - uta = cr * scale; - utb = -sr * scale; - utc = sr * scale; - utd = cr * scale; - ute = x; - utf = y; + modelRotateY: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = modelMatrix[0]; + var a01 = modelMatrix[1]; + var a02 = modelMatrix[2]; + var a03 = modelMatrix[3]; + var a20 = modelMatrix[8]; + var a21 = modelMatrix[9]; + var a22 = modelMatrix[10]; + var a23 = modelMatrix[11]; - sra = uta * mva + utb * mvc; - srb = uta * mvb + utb * mvd; - src = utc * mva + utd * mvc; - srd = utc * mvb + utd * mvd; - sre = ute * mva + utf * mvc + mve; - srf = ute * mvb + utf * mvd + mvf; + modelMatrix[0] = a00 * c - a20 * s; + modelMatrix[1] = a01 * c - a21 * s; + modelMatrix[2] = a02 * c - a22 * s; + modelMatrix[3] = a03 * c - a23 * s; + modelMatrix[8] = a00 * s + a20 * c; + modelMatrix[9] = a01 * s + a21 * c; + modelMatrix[10] = a02 * s + a22 * c; + modelMatrix[11] = a03 * s + a23 * c; - xw = glyphW; - yh = glyphH; - tx0 = sre; - ty0 = srf; - tx1 = yh * src + sre; - ty1 = yh * srd + srf; - tx2 = xw * sra + yh * src + sre; - ty2 = xw * srb + yh * srd + srf; - tx3 = xw * sra + sre; - ty3 = xw * srb + srf; + this.modelMatrixDirty = true; + + return this; + }, - umin = glyphX / textureWidth; - umax = (glyphX + glyphW) / textureWidth; - vmin = glyphY / textureHeight; - vmax = (glyphY + glyphH) / textureHeight; + modelRotateZ: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = modelMatrix[0]; + var a01 = modelMatrix[1]; + var a02 = modelMatrix[2]; + var a03 = modelMatrix[3]; + var a10 = modelMatrix[4]; + var a11 = modelMatrix[5]; + var a12 = modelMatrix[6]; + var a13 = modelMatrix[7]; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - vertexOffset = this.vertexCount * this.vertexComponentCount; + modelMatrix[0] = a00 * c + a10 * s; + modelMatrix[1] = a01 * c + a11 * s; + modelMatrix[2] = a02 * c + a12 * s; + modelMatrix[3] = a03 * c + a13 * s; + modelMatrix[4] = a10 * c - a00 * s; + modelMatrix[5] = a11 * c - a01 * s; + modelMatrix[6] = a12 * c - a02 * s; + modelMatrix[7] = a13 * c - a03 * s; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = umin; - vertexViewF32[vertexOffset + 3] = vmin; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = umin; - vertexViewF32[vertexOffset + 8] = vmax; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = umax; - vertexViewF32[vertexOffset + 13] = vmax; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = umin; - vertexViewF32[vertexOffset + 18] = vmin; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = umax; - vertexViewF32[vertexOffset + 23] = vmax; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = umax; - vertexViewF32[vertexOffset + 28] = vmin; - vertexViewU32[vertexOffset + 29] = vTintTR; + this.modelMatrixDirty = true; + + return this; + }, + + viewIdentity: function () + { + var viewMatrix = this.viewMatrix; - this.vertexCount += 6; - } + viewMatrix[0] = 1; + viewMatrix[1] = 0; + viewMatrix[2] = 0; + viewMatrix[3] = 0; + viewMatrix[4] = 0; + viewMatrix[5] = 1; + viewMatrix[6] = 0; + viewMatrix[7] = 0; + viewMatrix[8] = 0; + viewMatrix[9] = 0; + viewMatrix[10] = 1; + viewMatrix[11] = 0; + viewMatrix[12] = 0; + viewMatrix[13] = 0; + viewMatrix[14] = 0; + viewMatrix[15] = 1; - if (crop) - { - renderer.popScissor(); - } + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchText: function (text, camera) + viewScale: function (x, y, z) { - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; - this.batchTexture( - text, - text.canvasTexture, - text.canvasTexture.width, text.canvasTexture.height, - text.x, text.y, - text.canvasTexture.width, text.canvasTexture.height, - text.scaleX, text.scaleY, - text.rotation, - text.flipX, text.flipY, - text.scrollFactorX, text.scrollFactorY, - text.displayOriginX, text.displayOriginY, - 0, 0, text.canvasTexture.width, text.canvasTexture.height, - getTint(text._tintTL, text._alphaTL), - getTint(text._tintTR, text._alphaTR), - getTint(text._tintBL, text._alphaBL), - getTint(text._tintBR, text._alphaBR), - 0, 0, - camera - ); + viewMatrix[0] = viewMatrix[0] * x; + viewMatrix[1] = viewMatrix[1] * x; + viewMatrix[2] = viewMatrix[2] * x; + viewMatrix[3] = viewMatrix[3] * x; + viewMatrix[4] = viewMatrix[4] * y; + viewMatrix[5] = viewMatrix[5] * y; + viewMatrix[6] = viewMatrix[6] * y; + viewMatrix[7] = viewMatrix[7] * y; + viewMatrix[8] = viewMatrix[8] * z; + viewMatrix[9] = viewMatrix[9] * z; + viewMatrix[10] = viewMatrix[10] * z; + viewMatrix[11] = viewMatrix[11] * z; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicTilemapLayer: function (tilemapLayer, camera) + viewTranslate: function (x, y, z) { - var renderTiles = tilemapLayer.culledTiles; - var length = renderTiles.length; - var texture = tilemapLayer.tileset.image.get().source.glTexture; - var tileset = tilemapLayer.tileset; - var scrollFactorX = tilemapLayer.scrollFactorX; - var scrollFactorY = tilemapLayer.scrollFactorY; - var alpha = tilemapLayer.alpha; - var x = tilemapLayer.x; - var y = tilemapLayer.y; - var sx = tilemapLayer.scaleX; - var sy = tilemapLayer.scaleY; - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; - for (var index = 0; index < length; ++index) - { - var tile = renderTiles[index]; + viewMatrix[12] = viewMatrix[0] * x + viewMatrix[4] * y + viewMatrix[8] * z + viewMatrix[12]; + viewMatrix[13] = viewMatrix[1] * x + viewMatrix[5] * y + viewMatrix[9] * z + viewMatrix[13]; + viewMatrix[14] = viewMatrix[2] * x + viewMatrix[6] * y + viewMatrix[10] * z + viewMatrix[14]; + viewMatrix[15] = viewMatrix[3] * x + viewMatrix[7] * y + viewMatrix[11] * z + viewMatrix[15]; - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); - if (tileTexCoords === null) { continue; } + this.viewMatrixDirty = true; - var frameWidth = tile.width; - var frameHeight = tile.height; - var frameX = tileTexCoords.x; - var frameY = tileTexCoords.y; - var tint = getTint(tile.tint, alpha * tile.alpha); + return this; + }, - this.batchTexture( - tilemapLayer, - texture, - texture.width, texture.height, - (tile.width / 2) + x + tile.pixelX * sx, (tile.height / 2) + y + tile.pixelY * sy, - tile.width * sx, tile.height * sy, - 1, 1, - tile.rotation, - tile.flipX, tile.flipY, - scrollFactorX, scrollFactorY, - (tile.width / 2), (tile.height / 2), - frameX, frameY, frameWidth, frameHeight, - tint, tint, tint, tint, - 0, 0, - camera - ); - } + viewRotateX: function (radians) + { + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a10 = viewMatrix[4]; + var a11 = viewMatrix[5]; + var a12 = viewMatrix[6]; + var a13 = viewMatrix[7]; + var a20 = viewMatrix[8]; + var a21 = viewMatrix[9]; + var a22 = viewMatrix[10]; + var a23 = viewMatrix[11]; + + viewMatrix[4] = a10 * c + a20 * s; + viewMatrix[5] = a11 * c + a21 * s; + viewMatrix[6] = a12 * c + a22 * s; + viewMatrix[7] = a13 * c + a23 * s; + viewMatrix[8] = a20 * c - a10 * s; + viewMatrix[9] = a21 * c - a11 * s; + viewMatrix[10] = a22 * c - a12 * s; + viewMatrix[11] = a23 * c - a13 * s; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTileSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTileSprite: function (tileSprite, camera) + viewRotateY: function (radians) { - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = viewMatrix[0]; + var a01 = viewMatrix[1]; + var a02 = viewMatrix[2]; + var a03 = viewMatrix[3]; + var a20 = viewMatrix[8]; + var a21 = viewMatrix[9]; + var a22 = viewMatrix[10]; + var a23 = viewMatrix[11]; - this.batchTexture( - tileSprite, - tileSprite.tileTexture, - tileSprite.frame.width, tileSprite.frame.height, - tileSprite.x, tileSprite.y, - tileSprite.width, tileSprite.height, - tileSprite.scaleX, tileSprite.scaleY, - tileSprite.rotation, - tileSprite.flipX, tileSprite.flipY, - tileSprite.scrollFactorX, tileSprite.scrollFactorY, - tileSprite.originX * tileSprite.width, tileSprite.originY * tileSprite.height, - 0, 0, tileSprite.width, tileSprite.height, - getTint(tileSprite._tintTL, tileSprite._alphaTL), - getTint(tileSprite._tintTR, tileSprite._alphaTR), - getTint(tileSprite._tintBL, tileSprite._alphaBL), - getTint(tileSprite._tintBR, tileSprite._alphaBR), - tileSprite.tilePositionX / tileSprite.frame.width, - tileSprite.tilePositionY / tileSprite.frame.height, - camera - ); + viewMatrix[0] = a00 * c - a20 * s; + viewMatrix[1] = a01 * c - a21 * s; + viewMatrix[2] = a02 * c - a22 * s; + viewMatrix[3] = a03 * c - a23 * s; + viewMatrix[8] = a00 * s + a20 * c; + viewMatrix[9] = a01 * s + a21 * c; + viewMatrix[10] = a02 * s + a22 * c; + viewMatrix[11] = a03 * s + a23 * c; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTexture - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] - * @param {WebGLTexture} texture - [description] - * @param {integer} textureWidth - [description] - * @param {integer} textureHeight - [description] - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcWidth - [description] - * @param {float} srcHeight - [description] - * @param {float} scaleX - [description] - * @param {float} scaleY - [description] - * @param {float} rotation - [description] - * @param {boolean} flipX - [description] - * @param {boolean} flipY - [description] - * @param {float} scrollFactorX - [description] - * @param {float} scrollFactorY - [description] - * @param {float} displayOriginX - [description] - * @param {float} displayOriginY - [description] - * @param {float} frameX - [description] - * @param {float} frameY - [description] - * @param {float} frameWidth - [description] - * @param {float} frameHeight - [description] - * @param {integer} tintTL - [description] - * @param {integer} tintTR - [description] - * @param {integer} tintBL - [description] - * @param {integer} tintBR - [description] - * @param {float} uOffset - [description] - * @param {float} vOffset - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, - uOffset, vOffset, - camera) + viewRotateZ: function (radians) { - this.renderer.setPipeline(this); + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = viewMatrix[0]; + var a01 = viewMatrix[1]; + var a02 = viewMatrix[2]; + var a03 = viewMatrix[3]; + var a10 = viewMatrix[4]; + var a11 = viewMatrix[5]; + var a12 = viewMatrix[6]; + var a13 = viewMatrix[7]; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + viewMatrix[0] = a00 * c + a10 * s; + viewMatrix[1] = a01 * c + a11 * s; + viewMatrix[2] = a02 * c + a12 * s; + viewMatrix[3] = a03 * c + a13 * s; + viewMatrix[4] = a10 * c - a00 * s; + viewMatrix[5] = a11 * c - a01 * s; + viewMatrix[6] = a12 * c - a02 * s; + viewMatrix[7] = a13 * c - a03 * s; - flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); - rotation = -rotation; + this.viewMatrixDirty = true; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var width = srcWidth * (flipX ? -1.0 : 1.0); - var height = srcHeight * (flipY ? -1.0 : 1.0); - var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0)); - var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var translateX = srcX - camera.scrollX * scrollFactorX; - var translateY = srcY - camera.scrollY * scrollFactorY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = 0; - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; - - this.setTexture2D(texture, 0); + return this; + }, - vertexOffset = this.vertexCount * this.vertexComponentCount; + viewLoad2D: function (matrix2D) + { + var vm = this.viewMatrix; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = u0; - vertexViewF32[vertexOffset + 3] = v0; - vertexViewU32[vertexOffset + 4] = tintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = u0; - vertexViewF32[vertexOffset + 8] = v1; - vertexViewU32[vertexOffset + 9] = tintTR; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = u1; - vertexViewF32[vertexOffset + 13] = v1; - vertexViewU32[vertexOffset + 14] = tintBL; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = u0; - vertexViewF32[vertexOffset + 18] = v0; - vertexViewU32[vertexOffset + 19] = tintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = u1; - vertexViewF32[vertexOffset + 23] = v1; - vertexViewU32[vertexOffset + 24] = tintBL; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = u1; - vertexViewF32[vertexOffset + 28] = v0; - vertexViewU32[vertexOffset + 29] = tintBR; + vm[0] = matrix2D[0]; + vm[1] = matrix2D[1]; + vm[2] = 0.0; + vm[3] = 0.0; + vm[4] = matrix2D[2]; + vm[5] = matrix2D[3]; + vm[6] = 0.0; + vm[7] = 0.0; + vm[8] = matrix2D[4]; + vm[9] = matrix2D[5]; + vm[10] = 1.0; + vm[11] = 0.0; + vm[12] = 0.0; + vm[13] = 0.0; + vm[14] = 0.0; + vm[15] = 1.0; - this.vertexCount += 6; + this.viewMatrixDirty = true; + + return this; }, - drawTexture: function ( - texture, - srcX, srcY, - frameX, frameY, frameWidth, frameHeight, - transformMatrix - ) + viewLoad: function (matrix) { - this.renderer.setPipeline(this); + var vm = this.viewMatrix; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + vm[0] = matrix[0]; + vm[1] = matrix[1]; + vm[2] = matrix[2]; + vm[3] = matrix[3]; + vm[4] = matrix[4]; + vm[5] = matrix[5]; + vm[6] = matrix[6]; + vm[7] = matrix[7]; + vm[8] = matrix[8]; + vm[9] = matrix[9]; + vm[10] = matrix[10]; + vm[11] = matrix[11]; + vm[12] = matrix[12]; + vm[13] = matrix[13]; + vm[14] = matrix[14]; + vm[15] = matrix[15]; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var width = frameWidth; - var height = frameHeight; - var x = srcX; - var y = srcY; - var xw = x + width; - var yh = y + height; - var mva = transformMatrix[0]; - var mvb = transformMatrix[1]; - var mvc = transformMatrix[2]; - var mvd = transformMatrix[3]; - var mve = transformMatrix[4]; - var mvf = transformMatrix[5]; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = 0; - var textureWidth = texture.width; - var textureHeight = texture.height; - var u0 = (frameX / textureWidth); - var v0 = (frameY / textureHeight); - var u1 = (frameX + frameWidth) / textureWidth; - var v1 = (frameY + frameHeight) / textureHeight; - var tint = 0xffffffff; + this.viewMatrixDirty = true; + + return this; + }, + + projIdentity: function () + { + var projectionMatrix = this.projectionMatrix; - this.setTexture2D(texture, 0); + projectionMatrix[0] = 1; + projectionMatrix[1] = 0; + projectionMatrix[2] = 0; + projectionMatrix[3] = 0; + projectionMatrix[4] = 0; + projectionMatrix[5] = 1; + projectionMatrix[6] = 0; + projectionMatrix[7] = 0; + projectionMatrix[8] = 0; + projectionMatrix[9] = 0; + projectionMatrix[10] = 1; + projectionMatrix[11] = 0; + projectionMatrix[12] = 0; + projectionMatrix[13] = 0; + projectionMatrix[14] = 0; + projectionMatrix[15] = 1; - vertexOffset = this.vertexCount * this.vertexComponentCount; + this.projectionMatrixDirty = true; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = u0; - vertexViewF32[vertexOffset + 3] = v0; - vertexViewU32[vertexOffset + 4] = tint; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = u0; - vertexViewF32[vertexOffset + 8] = v1; - vertexViewU32[vertexOffset + 9] = tint; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = u1; - vertexViewF32[vertexOffset + 13] = v1; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = u0; - vertexViewF32[vertexOffset + 18] = v0; - vertexViewU32[vertexOffset + 19] = tint; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = u1; - vertexViewF32[vertexOffset + 23] = v1; - vertexViewU32[vertexOffset + 24] = tint; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = u1; - vertexViewF32[vertexOffset + 28] = v0; - vertexViewU32[vertexOffset + 29] = tint; + return this; + }, - this.vertexCount += 6; + projOrtho: function (left, right, bottom, top, near, far) + { + var projectionMatrix = this.projectionMatrix; + var leftRight = 1.0 / (left - right); + var bottomTop = 1.0 / (bottom - top); + var nearFar = 1.0 / (near - far); - // Force an immediate draw - this.flush(); + projectionMatrix[0] = -2.0 * leftRight; + projectionMatrix[1] = 0.0; + projectionMatrix[2] = 0.0; + projectionMatrix[3] = 0.0; + projectionMatrix[4] = 0.0; + projectionMatrix[5] = -2.0 * bottomTop; + projectionMatrix[6] = 0.0; + projectionMatrix[7] = 0.0; + projectionMatrix[8] = 0.0; + projectionMatrix[9] = 0.0; + projectionMatrix[10] = 2.0 * nearFar; + projectionMatrix[11] = 0.0; + projectionMatrix[12] = (left + right) * leftRight; + projectionMatrix[13] = (top + bottom) * bottomTop; + projectionMatrix[14] = (far + near) * nearFar; + projectionMatrix[15] = 1.0; + + this.projectionMatrixDirty = true; + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchGraphics - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchGraphics: function () + projPersp: function (fovy, aspectRatio, near, far) { - // Stub + var projectionMatrix = this.projectionMatrix; + var fov = 1.0 / Math.tan(fovy / 2.0); + var nearFar = 1.0 / (near - far); + + projectionMatrix[0] = fov / aspectRatio; + projectionMatrix[1] = 0.0; + projectionMatrix[2] = 0.0; + projectionMatrix[3] = 0.0; + projectionMatrix[4] = 0.0; + projectionMatrix[5] = fov; + projectionMatrix[6] = 0.0; + projectionMatrix[7] = 0.0; + projectionMatrix[8] = 0.0; + projectionMatrix[9] = 0.0; + projectionMatrix[10] = (far + near) * nearFar; + projectionMatrix[11] = -1.0; + projectionMatrix[12] = 0.0; + projectionMatrix[13] = 0.0; + projectionMatrix[14] = (2.0 * far * near) * nearFar; + projectionMatrix[15] = 0.0; + + this.projectionMatrixDirty = true; + return this; } +}; -}); - -module.exports = TextureTintPipeline; +module.exports = ModelViewProjection; /***/ }), -/* 239 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43663,13 +44367,13 @@ module.exports = TextureTintPipeline; var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var Gamepad = __webpack_require__(240); -var Keyboard = __webpack_require__(244); -var Mouse = __webpack_require__(247); -var Pointer = __webpack_require__(248); +var Gamepad = __webpack_require__(241); +var Keyboard = __webpack_require__(245); +var Mouse = __webpack_require__(248); +var Pointer = __webpack_require__(249); var Rectangle = __webpack_require__(8); -var Touch = __webpack_require__(249); -var TransformXY = __webpack_require__(250); +var Touch = __webpack_require__(250); +var TransformXY = __webpack_require__(251); /** * @classdesc @@ -43884,15 +44588,39 @@ var InputManager = new Class({ */ updateBounds: function () { - var clientRect = this.canvas.getBoundingClientRect(); var bounds = this.bounds; - bounds.left = clientRect.left + window.pageXOffset; - bounds.top = clientRect.top + window.pageYOffset; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + window.pageXOffset - document.documentElement.clientLeft; + bounds.y = clientRect.top + window.pageYOffset - document.documentElement.clientTop; bounds.width = clientRect.width; bounds.height = clientRect.height; }, + /** + * [description] + * + * @method Phaser.Input.InputManager#resize + * @since 3.2.0 + */ + resize: function () + { + this.updateBounds(); + + // Game config size + var gw = this.game.config.width; + var gh = this.game.config.height; + + // Actual canvas size + var bw = this.bounds.width; + var bh = this.bounds.height; + + // Scale factor + this.scale.x = gw / bw; + this.scale.y = gh / bh; + }, + /** * [description] * @@ -44211,7 +44939,7 @@ module.exports = InputManager; /***/ }), -/* 240 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44221,7 +44949,7 @@ module.exports = InputManager; */ var Class = __webpack_require__(0); -var Gamepad = __webpack_require__(241); +var Gamepad = __webpack_require__(242); // https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API // https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API @@ -44604,7 +45332,7 @@ module.exports = GamepadManager; /***/ }), -/* 241 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44613,8 +45341,8 @@ module.exports = GamepadManager; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Axis = __webpack_require__(242); -var Button = __webpack_require__(243); +var Axis = __webpack_require__(243); +var Button = __webpack_require__(244); var Class = __webpack_require__(0); /** @@ -44763,7 +45491,7 @@ module.exports = Gamepad; /***/ }), -/* 242 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44871,7 +45599,7 @@ module.exports = Axis; /***/ }), -/* 243 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44991,7 +45719,7 @@ module.exports = Button; /***/ }), -/* 244 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45002,12 +45730,12 @@ module.exports = Button; var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var Key = __webpack_require__(245); +var Key = __webpack_require__(246); var KeyCodes = __webpack_require__(128); -var KeyCombo = __webpack_require__(246); -var KeyMap = __webpack_require__(526); -var ProcessKeyDown = __webpack_require__(527); -var ProcessKeyUp = __webpack_require__(528); +var KeyCombo = __webpack_require__(247); +var KeyMap = __webpack_require__(528); +var ProcessKeyDown = __webpack_require__(529); +var ProcessKeyUp = __webpack_require__(530); /** * @classdesc @@ -45358,13 +46086,13 @@ var KeyboardManager = new Class({ var event = queue[i]; var code = event.keyCode; - // Will emit a keyboard or keyup event - this.emit(event.type, event); - if (event.type === 'keydown') { - if (KeyMap[code]) + if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false)) { + // Will emit a keyboard or keyup event + this.emit(event.type, event); + this.emit('keydown_' + KeyMap[code], event); } @@ -45375,6 +46103,9 @@ var KeyboardManager = new Class({ } else { + // Will emit a keyboard or keyup event + this.emit(event.type, event); + this.emit('keyup_' + KeyMap[code], event); if (keys[code]) @@ -45423,7 +46154,7 @@ module.exports = KeyboardManager; /***/ }), -/* 245 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45621,7 +46352,7 @@ module.exports = Key; /***/ }), -/* 246 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45632,8 +46363,8 @@ module.exports = Key; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(523); -var ResetKeyCombo = __webpack_require__(525); +var ProcessKeyCombo = __webpack_require__(525); +var ResetKeyCombo = __webpack_require__(527); /** * @classdesc @@ -45891,7 +46622,7 @@ module.exports = KeyCombo; /***/ }), -/* 247 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45901,7 +46632,7 @@ module.exports = KeyCombo; */ var Class = __webpack_require__(0); -var Features = __webpack_require__(124); +var Features = __webpack_require__(125); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -46197,7 +46928,7 @@ module.exports = MouseManager; /***/ }), -/* 248 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -46836,7 +47567,7 @@ module.exports = Pointer; /***/ }), -/* 249 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47033,7 +47764,7 @@ module.exports = TouchManager; /***/ }), -/* 250 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47099,7 +47830,7 @@ module.exports = TransformXY; /***/ }), -/* 251 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47112,7 +47843,7 @@ var Class = __webpack_require__(0); var CONST = __webpack_require__(83); var GetValue = __webpack_require__(4); var NOOP = __webpack_require__(3); -var Scene = __webpack_require__(252); +var Scene = __webpack_require__(253); var Systems = __webpack_require__(129); /** @@ -47223,8 +47954,71 @@ var SceneManager = new Class({ } // Only need to wait for the boot event if we've scenes to actually boot - game.events.once('ready', this.processQueue, this); + game.events.once('ready', this.bootQueue, this); + } + }, + + /** + * Internal first-time Scene boot handler. + * + * @method Phaser.Scenes.SceneManager#bootQueue + * @private + * @since 3.2.0 + */ + bootQueue: function () + { + var i; + var entry; + var key; + var sceneConfig; + + for (i = 0; i < this._pending.length; i++) + { + entry = this._pending[i]; + + key = entry.key; + sceneConfig = entry.scene; + + var newScene; + + if (sceneConfig instanceof Scene) + { + newScene = this.createSceneFromInstance(key, sceneConfig); + } + else if (typeof sceneConfig === 'object') + { + newScene = this.createSceneFromObject(key, sceneConfig); + } + else if (typeof sceneConfig === 'function') + { + newScene = this.createSceneFromFunction(key, sceneConfig); + } + + // Replace key in case the scene changed it + key = newScene.sys.settings.key; + + this.keys[key] = newScene; + + this.scenes.push(newScene); + + if (entry.autoStart || newScene.sys.settings.active) + { + this._start.push(key); + } } + + // Clear the pending lists + this._pending.length = 0; + + // _start might have been populated by the above + for (i = 0; i < this._start.length; i++) + { + entry = this._start[i]; + + this.start(entry); + } + + this._start.length = 0; }, /** @@ -47270,13 +48064,13 @@ var SceneManager = new Class({ return; } - for (i = 0; i < queueLength; i++) + for (i = 0; i < this._queue.length; i++) { entry = this._queue[i]; this[entry.op](entry.keyA, entry.keyB); } - + this._queue.length = 0; }, @@ -47361,6 +48155,58 @@ var SceneManager = new Class({ return newScene; }, + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it wil + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.SceneManager#remove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} scene - The Scene to be removed. + * + * @return {Phaser.Scenes.SceneManager} This SceneManager. + */ + remove: function (key) + { + if (this._processing) + { + this._queue.push({ op: 'remove', keyA: key, keyB: null }); + } + else + { + var sceneToRemove = this.getScene(key); + + if (!sceneToRemove) + { + return this; + } + + var index = this.scenes.indexOf(sceneToRemove); + var sceneKey = sceneToRemove.sys.settings.key; + + if (index > -1) + { + this.keys[sceneKey] = undefined; + this.scenes.splice(index, 1); + + if (this._start.indexOf(sceneKey) > -1) + { + index = this._start.indexOf(sceneKey); + this._start.splice(index, 1); + } + + sceneToRemove.sys.destroy(); + } + } + + return this; + }, + /** * [description] * @@ -47382,7 +48228,7 @@ var SceneManager = new Class({ if (scene.sys.load) { loader = scene.sys.load; - + loader.reset(); } @@ -47469,6 +48315,26 @@ var SceneManager = new Class({ } }, + /** + * [description] + * + * @method Phaser.Scenes.SceneManager#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + */ + resize: function (width, height) + { + // Loop through the scenes in forward order + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; + + sys.resize(width, height); + } + }, + /** * [description] * @@ -47484,7 +48350,7 @@ var SceneManager = new Class({ { var sys = this.scenes[i].sys; - if (sys.settings.visible) + if (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) { sys.render(renderer); } @@ -47956,7 +48822,7 @@ var SceneManager = new Class({ return this; } } - + this.bootScene(scene); } @@ -48056,7 +48922,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#bringToTop * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -48088,7 +48954,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#sendToBack * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -48120,7 +48986,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#moveDown * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -48154,7 +49020,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#moveUp * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -48182,6 +49048,92 @@ var SceneManager = new Class({ return this; }, + /** + * Moves a Scene so it is immediately above another Scene in the Scenes list. + * This means it will render over the top of the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveAbove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} keyA - The Scene that Scene B will be moved above. + * @param {string|Phaser.Scene} keyB - The Scene to be moved. + * + * @return {Phaser.Scenes.SceneManager} [description] + */ + moveAbove: function (keyA, keyB) + { + if (keyA === keyB) + { + return this; + } + + if (this._processing) + { + this._queue.push({ op: 'moveAbove', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); + + if (indexA > indexB && indexA !== -1 && indexB !== -1) + { + var tempScene = this.getAt(indexB); + + // Remove + this.scenes.splice(indexB, 1); + + // Add in new location + this.scenes.splice(indexA, 0, tempScene); + } + } + + return this; + }, + + /** + * Moves a Scene so it is immediately below another Scene in the Scenes list. + * This means it will render behind the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveBelow + * @since 3.2.0 + * + * @param {string|Phaser.Scene} keyA - The Scene that Scene B will be moved above. + * @param {string|Phaser.Scene} keyB - The Scene to be moved. + * + * @return {Phaser.Scenes.SceneManager} [description] + */ + moveBelow: function (keyA, keyB) + { + if (keyA === keyB) + { + return this; + } + + if (this._processing) + { + this._queue.push({ op: 'moveBelow', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); + + if (indexA < indexB && indexA !== -1 && indexB !== -1) + { + var tempScene = this.getAt(indexB); + + // Remove + this.scenes.splice(indexB, 1); + + // Add in new location + this.scenes.splice(indexA, 0, tempScene); + } + } + + return this; + }, + queueOp: function (op, keyA, keyB) { this._queue.push({ op: op, keyA: keyA, keyB: keyB }); @@ -48228,6 +49180,24 @@ var SceneManager = new Class({ return this; }, + dump: function () + { + var out = []; + var map = [ 'pending', 'init', 'start', 'loading', 'creating', 'running', 'paused', 'sleeping', 'shutdown', 'destroyed' ]; + + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; + + var key = (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) ? '[*] ' : '[-] '; + key += sys.settings.key + ' (' + map[sys.settings.status] + ')'; + + out.push(key); + } + + console.log(out.join('\n')); + }, + /** * [description] * @@ -48258,7 +49228,7 @@ module.exports = SceneManager; /***/ }), -/* 252 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48314,7 +49284,7 @@ module.exports = Scene; /***/ }), -/* 253 */ +/* 254 */ /***/ (function(module, exports) { /** @@ -48342,7 +49312,7 @@ module.exports = UppercaseFirst; /***/ }), -/* 254 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48353,7 +49323,7 @@ module.exports = UppercaseFirst; var CONST = __webpack_require__(83); var GetValue = __webpack_require__(4); -var InjectionMap = __webpack_require__(531); +var InjectionMap = __webpack_require__(533); /** * Takes a Scene configuration object and returns a fully formed Systems object. @@ -48424,7 +49394,7 @@ module.exports = Settings; /***/ }), -/* 255 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48433,9 +49403,9 @@ module.exports = Settings; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(256); -var NoAudioSoundManager = __webpack_require__(258); -var WebAudioSoundManager = __webpack_require__(260); +var HTML5AudioSoundManager = __webpack_require__(257); +var NoAudioSoundManager = __webpack_require__(259); +var WebAudioSoundManager = __webpack_require__(261); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -48472,7 +49442,7 @@ module.exports = SoundManagerCreator; /***/ }), -/* 256 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48480,9 +49450,10 @@ module.exports = SoundManagerCreator; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); + var BaseSoundManager = __webpack_require__(84); -var HTML5AudioSound = __webpack_require__(257); +var Class = __webpack_require__(0); +var HTML5AudioSound = __webpack_require__(258); /** * HTML5 Audio implementation of the sound manager. @@ -48497,8 +49468,12 @@ var HTML5AudioSound = __webpack_require__(257); * @param {Phaser.Game} game - Reference to the current game instance. */ var HTML5AudioSoundManager = new Class({ + Extends: BaseSoundManager, - initialize: function HTML5AudioSoundManager (game) + + initialize: + + function HTML5AudioSoundManager (game) { /** * Flag indicating whether if there are no idle instances of HTML5 Audio tag, @@ -48554,6 +49529,7 @@ var HTML5AudioSoundManager = new Class({ * @since 3.0.0 */ this.onBlurPausedSounds = []; + this.locked = 'ontouchstart' in window; /** @@ -48592,6 +49568,7 @@ var HTML5AudioSoundManager = new Class({ * @since 3.0.0 */ this._volume = 1; + BaseSoundManager.call(this, game); }, @@ -48609,7 +49586,9 @@ var HTML5AudioSoundManager = new Class({ add: function (key, config) { var sound = new HTML5AudioSound(this, key, config); + this.sounds.push(sound); + return sound; }, @@ -48624,21 +49603,32 @@ var HTML5AudioSoundManager = new Class({ unlock: function () { var _this = this; + var moved = false; + var detectMove = function () { moved = true; }; + var unlock = function () { + if (!_this.game.cache.audio.entries.size) + { + return; + } + if (moved) { moved = false; return; } + document.body.removeEventListener('touchmove', detectMove); document.body.removeEventListener('touchend', unlock); + var allTags = []; + _this.game.cache.audio.entries.each(function (key, tags) { for (var i = 0; i < tags.length; i++) @@ -48647,25 +49637,30 @@ var HTML5AudioSoundManager = new Class({ } return true; }); + var lastTag = allTags[allTags.length - 1]; + lastTag.oncanplaythrough = function () { lastTag.oncanplaythrough = null; _this.unlocked = true; }; + allTags.forEach(function (tag) { tag.load(); }); }; + this.once('unlocked', function () { - _this.forEachActiveSound(function (sound) + this.forEachActiveSound(function (sound) { sound.duration = sound.tags[0].duration; sound.totalDuration = sound.tags[0].duration; }); - _this.lockedActionsQueue.forEach(function (lockedAction) + + this.lockedActionsQueue.forEach(function (lockedAction) { if (lockedAction.sound[lockedAction.prop].apply) { @@ -48676,9 +49671,11 @@ var HTML5AudioSoundManager = new Class({ lockedAction.sound[lockedAction.prop] = lockedAction.value; } }); - _this.lockedActionsQueue.length = 0; - _this.lockedActionsQueue = null; - }); + + this.lockedActionsQueue.length = 0; + this.lockedActionsQueue = null; + }, this); + document.body.addEventListener('touchmove', detectMove, false); document.body.addEventListener('touchend', unlock, false); }, @@ -48717,6 +49714,7 @@ var HTML5AudioSoundManager = new Class({ { sound.onFocus(); }); + this.onBlurPausedSounds.length = 0; }, @@ -48730,6 +49728,7 @@ var HTML5AudioSoundManager = new Class({ destroy: function () { BaseSoundManager.prototype.destroy.call(this); + this.onBlurPausedSounds.length = 0; this.onBlurPausedSounds = null; }, @@ -48758,58 +49757,86 @@ var HTML5AudioSoundManager = new Class({ prop: prop, value: value }); + return true; } + return false; - } -}); -Object.defineProperty(HTML5AudioSoundManager.prototype, 'mute', { - get: function () - { - return this._mute; }, - set: function (value) - { - this._mute = value; - this.forEachActiveSound(function (sound) + + /** + * @event Phaser.Sound.HTML5AudioSoundManager#MuteEvent + * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#mute property. + */ + + /** + * @name Phaser.Sound.HTML5AudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.HTML5AudioSoundManager#MuteEvent + * @since 3.0.0 + */ + mute: { + + get: function () { - sound.setMute(); - }); + return this._mute; + }, + + set: function (value) + { + this._mute = value; + + this.forEachActiveSound(function (sound) + { + sound.setMute(); + }); + + this.emit('mute', this, value); + } - /** - * @event Phaser.Sound.HTML5AudioSoundManager#mute - * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#mute property. - */ - this.emit('mute', this, value); - } -}); -Object.defineProperty(HTML5AudioSoundManager.prototype, 'volume', { - get: function () - { - return this._volume; }, - set: function (value) - { - this._volume = value; - this.forEachActiveSound(function (sound) + + /** + * @event Phaser.Sound.HTML5AudioSoundManager#VolumeEvent + * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#volume property. + */ + + /** + * @name Phaser.Sound.HTML5AudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.HTML5AudioSoundManager#VolumeEvent + * @since 3.0.0 + */ + volume: { + + get: function () { - sound.setVolume(); - }); + return this._volume; + }, + + set: function (value) + { + this._volume = value; + + this.forEachActiveSound(function (sound) + { + sound.setVolume(); + }); + + this.emit('volume', this, value); + } - /** - * @event Phaser.Sound.HTML5AudioSoundManager#volume - * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#volume property. - */ - this.emit('volume', this, value); } + }); + module.exports = HTML5AudioSoundManager; /***/ }), -/* 257 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49155,7 +50182,10 @@ var HTML5AudioSound = new Class({ if (playPromise) { // eslint-disable-next-line no-unused-vars - playPromise.catch(function (reason) { }); + playPromise.catch(function (reason) + { + console.warn(reason); + }); } }, @@ -49507,7 +50537,7 @@ module.exports = HTML5AudioSound; /***/ }), -/* 258 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49518,7 +50548,7 @@ module.exports = HTML5AudioSound; var BaseSoundManager = __webpack_require__(84); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var NoAudioSound = __webpack_require__(259); +var NoAudioSound = __webpack_require__(260); var NOOP = __webpack_require__(3); /** @@ -49600,7 +50630,7 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 259 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49708,7 +50738,7 @@ module.exports = NoAudioSound; /***/ }), -/* 260 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49716,9 +50746,10 @@ module.exports = NoAudioSound; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); + var BaseSoundManager = __webpack_require__(84); -var WebAudioSound = __webpack_require__(261); +var Class = __webpack_require__(0); +var WebAudioSound = __webpack_require__(262); /** * @classdesc @@ -49734,8 +50765,12 @@ var WebAudioSound = __webpack_require__(261); * @param {Phaser.Game} game - Reference to the current game instance. */ var WebAudioSoundManager = new Class({ + Extends: BaseSoundManager, - initialize: function WebAudioSoundManager (game) + + initialize: + + function WebAudioSoundManager (game) { /** * The AudioContext being used for playback. @@ -49766,7 +50801,9 @@ var WebAudioSoundManager = new Class({ * @since 3.0.0 */ this.masterVolumeNode = this.context.createGain(); + this.masterMuteNode.connect(this.masterVolumeNode); + this.masterVolumeNode.connect(this.context.destination); /** @@ -49778,7 +50815,9 @@ var WebAudioSoundManager = new Class({ * @since 3.0.0 */ this.destination = this.masterMuteNode; + this.locked = this.context.state === 'suspended' && 'ontouchstart' in window; + BaseSoundManager.call(this, game); }, @@ -49800,11 +50839,13 @@ var WebAudioSoundManager = new Class({ createAudioContext: function (game) { var audioConfig = game.config.audio; + if (audioConfig && audioConfig.context) { audioConfig.context.resume(); return audioConfig.context; } + return new AudioContext(); }, @@ -49821,8 +50862,11 @@ var WebAudioSoundManager = new Class({ */ add: function (key, config) { + var sound = new WebAudioSound(this, key, config); + this.sounds.push(sound); + return sound; }, @@ -49838,6 +50882,7 @@ var WebAudioSoundManager = new Class({ unlock: function () { var _this = this; + var unlock = function () { _this.context.resume().then(function () @@ -49847,6 +50892,7 @@ var WebAudioSoundManager = new Class({ _this.unlocked = true; }); }; + document.body.addEventListener('touchstart', unlock, false); document.body.addEventListener('touchend', unlock, false); }, @@ -49891,6 +50937,7 @@ var WebAudioSoundManager = new Class({ this.masterVolumeNode = null; this.masterMuteNode.disconnect(); this.masterMuteNode = null; + if (this.game.config.audio && this.game.config.audio.context) { this.context.suspend(); @@ -49899,49 +50946,75 @@ var WebAudioSoundManager = new Class({ { this.context.close(); } + this.context = null; + BaseSoundManager.prototype.destroy.call(this); - } -}); -Object.defineProperty(WebAudioSoundManager.prototype, 'mute', { - get: function () - { - return this.masterMuteNode.gain.value === 0; }, - set: function (value) - { - this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - /** - * @event Phaser.Sound.WebAudioSoundManager#mute - * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSoundManager#mute property. - */ - this.emit('mute', this, value); - } -}); -Object.defineProperty(WebAudioSoundManager.prototype, 'volume', { - get: function () - { - return this.masterVolumeNode.gain.value; + /** + * @event Phaser.Sound.WebAudioSoundManager#MuteEvent + * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSoundManager#mute property. + */ + + /** + * @name Phaser.Sound.WebAudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @since 3.0.0 + */ + mute: { + + get: function () + { + return (this.masterMuteNode.gain.value === 0); + }, + + set: function (value) + { + this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); + + this.emit('mute', this, value); + } + }, - set: function (value) - { - this.masterVolumeNode.gain.setValueAtTime(value, 0); - /** - * @event Phaser.Sound.WebAudioSoundManager#volume - * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSoundManager#volume property. - */ - this.emit('volume', this, value); + /** + * @event Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.WebAudioSoundManager#volume property. + */ + + /** + * @name Phaser.Sound.WebAudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @since 3.0.0 + */ + volume: { + + get: function () + { + return this.masterVolumeNode.gain.value; + }, + + set: function (value) + { + this.masterVolumeNode.gain.setValueAtTime(value, 0); + + this.emit('volume', this, value); + } + } + }); + module.exports = WebAudioSoundManager; /***/ }), -/* 261 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -50611,7 +51684,7 @@ module.exports = WebAudioSound; /***/ }), -/* 262 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -50620,14 +51693,14 @@ module.exports = WebAudioSound; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Color = __webpack_require__(36); var EventEmitter = __webpack_require__(14); -var GenerateTexture = __webpack_require__(213); +var GenerateTexture = __webpack_require__(214); var GetValue = __webpack_require__(4); -var Parser = __webpack_require__(263); -var Texture = __webpack_require__(264); +var Parser = __webpack_require__(264); +var Texture = __webpack_require__(265); /** * @classdesc @@ -50930,9 +52003,11 @@ var TextureManager = new Class({ if (Array.isArray(data)) { - for (var i = 0; i < data.length; i++) + var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images + for (var i = 0; i < texture.source.length; i++) { - Parser.JSONArray(texture, i, data[i]); + var atlasData = singleAtlasFile ? data[0] : data[i]; + Parser.JSONArray(texture, i, atlasData); } } else @@ -51397,7 +52472,7 @@ module.exports = TextureManager; /***/ }), -/* 263 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51412,21 +52487,21 @@ module.exports = TextureManager; module.exports = { - Canvas: __webpack_require__(532), - Image: __webpack_require__(533), - JSONArray: __webpack_require__(534), - JSONHash: __webpack_require__(535), - Pyxel: __webpack_require__(536), - SpriteSheet: __webpack_require__(537), - SpriteSheetFromAtlas: __webpack_require__(538), - StarlingXML: __webpack_require__(539), - UnityYAML: __webpack_require__(540) + Canvas: __webpack_require__(534), + Image: __webpack_require__(535), + JSONArray: __webpack_require__(536), + JSONHash: __webpack_require__(537), + Pyxel: __webpack_require__(538), + SpriteSheet: __webpack_require__(539), + SpriteSheetFromAtlas: __webpack_require__(540), + StarlingXML: __webpack_require__(541), + UnityYAML: __webpack_require__(542) }; /***/ }), -/* 264 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51437,7 +52512,7 @@ module.exports = { var Class = __webpack_require__(0); var Frame = __webpack_require__(130); -var TextureSource = __webpack_require__(265); +var TextureSource = __webpack_require__(266); /** * @classdesc @@ -51624,9 +52699,10 @@ var Texture = new Class({ */ get: function (name) { - if (name === undefined || name === null || (typeof name !== 'string' && typeof name !== 'number')) + // null, undefined, empty string, zero + if (!name) { - name = (this.frameTotal === 1) ? '__BASE' : this.firstFrame; + name = this.firstFrame; } var frame = this.frames[name]; @@ -51634,13 +52710,11 @@ var Texture = new Class({ if (!frame) { console.warn('No Texture.frame found with name ' + name); - - return this.frames['__BASE']; - } - else - { - return frame; + + frame = this.frames[this.firstFrame]; } + + return frame; }, /** @@ -51859,7 +52933,7 @@ module.exports = Texture; /***/ }), -/* 265 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51870,8 +52944,8 @@ module.exports = Texture; var Class = __webpack_require__(0); var CONST = __webpack_require__(22); -var IsSizePowerOfTwo = __webpack_require__(125); -var ScaleModes = __webpack_require__(62); +var IsSizePowerOfTwo = __webpack_require__(126); +var ScaleModes = __webpack_require__(63); /** * @classdesc @@ -52059,7 +53133,7 @@ module.exports = TextureSource; /***/ }), -/* 266 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52181,7 +53255,7 @@ else { })(); /***/ }), -/* 267 */ +/* 268 */ /***/ (function(module, exports) { /** @@ -52320,7 +53394,7 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 268 */ +/* 269 */ /***/ (function(module, exports) { /** @@ -52435,7 +53509,7 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 269 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52446,27 +53520,27 @@ module.exports = ParseXMLBitmapFont; var Ellipse = __webpack_require__(135); -Ellipse.Area = __webpack_require__(558); -Ellipse.Circumference = __webpack_require__(272); +Ellipse.Area = __webpack_require__(560); +Ellipse.Circumference = __webpack_require__(273); Ellipse.CircumferencePoint = __webpack_require__(136); -Ellipse.Clone = __webpack_require__(559); +Ellipse.Clone = __webpack_require__(561); Ellipse.Contains = __webpack_require__(68); -Ellipse.ContainsPoint = __webpack_require__(560); -Ellipse.ContainsRect = __webpack_require__(561); -Ellipse.CopyFrom = __webpack_require__(562); -Ellipse.Equals = __webpack_require__(563); -Ellipse.GetBounds = __webpack_require__(564); -Ellipse.GetPoint = __webpack_require__(270); -Ellipse.GetPoints = __webpack_require__(271); -Ellipse.Offset = __webpack_require__(565); -Ellipse.OffsetPoint = __webpack_require__(566); -Ellipse.Random = __webpack_require__(109); +Ellipse.ContainsPoint = __webpack_require__(562); +Ellipse.ContainsRect = __webpack_require__(563); +Ellipse.CopyFrom = __webpack_require__(564); +Ellipse.Equals = __webpack_require__(565); +Ellipse.GetBounds = __webpack_require__(566); +Ellipse.GetPoint = __webpack_require__(271); +Ellipse.GetPoints = __webpack_require__(272); +Ellipse.Offset = __webpack_require__(567); +Ellipse.OffsetPoint = __webpack_require__(568); +Ellipse.Random = __webpack_require__(110); module.exports = Ellipse; /***/ }), -/* 270 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52476,7 +53550,7 @@ module.exports = Ellipse; */ var CircumferencePoint = __webpack_require__(136); -var FromPercent = __webpack_require__(64); +var FromPercent = __webpack_require__(65); var MATH_CONST = __webpack_require__(16); var Point = __webpack_require__(5); @@ -52507,7 +53581,7 @@ module.exports = GetPoint; /***/ }), -/* 271 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52516,9 +53590,9 @@ module.exports = GetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(272); +var Circumference = __webpack_require__(273); var CircumferencePoint = __webpack_require__(136); -var FromPercent = __webpack_require__(64); +var FromPercent = __webpack_require__(65); var MATH_CONST = __webpack_require__(16); /** @@ -52559,7 +53633,7 @@ module.exports = GetPoints; /***/ }), -/* 272 */ +/* 273 */ /***/ (function(module, exports) { /** @@ -52591,7 +53665,7 @@ module.exports = Circumference; /***/ }), -/* 273 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52857,7 +53931,7 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 274 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52997,7 +54071,7 @@ module.exports = Range; /***/ }), -/* 275 */ +/* 276 */ /***/ (function(module, exports) { /** @@ -53026,7 +54100,7 @@ module.exports = FloatBetween; /***/ }), -/* 276 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53039,15 +54113,15 @@ module.exports = FloatBetween; module.exports = { - In: __webpack_require__(578), - Out: __webpack_require__(579), - InOut: __webpack_require__(580) + In: __webpack_require__(580), + Out: __webpack_require__(581), + InOut: __webpack_require__(582) }; /***/ }), -/* 277 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53060,15 +54134,15 @@ module.exports = { module.exports = { - In: __webpack_require__(581), - Out: __webpack_require__(582), - InOut: __webpack_require__(583) + In: __webpack_require__(583), + Out: __webpack_require__(584), + InOut: __webpack_require__(585) }; /***/ }), -/* 278 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53081,15 +54155,15 @@ module.exports = { module.exports = { - In: __webpack_require__(584), - Out: __webpack_require__(585), - InOut: __webpack_require__(586) + In: __webpack_require__(586), + Out: __webpack_require__(587), + InOut: __webpack_require__(588) }; /***/ }), -/* 279 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53102,15 +54176,15 @@ module.exports = { module.exports = { - In: __webpack_require__(587), - Out: __webpack_require__(588), - InOut: __webpack_require__(589) + In: __webpack_require__(589), + Out: __webpack_require__(590), + InOut: __webpack_require__(591) }; /***/ }), -/* 280 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53123,15 +54197,15 @@ module.exports = { module.exports = { - In: __webpack_require__(590), - Out: __webpack_require__(591), - InOut: __webpack_require__(592) + In: __webpack_require__(592), + Out: __webpack_require__(593), + InOut: __webpack_require__(594) }; /***/ }), -/* 281 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53144,15 +54218,15 @@ module.exports = { module.exports = { - In: __webpack_require__(593), - Out: __webpack_require__(594), - InOut: __webpack_require__(595) + In: __webpack_require__(595), + Out: __webpack_require__(596), + InOut: __webpack_require__(597) }; /***/ }), -/* 282 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53163,11 +54237,11 @@ module.exports = { // Phaser.Math.Easing.Linear -module.exports = __webpack_require__(596); +module.exports = __webpack_require__(598); /***/ }), -/* 283 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53180,15 +54254,15 @@ module.exports = __webpack_require__(596); module.exports = { - In: __webpack_require__(597), - Out: __webpack_require__(598), - InOut: __webpack_require__(599) + In: __webpack_require__(599), + Out: __webpack_require__(600), + InOut: __webpack_require__(601) }; /***/ }), -/* 284 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53201,15 +54275,15 @@ module.exports = { module.exports = { - In: __webpack_require__(600), - Out: __webpack_require__(601), - InOut: __webpack_require__(602) + In: __webpack_require__(602), + Out: __webpack_require__(603), + InOut: __webpack_require__(604) }; /***/ }), -/* 285 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53222,15 +54296,15 @@ module.exports = { module.exports = { - In: __webpack_require__(603), - Out: __webpack_require__(604), - InOut: __webpack_require__(605) + In: __webpack_require__(605), + Out: __webpack_require__(606), + InOut: __webpack_require__(607) }; /***/ }), -/* 286 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53243,15 +54317,15 @@ module.exports = { module.exports = { - In: __webpack_require__(606), - Out: __webpack_require__(607), - InOut: __webpack_require__(608) + In: __webpack_require__(608), + Out: __webpack_require__(609), + InOut: __webpack_require__(610) }; /***/ }), -/* 287 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53262,11 +54336,11 @@ module.exports = { // Phaser.Math.Easing.Stepped -module.exports = __webpack_require__(609); +module.exports = __webpack_require__(611); /***/ }), -/* 288 */ +/* 289 */ /***/ (function(module, exports) { /** @@ -53303,7 +54377,7 @@ module.exports = HasAny; /***/ }), -/* 289 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53725,7 +54799,7 @@ module.exports = PathFollower; /***/ }), -/* 290 */ +/* 291 */ /***/ (function(module, exports) { /** @@ -53756,7 +54830,96 @@ module.exports = GetPowerOfTwo; /***/ }), -/* 291 */ +/* 292 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetAdvancedValue = __webpack_require__(10); + +/** + * Adds an Animation component to a Sprite and populates it based on the given config. + * + * @function Phaser.Gameobjects.BuildGameObjectAnimation + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.Sprite} The updated Sprite. + */ +var BuildGameObjectAnimation = function (sprite, config) +{ + var animConfig = GetAdvancedValue(config, 'anims', null); + + if (animConfig === null) + { + return sprite; + } + + if (typeof animConfig === 'string') + { + // { anims: 'key' } + sprite.anims.play(animConfig); + } + else if (typeof animConfig === 'object') + { + // { anims: { + // key: string + // startFrame: [string|integer] + // delay: [float] + // repeat: [integer] + // repeatDelay: [float] + // yoyo: [boolean] + // play: [boolean] + // delayedPlay: [boolean] + // } + // } + + var anims = sprite.anims; + + var key = GetAdvancedValue(animConfig, 'key', undefined); + var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); + + var delay = GetAdvancedValue(animConfig, 'delay', 0); + var repeat = GetAdvancedValue(animConfig, 'repeat', 0); + var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); + var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); + + var play = GetAdvancedValue(animConfig, 'play', false); + var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); + + anims.delay(delay); + anims.repeat(repeat); + anims.repeatDelay(repeatDelay); + anims.yoyo(yoyo); + + if (play) + { + anims.play(key, startFrame); + } + else if (delayedPlay > 0) + { + anims.delayedPlay(delayedPlay, key, startFrame); + } + else + { + anims.load(key); + } + } + + return sprite; +}; + +module.exports = BuildGameObjectAnimation; + + +/***/ }), +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53766,7 +54929,7 @@ module.exports = GetPowerOfTwo; */ var Class = __webpack_require__(0); -var Utils = __webpack_require__(42); +var Utils = __webpack_require__(41); /** * @classdesc @@ -54010,7 +55173,7 @@ module.exports = Light; /***/ }), -/* 292 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54020,9 +55183,9 @@ module.exports = Light; */ var Class = __webpack_require__(0); -var Light = __webpack_require__(291); -var LightPipeline = __webpack_require__(237); -var Utils = __webpack_require__(42); +var Light = __webpack_require__(293); +var LightPipeline = __webpack_require__(163); +var Utils = __webpack_require__(41); /** * @classdesc @@ -54340,7 +55503,7 @@ module.exports = LightsManager; /***/ }), -/* 293 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54355,20 +55518,20 @@ module.exports = LightsManager; module.exports = { - Circle: __webpack_require__(663), - Ellipse: __webpack_require__(269), - Intersects: __webpack_require__(294), - Line: __webpack_require__(683), - Point: __webpack_require__(701), - Polygon: __webpack_require__(715), - Rectangle: __webpack_require__(306), - Triangle: __webpack_require__(744) + Circle: __webpack_require__(666), + Ellipse: __webpack_require__(270), + Intersects: __webpack_require__(296), + Line: __webpack_require__(686), + Point: __webpack_require__(704), + Polygon: __webpack_require__(718), + Rectangle: __webpack_require__(308), + Triangle: __webpack_require__(747) }; /***/ }), -/* 294 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54383,26 +55546,26 @@ module.exports = { module.exports = { - CircleToCircle: __webpack_require__(673), - CircleToRectangle: __webpack_require__(674), - GetRectangleIntersection: __webpack_require__(675), - LineToCircle: __webpack_require__(296), + CircleToCircle: __webpack_require__(676), + CircleToRectangle: __webpack_require__(677), + GetRectangleIntersection: __webpack_require__(678), + LineToCircle: __webpack_require__(298), LineToLine: __webpack_require__(89), - LineToRectangle: __webpack_require__(676), - PointToLine: __webpack_require__(297), - PointToLineSegment: __webpack_require__(677), - RectangleToRectangle: __webpack_require__(295), - RectangleToTriangle: __webpack_require__(678), - RectangleToValues: __webpack_require__(679), - TriangleToCircle: __webpack_require__(680), - TriangleToLine: __webpack_require__(681), - TriangleToTriangle: __webpack_require__(682) + LineToRectangle: __webpack_require__(679), + PointToLine: __webpack_require__(299), + PointToLineSegment: __webpack_require__(680), + RectangleToRectangle: __webpack_require__(297), + RectangleToTriangle: __webpack_require__(681), + RectangleToValues: __webpack_require__(682), + TriangleToCircle: __webpack_require__(683), + TriangleToLine: __webpack_require__(684), + TriangleToTriangle: __webpack_require__(685) }; /***/ }), -/* 295 */ +/* 297 */ /***/ (function(module, exports) { /** @@ -54436,7 +55599,7 @@ module.exports = RectangleToRectangle; /***/ }), -/* 296 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54521,7 +55684,7 @@ module.exports = LineToCircle; /***/ }), -/* 297 */ +/* 299 */ /***/ (function(module, exports) { /** @@ -54550,7 +55713,7 @@ module.exports = PointToLine; /***/ }), -/* 298 */ +/* 300 */ /***/ (function(module, exports) { /** @@ -54586,7 +55749,7 @@ module.exports = Decompose; /***/ }), -/* 299 */ +/* 301 */ /***/ (function(module, exports) { /** @@ -54621,7 +55784,7 @@ module.exports = Decompose; /***/ }), -/* 300 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54631,9 +55794,9 @@ module.exports = Decompose; */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(301); -var GetPoints = __webpack_require__(108); -var Random = __webpack_require__(110); +var GetPoint = __webpack_require__(303); +var GetPoints = __webpack_require__(109); +var Random = __webpack_require__(111); /** * @classdesc @@ -54918,7 +56081,7 @@ module.exports = Line; /***/ }), -/* 301 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54958,7 +56121,7 @@ module.exports = GetPoint; /***/ }), -/* 302 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54969,7 +56132,7 @@ module.exports = GetPoint; var MATH_CONST = __webpack_require__(16); var Wrap = __webpack_require__(50); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -54992,7 +56155,7 @@ module.exports = NormalAngle; /***/ }), -/* 303 */ +/* 305 */ /***/ (function(module, exports) { /** @@ -55020,7 +56183,7 @@ module.exports = GetMagnitude; /***/ }), -/* 304 */ +/* 306 */ /***/ (function(module, exports) { /** @@ -55048,7 +56211,7 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 305 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55058,7 +56221,7 @@ module.exports = GetMagnitudeSq; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(146); +var Contains = __webpack_require__(145); /** * @classdesc @@ -55233,7 +56396,7 @@ module.exports = Polygon; /***/ }), -/* 306 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55244,46 +56407,46 @@ module.exports = Polygon; var Rectangle = __webpack_require__(8); -Rectangle.Area = __webpack_require__(720); -Rectangle.Ceil = __webpack_require__(721); -Rectangle.CeilAll = __webpack_require__(722); -Rectangle.CenterOn = __webpack_require__(307); -Rectangle.Clone = __webpack_require__(723); +Rectangle.Area = __webpack_require__(723); +Rectangle.Ceil = __webpack_require__(724); +Rectangle.CeilAll = __webpack_require__(725); +Rectangle.CenterOn = __webpack_require__(309); +Rectangle.Clone = __webpack_require__(726); Rectangle.Contains = __webpack_require__(33); -Rectangle.ContainsPoint = __webpack_require__(724); -Rectangle.ContainsRect = __webpack_require__(725); -Rectangle.CopyFrom = __webpack_require__(726); -Rectangle.Decompose = __webpack_require__(298); -Rectangle.Equals = __webpack_require__(727); -Rectangle.FitInside = __webpack_require__(728); -Rectangle.FitOutside = __webpack_require__(729); -Rectangle.Floor = __webpack_require__(730); -Rectangle.FloorAll = __webpack_require__(731); -Rectangle.FromPoints = __webpack_require__(121); -Rectangle.GetAspectRatio = __webpack_require__(147); -Rectangle.GetCenter = __webpack_require__(732); -Rectangle.GetPoint = __webpack_require__(106); -Rectangle.GetPoints = __webpack_require__(184); -Rectangle.GetSize = __webpack_require__(733); -Rectangle.Inflate = __webpack_require__(734); -Rectangle.MarchingAnts = __webpack_require__(188); -Rectangle.MergePoints = __webpack_require__(735); -Rectangle.MergeRect = __webpack_require__(736); -Rectangle.MergeXY = __webpack_require__(737); -Rectangle.Offset = __webpack_require__(738); -Rectangle.OffsetPoint = __webpack_require__(739); -Rectangle.Overlaps = __webpack_require__(740); +Rectangle.ContainsPoint = __webpack_require__(727); +Rectangle.ContainsRect = __webpack_require__(728); +Rectangle.CopyFrom = __webpack_require__(729); +Rectangle.Decompose = __webpack_require__(300); +Rectangle.Equals = __webpack_require__(730); +Rectangle.FitInside = __webpack_require__(731); +Rectangle.FitOutside = __webpack_require__(732); +Rectangle.Floor = __webpack_require__(733); +Rectangle.FloorAll = __webpack_require__(734); +Rectangle.FromPoints = __webpack_require__(122); +Rectangle.GetAspectRatio = __webpack_require__(146); +Rectangle.GetCenter = __webpack_require__(735); +Rectangle.GetPoint = __webpack_require__(107); +Rectangle.GetPoints = __webpack_require__(185); +Rectangle.GetSize = __webpack_require__(736); +Rectangle.Inflate = __webpack_require__(737); +Rectangle.MarchingAnts = __webpack_require__(189); +Rectangle.MergePoints = __webpack_require__(738); +Rectangle.MergeRect = __webpack_require__(739); +Rectangle.MergeXY = __webpack_require__(740); +Rectangle.Offset = __webpack_require__(741); +Rectangle.OffsetPoint = __webpack_require__(742); +Rectangle.Overlaps = __webpack_require__(743); Rectangle.Perimeter = __webpack_require__(78); -Rectangle.PerimeterPoint = __webpack_require__(741); -Rectangle.Random = __webpack_require__(107); -Rectangle.Scale = __webpack_require__(742); -Rectangle.Union = __webpack_require__(743); +Rectangle.PerimeterPoint = __webpack_require__(744); +Rectangle.Random = __webpack_require__(108); +Rectangle.Scale = __webpack_require__(745); +Rectangle.Union = __webpack_require__(746); module.exports = Rectangle; /***/ }), -/* 307 */ +/* 309 */ /***/ (function(module, exports) { /** @@ -55318,7 +56481,7 @@ module.exports = CenterOn; /***/ }), -/* 308 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55328,7 +56491,7 @@ module.exports = CenterOn; */ var Point = __webpack_require__(5); -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); // Position is a value between 0 and 1 /** @@ -55404,7 +56567,7 @@ module.exports = GetPoint; /***/ }), -/* 309 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55413,7 +56576,7 @@ module.exports = GetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); var Point = __webpack_require__(5); /** @@ -55495,7 +56658,7 @@ module.exports = GetPoints; /***/ }), -/* 310 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55535,7 +56698,7 @@ module.exports = Centroid; /***/ }), -/* 311 */ +/* 313 */ /***/ (function(module, exports) { /** @@ -55574,7 +56737,7 @@ module.exports = Offset; /***/ }), -/* 312 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55637,7 +56800,7 @@ module.exports = InCenter; /***/ }), -/* 313 */ +/* 315 */ /***/ (function(module, exports) { /** @@ -55686,7 +56849,7 @@ module.exports = InteractiveObject; /***/ }), -/* 314 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55695,7 +56858,7 @@ module.exports = InteractiveObject; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MergeXHRSettings = __webpack_require__(150); +var MergeXHRSettings = __webpack_require__(149); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -55749,7 +56912,7 @@ module.exports = XHRLoader; /***/ }), -/* 315 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55763,7 +56926,7 @@ var CONST = __webpack_require__(22); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(316); +var HTML5AudioFile = __webpack_require__(318); /** * @classdesc @@ -55989,7 +57152,7 @@ module.exports = AudioFile; /***/ }), -/* 316 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56001,7 +57164,7 @@ module.exports = AudioFile; var Class = __webpack_require__(0); var File = __webpack_require__(18); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(149); +var GetURL = __webpack_require__(148); /** * @classdesc @@ -56137,7 +57300,7 @@ module.exports = HTML5AudioFile; /***/ }), -/* 317 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56151,7 +57314,7 @@ var CONST = __webpack_require__(17); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ParseXML = __webpack_require__(230); +var ParseXML = __webpack_require__(233); /** * @classdesc @@ -56249,7 +57412,7 @@ module.exports = XMLFile; /***/ }), -/* 318 */ +/* 320 */ /***/ (function(module, exports) { /** @@ -56313,7 +57476,7 @@ module.exports = NumberArray; /***/ }), -/* 319 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56416,7 +57579,7 @@ module.exports = TextFile; /***/ }), -/* 320 */ +/* 322 */ /***/ (function(module, exports) { /** @@ -56453,7 +57616,7 @@ module.exports = Normalize; /***/ }), -/* 321 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56462,7 +57625,7 @@ module.exports = Normalize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Factorial = __webpack_require__(322); +var Factorial = __webpack_require__(324); /** * [description] @@ -56484,7 +57647,7 @@ module.exports = Bernstein; /***/ }), -/* 322 */ +/* 324 */ /***/ (function(module, exports) { /** @@ -56524,7 +57687,7 @@ module.exports = Factorial; /***/ }), -/* 323 */ +/* 325 */ /***/ (function(module, exports) { /** @@ -56559,7 +57722,7 @@ module.exports = Rotate; /***/ }), -/* 324 */ +/* 326 */ /***/ (function(module, exports) { /** @@ -56588,7 +57751,7 @@ module.exports = RoundAwayFromZero; /***/ }), -/* 325 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56597,12 +57760,12 @@ module.exports = RoundAwayFromZero; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeImage = __webpack_require__(326); +var ArcadeImage = __webpack_require__(328); var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); -var PhysicsGroup = __webpack_require__(328); -var StaticPhysicsGroup = __webpack_require__(329); +var CONST = __webpack_require__(59); +var PhysicsGroup = __webpack_require__(330); +var StaticPhysicsGroup = __webpack_require__(331); /** * @classdesc @@ -56846,7 +58009,7 @@ module.exports = Factory; /***/ }), -/* 326 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56856,7 +58019,7 @@ module.exports = Factory; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(327); +var Components = __webpack_require__(329); var Image = __webpack_require__(70); /** @@ -56939,7 +58102,7 @@ module.exports = ArcadeImage; /***/ }), -/* 327 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56952,24 +58115,24 @@ module.exports = ArcadeImage; module.exports = { - Acceleration: __webpack_require__(835), - Angular: __webpack_require__(836), - Bounce: __webpack_require__(837), - Debug: __webpack_require__(838), - Drag: __webpack_require__(839), - Enable: __webpack_require__(840), - Friction: __webpack_require__(841), - Gravity: __webpack_require__(842), - Immovable: __webpack_require__(843), - Mass: __webpack_require__(844), - Size: __webpack_require__(845), - Velocity: __webpack_require__(846) + Acceleration: __webpack_require__(838), + Angular: __webpack_require__(839), + Bounce: __webpack_require__(840), + Debug: __webpack_require__(841), + Drag: __webpack_require__(842), + Enable: __webpack_require__(843), + Friction: __webpack_require__(844), + Gravity: __webpack_require__(845), + Immovable: __webpack_require__(846), + Mass: __webpack_require__(847), + Size: __webpack_require__(848), + Velocity: __webpack_require__(849) }; /***/ }), -/* 328 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56980,7 +58143,7 @@ module.exports = { var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); var Group = __webpack_require__(69); @@ -57194,7 +58357,7 @@ module.exports = PhysicsGroup; /***/ }), -/* 329 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57207,7 +58370,7 @@ module.exports = PhysicsGroup; var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var Group = __webpack_require__(69); /** @@ -57341,7 +58504,7 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 330 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57350,26 +58513,26 @@ module.exports = StaticPhysicsGroup; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(331); -var Clamp = __webpack_require__(60); +var Body = __webpack_require__(333); +var Clamp = __webpack_require__(61); var Class = __webpack_require__(0); -var Collider = __webpack_require__(332); -var CONST = __webpack_require__(58); -var DistanceBetween = __webpack_require__(41); +var Collider = __webpack_require__(334); +var CONST = __webpack_require__(59); +var DistanceBetween = __webpack_require__(42); var EventEmitter = __webpack_require__(14); -var GetOverlapX = __webpack_require__(333); -var GetOverlapY = __webpack_require__(334); +var GetOverlapX = __webpack_require__(335); +var GetOverlapY = __webpack_require__(336); var GetValue = __webpack_require__(4); -var ProcessQueue = __webpack_require__(335); -var ProcessTileCallbacks = __webpack_require__(847); +var ProcessQueue = __webpack_require__(337); +var ProcessTileCallbacks = __webpack_require__(850); var Rectangle = __webpack_require__(8); -var RTree = __webpack_require__(336); -var SeparateTile = __webpack_require__(848); -var SeparateX = __webpack_require__(853); -var SeparateY = __webpack_require__(854); -var Set = __webpack_require__(61); -var StaticBody = __webpack_require__(339); -var TileIntersectsBody = __webpack_require__(338); +var RTree = __webpack_require__(338); +var SeparateTile = __webpack_require__(851); +var SeparateX = __webpack_require__(856); +var SeparateY = __webpack_require__(857); +var Set = __webpack_require__(62); +var StaticBody = __webpack_require__(341); +var TileIntersectsBody = __webpack_require__(340); var Vector2 = __webpack_require__(6); /** @@ -58650,6 +59813,8 @@ var World = new Class({ collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) { var i; + object1 = object1.isParent && typeof(object1.physicsType) === 'undefined' ? object1.children.entries : object1; + object2 = object2.isParent && typeof(object2.physicsType) === 'undefined' ? object2.children.entries : object2; var object1isArray = Array.isArray(object1); var object2isArray = Array.isArray(object2); @@ -58708,10 +59873,11 @@ var World = new Class({ */ collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) { + // Collide Group with Self // Only collide valid objects if (object2 === undefined && object1.isParent) { - return this.collideGroupVsSelf(object1, collideCallback, processCallback, callbackContext, overlapOnly); + return this.collideGroupVsGroup(object1, object1, collideCallback, processCallback, callbackContext, overlapOnly); } // If neither of the objects are set then bail out @@ -59069,7 +60235,7 @@ module.exports = World; /***/ }), -/* 331 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59080,7 +60246,7 @@ module.exports = World; var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var Rectangle = __webpack_require__(8); var RectangleContains = __webpack_require__(33); var Vector2 = __webpack_require__(6); @@ -59398,7 +60564,7 @@ var Body = new Class({ // If true this Body will dispatch events /** - * [description] + * Emit a `worldbounds` event when this body collides with the world bounds (and `collideWorldBounds` is also true). * * @name Phaser.Physics.Arcade.Body#onWorldBounds * @type {boolean} @@ -59862,8 +61028,8 @@ var Body = new Class({ var sprite = this.gameObject; - this.position.x = sprite.x - sprite.displayOriginX + (sprite.scaleX * this.offset.x); - this.position.y = sprite.y - sprite.displayOriginY + (sprite.scaleY * this.offset.y); + this.position.x = sprite.x + sprite.scaleX * (this.offset.x - sprite.displayOriginX); + this.position.y = sprite.y + sprite.scaleY * (this.offset.y - sprite.displayOriginY); this.updateCenter(); @@ -59926,29 +61092,29 @@ var Body = new Class({ this.dirty = false; - if (this.deltaX() < 0) + this._dx = this.deltaX(); + this._dy = this.deltaY(); + + if (this._dx < 0) { this.facing = CONST.FACING_LEFT; } - else if (this.deltaX() > 0) + else if (this._dx > 0) { this.facing = CONST.FACING_RIGHT; } - if (this.deltaY() < 0) + if (this._dy < 0) { this.facing = CONST.FACING_UP; } - else if (this.deltaY() > 0) + else if (this._dy > 0) { this.facing = CONST.FACING_DOWN; } if (this.moves) { - this._dx = this.deltaX(); - this._dy = this.deltaY(); - if (this.deltaMax.x !== 0 && this._dx !== 0) { if (this._dx < 0 && this._dx < -this.deltaMax.x) @@ -60076,6 +61242,8 @@ var Body = new Class({ { if (center === undefined) { center = true; } + var gameObject = this.gameObject; + this.sourceWidth = width; this.sourceHeight = height; @@ -60087,10 +61255,8 @@ var Body = new Class({ this.updateCenter(); - if (center && this.gameObject.getCenter) + if (center && gameObject.getCenter) { - var gameObject = this.gameObject; - var ox = gameObject.displayWidth / 2; var oy = gameObject.displayHeight / 2; @@ -60925,7 +62091,7 @@ module.exports = Body; /***/ }), -/* 332 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61105,7 +62271,7 @@ module.exports = Collider; /***/ }), -/* 333 */ +/* 335 */ /***/ (function(module, exports) { /** @@ -61184,7 +62350,7 @@ module.exports = GetOverlapX; /***/ }), -/* 334 */ +/* 336 */ /***/ (function(module, exports) { /** @@ -61263,7 +62429,7 @@ module.exports = GetOverlapY; /***/ }), -/* 335 */ +/* 337 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61461,7 +62627,7 @@ module.exports = ProcessQueue; /***/ }), -/* 336 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61470,7 +62636,7 @@ module.exports = ProcessQueue; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var quickselect = __webpack_require__(337); +var quickselect = __webpack_require__(339); /** * @classdesc @@ -62070,7 +63236,7 @@ module.exports = rbush; /***/ }), -/* 337 */ +/* 339 */ /***/ (function(module, exports) { /** @@ -62188,7 +63354,7 @@ module.exports = QuickSelect; /***/ }), -/* 338 */ +/* 340 */ /***/ (function(module, exports) { /** @@ -62225,7 +63391,7 @@ module.exports = TileIntersectsBody; /***/ }), -/* 339 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62236,7 +63402,7 @@ module.exports = TileIntersectsBody; var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var RectangleContains = __webpack_require__(33); var Vector2 = __webpack_require__(6); @@ -63081,10 +64247,10 @@ module.exports = StaticBody; /***/ }), -/* 340 */, -/* 341 */, /* 342 */, -/* 343 */ +/* 343 */, +/* 344 */, +/* 345 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63127,7 +64293,7 @@ module.exports = ReplaceByIndex; /***/ }), -/* 344 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63169,7 +64335,7 @@ module.exports = HasTileAt; /***/ }), -/* 345 */ +/* 347 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63180,7 +64346,7 @@ module.exports = HasTileAt; var Tile = __webpack_require__(44); var IsInLayerBounds = __webpack_require__(74); -var CalculateFacesAt = __webpack_require__(152); +var CalculateFacesAt = __webpack_require__(151); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -63230,7 +64396,7 @@ module.exports = RemoveTileAt; /***/ }), -/* 346 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63239,11 +64405,11 @@ module.exports = RemoveTileAt; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); -var Parse2DArray = __webpack_require__(155); -var ParseCSV = __webpack_require__(347); -var ParseJSONTiled = __webpack_require__(348); -var ParseWeltmeister = __webpack_require__(353); +var Formats = __webpack_require__(21); +var Parse2DArray = __webpack_require__(154); +var ParseCSV = __webpack_require__(349); +var ParseJSONTiled = __webpack_require__(350); +var ParseWeltmeister = __webpack_require__(355); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -63300,7 +64466,7 @@ module.exports = Parse; /***/ }), -/* 347 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63309,8 +64475,8 @@ module.exports = Parse; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); -var Parse2DArray = __webpack_require__(155); +var Formats = __webpack_require__(21); +var Parse2DArray = __webpack_require__(154); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -63348,7 +64514,7 @@ module.exports = ParseCSV; /***/ }), -/* 348 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63357,14 +64523,14 @@ module.exports = ParseCSV; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var ParseTileLayers = __webpack_require__(901); -var ParseImageLayers = __webpack_require__(903); -var ParseTilesets = __webpack_require__(904); -var ParseObjectLayers = __webpack_require__(906); -var BuildTilesetIndex = __webpack_require__(907); -var AssignTileProperties = __webpack_require__(908); +var ParseTileLayers = __webpack_require__(904); +var ParseImageLayers = __webpack_require__(906); +var ParseTilesets = __webpack_require__(907); +var ParseObjectLayers = __webpack_require__(909); +var BuildTilesetIndex = __webpack_require__(910); +var AssignTileProperties = __webpack_require__(911); /** * Parses a Tiled JSON object into a new MapData object. @@ -63424,7 +64590,7 @@ module.exports = ParseJSONTiled; /***/ }), -/* 349 */ +/* 351 */ /***/ (function(module, exports) { /** @@ -63514,7 +64680,7 @@ module.exports = ParseGID; /***/ }), -/* 350 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63686,7 +64852,7 @@ module.exports = ImageCollection; /***/ }), -/* 351 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63695,8 +64861,8 @@ module.exports = ImageCollection; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pick = __webpack_require__(905); -var ParseGID = __webpack_require__(349); +var Pick = __webpack_require__(908); +var ParseGID = __webpack_require__(351); var copyPoints = function (p) { return { x: p.x, y: p.y }; }; @@ -63768,7 +64934,7 @@ module.exports = ParseObject; /***/ }), -/* 352 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63874,7 +65040,7 @@ module.exports = ObjectLayer; /***/ }), -/* 353 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63883,10 +65049,10 @@ module.exports = ObjectLayer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var ParseTileLayers = __webpack_require__(909); -var ParseTilesets = __webpack_require__(910); +var ParseTileLayers = __webpack_require__(912); +var ParseTilesets = __webpack_require__(913); /** * Parses a Weltmeister JSON object into a new MapData object. @@ -63941,7 +65107,7 @@ module.exports = ParseWeltmeister; /***/ }), -/* 354 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63952,12 +65118,12 @@ module.exports = ParseWeltmeister; var Class = __webpack_require__(0); var DegToRad = __webpack_require__(35); -var DynamicTilemapLayer = __webpack_require__(355); +var DynamicTilemapLayer = __webpack_require__(357); var Extend = __webpack_require__(23); -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var LayerData = __webpack_require__(75); -var Rotate = __webpack_require__(323); -var StaticTilemapLayer = __webpack_require__(356); +var Rotate = __webpack_require__(325); +var StaticTilemapLayer = __webpack_require__(358); var Tile = __webpack_require__(44); var TilemapComponents = __webpack_require__(96); var Tileset = __webpack_require__(100); @@ -66200,7 +67366,7 @@ module.exports = Tilemap; /***/ }), -/* 355 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -66211,7 +67377,7 @@ module.exports = Tilemap; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DynamicTilemapLayerRender = __webpack_require__(911); +var DynamicTilemapLayerRender = __webpack_require__(914); var GameObject = __webpack_require__(1); var TilemapComponents = __webpack_require__(96); @@ -67319,7 +68485,7 @@ module.exports = DynamicTilemapLayer; /***/ }), -/* 356 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67331,9 +68497,9 @@ module.exports = DynamicTilemapLayer; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var StaticTilemapLayerRender = __webpack_require__(914); +var StaticTilemapLayerRender = __webpack_require__(917); var TilemapComponents = __webpack_require__(96); -var Utils = __webpack_require__(42); +var Utils = __webpack_require__(41); /** * @classdesc @@ -68110,940 +69276,253 @@ var StaticTilemapLayer = new Class({ */ setCollisionBetween: function (start, stop, collides, recalculateFaces) { - TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByProperty - * @since 3.0.0 - * - * @param {object} properties - An object with tile properties and corresponding values that should - * be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByProperty: function (properties, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByExclusion - * @since 3.0.0 - * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByExclusion: function (indexes, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileIndexCallback - * @since 3.0.0 - * - * @param {integer|array} indexes - Either a single tile index, or an array of tile indexes to have a - * collision callback set for. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileIndexCallback: function (indexes, callback, callbackContext) - { - TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking each tiles collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tiles collision group, the tile's colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionFromCollisionGroup - * @since 3.0.0 - * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionFromCollisionGroup: function (collides, recalculateFaces) - { - TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback - * @since 3.0.0 - * - * @param {integer} [tileX=0] - [description] - * @param {integer} [tileY=0] - [description] - * @param {integer} [width=max width based on tileX] - [description] - * @param {integer} [height=max height based on tileY] - [description] - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) - { - TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX - * @since 3.0.0 - * - * @param {integer} tileX - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {number} - */ - tileToWorldX: function (tileX, camera) - { - return TilemapComponents.TileToWorldX(tileX, camera, this.layer); - }, - - /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY - * @since 3.0.0 - * - * @param {integer} tileY - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {number} - */ - tileToWorldY: function (tileY, camera) - { - return TilemapComponents.TileToWorldY(tileY, camera, this.layer); - }, - - /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldXY - * @since 3.0.0 - * - * @param {integer} tileX - [description] - * @param {integer} tileY - [description] - * @param {Phaser.Math.Vector2} [point] - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {Phaser.Math.Vector2} - */ - tileToWorldXY: function (tileX, tileY, point, camera) - { - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); - }, - - /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX - * @since 3.0.0 - * - * @param {number} worldX - [description] - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {number} - */ - worldToTileX: function (worldX, snapToFloor, camera) - { - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY - * @since 3.0.0 - * - * @param {number} worldY - [description] - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {number} - */ - worldToTileY: function (worldY, snapToFloor, camera) - { - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY - * @since 3.0.0 - * - * @param {number} worldX - [description] - * @param {number} worldY - [description] - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Math.Vector2} [point] - [description] - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] - * - * @return {Phaser.Math.Vector2} - */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) - { - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); - } - -}); - -module.exports = StaticTilemapLayer; - - -/***/ }), -/* 357 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); - -/** - * @classdesc - * [description] - * - * @class TimerEvent - * @memberOf Phaser.Time - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] - */ -var TimerEvent = new Class({ - - initialize: - - function TimerEvent (config) - { - /** - * The delay in ms at which this TimerEvent fires. - * - * @name Phaser.Time.TimerEvent#delay - * @type {number} - * @default 0 - * @readOnly - * @since 3.0.0 - */ - this.delay = 0; - - /** - * The total number of times this TimerEvent will repeat before finishing. - * - * @name Phaser.Time.TimerEvent#repeat - * @type {number} - * @default 0 - * @readOnly - * @since 3.0.0 - */ - this.repeat = 0; - - /** - * If repeating this contains the current repeat count. - * - * @name Phaser.Time.TimerEvent#repeatCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeatCount = 0; - - /** - * True if this TimerEvent loops, otherwise false. - * - * @name Phaser.Time.TimerEvent#loop - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.loop = false; - - /** - * The callback that will be called when the TimerEvent occurs. - * - * @name Phaser.Time.TimerEvent#callback - * @type {function} - * @since 3.0.0 - */ - this.callback; - - /** - * The scope in which the callback will be called. - * - * @name Phaser.Time.TimerEvent#callbackScope - * @type {object} - * @since 3.0.0 - */ - this.callbackScope; - - /** - * Additional arguments to be passed to the callback. - * - * @name Phaser.Time.TimerEvent#args - * @type {array} - * @since 3.0.0 - */ - this.args; - - /** - * Scale the time causing this TimerEvent to update. - * - * @name Phaser.Time.TimerEvent#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * Start this many MS into the elapsed (useful if you want a long duration with repeat, but for the first loop to fire quickly) - * - * @name Phaser.Time.TimerEvent#startAt - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.startAt = 0; - - /** - * [description] - * - * @name Phaser.Time.TimerEvent#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; - - /** - * [description] - * - * @name Phaser.Time.TimerEvent#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - /** - * [description] - * - * @name Phaser.Time.TimerEvent#hasDispatched - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.hasDispatched = false; - - this.reset(config); - }, - - /** - * [description] - * - * @method Phaser.Time.TimerEvent#reset - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.Time.TimerEvent} This TimerEvent object. - */ - reset: function (config) - { - this.delay = GetFastValue(config, 'delay', 0); - - // Can also be set to -1 for an infinite loop (same as setting loop: true) - this.repeat = GetFastValue(config, 'repeat', 0); - - this.loop = GetFastValue(config, 'loop', false); - - this.callback = GetFastValue(config, 'callback', undefined); - - this.callbackScope = GetFastValue(config, 'callbackScope', this.callback); - - this.args = GetFastValue(config, 'args', []); - - this.timeScale = GetFastValue(config, 'timeScale', 1); - - this.startAt = GetFastValue(config, 'startAt', 0); - - this.paused = GetFastValue(config, 'paused', false); - - this.elapsed = this.startAt; - this.hasDispatched = false; - this.repeatCount = (this.repeat === -1 || this.loop) ? 999999999999 : this.repeat; + TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); return this; }, /** - * Gets the progress of the current iteration, not factoring in repeats. - * - * @method Phaser.Time.TimerEvent#getProgress + * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property + * that matches the given properties object, its collision flag will be set. The `collides` + * parameter controls if collision will be enabled (true) or disabled (false). Passing in + * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that + * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can + * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a + * "types" property that matches any of those values, its collision flag will be updated. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByProperty * @since 3.0.0 * - * @return {number} [description] + * @param {object} properties - An object with tile properties and corresponding values that should + * be checked. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear + * collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the + * update. + * + * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ - getProgress: function () + setCollisionByProperty: function (properties, collides, recalculateFaces) { - return (this.elapsed / this.delay); + TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); + + return this; }, /** - * Gets the progress of the timer overall, factoring in repeats. - * - * @method Phaser.Time.TimerEvent#getOverallProgress + * Sets collision on all tiles in the given layer, except for tiles that have an index specified in + * the given array. The `collides` parameter controls if collision will be enabled (true) or + * disabled (false). + * + * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByExclusion * @since 3.0.0 + * + * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear + * collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the + * update. * - * @return {number} [description] + * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ - getOverallProgress: function () + setCollisionByExclusion: function (indexes, collides, recalculateFaces) { - if (this.repeat > 0) - { - var totalDuration = this.delay + (this.delay * this.repeat); - var totalElapsed = this.elapsed + (this.delay * (this.repeat - this.repeatCount)); + TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); - return (totalElapsed / totalDuration); - } - else - { - return this.getProgress(); - } + return this; }, /** - * [description] - * - * @method Phaser.Time.TimerEvent#getRepeatCount + * Sets a global collision callback for the given tile index within the layer. This will affect all + * tiles on this layer that have the same index. If a callback is already set for the tile index it + * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile + * at a specific location on the map then see setTileLocationCallback. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#setTileIndexCallback * @since 3.0.0 + * + * @param {integer|array} indexes - Either a single tile index, or an array of tile indexes to have a + * collision callback set for. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. * - * @return {number} [description] + * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ - getRepeatCount: function () + setTileIndexCallback: function (indexes, callback, callbackContext) { - return this.repeatCount; + TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); + + return this; }, /** - * [description] - * - * @method Phaser.Time.TimerEvent#getElapsed + * Sets collision on the tiles within a layer by checking each tiles collision group data + * (typically defined in Tiled within the tileset collision editor). If any objects are found within + * a tiles collision group, the tile's colliding information will be set. The `collides` parameter + * controls if collision will be enabled (true) or disabled (false). + * + * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionFromCollisionGroup * @since 3.0.0 + * + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear + * collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the + * update. * - * @return {number} [description] + * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ - getElapsed: function () + setCollisionFromCollisionGroup: function (collides, recalculateFaces) { - return this.elapsed; + TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); + + return this; }, /** - * [description] - * - * @method Phaser.Time.TimerEvent#getElapsedSeconds + * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. + * If a callback is already set for the tile index it will be replaced. Set the callback to null to + * remove it. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback * @since 3.0.0 + * + * @param {integer} [tileX=0] - [description] + * @param {integer} [tileY=0] - [description] + * @param {integer} [width=max width based on tileX] - [description] + * @param {integer} [height=max height based on tileY] - [description] + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. * - * @return {number} [description] + * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. */ - getElapsedSeconds: function () + setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) { - return this.elapsed * 0.001; + TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); + + return this; }, /** - * [description] - * - * @method Phaser.Time.TimerEvent#remove + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX * @since 3.0.0 + * + * @param {integer} tileX - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] * - * @param {function} dispatchCallback - [description] + * @return {number} */ - remove: function (dispatchCallback) + tileToWorldX: function (tileX, camera) { - if (dispatchCallback === undefined) { dispatchCallback = false; } - - this.elapsed = this.delay; - - this.hasDispatched = !!dispatchCallback; - - this.repeatCount = 0; + return TilemapComponents.TileToWorldX(tileX, camera, this.layer); }, /** - * [description] - * - * @method Phaser.Time.TimerEvent#destroy + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY * @since 3.0.0 + * + * @param {integer} tileY - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * + * @return {number} */ - destroy: function () - { - this.callback = undefined; - this.callbackScope = undefined; - this.args = []; - } - -}); - -module.exports = TimerEvent; - - -/***/ }), -/* 358 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var RESERVED = __webpack_require__(923); - -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetProps - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {array} [description] - */ -var GetProps = function (config) -{ - var key; - var keys = []; - - // First see if we have a props object - - if (config.hasOwnProperty('props')) - { - for (key in config.props) - { - // Skip any property that starts with an underscore - if (key.substr(0, 1) !== '_') - { - keys.push({ key: key, value: config.props[key] }); - } - } - } - else - { - for (key in config) - { - // Skip any property that is in the ReservedProps list or that starts with an underscore - if (RESERVED.indexOf(key) === -1 && key.substr(0, 1) !== '_') - { - keys.push({ key: key, value: config[key] }); - } - } - } - - return keys; -}; - -module.exports = GetProps; - - -/***/ }), -/* 359 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetValue = __webpack_require__(4); - -/** - * [description] - * - * @function Phaser.Tweens.Builders.GetTweens - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {array} [description] - */ -var GetTweens = function (config) -{ - var tweens = GetValue(config, 'tweens', null); - - if (tweens === null) - { - return []; - } - else if (typeof tweens === 'function') - { - tweens = tweens.call(); - } - - if (!Array.isArray(tweens)) - { - tweens = [ tweens ]; - } - - return tweens; -}; - -module.exports = GetTweens; - - -/***/ }), -/* 360 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Defaults = __webpack_require__(159); -var GetAdvancedValue = __webpack_require__(10); -var GetBoolean = __webpack_require__(73); -var GetEaseFunction = __webpack_require__(71); -var GetNewValue = __webpack_require__(101); -var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(158); -var Tween = __webpack_require__(160); -var TweenData = __webpack_require__(161); - -/** - * [description] - * - * @function Phaser.Tweens.Builders.NumberTweenBuilder - * @since 3.0.0 - * - * @param {Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline} parent - [description] - * @param {object} config - [description] - * @param {Phaser.Tweens.Tween~ConfigDefaults} defaults - [description] - * - * @return {Phaser.Tweens.Tween} [description] - */ -var NumberTweenBuilder = function (parent, config, defaults) -{ - if (defaults === undefined) - { - defaults = Defaults; - } - - // var tween = this.tweens.addCounter({ - // from: 100, - // to: 200, - // ... (normal tween properties) - // }) - // - // Then use it in your game via: - // - // tween.getValue() - - var from = GetValue(config, 'from', 0); - var to = GetValue(config, 'to', 1); - - var targets = [ { value: from } ]; - - var delay = GetNewValue(config, 'delay', defaults.delay); - var duration = GetNewValue(config, 'duration', defaults.duration); - var easeParams = GetValue(config, 'easeParams', defaults.easeParams); - var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); - var hold = GetNewValue(config, 'hold', defaults.hold); - var repeat = GetNewValue(config, 'repeat', defaults.repeat); - var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - - var data = []; - - var ops = GetValueOp('value', to); - - var tweenData = TweenData( - targets[0], - 'value', - ops.getEnd, - ops.getStart, - ease, - delay, - duration, - yoyo, - hold, - repeat, - repeatDelay, - false, - false - ); - - tweenData.start = from; - tweenData.current = from; - tweenData.to = to; - - data.push(tweenData); - - var tween = new Tween(parent, data, targets); - - tween.offset = GetAdvancedValue(config, 'offset', null); - tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - tween.paused = GetBoolean(config, 'paused', false); - tween.useFrames = GetBoolean(config, 'useFrames', false); - - // Set the Callbacks - var scope = GetValue(config, 'callbackScope', tween); - - // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params - var tweenArray = [ tween, null ]; - - var callbacks = Tween.TYPES; - - for (var i = 0; i < callbacks.length; i++) - { - var type = callbacks[i]; - - var callback = GetValue(config, type, false); - - if (callback) - { - var callbackScope = GetValue(config, type + 'Scope', scope); - var callbackParams = GetValue(config, type + 'Params', []); - - // The null is reset to be the Tween target - tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); - } - } - - return tween; -}; - -module.exports = NumberTweenBuilder; - - -/***/ }), -/* 361 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Clone = __webpack_require__(52); -var Defaults = __webpack_require__(159); -var GetAdvancedValue = __webpack_require__(10); -var GetBoolean = __webpack_require__(73); -var GetEaseFunction = __webpack_require__(71); -var GetNewValue = __webpack_require__(101); -var GetTargets = __webpack_require__(157); -var GetTweens = __webpack_require__(359); -var GetValue = __webpack_require__(4); -var Timeline = __webpack_require__(362); -var TweenBuilder = __webpack_require__(102); - -/** - * [description] - * - * @function Phaser.Tweens.Builders.TimelineBuilder - * @since 3.0.0 - * - * @param {Phaser.Tweens.TweenManager} manager - [description] - * @param {object} config - [description] - * - * @return {Phaser.Tweens.Timeline} [description] - */ -var TimelineBuilder = function (manager, config) -{ - var timeline = new Timeline(manager); - - var tweens = GetTweens(config); - - if (tweens.length === 0) - { - timeline.paused = true; - - return timeline; - } - - var defaults = Clone(Defaults); - - defaults.targets = GetTargets(config); - - // totalDuration: If specified each tween in the Timeline is given an equal portion of the totalDuration - - var totalDuration = GetAdvancedValue(config, 'totalDuration', 0); - - if (totalDuration > 0) - { - defaults.duration = Math.floor(totalDuration / tweens.length); - } - else - { - defaults.duration = GetNewValue(config, 'duration', defaults.duration); - } - - defaults.delay = GetNewValue(config, 'delay', defaults.delay); - defaults.easeParams = GetValue(config, 'easeParams', defaults.easeParams); - defaults.ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), defaults.easeParams); - defaults.hold = GetNewValue(config, 'hold', defaults.hold); - defaults.repeat = GetNewValue(config, 'repeat', defaults.repeat); - defaults.repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - defaults.yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - defaults.flipX = GetBoolean(config, 'flipX', defaults.flipX); - defaults.flipY = GetBoolean(config, 'flipY', defaults.flipY); - - // Create the Tweens - for (var i = 0; i < tweens.length; i++) - { - timeline.queue(TweenBuilder(timeline, tweens[i], defaults)); - } - - timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - timeline.paused = GetBoolean(config, 'paused', false); - timeline.useFrames = GetBoolean(config, 'useFrames', false); - - // Callbacks - - var scope = GetValue(config, 'callbackScope', timeline); - - var timelineArray = [ timeline ]; - - var onStart = GetValue(config, 'onStart', false); - - // The Start of the Timeline - if (onStart) + tileToWorldY: function (tileY, camera) { - var onStartScope = GetValue(config, 'onStartScope', scope); - var onStartParams = GetValue(config, 'onStartParams', []); - - timeline.setCallback('onStart', onStart, timelineArray.concat(onStartParams), onStartScope); - } - - var onUpdate = GetValue(config, 'onUpdate', false); + return TilemapComponents.TileToWorldY(tileY, camera, this.layer); + }, - // Every time the Timeline updates (regardless which Tweens are running) - if (onUpdate) + /** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldXY + * @since 3.0.0 + * + * @param {integer} tileX - [description] + * @param {integer} tileY - [description] + * @param {Phaser.Math.Vector2} [point] - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * + * @return {Phaser.Math.Vector2} + */ + tileToWorldXY: function (tileX, tileY, point, camera) { - var onUpdateScope = GetValue(config, 'onUpdateScope', scope); - var onUpdateParams = GetValue(config, 'onUpdateParams', []); - - timeline.setCallback('onUpdate', onUpdate, timelineArray.concat(onUpdateParams), onUpdateScope); - } - - var onLoop = GetValue(config, 'onLoop', false); + return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); + }, - // Called when the whole Timeline loops - if (onLoop) + /** + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX + * @since 3.0.0 + * + * @param {number} worldX - [description] + * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the + * nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * + * @return {number} + */ + worldToTileX: function (worldX, snapToFloor, camera) { - var onLoopScope = GetValue(config, 'onLoopScope', scope); - var onLoopParams = GetValue(config, 'onLoopParams', []); - - timeline.setCallback('onLoop', onLoop, timelineArray.concat(onLoopParams), onLoopScope); - } - - var onYoyo = GetValue(config, 'onYoyo', false); + return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); + }, - // Called when a Timeline yoyos - if (onYoyo) + /** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY + * @since 3.0.0 + * + * @param {number} worldY - [description] + * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the + * nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * + * @return {number} + */ + worldToTileY: function (worldY, snapToFloor, camera) { - var onYoyoScope = GetValue(config, 'onYoyoScope', scope); - var onYoyoParams = GetValue(config, 'onYoyoParams', []); - - timeline.setCallback('onYoyo', onYoyo, timelineArray.concat(null, onYoyoParams), onYoyoScope); - } - - var onComplete = GetValue(config, 'onComplete', false); + return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); + }, - // Called when the Timeline completes, after the completeDelay, etc. - if (onComplete) + /** + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY + * @since 3.0.0 + * + * @param {number} worldX - [description] + * @param {number} worldY - [description] + * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the + * nearest integer. + * @param {Phaser.Math.Vector2} [point] - [description] + * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description] + * + * @return {Phaser.Math.Vector2} + */ + worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) { - var onCompleteScope = GetValue(config, 'onCompleteScope', scope); - var onCompleteParams = GetValue(config, 'onCompleteParams', []); - - timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope); + return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); } - return timeline; -}; +}); -module.exports = TimelineBuilder; +module.exports = StaticTilemapLayer; /***/ }), -/* 362 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69053,166 +69532,129 @@ module.exports = TimelineBuilder; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(14); -var TweenBuilder = __webpack_require__(102); -var TWEEN_CONST = __webpack_require__(87); +var GetFastValue = __webpack_require__(2); /** * @classdesc * [description] * - * @class Timeline - * @memberOf Phaser.Tweens - * @extends EventEmitter + * @class TimerEvent + * @memberOf Phaser.Time * @constructor * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - [description] + * @param {object} config - [description] */ -var Timeline = new Class({ - - Extends: EventEmitter, +var TimerEvent = new Class({ initialize: - function Timeline (manager) + function TimerEvent (config) { - EventEmitter.call(this); - - /** - * [description] - * - * @name Phaser.Tweens.Timeline#manager - * @type {Phaser.Tweens.TweenManager} - * @since 3.0.0 - */ - this.manager = manager; - /** - * [description] + * The delay in ms at which this TimerEvent fires. * - * @name Phaser.Tweens.Timeline#isTimeline - * @type {boolean} - * @default true + * @name Phaser.Time.TimerEvent#delay + * @type {number} + * @default 0 + * @readOnly * @since 3.0.0 */ - this.isTimeline = true; + this.delay = 0; /** - * An array of Tween objects, each containing a unique property and target being tweened. + * The total number of times this TimerEvent will repeat before finishing. * - * @name Phaser.Tweens.Timeline#data - * @type {array} - * @default [] + * @name Phaser.Time.TimerEvent#repeat + * @type {number} + * @default 0 + * @readOnly * @since 3.0.0 */ - this.data = []; + this.repeat = 0; /** - * data array doesn't usually change, so we can cache the length + * If repeating this contains the current repeat count. * - * @name Phaser.Tweens.Timeline#totalData + * @name Phaser.Time.TimerEvent#repeatCount * @type {number} * @default 0 * @since 3.0.0 */ - this.totalData = 0; + this.repeatCount = 0; /** - * If true then duration, delay, etc values are all frame totals. + * True if this TimerEvent loops, otherwise false. * - * @name Phaser.Tweens.Timeline#useFrames + * @name Phaser.Time.TimerEvent#loop * @type {boolean} * @default false + * @readOnly * @since 3.0.0 */ - this.useFrames = false; + this.loop = false; /** - * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. - * Value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. + * The callback that will be called when the TimerEvent occurs. * - * @name Phaser.Tweens.Timeline#timeScale - * @type {number} - * @default 1 + * @name Phaser.Time.TimerEvent#callback + * @type {function} * @since 3.0.0 */ - this.timeScale = 1; + this.callback; /** - * Loop this tween? Can be -1 for an infinite loop, or an integer. - * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD) + * The scope in which the callback will be called. * - * @name Phaser.Tweens.Timeline#loop - * @type {number} - * @default 0 + * @name Phaser.Time.TimerEvent#callbackScope + * @type {object} * @since 3.0.0 */ - this.loop = 0; + this.callbackScope; /** - * Time in ms/frames before the tween loops. + * Additional arguments to be passed to the callback. * - * @name Phaser.Tweens.Timeline#loopDelay - * @type {number} - * @default 0 + * @name Phaser.Time.TimerEvent#args + * @type {array} * @since 3.0.0 */ - this.loopDelay = 0; + this.args; /** - * How many loops are left to run? + * Scale the time causing this TimerEvent to update. * - * @name Phaser.Tweens.Timeline#loopCounter + * @name Phaser.Time.TimerEvent#timeScale * @type {number} - * @default 0 + * @default 1 * @since 3.0.0 */ - this.loopCounter = 0; + this.timeScale = 1; /** - * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes) + * Start this many MS into the elapsed (useful if you want a long duration with repeat, but for the first loop to fire quickly) * - * @name Phaser.Tweens.Timeline#completeDelay + * @name Phaser.Time.TimerEvent#startAt * @type {number} * @default 0 * @since 3.0.0 */ - this.completeDelay = 0; + this.startAt = 0; /** - * Countdown timer (used by loopDelay and completeDelay) + * [description] * - * @name Phaser.Tweens.Timeline#countdown + * @name Phaser.Time.TimerEvent#elapsed * @type {number} * @default 0 * @since 3.0.0 */ - this.countdown = 0; - - /** - * The current state of the tween - * - * @name Phaser.Tweens.Timeline#state - * @type {integer} - * @since 3.0.0 - */ - this.state = TWEEN_CONST.PENDING_ADD; - - /** - * The state of the tween when it was paused (used by Resume) - * - * @name Phaser.Tweens.Timeline#_pausedState - * @type {integer} - * @private - * @since 3.0.0 - */ - this._pausedState = TWEEN_CONST.PENDING_ADD; + this.elapsed = 0; /** - * Does the Tween start off paused? (if so it needs to be started with Tween.play) + * [description] * - * @name Phaser.Tweens.Timeline#paused + * @name Phaser.Time.TimerEvent#paused * @type {boolean} * @default false * @since 3.0.0 @@ -69220,685 +69662,403 @@ var Timeline = new Class({ this.paused = false; /** - * Elapsed time in ms/frames of this run through the Tween. - * - * @name Phaser.Tweens.Timeline#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; - - /** - * Total elapsed time in ms/frames of the entire Tween, including looping. - * - * @name Phaser.Tweens.Timeline#totalElapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalElapsed = 0; - - /** - * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays. - * - * @name Phaser.Tweens.Timeline#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; - - /** - * Value between 0 and 1. The amount through the Tween, excluding loops. - * - * @name Phaser.Tweens.Timeline#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; - - /** - * Time in ms/frames for all Tweens to complete (including looping) - * - * @name Phaser.Tweens.Timeline#totalDuration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalDuration = 0; - - /** - * Value between 0 and 1. The amount through the entire Tween, including looping. + * [description] * - * @name Phaser.Tweens.Timeline#totalProgress - * @type {number} - * @default 0 + * @name Phaser.Time.TimerEvent#hasDispatched + * @type {boolean} + * @default false * @since 3.0.0 */ - this.totalProgress = 0; - - this.callbacks = { - onComplete: null, - onLoop: null, - onStart: null, - onUpdate: null, - onYoyo: null - }; - - this.callbackScope; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#setTimeScale - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - setTimeScale: function (value) - { - this.timeScale = value; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#getTimeScale - * @since 3.0.0 - * - * @return {number} [description] - */ - getTimeScale: function () - { - return this.timeScale; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isPlaying - * @since 3.0.0 - * - * @return {boolean} [description] - */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#add - * @since 3.0.0 - * - * @param {[type]} config - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - add: function (config) - { - return this.queue(TweenBuilder(this, config)); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#queue - * @since 3.0.0 - * - * @param {[type]} tween - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - queue: function (tween) - { - if (!this.isPlaying()) - { - tween.parent = this; - tween.parentIsTimeline = true; - - this.data.push(tween); - - this.totalData = this.data.length; - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#hasOffset - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * - * @return {boolean} [description] - */ - hasOffset: function (tween) - { - return (tween.offset !== null); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isOffsetAbsolute - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {boolean} [description] - */ - isOffsetAbsolute: function (value) - { - return (typeof(value) === 'number'); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isOffsetRelative - * @since 3.0.0 - * - * @param {string} value - [description] - * - * @return {boolean} [description] - */ - isOffsetRelative: function (value) - { - var t = typeof(value); - - if (t === 'string') - { - var op = value[0]; - - if (op === '-' || op === '+') - { - return true; - } - } + this.hasDispatched = false; - return false; + this.reset(config); }, /** * [description] * - * @method Phaser.Tweens.Timeline#getRelativeOffset + * @method Phaser.Time.TimerEvent#reset * @since 3.0.0 * - * @param {string} value - [description] - * @param {number} base - [description] - * - * @return {number} [description] - */ - getRelativeOffset: function (value, base) - { - var op = value[0]; - var num = parseFloat(value.substr(2)); - var result = base; - - switch (op) - { - case '+': - result += num; - break; - - case '-': - result -= num; - break; - } - - // Cannot ever be < 0 - return Math.max(0, result); - }, - - /** - * [description] + * @param {object} config - [description] * - * @method Phaser.Tweens.Timeline#calcDuration - * @since 3.0.0 + * @return {Phaser.Time.TimerEvent} This TimerEvent object. */ - calcDuration: function () + reset: function (config) { - var prevEnd = 0; - var totalDuration = 0; - var offsetDuration = 0; - - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; + this.delay = GetFastValue(config, 'delay', 0); - tween.init(); + // Can also be set to -1 for an infinite loop (same as setting loop: true) + this.repeat = GetFastValue(config, 'repeat', 0); - if (this.hasOffset(tween)) - { - if (this.isOffsetAbsolute(tween.offset)) - { - // An actual number, so it defines the start point from the beginning of the timeline - tween.calculatedOffset = tween.offset; + this.loop = GetFastValue(config, 'loop', false); - if (tween.offset === 0) - { - offsetDuration = 0; - } - } - else if (this.isOffsetRelative(tween.offset)) - { - // A relative offset (i.e. '-=1000', so starts at 'offset' ms relative to the PREVIOUS Tweens ending time) - tween.calculatedOffset = this.getRelativeOffset(tween.offset, prevEnd); - } - } - else - { - // Sequential - tween.calculatedOffset = offsetDuration; - } + this.callback = GetFastValue(config, 'callback', undefined); - prevEnd = tween.totalDuration + tween.calculatedOffset; + this.callbackScope = GetFastValue(config, 'callbackScope', this.callback); - totalDuration += tween.totalDuration; - offsetDuration += tween.totalDuration; - } + this.args = GetFastValue(config, 'args', []); - // Excludes loop values - this.duration = totalDuration; + this.timeScale = GetFastValue(config, 'timeScale', 1); - this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; + this.startAt = GetFastValue(config, 'startAt', 0); - if (this.loopCounter > 0) - { - this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); - } - else - { - this.totalDuration = this.duration + this.completeDelay; - } + this.paused = GetFastValue(config, 'paused', false); + + this.elapsed = this.startAt; + this.hasDispatched = false; + this.repeatCount = (this.repeat === -1 || this.loop) ? 999999999999 : this.repeat; + + return this; }, /** - * [description] + * Gets the progress of the current iteration, not factoring in repeats. * - * @method Phaser.Tweens.Timeline#init + * @method Phaser.Time.TimerEvent#getProgress * @since 3.0.0 * - * @return {boolean} [description] + * @return {number} [description] */ - init: function () + getProgress: function () { - this.calcDuration(); - - this.progress = 0; - this.totalProgress = 0; + return (this.elapsed / this.delay); + }, - if (this.paused) + /** + * Gets the progress of the timer overall, factoring in repeats. + * + * @method Phaser.Time.TimerEvent#getOverallProgress + * @since 3.0.0 + * + * @return {number} [description] + */ + getOverallProgress: function () + { + if (this.repeat > 0) { - this.state = TWEEN_CONST.PAUSED; + var totalDuration = this.delay + (this.delay * this.repeat); + var totalElapsed = this.elapsed + (this.delay * (this.repeat - this.repeatCount)); - return false; + return (totalElapsed / totalDuration); } else { - return true; + return this.getProgress(); } }, /** * [description] * - * @method Phaser.Tweens.Timeline#resetTweens + * @method Phaser.Time.TimerEvent#getRepeatCount * @since 3.0.0 * - * @param {boolean} resetFromLoop - [description] + * @return {number} [description] */ - resetTweens: function (resetFromLoop) + getRepeatCount: function () { - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; - - tween.play(resetFromLoop); - } + return this.repeatCount; }, /** * [description] * - * @method Phaser.Tweens.Timeline#setCallback + * @method Phaser.Time.TimerEvent#getElapsed * @since 3.0.0 * - * @param {string} type - [description] - * @param {function} callback - [description] - * @param {array} [params] - [description] - * @param {object} [scope] - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. + * @return {number} [description] */ - setCallback: function (type, callback, params, scope) + getElapsed: function () { - if (Timeline.TYPES.indexOf(type) !== -1) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - } - - return this; + return this.elapsed; }, /** * [description] * - * @method Phaser.Tweens.Timeline#play + * @method Phaser.Time.TimerEvent#getElapsedSeconds * @since 3.0.0 + * + * @return {number} [description] */ - play: function () + getElapsedSeconds: function () { - if (this.state === TWEEN_CONST.ACTIVE) - { - return; - } - - if (this.paused) - { - this.paused = false; - - this.manager.makeActive(this); - - return; - } - else - { - this.resetTweens(false); + return this.elapsed * 0.001; + }, - this.state = TWEEN_CONST.ACTIVE; - } + /** + * [description] + * + * @method Phaser.Time.TimerEvent#remove + * @since 3.0.0 + * + * @param {function} dispatchCallback - [description] + */ + remove: function (dispatchCallback) + { + if (dispatchCallback === undefined) { dispatchCallback = false; } - var onStart = this.callbacks.onStart; + this.elapsed = this.delay; - if (onStart) - { - onStart.func.apply(onStart.scope, onStart.params); - } + this.hasDispatched = !!dispatchCallback; - this.emit('start', this); + this.repeatCount = 0; }, /** * [description] * - * @method Phaser.Tweens.Timeline#nextState + * @method Phaser.Time.TimerEvent#destroy * @since 3.0.0 */ - nextState: function () + destroy: function () { - if (this.loopCounter > 0) - { - // Reset the elapsed time - // TODO: Probably ought to be set to the remainder from elapsed - duration - // as the tweens nearly always over-run by a few ms due to rAf - - this.elapsed = 0; - this.progress = 0; - - this.loopCounter--; + this.callback = undefined; + this.callbackScope = undefined; + this.args = []; + } - var onLoop = this.callbacks.onLoop; +}); - if (onLoop) - { - onLoop.func.apply(onLoop.scope, onLoop.params); - } +module.exports = TimerEvent; - this.emit('loop', this, this.loopCounter); - this.resetTweens(true); +/***/ }), +/* 360 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.loopDelay > 0) - { - this.countdown = this.loopDelay; - this.state = TWEEN_CONST.LOOP_DELAY; - } - else - { - this.state = TWEEN_CONST.ACTIVE; - } - } - else if (this.completeDelay > 0) - { - this.countdown = this.completeDelay; - this.state = TWEEN_CONST.COMPLETE_DELAY; - } - else - { - var onComplete = this.callbacks.onComplete; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (onComplete) - { - onComplete.func.apply(onComplete.scope, onComplete.params); - } +var RESERVED = __webpack_require__(926); - this.emit('complete', this); +/** + * [description] + * + * @function Phaser.Tweens.Builders.GetProps + * @since 3.0.0 + * + * @param {object} config - [description] + * + * @return {array} [description] + */ +var GetProps = function (config) +{ + var key; + var keys = []; - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, + // First see if we have a props object - /** - * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager. - * Otherwise, returns false. - * - * @method Phaser.Tweens.Timeline#update - * @since 3.0.0 - * - * @param {number} timestamp - [description] - * @param {number} delta - [description] - * - * @return {boolean} Returns `true` if this Timeline has finished and should be removed from the Tween Manager. - */ - update: function (timestamp, delta) + if (config.hasOwnProperty('props')) { - if (this.state === TWEEN_CONST.PAUSED) + for (key in config.props) { - return; + // Skip any property that starts with an underscore + if (key.substr(0, 1) !== '_') + { + keys.push({ key: key, value: config.props[key] }); + } } - - var rawDelta = delta; - - if (this.useFrames) + } + else + { + for (key in config) { - delta = 1 * this.manager.timeScale; + // Skip any property that is in the ReservedProps list or that starts with an underscore + if (RESERVED.indexOf(key) === -1 && key.substr(0, 1) !== '_') + { + keys.push({ key: key, value: config[key] }); + } } + } - delta *= this.timeScale; - - this.elapsed += delta; - this.progress = Math.min(this.elapsed / this.duration, 1); + return keys; +}; - this.totalElapsed += delta; - this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); +module.exports = GetProps; - switch (this.state) - { - case TWEEN_CONST.ACTIVE: - var stillRunning = this.totalData; +/***/ }), +/* 361 */ +/***/ (function(module, exports, __webpack_require__) { - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (tween.update(timestamp, rawDelta)) - { - stillRunning--; - } - } +var GetValue = __webpack_require__(4); - var onUpdate = this.callbacks.onUpdate; +/** + * [description] + * + * @function Phaser.Tweens.Builders.GetTweens + * @since 3.0.0 + * + * @param {object} config - [description] + * + * @return {array} [description] + */ +var GetTweens = function (config) +{ + var tweens = GetValue(config, 'tweens', null); - if (onUpdate) - { - onUpdate.func.apply(onUpdate.scope, onUpdate.params); - } + if (tweens === null) + { + return []; + } + else if (typeof tweens === 'function') + { + tweens = tweens.call(); + } - this.emit('update', this); + if (!Array.isArray(tweens)) + { + tweens = [ tweens ]; + } - // Anything still running? If not, we're done - if (stillRunning === 0) - { - this.nextState(); - } + return tweens; +}; - break; +module.exports = GetTweens; - case TWEEN_CONST.LOOP_DELAY: - this.countdown -= delta; +/***/ }), +/* 362 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - break; +var Defaults = __webpack_require__(158); +var GetAdvancedValue = __webpack_require__(10); +var GetBoolean = __webpack_require__(73); +var GetEaseFunction = __webpack_require__(71); +var GetNewValue = __webpack_require__(101); +var GetValue = __webpack_require__(4); +var GetValueOp = __webpack_require__(157); +var Tween = __webpack_require__(159); +var TweenData = __webpack_require__(160); - case TWEEN_CONST.COMPLETE_DELAY: +/** + * [description] + * + * @function Phaser.Tweens.Builders.NumberTweenBuilder + * @since 3.0.0 + * + * @param {Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline} parent - [description] + * @param {object} config - [description] + * @param {Phaser.Tweens.Tween~ConfigDefaults} defaults - [description] + * + * @return {Phaser.Tweens.Tween} [description] + */ +var NumberTweenBuilder = function (parent, config, defaults) +{ + if (defaults === undefined) + { + defaults = Defaults; + } - this.countdown -= delta; + // var tween = this.tweens.addCounter({ + // from: 100, + // to: 200, + // ... (normal tween properties) + // }) + // + // Then use it in your game via: + // + // tween.getValue() - if (this.countdown <= 0) - { - var onComplete = this.callbacks.onComplete; + var from = GetValue(config, 'from', 0); + var to = GetValue(config, 'to', 1); - if (onComplete) - { - onComplete.func.apply(onComplete.scope, onComplete.params); - } + var targets = [ { value: from } ]; - this.emit('complete', this); + var delay = GetNewValue(config, 'delay', defaults.delay); + var duration = GetNewValue(config, 'duration', defaults.duration); + var easeParams = GetValue(config, 'easeParams', defaults.easeParams); + var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); + var hold = GetNewValue(config, 'hold', defaults.hold); + var repeat = GetNewValue(config, 'repeat', defaults.repeat); + var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); + var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - this.state = TWEEN_CONST.PENDING_REMOVE; - } + var data = []; - break; - } + var ops = GetValueOp('value', to); - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, + var tweenData = TweenData( + targets[0], + 'value', + ops.getEnd, + ops.getStart, + ease, + delay, + duration, + yoyo, + hold, + repeat, + repeatDelay, + false, + false + ); - /** - * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. - * - * @method Phaser.Tweens.Timeline#stop - * @since 3.0.0 - */ - stop: function () - { - this.state = TWEEN_CONST.PENDING_REMOVE; - }, + tweenData.start = from; + tweenData.current = from; + tweenData.to = to; - /** - * [description] - * - * @method Phaser.Tweens.Timeline#pause - * @since 3.0.0 - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } + data.push(tweenData); - this.paused = true; + var tween = new Tween(parent, data, targets); - this._pausedState = this.state; + tween.offset = GetAdvancedValue(config, 'offset', null); + tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + tween.paused = GetBoolean(config, 'paused', false); + tween.useFrames = GetBoolean(config, 'useFrames', false); - this.state = TWEEN_CONST.PAUSED; + // Set the Callbacks + var scope = GetValue(config, 'callbackScope', tween); - this.emit('pause', this); + // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params + var tweenArray = [ tween, null ]; - return this; - }, + var callbacks = Tween.TYPES; - /** - * [description] - * - * @method Phaser.Tweens.Timeline#resume - * @since 3.0.0 - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - resume: function () + for (var i = 0; i < callbacks.length; i++) { - if (this.state === TWEEN_CONST.PAUSED) - { - this.paused = false; - - this.state = this._pausedState; - } - - this.emit('resume', this); - - return this; - }, + var type = callbacks[i]; - /** - * [description] - * - * @method Phaser.Tweens.Timeline#hasTarget - * @since 3.0.0 - * - * @param {object} target - [description] - * - * @return {boolean} [description] - */ - hasTarget: function (target) - { - for (var i = 0; i < this.data.length; i++) - { - if (this.data[i].hasTarget(target)) - { - return true; - } - } - - return false; - }, + var callback = GetValue(config, type, false); - /** - * [description] - * - * @method Phaser.Tweens.Timeline#destroy - * @since 3.0.0 - */ - destroy: function () - { - for (var i = 0; i < this.data.length; i++) + if (callback) { - this.data[i].destroy(); - } + var callbackScope = GetValue(config, type + 'Scope', scope); + var callbackParams = GetValue(config, type + 'Params', []); + // The null is reset to be the Tween target + tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); + } } -}); -Timeline.TYPES = [ 'onStart', 'onUpdate', 'onLoop', 'onComplete', 'onYoyo' ]; + return tween; +}; -module.exports = Timeline; +module.exports = NumberTweenBuilder; /***/ }), /* 363 */ -/***/ (function(module, exports) { +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -69906,41 +70066,146 @@ module.exports = Timeline; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on code by Mike Reinstein +var Clone = __webpack_require__(53); +var Defaults = __webpack_require__(158); +var GetAdvancedValue = __webpack_require__(10); +var GetBoolean = __webpack_require__(73); +var GetEaseFunction = __webpack_require__(71); +var GetNewValue = __webpack_require__(101); +var GetTargets = __webpack_require__(156); +var GetTweens = __webpack_require__(361); +var GetValue = __webpack_require__(4); +var Timeline = __webpack_require__(364); +var TweenBuilder = __webpack_require__(102); /** - * Removes a single item from an array and returns it without creating gc (like the native splice does) + * [description] * - * @function Phaser.Utils.Array.SpliceOne + * @function Phaser.Tweens.Builders.TimelineBuilder * @since 3.0.0 * - * @param {array} array - [description] - * @param {integer} index - [description] + * @param {Phaser.Tweens.TweenManager} manager - [description] + * @param {object} config - [description] * - * @return {any} [description] + * @return {Phaser.Tweens.Timeline} [description] */ -var SpliceOne = function (array, index) +var TimelineBuilder = function (manager, config) { - if (index >= array.length) + var timeline = new Timeline(manager); + + var tweens = GetTweens(config); + + if (tweens.length === 0) { - return; + timeline.paused = true; + + return timeline; } - var len = array.length - 1; + var defaults = Clone(Defaults); - var item = array[index]; + defaults.targets = GetTargets(config); - for (var i = index; i < len; i++) + // totalDuration: If specified each tween in the Timeline is given an equal portion of the totalDuration + + var totalDuration = GetAdvancedValue(config, 'totalDuration', 0); + + if (totalDuration > 0) { - array[i] = array[i + 1]; + defaults.duration = Math.floor(totalDuration / tweens.length); + } + else + { + defaults.duration = GetNewValue(config, 'duration', defaults.duration); } - array.length = len; + defaults.delay = GetNewValue(config, 'delay', defaults.delay); + defaults.easeParams = GetValue(config, 'easeParams', defaults.easeParams); + defaults.ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), defaults.easeParams); + defaults.hold = GetNewValue(config, 'hold', defaults.hold); + defaults.repeat = GetNewValue(config, 'repeat', defaults.repeat); + defaults.repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); + defaults.yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); + defaults.flipX = GetBoolean(config, 'flipX', defaults.flipX); + defaults.flipY = GetBoolean(config, 'flipY', defaults.flipY); - return item; + // Create the Tweens + for (var i = 0; i < tweens.length; i++) + { + timeline.queue(TweenBuilder(timeline, tweens[i], defaults)); + } + + timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + timeline.paused = GetBoolean(config, 'paused', false); + timeline.useFrames = GetBoolean(config, 'useFrames', false); + + // Callbacks + + var scope = GetValue(config, 'callbackScope', timeline); + + var timelineArray = [ timeline ]; + + var onStart = GetValue(config, 'onStart', false); + + // The Start of the Timeline + if (onStart) + { + var onStartScope = GetValue(config, 'onStartScope', scope); + var onStartParams = GetValue(config, 'onStartParams', []); + + timeline.setCallback('onStart', onStart, timelineArray.concat(onStartParams), onStartScope); + } + + var onUpdate = GetValue(config, 'onUpdate', false); + + // Every time the Timeline updates (regardless which Tweens are running) + if (onUpdate) + { + var onUpdateScope = GetValue(config, 'onUpdateScope', scope); + var onUpdateParams = GetValue(config, 'onUpdateParams', []); + + timeline.setCallback('onUpdate', onUpdate, timelineArray.concat(onUpdateParams), onUpdateScope); + } + + var onLoop = GetValue(config, 'onLoop', false); + + // Called when the whole Timeline loops + if (onLoop) + { + var onLoopScope = GetValue(config, 'onLoopScope', scope); + var onLoopParams = GetValue(config, 'onLoopParams', []); + + timeline.setCallback('onLoop', onLoop, timelineArray.concat(onLoopParams), onLoopScope); + } + + var onYoyo = GetValue(config, 'onYoyo', false); + + // Called when a Timeline yoyos + if (onYoyo) + { + var onYoyoScope = GetValue(config, 'onYoyoScope', scope); + var onYoyoParams = GetValue(config, 'onYoyoParams', []); + + timeline.setCallback('onYoyo', onYoyo, timelineArray.concat(null, onYoyoParams), onYoyoScope); + } + + var onComplete = GetValue(config, 'onComplete', false); + + // Called when the Timeline completes, after the completeDelay, etc. + if (onComplete) + { + var onCompleteScope = GetValue(config, 'onCompleteScope', scope); + var onCompleteParams = GetValue(config, 'onCompleteParams', []); + + timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope); + } + + return timeline; }; -module.exports = SpliceOne; +module.exports = TimelineBuilder; /***/ }), @@ -69954,352 +70219,322 @@ module.exports = SpliceOne; */ var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(14); +var TweenBuilder = __webpack_require__(102); +var TWEEN_CONST = __webpack_require__(87); /** * @classdesc - * A Game Object Animation Controller. - * - * This controller lives as an instance within a Game Object, accessible as `sprite.anims`. + * [description] * - * @class Animation - * @memberOf Phaser.GameObjects.Components + * @class Timeline + * @memberOf Phaser.Tweens + * @extends EventEmitter * @constructor * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation controller belongs. + * @param {Phaser.Tweens.TweenManager} manager - [description] */ -var Animation = new Class({ +var Timeline = new Class({ + + Extends: EventEmitter, initialize: - function Animation (parent) + function Timeline (manager) { + EventEmitter.call(this); + /** - * The Game Object to which this animation controller belongs. + * [description] * - * @name Phaser.GameObjects.Components.Animation#parent - * @type {Phaser.GameObjects.GameObject} + * @name Phaser.Tweens.Timeline#manager + * @type {Phaser.Tweens.TweenManager} * @since 3.0.0 */ - this.parent = parent; + this.manager = manager; /** - * A reference to the global Animation Manager. + * [description] * - * @name Phaser.GameObjects.Components.Animation#animationManager - * @type {Phaser.Animations.AnimationManager} + * @name Phaser.Tweens.Timeline#isTimeline + * @type {boolean} + * @default true * @since 3.0.0 */ - this.animationManager = parent.scene.sys.anims; - - this.animationManager.once('remove', this.remove, this); + this.isTimeline = true; /** - * Is an animation currently playing or not? + * An array of Tween objects, each containing a unique property and target being tweened. * - * @name Phaser.GameObjects.Components.Animation#isPlaying - * @type {boolean} - * @default false + * @name Phaser.Tweens.Timeline#data + * @type {array} + * @default [] * @since 3.0.0 */ - this.isPlaying = false; - - // Reference to the Phaser.Animation object + this.data = []; /** - * The current Animation loaded into this Animation Controller. + * data array doesn't usually change, so we can cache the length * - * @name Phaser.GameObjects.Components.Animation#currentAnim - * @type {?Phaser.Animations.Animation} - * @default null + * @name Phaser.Tweens.Timeline#totalData + * @type {number} + * @default 0 * @since 3.0.0 */ - this.currentAnim = null; + this.totalData = 0; /** - * The current AnimationFrame being displayed by this Animation Controller. + * If true then duration, delay, etc values are all frame totals. * - * @name Phaser.GameObjects.Components.Animation#currentFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null + * @name Phaser.Tweens.Timeline#useFrames + * @type {boolean} + * @default false * @since 3.0.0 */ - this.currentFrame = null; + this.useFrames = false; /** - * Time scale factor. + * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. + * Value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. * - * @name Phaser.GameObjects.Components.Animation#_timeScale + * @name Phaser.Tweens.Timeline#timeScale * @type {number} - * @private * @default 1 * @since 3.0.0 */ - this._timeScale = 1; + this.timeScale = 1; /** - * The frame rate of playback in frames per second. - * The default is 24 if the `duration` property is `null`. + * Loop this tween? Can be -1 for an infinite loop, or an integer. + * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD) * - * @name Phaser.GameObjects.Components.Animation#frameRate + * @name Phaser.Tweens.Timeline#loop * @type {number} * @default 0 * @since 3.0.0 */ - this.frameRate = 0; + this.loop = 0; /** - * How long the animation should play for. - * If the `frameRate` property has been set then it overrides this value, - * otherwise frameRate is derived from `duration`. + * Time in ms/frames before the tween loops. * - * @name Phaser.GameObjects.Components.Animation#duration + * @name Phaser.Tweens.Timeline#loopDelay * @type {number} * @default 0 * @since 3.0.0 */ - this.duration = 0; + this.loopDelay = 0; /** - * ms per frame, not including frame specific modifiers that may be present in the Animation data. + * How many loops are left to run? * - * @name Phaser.GameObjects.Components.Animation#msPerFrame + * @name Phaser.Tweens.Timeline#loopCounter * @type {number} * @default 0 * @since 3.0.0 */ - this.msPerFrame = 0; - - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.GameObjects.Components.Animation#skipMissedFrames - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.skipMissedFrames = true; + this.loopCounter = 0; /** - * A delay before starting playback, in seconds. + * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes) * - * @name Phaser.GameObjects.Components.Animation#_delay + * @name Phaser.Tweens.Timeline#completeDelay * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._delay = 0; + this.completeDelay = 0; /** - * Number of times to repeat the animation (-1 for infinity) + * Countdown timer (used by loopDelay and completeDelay) * - * @name Phaser.GameObjects.Components.Animation#_repeat + * @name Phaser.Tweens.Timeline#countdown * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._repeat = 0; + this.countdown = 0; /** - * Delay before the repeat starts, in seconds. + * The current state of the tween * - * @name Phaser.GameObjects.Components.Animation#_repeatDelay - * @type {number} - * @private - * @default 0 + * @name Phaser.Tweens.Timeline#state + * @type {integer} * @since 3.0.0 */ - this._repeatDelay = 0; + this.state = TWEEN_CONST.PENDING_ADD; /** - * Should the animation yoyo? (reverse back down to the start) before repeating? + * The state of the tween when it was paused (used by Resume) * - * @name Phaser.GameObjects.Components.Animation#_yoyo - * @type {boolean} + * @name Phaser.Tweens.Timeline#_pausedState + * @type {integer} * @private - * @default false * @since 3.0.0 */ - this._yoyo = false; + this._pausedState = TWEEN_CONST.PENDING_ADD; /** - * Will the playhead move forwards (`true`) or in reverse (`false`) + * Does the Tween start off paused? (if so it needs to be started with Tween.play) * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.Tweens.Timeline#paused * @type {boolean} - * @default true + * @default false * @since 3.0.0 */ - this.forward = true; + this.paused = false; /** - * Internal time overflow accumulator. + * Elapsed time in ms/frames of this run through the Tween. * - * @name Phaser.GameObjects.Components.Animation#accumulator + * @name Phaser.Tweens.Timeline#elapsed * @type {number} * @default 0 * @since 3.0.0 */ - this.accumulator = 0; + this.elapsed = 0; /** - * The time point at which the next animation frame will change. + * Total elapsed time in ms/frames of the entire Tween, including looping. * - * @name Phaser.GameObjects.Components.Animation#nextTick + * @name Phaser.Tweens.Timeline#totalElapsed * @type {number} * @default 0 * @since 3.0.0 */ - this.nextTick = 0; + this.totalElapsed = 0; /** - * An internal counter keeping track of how many repeats are left to play. + * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays. * - * @name Phaser.GameObjects.Components.Animation#repeatCounter + * @name Phaser.Tweens.Timeline#duration * @type {number} * @default 0 * @since 3.0.0 */ - this.repeatCounter = 0; + this.duration = 0; /** - * An internal flag keeping track of pending repeats. + * Value between 0 and 1. The amount through the Tween, excluding loops. * - * @name Phaser.GameObjects.Components.Animation#pendingRepeat - * @type {boolean} - * @default false + * @name Phaser.Tweens.Timeline#progress + * @type {number} + * @default 0 * @since 3.0.0 */ - this.pendingRepeat = false; + this.progress = 0; /** - * Is the Animation paused? + * Time in ms/frames for all Tweens to complete (including looping) * - * @name Phaser.GameObjects.Components.Animation#_paused - * @type {boolean} - * @private - * @default false + * @name Phaser.Tweens.Timeline#totalDuration + * @type {number} + * @default 0 * @since 3.0.0 */ - this._paused = false; + this.totalDuration = 0; /** - * Was the animation previously playing before being paused? + * Value between 0 and 1. The amount through the entire Tween, including looping. * - * @name Phaser.GameObjects.Components.Animation#_wasPlaying - * @type {boolean} - * @private - * @default false + * @name Phaser.Tweens.Timeline#totalProgress + * @type {number} + * @default 0 * @since 3.0.0 */ - this._wasPlaying = false; + this.totalProgress = 0; - /** - * Container for the callback arguments. - * - * @name Phaser.GameObjects.Components.Animation#_callbackArgs - * @type {array} - * @private - * @since 3.0.0 - */ - this._callbackArgs = [ parent, null ]; + this.callbacks = { + onComplete: null, + onLoop: null, + onStart: null, + onUpdate: null, + onYoyo: null + }; - /** - * Container for the update arguments. - * - * @name Phaser.GameObjects.Components.Animation#_updateParams - * @type {array} - * @private - * @since 3.0.0 - */ - this._updateParams = []; + this.callbackScope; }, /** - * Sets the amount of time, in seconds that the animation will be delayed before starting playback. - * - * @method Phaser.GameObjects.Components.Animation#delay + * [description] + * + * @method Phaser.Tweens.Timeline#setTimeScale * @since 3.0.0 * - * @param {number} value - The amount of time, in seconds, to wait before starting playback. + * @param {number} value - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - delay: function (value) + setTimeScale: function (value) { - if (value === undefined) - { - return this._delay; - } - else - { - this._delay = value; + this.timeScale = value; - return this; - } + return this; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#delayedPlay + * @method Phaser.Tweens.Timeline#getTimeScale * @since 3.0.0 * - * @param {[type]} delay - [description] - * @param {[type]} key - [description] - * @param {[type]} startFrame - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {number} [description] */ - delayedPlay: function (delay, key, startFrame) + getTimeScale: function () { - this.play(key, true, startFrame); - - this.nextTick += (delay * 1000); - - return this; + return this.timeScale; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#getCurrentKey + * @method Phaser.Tweens.Timeline#isPlaying * @since 3.0.0 * - * @return {[type]} [description] + * @return {boolean} [description] */ - getCurrentKey: function () + isPlaying: function () { - if (this.currentAnim) - { - return this.currentAnim.key; - } + return (this.state === TWEEN_CONST.ACTIVE); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#load + * @method Phaser.Tweens.Timeline#add * @since 3.0.0 * - * @param {[type]} key - [description] - * @param {[type]} startFrame - [description] + * @param {[type]} config - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - load: function (key, startFrame) + add: function (config) { - if (startFrame === undefined) { startFrame = 0; } + return this.queue(TweenBuilder(this, config)); + }, - if (this.isPlaying) + /** + * [description] + * + * @method Phaser.Tweens.Timeline#queue + * @since 3.0.0 + * + * @param {[type]} tween - [description] + * + * @return {Phaser.Tweens.Timeline} This Timeline object. + */ + queue: function (tween) + { + if (!this.isPlaying()) { - this.stop(); - } + tween.parent = this; + tween.parentIsTimeline = true; - // Load the new animation in - this.animationManager.load(this, key, startFrame); + this.data.push(tween); + + this.totalData = this.data.length; + } return this; }, @@ -70307,1202 +70542,1399 @@ var Animation = new Class({ /** * [description] * - * @method Phaser.GameObjects.Components.Animation#pause + * @method Phaser.Tweens.Timeline#hasOffset * @since 3.0.0 * - * @param {[type]} atFrame - [description] + * @param {Phaser.Tweens.Tween} tween - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {boolean} [description] */ - pause: function (atFrame) + hasOffset: function (tween) { - if (!this._paused) - { - this._paused = true; - this._wasPlaying = this.isPlaying; - this.isPlaying = false; - } - - if (atFrame !== undefined) - { - this.updateFrame(atFrame); - } - - return this; + return (tween.offset !== null); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#paused + * @method Phaser.Tweens.Timeline#isOffsetAbsolute * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {number} value - [description] * - * @return {[type]} [description] + * @return {boolean} [description] */ - paused: function (value) + isOffsetAbsolute: function (value) { - if (value !== undefined) - { - // Setter - if (value) - { - return this.pause(); - } - else - { - return this.resume(); - } - } - else - { - return this._paused; - } + return (typeof(value) === 'number'); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#play + * @method Phaser.Tweens.Timeline#isOffsetRelative * @since 3.0.0 * - * @param {[type]} key - [description] - * @param {[type]} ignoreIfPlaying - [description] - * @param {[type]} startFrame - [description] + * @param {string} value - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {boolean} [description] */ - play: function (key, ignoreIfPlaying, startFrame) + isOffsetRelative: function (value) { - if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } - if (startFrame === undefined) { startFrame = 0; } - - if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) - { - return this; - } - - this.load(key, startFrame); - - var anim = this.currentAnim; - - // Should give us 9,007,199,254,740,991 safe repeats - this.repeatCounter = (this._repeat === -1) ? Number.MAX_VALUE : this._repeat; - - anim.getFirstTick(this); - - this.forward = true; - this.isPlaying = true; - this.pendingRepeat = false; + var t = typeof(value); - if (anim.showOnStart) + if (t === 'string') { - this.parent.visible = true; - } + var op = value[0]; - if (anim.onStart) - { - anim.onStart.apply(anim.callbackScope, this._callbackArgs.concat(anim.onStartParams)); + if (op === '-' || op === '+') + { + return true; + } } - return this; + return false; }, - // Value between 0 and 1. How far this animation is through, ignoring repeats and yoyos. - // If the animation has a non-zero repeat defined, progress and totalProgress will be different - // because progress doesn't include any repeats or repeatDelays whereas totalProgress does. /** * [description] * - * @method Phaser.GameObjects.Components.Animation#progress + * @method Phaser.Tweens.Timeline#getRelativeOffset * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {string} value - [description] + * @param {number} base - [description] * - * @return {[type]} [description] + * @return {number} [description] */ - progress: function (value) + getRelativeOffset: function (value, base) { - if (value === undefined) - { - var p = this.currentFrame.progress; - - if (!this.forward) - { - p = 1 - p; - } + var op = value[0]; + var num = parseFloat(value.substr(2)); + var result = base; - return p; - } - else + switch (op) { - // TODO: Set progress + case '+': + result += num; + break; - return this; + case '-': + result -= num; + break; } + + // Cannot ever be < 0 + return Math.max(0, result); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#remove + * @method Phaser.Tweens.Timeline#calcDuration * @since 3.0.0 - * - * @param {[type]} event - [description] */ - remove: function (event) + calcDuration: function () { - if (event === undefined) { event = this.currentAnim; } + var prevEnd = 0; + var totalDuration = 0; + var offsetDuration = 0; - if (this.isPlaying && event.key === this.currentAnim.key) + for (var i = 0; i < this.totalData; i++) { - this.stop(); + var tween = this.data[i]; - var sprite = this.parent; - var frame = this.currentAnim.frames[0]; + tween.init(); - this.currentFrame = frame; + if (this.hasOffset(tween)) + { + if (this.isOffsetAbsolute(tween.offset)) + { + // An actual number, so it defines the start point from the beginning of the timeline + tween.calculatedOffset = tween.offset; - sprite.texture = frame.frame.texture; - sprite.frame = frame.frame; + if (tween.offset === 0) + { + offsetDuration = 0; + } + } + else if (this.isOffsetRelative(tween.offset)) + { + // A relative offset (i.e. '-=1000', so starts at 'offset' ms relative to the PREVIOUS Tweens ending time) + tween.calculatedOffset = this.getRelativeOffset(tween.offset, prevEnd); + } + } + else + { + // Sequential + tween.calculatedOffset = offsetDuration; + } + + prevEnd = tween.totalDuration + tween.calculatedOffset; + + totalDuration += tween.totalDuration; + offsetDuration += tween.totalDuration; } - }, - // Gets or sets the number of times that the animation should repeat - // after its first iteration. For example, if repeat is 1, the animation will - // play a total of twice (the initial play plus 1 repeat). - // To repeat indefinitely, use -1. repeat should always be an integer. + // Excludes loop values + this.duration = totalDuration; - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#repeat - * @since 3.0.0 - * - * @param {[type]} value - [description] - * - * @return {[type]} [description] - */ - repeat: function (value) - { - if (value === undefined) + this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; + + if (this.loopCounter > 0) { - return this._repeat; + this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); } else { - this._repeat = value; - this.repeatCounter = 0; - - return this; + this.totalDuration = this.duration + this.completeDelay; } }, - // Gets or sets the amount of time in seconds between repeats. - // For example, if repeat is 2 and repeatDelay is 1, the animation will play initially, - // then wait for 1 second before it repeats, then play again, then wait 1 second again - // before doing its final repeat. - /** * [description] * - * @method Phaser.GameObjects.Components.Animation#repeatDelay + * @method Phaser.Tweens.Timeline#init * @since 3.0.0 * - * @param {[type]} value - [description] - * - * @return {[type]} [description] + * @return {boolean} [description] */ - repeatDelay: function (value) + init: function () { - if (value === undefined) + this.calcDuration(); + + this.progress = 0; + this.totalProgress = 0; + + if (this.paused) { - return this._repeatDelay; + this.state = TWEEN_CONST.PAUSED; + + return false; } else { - this._repeatDelay = value; - - return this; + return true; } }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#restart + * @method Phaser.Tweens.Timeline#resetTweens * @since 3.0.0 * - * @param {[type]} includeDelay - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @param {boolean} resetFromLoop - [description] */ - restart: function (includeDelay) + resetTweens: function (resetFromLoop) { - if (includeDelay === undefined) { includeDelay = false; } - - this.currentAnim.getFirstTick(this, includeDelay); - - this.forward = true; - this.isPlaying = true; - this.pendingRepeat = false; - this._paused = false; - - // Set frame - this.updateFrame(this.currentAnim.frames[0]); + for (var i = 0; i < this.totalData; i++) + { + var tween = this.data[i]; - return this; + tween.play(resetFromLoop); + } }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#resume + * @method Phaser.Tweens.Timeline#setCallback * @since 3.0.0 * - * @param {[type]} fromFrame - [description] + * @param {string} type - [description] + * @param {function} callback - [description] + * @param {array} [params] - [description] + * @param {object} [scope] - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - resume: function (fromFrame) + setCallback: function (type, callback, params, scope) { - if (this._paused) + if (Timeline.TYPES.indexOf(type) !== -1) { - this._paused = false; - this.isPlaying = this._wasPlaying; + this.callbacks[type] = { func: callback, scope: scope, params: params }; } - if (fromFrame !== undefined) - { - this.updateFrame(fromFrame); - } - return this; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#stop + * @method Phaser.Tweens.Timeline#play * @since 3.0.0 - * - * @param {[type]} dispatchCallbacks - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. */ - stop: function (dispatchCallbacks) + play: function () { - if (dispatchCallbacks === undefined) { dispatchCallbacks = false; } + if (this.state === TWEEN_CONST.ACTIVE) + { + return; + } - this.isPlaying = false; + if (this.paused) + { + this.paused = false; + + this.manager.makeActive(this); - var anim = this.currentAnim; + return; + } + else + { + this.resetTweens(false); - if (dispatchCallbacks && anim.onComplete) + this.state = TWEEN_CONST.ACTIVE; + } + + var onStart = this.callbacks.onStart; + + if (onStart) { - anim.onComplete.apply(anim.callbackScope, this._callbackArgs.concat(anim.onCompleteParams)); + onStart.func.apply(onStart.scope, onStart.params); } - return this; + this.emit('start', this); }, - // Scale the time (make it go faster / slower) - // Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc. - /** * [description] * - * @method Phaser.GameObjects.Components.Animation#timeScale + * @method Phaser.Tweens.Timeline#nextState * @since 3.0.0 - * - * @param {[type]} value - [description] - * - * @return {[type]} [description] */ - timeScale: function (value) + nextState: function () { - if (value === undefined) + if (this.loopCounter > 0) { - return this._timeScale; + // Reset the elapsed time + // TODO: Probably ought to be set to the remainder from elapsed - duration + // as the tweens nearly always over-run by a few ms due to rAf + + this.elapsed = 0; + this.progress = 0; + + this.loopCounter--; + + var onLoop = this.callbacks.onLoop; + + if (onLoop) + { + onLoop.func.apply(onLoop.scope, onLoop.params); + } + + this.emit('loop', this, this.loopCounter); + + this.resetTweens(true); + + if (this.loopDelay > 0) + { + this.countdown = this.loopDelay; + this.state = TWEEN_CONST.LOOP_DELAY; + } + else + { + this.state = TWEEN_CONST.ACTIVE; + } + } + else if (this.completeDelay > 0) + { + this.countdown = this.completeDelay; + this.state = TWEEN_CONST.COMPLETE_DELAY; } else { - this._timeScale = value; + var onComplete = this.callbacks.onComplete; - return this; + if (onComplete) + { + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.emit('complete', this); + + this.state = TWEEN_CONST.PENDING_REMOVE; } }, /** - * [description] + * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager. + * Otherwise, returns false. * - * @method Phaser.GameObjects.Components.Animation#totalFrames + * @method Phaser.Tweens.Timeline#update * @since 3.0.0 * - * @return {[type]} [description] + * @param {number} timestamp - [description] + * @param {number} delta - [description] + * + * @return {boolean} Returns `true` if this Timeline has finished and should be removed from the Tween Manager. */ - totalFrames: function () + update: function (timestamp, delta) { - return this.currentAnim.frames.length; + if (this.state === TWEEN_CONST.PAUSED) + { + return; + } + + var rawDelta = delta; + + if (this.useFrames) + { + delta = 1 * this.manager.timeScale; + } + + delta *= this.timeScale; + + this.elapsed += delta; + this.progress = Math.min(this.elapsed / this.duration, 1); + + this.totalElapsed += delta; + this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); + + switch (this.state) + { + case TWEEN_CONST.ACTIVE: + + var stillRunning = this.totalData; + + for (var i = 0; i < this.totalData; i++) + { + var tween = this.data[i]; + + if (tween.update(timestamp, rawDelta)) + { + stillRunning--; + } + } + + var onUpdate = this.callbacks.onUpdate; + + if (onUpdate) + { + onUpdate.func.apply(onUpdate.scope, onUpdate.params); + } + + this.emit('update', this); + + // Anything still running? If not, we're done + if (stillRunning === 0) + { + this.nextState(); + } + + break; + + case TWEEN_CONST.LOOP_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + this.state = TWEEN_CONST.ACTIVE; + } + + break; + + case TWEEN_CONST.COMPLETE_DELAY: + + this.countdown -= delta; + + if (this.countdown <= 0) + { + var onComplete = this.callbacks.onComplete; + + if (onComplete) + { + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.emit('complete', this); + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + + break; + } + + return (this.state === TWEEN_CONST.PENDING_REMOVE); }, - // Value between 0 and 1. How far this animation is through, including things like delays - // repeats, custom frame durations, etc. If the animation is set to repeat -1 it can never - // have a duration, therefore this will return -1. /** - * [description] + * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. * - * @method Phaser.GameObjects.Components.Animation#totalProgres + * @method Phaser.Tweens.Timeline#stop * @since 3.0.0 */ - totalProgres: function () + stop: function () { - // TODO + this.state = TWEEN_CONST.PENDING_REMOVE; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#update + * @method Phaser.Tweens.Timeline#pause * @since 3.0.0 * - * @param {[type]} timestamp - [description] - * @param {[type]} delta - [description] + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - update: function (timestamp, delta) + pause: function () { - if (!this.isPlaying || this.currentAnim.paused) + if (this.state === TWEEN_CONST.PAUSED) { return; } - this.accumulator += delta * this._timeScale; + this.paused = true; - if (this.accumulator >= this.nextTick) - { - this.currentAnim.setFrame(this); - } + this._pausedState = this.state; + + this.state = TWEEN_CONST.PAUSED; + + this.emit('pause', this); + + return this; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#updateFrame + * @method Phaser.Tweens.Timeline#resume * @since 3.0.0 * - * @param {[type]} animationFrame - [description] + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - updateFrame: function (animationFrame) + resume: function () { - var sprite = this.parent; - - this.currentFrame = animationFrame; - - sprite.texture = animationFrame.frame.texture; - sprite.frame = animationFrame.frame; - - if (this.isPlaying) + if (this.state === TWEEN_CONST.PAUSED) { - if (animationFrame.setAlpha) - { - sprite.alpha = animationFrame.alpha; - } + this.paused = false; - var anim = this.currentAnim; + this.state = this._pausedState; + } - if (anim.onUpdate) - { - anim.onUpdate.apply(anim.callbackScope, this._updateParams); - } + this.emit('resume', this); - if (animationFrame.onUpdate) - { - animationFrame.onUpdate(sprite, animationFrame); - } - } + return this; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#yoyo + * @method Phaser.Tweens.Timeline#hasTarget * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {object} target - [description] * - * @return {[type]} [description] + * @return {boolean} [description] */ - yoyo: function (value) + hasTarget: function (target) { - if (value === undefined) - { - return this._yoyo; - } - else + for (var i = 0; i < this.data.length; i++) { - this._yoyo = value; - - return this; + if (this.data[i].hasTarget(target)) + { + return true; + } } + + return false; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#destroy + * @method Phaser.Tweens.Timeline#destroy * @since 3.0.0 */ destroy: function () { - // TODO - } + for (var i = 0; i < this.data.length; i++) + { + this.data[i].destroy(); + } + } }); -module.exports = Animation; - - -/***/ }), -/* 365 */, -/* 366 */ -/***/ (function(module, exports, __webpack_require__) { +Timeline.TYPES = [ 'onStart', 'onUpdate', 'onLoop', 'onComplete', 'onYoyo' ]; -__webpack_require__(367); -__webpack_require__(368); -__webpack_require__(369); -__webpack_require__(370); -__webpack_require__(371); -__webpack_require__(372); -__webpack_require__(373); -__webpack_require__(374); -__webpack_require__(375); +module.exports = Timeline; /***/ }), -/* 367 */ +/* 365 */ /***/ (function(module, exports) { /** -* A polyfill for Array.forEach -* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach -*/ -if (!Array.prototype.forEach) -{ - Array.prototype.forEach = function (fun /*, thisArg */) - { - 'use strict'; - - if (this === void 0 || this === null) - { - throw new TypeError(); - } - - var t = Object(this); - var len = t.length >>> 0; - - if (typeof fun !== 'function') - { - throw new TypeError(); - } - - var thisArg = arguments.length >= 2 ? arguments[1] : void 0; - - for (var i = 0; i < len; i++) - { - if (i in t) - { - fun.call(thisArg, t[i], i, t); - } - } - }; -} - + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -/***/ }), -/* 368 */ -/***/ (function(module, exports) { +// Based on code by Mike Reinstein /** -* A polyfill for Array.isArray -*/ -if (!Array.isArray) + * Removes a single item from an array and returns it without creating gc (like the native splice does) + * + * @function Phaser.Utils.Array.SpliceOne + * @since 3.0.0 + * + * @param {array} array - [description] + * @param {integer} index - [description] + * + * @return {any} [description] + */ +var SpliceOne = function (array, index) { - Array.isArray = function (arg) + if (index >= array.length) { - return Object.prototype.toString.call(arg) === '[object Array]'; - }; -} - - -/***/ }), -/* 369 */ -/***/ (function(module, exports) { - -/* Copyright 2013 Chris Wilson - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* + return; + } -This monkeypatch library is intended to be included in projects that are -written to the proper AudioContext spec (instead of webkitAudioContext), -and that use the new naming and proper bits of the Web Audio API (e.g. -using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may -have to run on systems that only support the deprecated bits. + var len = array.length - 1; -This library should be harmless to include if the browser supports -unprefixed "AudioContext", and/or if it supports the new names. + var item = array[index]; -The patches this library handles: -if window.AudioContext is unsupported, it will be aliased to webkitAudioContext(). -if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or -noteGrainOn(), depending on parameters. + for (var i = index; i < len; i++) + { + array[i] = array[i + 1]; + } -The following aliases only take effect if the new names are not already in place: + array.length = len; -AudioBufferSourceNode.stop() is aliased to noteOff() -AudioContext.createGain() is aliased to createGainNode() -AudioContext.createDelay() is aliased to createDelayNode() -AudioContext.createScriptProcessor() is aliased to createJavaScriptNode() -AudioContext.createPeriodicWave() is aliased to createWaveTable() -OscillatorNode.start() is aliased to noteOn() -OscillatorNode.stop() is aliased to noteOff() -OscillatorNode.setPeriodicWave() is aliased to setWaveTable() -AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime() + return item; +}; -This library does NOT patch the enumerated type changes, as it is -recommended in the specification that implementations support both integer -and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel -BiquadFilterNode.type and OscillatorNode.type. +module.exports = SpliceOne; -*/ -(function (global, exports, perf) { - 'use strict'; - function fixSetTarget(param) { - if (!param) // if NYI, just return - return; - if (!param.setTargetAtTime) - param.setTargetAtTime = param.setTargetValueAtTime; - } +/***/ }), +/* 366 */ +/***/ (function(module, exports, __webpack_require__) { - if (window.hasOwnProperty('webkitAudioContext') && - !window.hasOwnProperty('AudioContext')) { - window.AudioContext = webkitAudioContext; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (!AudioContext.prototype.hasOwnProperty('createGain')) - AudioContext.prototype.createGain = AudioContext.prototype.createGainNode; - if (!AudioContext.prototype.hasOwnProperty('createDelay')) - AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode; - if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor')) - AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode; - if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave')) - AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable; +var Class = __webpack_require__(0); +/** + * @classdesc + * A Game Object Animation Controller. + * + * This controller lives as an instance within a Game Object, accessible as `sprite.anims`. + * + * @class Animation + * @memberOf Phaser.GameObjects.Components + * @constructor + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation controller belongs. + */ +var Animation = new Class({ - AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain; - AudioContext.prototype.createGain = function() { - var node = this.internal_createGain(); - fixSetTarget(node.gain); - return node; - }; + initialize: - AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay; - AudioContext.prototype.createDelay = function(maxDelayTime) { - var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay(); - fixSetTarget(node.delayTime); - return node; - }; + function Animation (parent) + { + /** + * The Game Object to which this animation controller belongs. + * + * @name Phaser.GameObjects.Components.Animation#parent + * @type {Phaser.GameObjects.GameObject} + * @since 3.0.0 + */ + this.parent = parent; - AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource; - AudioContext.prototype.createBufferSource = function() { - var node = this.internal_createBufferSource(); - if (!node.start) { - node.start = function ( when, offset, duration ) { - if ( offset || duration ) - this.noteGrainOn( when || 0, offset, duration ); - else - this.noteOn( when || 0 ); - }; - } else { - node.internal_start = node.start; - node.start = function( when, offset, duration ) { - if( typeof duration !== 'undefined' ) - node.internal_start( when || 0, offset, duration ); - else - node.internal_start( when || 0, offset || 0 ); - }; - } - if (!node.stop) { - node.stop = function ( when ) { - this.noteOff( when || 0 ); - }; - } else { - node.internal_stop = node.stop; - node.stop = function( when ) { - node.internal_stop( when || 0 ); - }; - } - fixSetTarget(node.playbackRate); - return node; - }; + /** + * A reference to the global Animation Manager. + * + * @name Phaser.GameObjects.Components.Animation#animationManager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.animationManager = parent.scene.sys.anims; - AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor; - AudioContext.prototype.createDynamicsCompressor = function() { - var node = this.internal_createDynamicsCompressor(); - fixSetTarget(node.threshold); - fixSetTarget(node.knee); - fixSetTarget(node.ratio); - fixSetTarget(node.reduction); - fixSetTarget(node.attack); - fixSetTarget(node.release); - return node; - }; + this.animationManager.once('remove', this.remove, this); - AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter; - AudioContext.prototype.createBiquadFilter = function() { - var node = this.internal_createBiquadFilter(); - fixSetTarget(node.frequency); - fixSetTarget(node.detune); - fixSetTarget(node.Q); - fixSetTarget(node.gain); - return node; - }; + /** + * Is an animation currently playing or not? + * + * @name Phaser.GameObjects.Components.Animation#isPlaying + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isPlaying = false; - if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) { - AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator; - AudioContext.prototype.createOscillator = function() { - var node = this.internal_createOscillator(); - if (!node.start) { - node.start = function ( when ) { - this.noteOn( when || 0 ); - }; - } else { - node.internal_start = node.start; - node.start = function ( when ) { - node.internal_start( when || 0); - }; - } - if (!node.stop) { - node.stop = function ( when ) { - this.noteOff( when || 0 ); - }; - } else { - node.internal_stop = node.stop; - node.stop = function( when ) { - node.internal_stop( when || 0 ); - }; - } - if (!node.setPeriodicWave) - node.setPeriodicWave = node.setWaveTable; - fixSetTarget(node.frequency); - fixSetTarget(node.detune); - return node; - }; - } - } + // Reference to the Phaser.Animation object - if (window.hasOwnProperty('webkitOfflineAudioContext') && - !window.hasOwnProperty('OfflineAudioContext')) { - window.OfflineAudioContext = webkitOfflineAudioContext; - } + /** + * The current Animation loaded into this Animation Controller. + * + * @name Phaser.GameObjects.Components.Animation#currentAnim + * @type {?Phaser.Animations.Animation} + * @default null + * @since 3.0.0 + */ + this.currentAnim = null; -}(window)); + /** + * The current AnimationFrame being displayed by this Animation Controller. + * + * @name Phaser.GameObjects.Components.Animation#currentFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @since 3.0.0 + */ + this.currentFrame = null; + /** + * Time scale factor. + * + * @name Phaser.GameObjects.Components.Animation#_timeScale + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._timeScale = 1; + /** + * The frame rate of playback in frames per second. + * The default is 24 if the `duration` property is `null`. + * + * @name Phaser.GameObjects.Components.Animation#frameRate + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.frameRate = 0; -/***/ }), -/* 370 */ -/***/ (function(module, exports) { + /** + * How long the animation should play for. + * If the `frameRate` property has been set then it overrides this value, + * otherwise frameRate is derived from `duration`. + * + * @name Phaser.GameObjects.Components.Animation#duration + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.duration = 0; -/** - * Also fix for the absent console in IE9 - */ -if (!window.console) -{ - window.console = {}; - window.console.log = window.console.assert = function(){}; - window.console.warn = window.console.assert = function(){}; -} + /** + * ms per frame, not including frame specific modifiers that may be present in the Animation data. + * + * @name Phaser.GameObjects.Components.Animation#msPerFrame + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.msPerFrame = 0; + /** + * Skip frames if the time lags, or always advanced anyway? + * + * @name Phaser.GameObjects.Components.Animation#skipMissedFrames + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.skipMissedFrames = true; -/***/ }), -/* 371 */ -/***/ (function(module, exports) { + /** + * A delay before starting playback, in seconds. + * + * @name Phaser.GameObjects.Components.Animation#_delay + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._delay = 0; -/** -* A polyfill for Function.prototype.bind -*/ -if (!Function.prototype.bind) { + /** + * Number of times to repeat the animation (-1 for infinity) + * + * @name Phaser.GameObjects.Components.Animation#_repeat + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._repeat = 0; - /* jshint freeze: false */ - Function.prototype.bind = (function () { + /** + * Delay before the repeat starts, in seconds. + * + * @name Phaser.GameObjects.Components.Animation#_repeatDelay + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._repeatDelay = 0; - var slice = Array.prototype.slice; + /** + * Should the animation yoyo? (reverse back down to the start) before repeating? + * + * @name Phaser.GameObjects.Components.Animation#_yoyo + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._yoyo = false; - return function (thisArg) { + /** + * Will the playhead move forwards (`true`) or in reverse (`false`) + * + * @name Phaser.GameObjects.Components.Animation#forward + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.forward = true; - var target = this, boundArgs = slice.call(arguments, 1); + /** + * Internal time overflow accumulator. + * + * @name Phaser.GameObjects.Components.Animation#accumulator + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.accumulator = 0; - if (typeof target !== 'function') - { - throw new TypeError(); - } + /** + * The time point at which the next animation frame will change. + * + * @name Phaser.GameObjects.Components.Animation#nextTick + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.nextTick = 0; - function bound() { - var args = boundArgs.concat(slice.call(arguments)); - target.apply(this instanceof bound ? this : thisArg, args); - } + /** + * An internal counter keeping track of how many repeats are left to play. + * + * @name Phaser.GameObjects.Components.Animation#repeatCounter + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.repeatCounter = 0; - bound.prototype = (function F(proto) { - if (proto) - { - F.prototype = proto; - } + /** + * An internal flag keeping track of pending repeats. + * + * @name Phaser.GameObjects.Components.Animation#pendingRepeat + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.pendingRepeat = false; - if (!(this instanceof F)) - { - /* jshint supernew: true */ - return new F; - } - })(target.prototype); + /** + * Is the Animation paused? + * + * @name Phaser.GameObjects.Components.Animation#_paused + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._paused = false; - return bound; - }; - })(); -} + /** + * Was the animation previously playing before being paused? + * + * @name Phaser.GameObjects.Components.Animation#_wasPlaying + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._wasPlaying = false; + /** + * Container for the callback arguments. + * + * @name Phaser.GameObjects.Components.Animation#_callbackArgs + * @type {array} + * @private + * @since 3.0.0 + */ + this._callbackArgs = [ parent, null ]; + /** + * Container for the update arguments. + * + * @name Phaser.GameObjects.Components.Animation#_updateParams + * @type {array} + * @private + * @since 3.0.0 + */ + this._updateParams = []; + }, -/***/ }), -/* 372 */ -/***/ (function(module, exports) { + /** + * Sets the amount of time, in seconds that the animation will be delayed before starting playback. + * + * @method Phaser.GameObjects.Components.Animation#delay + * @since 3.0.0 + * + * @param {number} value - The amount of time, in seconds, to wait before starting playback. + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + delay: function (value) + { + if (value === undefined) + { + return this._delay; + } + else + { + this._delay = value; -// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc -if (!Math.trunc) { - Math.trunc = function trunc(x) { - return x < 0 ? Math.ceil(x) : Math.floor(x); - }; -} + return this; + } + }, + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#delayedPlay + * @since 3.0.0 + * + * @param {[type]} delay - [description] + * @param {[type]} key - [description] + * @param {[type]} startFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + delayedPlay: function (delay, key, startFrame) + { + this.play(key, true, startFrame); -/***/ }), -/* 373 */ -/***/ (function(module, exports) { + this.nextTick += (delay * 1000); -/** - * performance.now - */ -(function () { + return this; + }, - if ('performance' in window === false) + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#getCurrentKey + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getCurrentKey: function () { - window.performance = {}; - } - - // Thanks IE8 - Date.now = (Date.now || function () { - return new Date().getTime(); - }); + if (this.currentAnim) + { + return this.currentAnim.key; + } + }, - if ('now' in window.performance === false) + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#load + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {integer} [startFrame=0] - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + load: function (key, startFrame) { - var nowOffset = Date.now(); + if (startFrame === undefined) { startFrame = 0; } - if (performance.timing && performance.timing.navigationStart) + if (this.isPlaying) { - nowOffset = performance.timing.navigationStart; + this.stop(); } - window.performance.now = function now () + // Load the new animation in + this.animationManager.load(this, key, startFrame); + + return this; + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#pause + * @since 3.0.0 + * + * @param {[type]} atFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + pause: function (atFrame) + { + if (!this._paused) { - return Date.now() - nowOffset; + this._paused = true; + this._wasPlaying = this.isPlaying; + this.isPlaying = false; } - } -})(); + if (atFrame !== undefined) + { + this.updateFrame(atFrame); + } + + return this; + }, + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#paused + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + paused: function (value) + { + if (value !== undefined) + { + // Setter + if (value) + { + return this.pause(); + } + else + { + return this.resume(); + } + } + else + { + return this._paused; + } + }, -/***/ }), -/* 374 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#play + * @since 3.0.0 + * + * @param {string} key - [description] + * @param {boolean} [ignoreIfPlaying=false] - [description] + * @param {integer} [startFrame=0] - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + play: function (key, ignoreIfPlaying, startFrame) + { + if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } + if (startFrame === undefined) { startFrame = 0; } -/* WEBPACK VAR INJECTION */(function(global) {// References: -// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -// https://gist.github.com/1579671 -// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision -// https://gist.github.com/timhall/4078614 -// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) + { + return this; + } -// Expected to be used with Browserfiy -// Browserify automatically detects the use of `global` and passes the -// correct reference of `global`, `self`, and finally `window` + this.load(key, startFrame); -// Date.now -if (!(Date.now && Date.prototype.getTime)) { - Date.now = function now() { - return new Date().getTime(); - }; -} + var anim = this.currentAnim; + var gameObject = this.parent; -// performance.now -if (!(global.performance && global.performance.now)) { - var startTime = Date.now(); - if (!global.performance) { - global.performance = {}; - } - global.performance.now = function () { - return Date.now() - startTime; - }; -} + // Should give us 9,007,199,254,740,991 safe repeats + this.repeatCounter = (this._repeat === -1) ? Number.MAX_VALUE : this._repeat; -// requestAnimationFrame -var lastTime = Date.now(); -var vendors = ['ms', 'moz', 'webkit', 'o']; + anim.getFirstTick(this); -for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { - global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; - global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || - global[vendors[x] + 'CancelRequestAnimationFrame']; -} + this.forward = true; + this.isPlaying = true; + this.pendingRepeat = false; -if (!global.requestAnimationFrame) { - global.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') { - throw new TypeError(callback + 'is not a function'); + if (anim.showOnStart) + { + gameObject.visible = true; } - var currentTime = Date.now(), - delay = 16 + lastTime - currentTime; - - if (delay < 0) { - delay = 0; + if (anim.onStart) + { + anim.onStart.apply(anim.callbackScope, this._callbackArgs.concat(anim.onStartParams)); } - lastTime = currentTime; - - return setTimeout(function () { - lastTime = Date.now(); - callback(performance.now()); - }, delay); - }; -} - -if (!global.cancelAnimationFrame) { - global.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166))) + gameObject.setSizeToFrame(); + gameObject.updateDisplayOrigin(); -/***/ }), -/* 375 */ -/***/ (function(module, exports) { + return this; + }, -/** -* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9 -* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/ -* Cameron Foale (http://www.kibibu.com) -*/ -if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object") -{ - var CheapArray = function(type) + // Value between 0 and 1. How far this animation is through, ignoring repeats and yoyos. + // If the animation has a non-zero repeat defined, progress and totalProgress will be different + // because progress doesn't include any repeats or repeatDelays whereas totalProgress does. + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#progress + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + progress: function (value) { - var proto = new Array(); // jshint ignore:line - - window[type] = function(arg) { - - if (typeof(arg) === "number") - { - Array.call(this, arg); - this.length = arg; + if (value === undefined) + { + var p = this.currentFrame.progress; - for (var i = 0; i < this.length; i++) - { - this[i] = 0; - } - } - else + if (!this.forward) { - Array.call(this, arg.length); - - this.length = arg.length; - - for (var i = 0; i < this.length; i++) - { - this[i] = arg[i]; - } + p = 1 - p; } - }; - - window[type].prototype = proto; - window[type].constructor = window[type]; - }; - - CheapArray('Float32Array'); // jshint ignore:line - CheapArray('Uint32Array'); // jshint ignore:line - CheapArray('Uint16Array'); // jshint ignore:line - CheapArray('Int16Array'); // jshint ignore:line - CheapArray('ArrayBuffer'); // jshint ignore:line -} - -/***/ }), -/* 376 */ -/***/ (function(module, exports) { + return p; + } + else + { + // TODO: Set progress -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + } + }, -/** - * [description] - * - * @function Phaser.Actions.Angle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Angle = function (items, value) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#remove + * @since 3.0.0 + * + * @param {[type]} event - [description] + */ + remove: function (event) { - items[i].angle += value; - } + if (event === undefined) { event = this.currentAnim; } - return items; -}; + if (this.isPlaying && event.key === this.currentAnim.key) + { + this.stop(); -module.exports = Angle; + var sprite = this.parent; + var frame = this.currentAnim.frames[0]; + this.currentFrame = frame; -/***/ }), -/* 377 */ -/***/ (function(module, exports) { + sprite.texture = frame.frame.texture; + sprite.frame = frame.frame; + } + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Gets or sets the number of times that the animation should repeat + // after its first iteration. For example, if repeat is 1, the animation will + // play a total of twice (the initial play plus 1 repeat). + // To repeat indefinitely, use -1. repeat should always be an integer. -/** - * [description] - * - * @function Phaser.Actions.Call - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {function} callback - [description] - * @param {object} thisArg - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Call = function (items, callback, thisArg) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#repeat + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + repeat: function (value) { - var item = items[i]; - - callback.call(thisArg, item); - } + if (value === undefined) + { + return this._repeat; + } + else + { + this._repeat = value; + this.repeatCounter = 0; - return items; -}; + return this; + } + }, -module.exports = Call; + // Gets or sets the amount of time in seconds between repeats. + // For example, if repeat is 2 and repeatDelay is 1, the animation will play initially, + // then wait for 1 second before it repeats, then play again, then wait 1 second again + // before doing its final repeat. + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#repeatDelay + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + repeatDelay: function (value) + { + if (value === undefined) + { + return this._repeatDelay; + } + else + { + this._repeatDelay = value; -/***/ }), -/* 378 */ -/***/ (function(module, exports) { + return this; + } + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#restart + * @since 3.0.0 + * + * @param {[type]} includeDelay - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + restart: function (includeDelay) + { + if (includeDelay === undefined) { includeDelay = false; } -// compare = Object: -// { -// scaleX: 0.5, -// scaleY: 1 -// } + this.currentAnim.getFirstTick(this, includeDelay); -/** - * [description] - * - * @function Phaser.Actions.GetFirst - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} compare - [description] - * @param {integer} index - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var GetFirst = function (items, compare, index) -{ - for (var i = index; i < items.length; i++) - { - var item = items[i]; + this.forward = true; + this.isPlaying = true; + this.pendingRepeat = false; + this._paused = false; - var match = true; + // Set frame + this.updateFrame(this.currentAnim.frames[0]); - for (var property in compare) + return this; + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#resume + * @since 3.0.0 + * + * @param {[type]} fromFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + resume: function (fromFrame) + { + if (this._paused) { - if (item[property] !== compare[property]) - { - match = false; - } + this._paused = false; + this.isPlaying = this._wasPlaying; } - if (match) + if (fromFrame !== undefined) { - return item; + this.updateFrame(fromFrame); } - } + + return this; + }, - return null; -}; + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#stop + * @since 3.0.0 + * + * @param {[type]} dispatchCallbacks - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + stop: function (dispatchCallbacks) + { + if (dispatchCallbacks === undefined) { dispatchCallbacks = false; } -module.exports = GetFirst; + this.isPlaying = false; + var anim = this.currentAnim; -/***/ }), -/* 379 */ -/***/ (function(module, exports, __webpack_require__) { + if (dispatchCallbacks && anim.onComplete) + { + anim.onComplete.apply(anim.callbackScope, this._callbackArgs.concat(anim.onCompleteParams)); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + }, -var AlignIn = __webpack_require__(169); -var CONST = __webpack_require__(170); -var GetValue = __webpack_require__(4); -var NOOP = __webpack_require__(3); -var Zone = __webpack_require__(77); + // Scale the time (make it go faster / slower) + // Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc. -var tempZone = new Zone({ sys: { queueDepthSort: NOOP }}, 0, 0, 1, 1); + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#timeScale + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + timeScale: function (value) + { + if (value === undefined) + { + return this._timeScale; + } + else + { + this._timeScale = value; -/** - * [description] - * - * @function Phaser.Actions.GridAlign - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} options - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var GridAlign = function (items, options) -{ - var width = GetValue(options, 'width', -1); - var height = GetValue(options, 'height', -1); - var cellWidth = GetValue(options, 'cellWidth', 1); - var cellHeight = GetValue(options, 'cellHeight', cellWidth); - var position = GetValue(options, 'position', CONST.TOP_LEFT); - var x = GetValue(options, 'x', 0); - var y = GetValue(options, 'y', 0); + return this; + } + }, - // var centerX = GetValue(options, 'centerX', null); - // var centerY = GetValue(options, 'centerY', null); + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#totalFrames + * @since 3.0.0 + * + * @return {[type]} [description] + */ + totalFrames: function () + { + return this.currentAnim.frames.length; + }, - var cx = 0; - var cy = 0; - var w = (width * cellWidth); - var h = (height * cellHeight); + // Value between 0 and 1. How far this animation is through, including things like delays + // repeats, custom frame durations, etc. If the animation is set to repeat -1 it can never + // have a duration, therefore this will return -1. + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#totalProgres + * @since 3.0.0 + */ + totalProgres: function () + { + // TODO + }, - // If the Grid is centered on a position then we need to calculate it now - // if (centerX !== null && centerY !== null) - // { - // - // } + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#update + * @since 3.0.0 + * + * @param {[type]} timestamp - [description] + * @param {[type]} delta - [description] + */ + update: function (timestamp, delta) + { + if (!this.isPlaying || this.currentAnim.paused) + { + return; + } - tempZone.setPosition(x, y); - tempZone.setSize(cellWidth, cellHeight); + this.accumulator += delta * this._timeScale; - for (var i = 0; i < items.length; i++) + if (this.accumulator >= this.nextTick) + { + this.currentAnim.setFrame(this); + } + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#updateFrame + * @since 3.0.0 + * + * @param {[type]} animationFrame - [description] + */ + updateFrame: function (animationFrame) { - AlignIn(items[i], tempZone, position); + var sprite = this.parent; - if (width === -1) + this.currentFrame = animationFrame; + + sprite.texture = animationFrame.frame.texture; + sprite.frame = animationFrame.frame; + + if (this.isPlaying) { - // We keep laying them out horizontally until we've done them all - cy += cellHeight; - tempZone.y += cellHeight; + if (animationFrame.setAlpha) + { + sprite.alpha = animationFrame.alpha; + } - if (cy === h) + var anim = this.currentAnim; + + if (anim.onUpdate) { - cy = 0; - tempZone.x += cellWidth; - tempZone.y = y; + anim.onUpdate.apply(anim.callbackScope, this._updateParams); } - } - else if (height === -1) - { - // We keep laying them out vertically until we've done them all - cx += cellWidth; - tempZone.x += cellWidth; - if (cx === w) + if (animationFrame.onUpdate) { - cx = 0; - tempZone.x = x; - tempZone.y += cellHeight; + animationFrame.onUpdate(sprite, animationFrame); } } + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#yoyo + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + yoyo: function (value) + { + if (value === undefined) + { + return this._yoyo; + } else { - // We keep laying them out until we hit the column limit - cx += cellWidth; - tempZone.x += cellWidth; - - if (cx === w) - { - cx = 0; - cy += cellHeight; - tempZone.x = x; - tempZone.y += cellHeight; + this._yoyo = value; - if (cy === h) - { - // We've hit the column limit, so return, even if there are items left - break; - } - } + return this; } + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#destroy + * @since 3.0.0 + */ + destroy: function () + { + // TODO } - return items; -}; +}); -module.exports = GridAlign; +module.exports = Animation; /***/ }), -/* 380 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71511,447 +71943,529 @@ module.exports = GridAlign; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var BlitImage = __webpack_require__(368); +var CanvasSnapshot = __webpack_require__(369); var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var DrawImage = __webpack_require__(370); +var GetBlendModes = __webpack_require__(371); +var ScaleModes = __webpack_require__(63); +var Smoothing = __webpack_require__(121); /** * @classdesc * [description] * - * @class RandomDataGenerator - * @memberOf Phaser.Math + * @class CanvasRenderer + * @memberOf Phaser.Renderer.Canvas * @constructor * @since 3.0.0 * - * @param {array} [seeds] - [description] + * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. */ -var RandomDataGenerator = new Class({ +var CanvasRenderer = new Class({ initialize: - function RandomDataGenerator (seeds) + function CanvasRenderer (game) { /** - * Internal var. + * The Phaser Game instance that owns this renderer. * - * @name Phaser.Math.RandomDataGenerator#c - * @type {number} - * @default 1 - * @private + * @name Phaser.Renderer.Canvas.CanvasRenderer#game + * @type {Phaser.Game} * @since 3.0.0 */ - this.c = 1; + this.game = game; /** - * Internal var. + * [description] * - * @name Phaser.Math.RandomDataGenerator#s0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.CANVAS; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount * @type {number} * @default 0 - * @private * @since 3.0.0 */ - this.s0 = 0; + this.drawCount = 0; /** - * Internal var. + * [description] * - * @name Phaser.Math.RandomDataGenerator#s1 + * @name Phaser.Renderer.Canvas.CanvasRenderer#width * @type {number} - * @default 0 - * @private * @since 3.0.0 */ - this.s1 = 0; + this.width = game.config.width; /** - * Internal var. + * [description] * - * @name Phaser.Math.RandomDataGenerator#s2 + * @name Phaser.Renderer.Canvas.CanvasRenderer#height * @type {number} - * @default 0 - * @private * @since 3.0.0 */ - this.s2 = 0; + this.height = game.config.height; /** * [description] * - * @name Phaser.Math.RandomDataGenerator#sign - * @type {array} + * @name Phaser.Renderer.Canvas.CanvasRenderer#config + * @type {object} * @since 3.0.0 */ - this.sign = [ -1, 1 ]; + this.config = { + clearBeforeRender: game.config.clearBeforeRender, + pixelArt: game.config.pixelArt, + backgroundColor: game.config.backgroundColor, + resolution: game.config.resolution, + autoResize: game.config.autoResize, + roundPixels: game.config.roundPixels + }; - if (seeds) - { - this.init(seeds); - } - }, + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode + * @type {integer} + * @since 3.0.0 + */ + this.scaleMode = (game.config.pixelArt) ? ScaleModes.NEAREST : ScaleModes.LINEAR; - /** - * Private random helper. - * - * @method Phaser.Math.RandomDataGenerator#rnd - * @since 3.0.0 - * @private - * - * @return {number} [description] - */ - rnd: function () - { - var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.gameCanvas = game.canvas; - this.c = t | 0; - this.s0 = this.s1; - this.s1 = this.s2; - this.s2 = t - this.c; + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.gameContext = this.gameCanvas.getContext('2d'); - return this.s2; - }, + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.currentContext = this.gameContext; - /** - * Internal method that creates a seed hash. - * - * @method Phaser.Math.RandomDataGenerator#hash - * @since 3.0.0 - * @private - * - * @param {[type]} data - [description] - * - * @return {number} The hashed value. - */ - hash: function (data) - { - var h; - var n = 0xefc8249d; + /** + * Map to the required function. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawImage + * @type {function} + * @since 3.0.0 + */ + this.drawImage = DrawImage(this.config.roundPixels); - data = data.toString(); + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage + * @type {function} + * @since 3.0.0 + */ + this.blitImage = BlitImage(this.config.roundPixels); - for (var i = 0; i < data.length; i++) - { - n += data.charCodeAt(i); - h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000;// 2^32 - } + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes + * @type {array} + * @since 3.0.0 + */ + this.blendModes = GetBlendModes(); + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentAlpha + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.currentAlpha = 1; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentBlendMode + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentBlendMode = 0; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentScaleMode = 0; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback + * @type {?function} + * @default null + * @since 3.0.0 + */ + this.snapshotCallback = null; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType + * @type {?[type]} + * @default null + * @since 3.0.0 + */ + this.snapshotType = null; - return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder + * @type {?[type]} + * @default null + * @since 3.0.0 + */ + this.snapshotEncoder = null; + + this.init(); }, /** * [description] * - * @method Phaser.Math.RandomDataGenerator#init + * @method Phaser.Renderer.Canvas.CanvasRenderer#init * @since 3.0.0 - * - * @param {string|array} seeds - [description] */ - init: function (seeds) + init: function () { - if (typeof seeds === 'string') - { - this.state(seeds); - } - else - { - this.sow(seeds); - } + this.resize(this.width, this.height); }, /** - * Reset the seed of the random data generator. - * - * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. + * Resize the main game canvas. * - * @method Phaser.Math.RandomDataGenerator#sow + * @method Phaser.Renderer.Canvas.CanvasRenderer#resize * @since 3.0.0 * - * @param {any[]} seeds - The array of seeds: the `toString()` of each value is used. + * @param {integer} width - [description] + * @param {integer} height - [description] */ - sow: function (seeds) + resize: function (width, height) { - // Always reset to default seed - this.s0 = this.hash(' '); - this.s1 = this.hash(this.s0); - this.s2 = this.hash(this.s1); - this.c = 1; + var resolution = this.config.resolution; - if (!seeds) + this.width = width * resolution; + this.height = height * resolution; + + this.gameCanvas.width = this.width; + this.gameCanvas.height = this.height; + + if (this.config.autoResize) { - return; + this.gameCanvas.style.width = (this.width / resolution) + 'px'; + this.gameCanvas.style.height = (this.height / resolution) + 'px'; } - // Apply any seeds - for (var i = 0; i < seeds.length && (seeds[i] != null); i++) + // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) + if (this.scaleMode === ScaleModes.NEAREST) { - var seed = seeds[i]; - - this.s0 -= this.hash(seed); - this.s0 += ~~(this.s0 < 0); - this.s1 -= this.hash(seed); - this.s1 += ~~(this.s1 < 0); - this.s2 -= this.hash(seed); - this.s2 += ~~(this.s2 < 0); + Smoothing.disable(this.gameContext); } }, /** - * Returns a random integer between 0 and 2^32. + * [description] * - * @method Phaser.Math.RandomDataGenerator#integer + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost * @since 3.0.0 * - * @return {number} A random integer between 0 and 2^32. + * @param {function} callback - [description] */ - integer: function () + onContextLost: function () { - // 2^32 - return this.rnd() * 0x100000000; }, /** - * Returns a random real number between 0 and 1. + * [description] * - * @method Phaser.Math.RandomDataGenerator#frac + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored * @since 3.0.0 * - * @return {number} A random real number between 0 and 1. + * @param {function} callback - [description] */ - frac: function () + onContextRestored: function () { - // 2^-53 - return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; }, /** - * Returns a random real number between 0 and 2^32. + * [description] * - * @method Phaser.Math.RandomDataGenerator#real + * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform * @since 3.0.0 - * - * @return {number} A random real number between 0 and 2^32. */ - real: function () + resetTransform: function () { - return this.integer() + this.frac(); + this.currentContext.setTransform(1, 0, 0, 1, 0, 0); }, /** - * Returns a random integer between and including min and max. + * [description] * - * @method Phaser.Math.RandomDataGenerator#integerInRange + * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * @param {[type]} blendMode - [description] * - * @return {number} A random number between min and max. + * @return {[type]} [description] */ - integerInRange: function (min, max) + setBlendMode: function (blendMode) { - return Math.floor(this.realInRange(0, max - min + 1) + min); - }, + if (this.currentBlendMode !== blendMode) + { + this.currentContext.globalCompositeOperation = blendMode; + this.currentBlendMode = blendMode; + } - /** - * Returns a random integer between and including min and max. - * This method is an alias for RandomDataGenerator.integerInRange. - * - * @method Phaser.Math.RandomDataGenerator#between - * @since 3.0.0 - * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. - * - * @return {number} A random number between min and max. - */ - between: function (min, max) - { - return Math.floor(this.realInRange(0, max - min + 1) + min); + return this.currentBlendMode; }, /** - * Returns a random real number between min and max. + * [description] * - * @method Phaser.Math.RandomDataGenerator#realInRange + * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * @param {float} alpha - [description] * - * @return {number} A random number between min and max. + * @return {float} [description] */ - realInRange: function (min, max) + setAlpha: function (alpha) { - return this.frac() * (max - min) + min; - }, + if (this.currentAlpha !== alpha) + { + this.currentContext.globalAlpha = alpha; + this.currentAlpha = alpha; + } - /** - * Returns a random real number between -1 and 1. - * - * @method Phaser.Math.RandomDataGenerator#normal - * @since 3.0.0 - * - * @return {number} A random real number between -1 and 1. - */ - normal: function () - { - return 1 - (2 * this.frac()); + return this.currentAlpha; }, /** - * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * Called at the start of the render loop. * - * @method Phaser.Math.RandomDataGenerator#uuid + * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender * @since 3.0.0 - * - * @return {string} A valid RFC4122 version4 ID hex string */ - uuid: function () + preRender: function () { - var a = ''; - var b = ''; + var ctx = this.gameContext; + var config = this.config; - for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') + var width = this.width; + var height = this.height; + + if (config.clearBeforeRender) { - // eslint-disable-next-line no-empty + ctx.clearRect(0, 0, width, height); } - return b; - }, + if (!config.transparent) + { + ctx.fillStyle = config.backgroundColor.rgba; + ctx.fillRect(0, 0, width, height); + } - /** - * Returns a random element from within the given array. - * - * @method Phaser.Math.RandomDataGenerator#pick - * @since 3.0.0 - * - * @param {array} array - The array to pick a random element from. - * - * @return {any} A random member of the array. - */ - pick: function (array) - { - return array[this.integerInRange(0, array.length - 1)]; + this.drawCount = 0; }, /** - * Returns a sign to be used with multiplication operator. + * Renders the Scene to the given Camera. * - * @method Phaser.Math.RandomDataGenerator#sign + * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 * - * @return {number} -1 or +1. + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.DisplayList} children - [description] + * @param {float} interpolationPercentage - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - sign: function () + render: function (scene, children, interpolationPercentage, camera) { - return this.pick(this.sign); - }, + var ctx = scene.sys.context; + var scissor = (camera.x !== 0 || camera.y !== 0 || camera.width !== ctx.canvas.width || camera.height !== ctx.canvas.height); + var list = children.list; + var resolution = this.config.resolution; - /** - * Returns a random element from within the given array, favoring the earlier entries. - * - * @method Phaser.Math.RandomDataGenerator#weightedPick - * @since 3.0.0 - * - * @param {array} array - The array to pick a random element from. - * - * @return {any} A random member of the array. - */ - weightedPick: function (array) - { - return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; - }, + this.currentContext = ctx; - /** - * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. - * - * @method Phaser.Math.RandomDataGenerator#timestamp - * @since 3.0.0 - * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. - * - * @return {number} A random timestamp between min and max. - */ - timestamp: function (min, max) - { - return this.realInRange(min || 946684800000, max || 1577862000000); + // If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops) + + if (!camera.transparent) + { + ctx.fillStyle = camera.backgroundColor.rgba; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + } + + if (this.currentAlpha !== 1) + { + ctx.globalAlpha = 1; + this.currentAlpha = 1; + } + + if (this.currentBlendMode !== 0) + { + ctx.globalCompositeOperation = 'source-over'; + this.currentBlendMode = 0; + } + + this.currentScaleMode = 0; + + this.drawCount += list.length; + + if (scissor) + { + ctx.save(); + ctx.beginPath(); + ctx.rect(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); + ctx.clip(); + } + + var matrix = camera.matrix.matrix; + + ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + + for (var c = 0; c < list.length; c++) + { + var child = list[c]; + + if (child.mask) + { + child.mask.preRenderCanvas(this, child, camera); + } + + child.renderCanvas(this, child, interpolationPercentage, camera); + + if (child.mask) + { + child.mask.postRenderCanvas(this, child, camera); + } + } + + ctx.setTransform(1, 0, 0, 1, 0, 0); + + if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) + { + ctx.globalCompositeOperation = 'source-over'; + + // fade rendering + ctx.fillStyle = 'rgb(' + (camera._fadeRed * 255) + ',' + (camera._fadeGreen * 255) + ',' + (camera._fadeBlue * 255) + ')'; + ctx.globalAlpha = camera._fadeAlpha; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + + // flash rendering + ctx.fillStyle = 'rgb(' + (camera._flashRed * 255) + ',' + (camera._flashGreen * 255) + ',' + (camera._flashBlue * 255) + ')'; + ctx.globalAlpha = camera._flashAlpha; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + + ctx.globalAlpha = 1.0; + } + + // Reset the camera scissor + if (scissor) + { + ctx.restore(); + } }, /** - * Returns a random angle between -180 and 180. + * [description] * - * @method Phaser.Math.RandomDataGenerator#angle + * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender * @since 3.0.0 - * - * @return {number} A random number between -180 and 180. */ - angle: function () + postRender: function () { - return this.integerInRange(-180, 180); + var ctx = this.gameContext; + + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + + this.currentAlpha = 1; + this.currentBlendMode = 0; + + if (this.snapshotCallback) + { + this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); + this.snapshotCallback = null; + } }, /** - * Returns a random rotation in radians, between -3.141 and 3.141 + * [description] * - * @method Phaser.Math.RandomDataGenerator#rotation + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot * @since 3.0.0 * - * @return {number} A random number between -3.141 and 3.141 + * @param {[type]} callback - [description] + * @param {[type]} type - [description] + * @param {[type]} encoderOptions - [description] */ - rotation: function () + snapshot: function (callback, type, encoderOptions) { - return this.realInRange(-3.1415926, 3.1415926); + this.snapshotCallback = callback; + this.snapshotType = type; + this.snapshotEncoder = encoderOptions; }, /** - * Gets or Sets the state of the generator. This allows you to retain the values - * that the generator is using between games, i.e. in a game save file. - * - * To seed this generator with a previously saved state you can pass it as the - * `seed` value in your game config, or call this method directly after Phaser has booted. - * - * Call this method with no parameters to return the current state. - * - * If providing a state it should match the same format that this method - * returns, which is a string with a header `!rnd` followed by the `c`, - * `s0`, `s1` and `s2` values respectively, each comma-delimited. + * [description] * - * @method Phaser.Math.RandomDataGenerator#state + * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy * @since 3.0.0 - * - * @param {string} [state] - Generator state to be set. - * - * @return {string} The current state of the generator. */ - state: function (state) + destroy: function () { - if (typeof state === 'string' && state.match(/^!rnd/)) - { - state = state.split(','); - - this.c = parseFloat(state[1]); - this.s0 = parseFloat(state[2]); - this.s1 = parseFloat(state[3]); - this.s2 = parseFloat(state[4]); - } + this.gameCanvas = null; + this.gameContext = null; - return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); + this.game = null; } }); -module.exports = RandomDataGenerator; +module.exports = CanvasRenderer; /***/ }), -/* 381 */ -/***/ (function(module, exports, __webpack_require__) { +/* 368 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -71959,244 +72473,258 @@ module.exports = RandomDataGenerator; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(60); - -// bitmask flag for GameObject.renderMask -var _FLAG = 2; // 0010 +var roundPixels = false; /** - * Provides methods used for setting the alpha properties of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Alpha + * No scaling, anchor, rotation or effects, literally draws the frame directly to the canvas. + * + * @function Phaser.Renderer.Canvas.BlitImage * @since 3.0.0 + * + * @param {number} dx - The x coordinate to render the Frame to. + * @param {number} dy - The y coordinate to render the Frame to. + * @param {Phaser.Textures.Frame} frame - The Frame to render. */ +var BlitImage = function (dx, dy, frame) +{ + var ctx = this.currentContext; + var cd = frame.canvasData; -var Alpha = { + if (roundPixels) + { + dx |= 0; + dy |= 0; + } - _alpha: 1, + ctx.drawImage( + frame.source.image, + cd.sx, + cd.sy, + cd.sWidth, + cd.sHeight, + dx, + dy, + cd.dWidth, + cd.dHeight + ); +}; - _alphaTL: 1, - _alphaTR: 1, - _alphaBL: 1, - _alphaBR: 1, +// Special return so we can store the config value locally - /** - * Clears all alpha values associated with this Game Object. - * Immediately sets the alpha levels back to 1 (fully opaque) - * - * @method Phaser.GameObjects.Components.Alpha#clearAlpha - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - clearAlpha: function () - { - return this.setAlpha(1); - }, +module.exports = function (configRoundPixels) +{ + roundPixels = configRoundPixels; - /** - * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * If your game is running under WebGL you can optionally specify four different alpha values, each of which - * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. - * - * @method Phaser.GameObjects.Components.Alpha#setAlpha - * @since 3.0.0 - * - * @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. - * @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. - * @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. - * @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) - { - if (topLeft === undefined) { topLeft = 1; } + return BlitImage; +}; + + +/***/ }), +/* 369 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Renderer.Snapshot.Canvas + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - [description] + * @param {string} [type='image/png'] - [description] + * @param {float} [encoderOptions=0.92] - [description] + * + * @return {Image} [description] + */ +var CanvasSnapshot = function (canvas, type, encoderOptions) +{ + if (type === undefined) { type = 'image/png'; } + if (encoderOptions === undefined) { encoderOptions = 0.92; } + + var src = canvas.toDataURL(type, encoderOptions); + + var image = new Image(); + + image.src = src; + + return image; +}; - // Treat as if there is only one alpha value for the whole Game Object - if (topRight === undefined) - { - this.alpha = topLeft; - } - else - { - this._alphaTL = Clamp(topLeft, 0, 1); - this._alphaTR = Clamp(topRight, 0, 1); - this._alphaBL = Clamp(bottomLeft, 0, 1); - this._alphaBR = Clamp(bottomRight, 0, 1); - } +module.exports = CanvasSnapshot; - return this; - }, - /** - * The alpha value of the Game Object. - * - * This is a global value, impacting the entire Game Object, not just a region of it. - * - * @name Phaser.GameObjects.Components.Alpha#alpha - * @type {float} - * @since 3.0.0 - */ - alpha: { +/***/ }), +/* 370 */ +/***/ (function(module, exports) { - get: function () - { - return this._alpha; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - set: function (value) - { - var v = Clamp(value, 0, 1); +var roundPixels = false; - this._alpha = v; - this._alphaTL = v; - this._alphaTR = v; - this._alphaBL = v; - this._alphaBR = v; +/** + * [description] + * + * @function Phaser.Renderer.Canvas.DrawImage + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} src - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ +var DrawImage = function (src, camera) +{ + var ctx = this.currentContext; + var frame = src.frame; + var cd = frame.canvasData; - if (v === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + // Blend Mode - }, + if (this.currentBlendMode !== src.blendMode) + { + this.currentBlendMode = src.blendMode; + ctx.globalCompositeOperation = this.blendModes[src.blendMode]; + } - /** - * The alpha value starting from the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaTopLeft: { + // Alpha - get: function () - { - return this._alphaTL; - }, + if (this.currentAlpha !== src.alpha) + { + this.currentAlpha = src.alpha; + ctx.globalAlpha = src.alpha; + } - set: function (value) - { - var v = Clamp(value, 0, 1); + // Smoothing - this._alphaTL = v; + if (this.currentScaleMode !== src.scaleMode) + { + this.currentScaleMode = src.scaleMode; - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } + // ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR); + } - }, + var dx = frame.x; + var dy = frame.y; - /** - * The alpha value starting from the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaTopRight - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaTopRight: { + var fx = 1; + var fy = 1; - get: function () - { - return this._alphaTR; - }, + if (src.flipX) + { + fx = -1; + dx -= cd.dWidth - src.displayOriginX; + } + else + { + dx -= src.displayOriginX; + } - set: function (value) - { - var v = Clamp(value, 0, 1); + if (src.flipY) + { + fy = -1; + dy -= cd.dHeight - src.displayOriginY; + } + else + { + dy -= src.displayOriginY; + } - this._alphaTR = v; + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } + if (roundPixels) + { + tx |= 0; + ty |= 0; + dx |= 0; + dy |= 0; + } - }, + // Perform Matrix ITRS - /** - * The alpha value starting from the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomLeft: { + ctx.save(); - get: function () - { - return this._alphaBL; - }, + ctx.translate(tx, ty); - set: function (value) - { - var v = Clamp(value, 0, 1); + ctx.rotate(src.rotation); - this._alphaBL = v; + ctx.scale(src.scaleX, src.scaleY); + ctx.scale(fx, fy); - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } + ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, dx, dy, cd.dWidth, cd.dHeight); - }, + ctx.restore(); +}; - /** - * The alpha value starting from the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomRight: { +// Special return so we can store the config value locally - get: function () - { - return this._alphaBR; - }, +module.exports = function (configRoundPixels) +{ + roundPixels = configRoundPixels; - set: function (value) - { - var v = Clamp(value, 0, 1); + return DrawImage; +}; - this._alphaBR = v; - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } +/***/ }), +/* 371 */ +/***/ (function(module, exports, __webpack_require__) { - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var modes = __webpack_require__(45); +var CanvasFeatures = __webpack_require__(237); + +/** + * [description] + * + * @function Phaser.Renderer.Canvas.GetBlendModes + * @since 3.0.0 + * + * @return {array} [description] + */ +var GetBlendModes = function () +{ + var output = []; + var useNew = CanvasFeatures.supportNewBlendModes; + + output[modes.NORMAL] = 'source-over'; + output[modes.ADD] = 'lighter'; + output[modes.MULTIPLY] = (useNew) ? 'multiply' : 'source-over'; + output[modes.SCREEN] = (useNew) ? 'screen' : 'source-over'; + output[modes.OVERLAY] = (useNew) ? 'overlay' : 'source-over'; + output[modes.DARKEN] = (useNew) ? 'darken' : 'source-over'; + output[modes.LIGHTEN] = (useNew) ? 'lighten' : 'source-over'; + output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : 'source-over'; + output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : 'source-over'; + output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : 'source-over'; + output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : 'source-over'; + output[modes.DIFFERENCE] = (useNew) ? 'difference' : 'source-over'; + output[modes.EXCLUSION] = (useNew) ? 'exclusion' : 'source-over'; + output[modes.HUE] = (useNew) ? 'hue' : 'source-over'; + output[modes.SATURATION] = (useNew) ? 'saturation' : 'source-over'; + output[modes.COLOR] = (useNew) ? 'color' : 'source-over'; + output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : 'source-over'; + return output; }; -module.exports = Alpha; +module.exports = GetBlendModes; /***/ }), -/* 382 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -72205,1569 +72733,1820 @@ module.exports = Alpha; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlendModes = __webpack_require__(45); +var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var IsSizePowerOfTwo = __webpack_require__(126); +var Utils = __webpack_require__(41); +var WebGLSnapshot = __webpack_require__(373); + +// Default Pipelines +var BitmapMaskPipeline = __webpack_require__(374); +var FlatTintPipeline = __webpack_require__(375); +var ForwardDiffuseLightPipeline = __webpack_require__(163); +var TextureTintPipeline = __webpack_require__(164); /** - * Provides methods used for setting the blend mode of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.BlendMode + * @classdesc + * [description] + * + * @class WebGLRenderer + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 + * + * @param {Phaser.Game} game - [description] */ +var WebGLRenderer = new Class({ -var BlendMode = { + initialize: - _blendMode: BlendModes.NORMAL, + function WebGLRenderer (game) + { + // eslint-disable-next-line consistent-this + var renderer = this; - /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN - * - * Canvas has more available depending on browser support. - * - * You can also create your own custom Blend Modes in WebGL. - * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency of which blend modes - * are used. - * - * @name Phaser.GameObjects.Components.BlendMode#blendMode - * @type {integer|string} - * @since 3.0.0 - */ - blendMode: { + var contextCreationConfig = { + alpha: game.config.transparent, + depth: false, // enable when 3D is added in the future + antialias: game.config.antialias, + premultipliedAlpha: game.config.transparent, + stencil: true, + preserveDrawingBuffer: game.config.preserveDrawingBuffer, + failIfMajorPerformanceCaveat: false, + powerPreference: game.config.powerPreference + }; - get: function () - { - return this._blendMode; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: game.config.clearBeforeRender, + pixelArt: game.config.pixelArt, + backgroundColor: game.config.backgroundColor, + contextCreation: contextCreationConfig, + resolution: game.config.resolution, + autoResize: game.config.autoResize, + roundPixels: game.config.roundPixels + }; - set: function (value) - { - if (typeof value === 'string') - { - value = BlendModes[value]; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - value | 0; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.WEBGL; - if (value >= 0) - { - this._blendMode = value; - } - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#width + * @type {number} + * @since 3.0.0 + */ + this.width = game.config.width; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#height + * @type {number} + * @since 3.0.0 + */ + this.height = game.config.height; - /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN - * - * Canvas has more available depending on browser support. - * - * You can also create your own custom Blend Modes in WebGL. - * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency of which blend modes - * are used. - * - * @method Phaser.GameObjects.Components.BlendMode#setBlendMode - * @since 3.0.0 - * - * @param {string|integer} value - The BlendMode value. Either a string or a CONST. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setBlendMode: function (value) - { - this.blendMode = value; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = game.canvas; - return this; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks + * @type {function[]} + * @since 3.0.0 + */ + this.lostContextCallbacks = []; -}; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks + * @type {function[]} + * @since 3.0.0 + */ + this.restoredContextCallbacks = []; -module.exports = BlendMode; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.blendModes = []; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.nativeTextures = []; -/***/ }), -/* 383 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.contextLost = false; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @type {object} + * @default null + * @since 3.0.0 + */ + this.pipelines = null; -/** - * Provides methods used for setting the blend mode of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.ComputedSize - * @since 3.0.0 - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState + * @type {object} + * @since 3.0.0 + */ + this.snapshotState = { + callback: null, + type: null, + encoder: null + }; -var ComputedSize = { + // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) - /** - * The native (un-scaled) width of this Game Object. - * - * @name Phaser.GameObjects.Components.ComputedSize#width - * @type {number} - * @since 3.0.0 - */ - width: 0, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit + * @type {integer} + * @since 3.1.0 + */ + this.currentActiveTextureUnit = 0; - /** - * The native (un-scaled) height of this Game Object. - * - * @name Phaser.GameObjects.Components.ComputedSize#height - * @type {number} - * @since 3.0.0 - */ - height: 0, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures + * @type {array} + * @since 3.0.0 + */ + this.currentTextures = new Array(16); - /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayWidth - * @type {number} - * @since 3.0.0 - */ - displayWidth: { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer + * @type {WebGLFramebuffer} + * @default null + * @since 3.0.0 + */ + this.currentFramebuffer = null; - get: function () - { - return this.scaleX * this.width; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @since 3.0.0 + */ + this.currentPipeline = null; - set: function (value) - { - this.scaleX = value / this.width; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram + * @type {WebGLProgram} + * @default null + * @since 3.0.0 + */ + this.currentProgram = null; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentVertexBuffer = null; - /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayHeight - * @type {number} - * @since 3.0.0 - */ - displayHeight: { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentIndexBuffer = null; - get: function () - { - return this.scaleY * this.height; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode + * @type {integer} + * @since 3.0.0 + */ + this.currentBlendMode = Infinity; - set: function (value) - { - this.scaleY = value / this.height; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.currentScissorEnabled = false; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor + * @type {Uint32Array} + * @since 3.0.0 + */ + this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); -}; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorIdx + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentScissorIdx = 0; -module.exports = ComputedSize; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack + * @type {Uint32Array} + * @since 3.0.0 + */ + this.scissorStack = new Uint32Array(4 * 1000); + // Setup context lost and restore event listeners -/***/ }), -/* 384 */ -/***/ (function(module, exports) { + this.canvas.addEventListener('webglcontextlost', function (event) + { + renderer.contextLost = true; + event.preventDefault(); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var index = 0; index < renderer.lostContextCallbacks.length; ++index) + { + var callback = renderer.lostContextCallbacks[index]; + callback[0].call(callback[1], renderer); + } + }, false); -/** - * Provides methods used for setting the depth of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Depth - * @since 3.0.0 - */ + this.canvas.addEventListener('webglcontextrestored', function () + { + renderer.contextLost = false; + renderer.init(renderer.config); + for (var index = 0; index < renderer.restoredContextCallbacks.length; ++index) + { + var callback = renderer.restoredContextCallbacks[index]; + callback[0].call(callback[1], renderer); + } + }, false); -var Depth = { + // This are initialized post context creation - _depth: 0, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#gl + * @type {WebGLRenderingContext} + * @default null + * @since 3.0.0 + */ + this.gl = null; - /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth - * value will always render in front of one with a lower value. - * - * Setting the depth will queue a depth sort event within the Scene. - * - * @name Phaser.GameObjects.Components.Depth#depth - * @type {number} - * @since 3.0.0 - */ - depth: { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions + * @type {object} + * @default null + * @since 3.0.0 + */ + this.supportedExtensions = null; - get: function () - { - return this._depth; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.extensions = {}; - set: function (value) - { - this.scene.sys.queueDepthSort(); - this._depth = value; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats + * @type {array} + * @default [] + * @since 3.2.0 + */ + this.glFormats = []; + this.init(this.config); }, /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth - * value will always render in front of one with a lower value. + * [description] * - * Setting the depth will queue a depth sort event within the Scene. - * - * @method Phaser.GameObjects.Components.Depth#setDepth + * @method Phaser.Renderer.WebGL.WebGLRenderer#init * @since 3.0.0 * - * @param {integer} value - The depth of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {object} config - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setDepth: function (value) + init: function (config) { - if (value === undefined) { value = 0; } + var canvas = this.canvas; + var clearColor = config.backgroundColor; + var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); + + if (!gl) + { + this.contextLost = true; + throw new Error('This browser does not support WebGL. Try using the Canvas pipeline.'); + } - this.depth = value; + this.gl = gl; - return this; - } + for (var i = 0; i <= 16; i++) + { + this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); + } -}; + this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; + this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; + this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; -module.exports = Depth; + this.glFormats[0] = gl.BYTE; + this.glFormats[1] = gl.SHORT; + this.glFormats[2] = gl.UNSIGNED_BYTE; + this.glFormats[3] = gl.UNSIGNED_SHORT; + this.glFormats[4] = gl.FLOAT; + // Load supported extensions + this.supportedExtensions = gl.getSupportedExtensions(); -/***/ }), -/* 385 */ -/***/ (function(module, exports) { + // Setup initial WebGL state + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.disable(gl.SCISSOR_TEST); + gl.enable(gl.BLEND); + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1.0); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Initialize all textures to null + for (var index = 0; index < this.currentTextures.length; ++index) + { + this.currentTextures[index] = null; + } -/** - * Provides methods used for visually flipping a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Flip - * @since 3.0.0 - */ + // Clear previous pipelines and reload default ones + this.pipelines = {}; -var Flip = { + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: this.game, renderer: this })); + this.addPipeline('FlatTintPipeline', new FlatTintPipeline({ game: this.game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: this.game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: this.game, renderer: this })); + + this.setBlendMode(CONST.BlendModes.NORMAL); + this.resize(this.width, this.height); + + return this; + }, /** - * The horizontally flipped state of the Game Object. - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * - * @name Phaser.GameObjects.Components.Flip#flipX - * @type {boolean} - * @default false + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resize * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - flipX: false, + resize: function (width, height) + { + var gl = this.gl; + var pipelines = this.pipelines; + var resolution = this.config.resolution; - /** - * The vertically flipped state of the Game Object. - * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * - * @name Phaser.GameObjects.Components.Flip#flipY - * @type {boolean} - * @default false - * @since 3.0.0 - */ - flipY: false, + this.width = width * resolution; + this.height = height * resolution; + + this.canvas.width = this.width; + this.canvas.height = this.height; - /** - * Toggles the horizontal flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipX - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - toggleFlipX: function () - { - this.flipX = !this.flipX; + if (this.config.autoResize) + { + this.canvas.style.width = (this.width / resolution) + 'px'; + this.canvas.style.height = (this.height / resolution) + 'px'; + } - return this; - }, + gl.viewport(0, 0, this.width, this.height); - /** - * Toggles the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipY - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - toggleFlipY: function () - { - this.flipY = !this.flipY; + // Update all registered pipelines + for (var pipelineName in pipelines) + { + pipelines[pipelineName].resize(width, height, resolution); + } return this; }, /** - * Sets the horizontal flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlipX + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {function} callback - [description] + * @param {object} target - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setFlipX: function (value) + onContextRestored: function (callback, target) { - this.flipX = value; - + this.restoredContextCallbacks.push([ callback, target ]); return this; }, /** - * Sets the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlipY + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {function} callback - [description] + * @param {object} target - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setFlipY: function (value) + onContextLost: function (callback, target) { - this.flipY = value; - + this.lostContextCallbacks.push([ callback, target ]); return this; }, /** - * Sets the horizontal and vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlip + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension * @since 3.0.0 * - * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {string} extensionName - [description] + * + * @return {boolean} [description] */ - setFlip: function (x, y) + hasExtension: function (extensionName) { - this.flipX = x; - this.flipY = y; - - return this; + return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; }, /** - * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. - * - * @method Phaser.GameObjects.Components.Flip#resetFlip - * @since 3.0.0 + * [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - resetFlip: function () - { - this.flipX = false; - this.flipY = false; - - return this; - } - -}; - -module.exports = Flip; - - -/***/ }), -/* 386 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Rectangle = __webpack_require__(8); -var RotateAround = __webpack_require__(185); -var Vector2 = __webpack_require__(6); - -/** - * Provides methods used for obtaining the bounds of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.GetBounds - * @since 3.0.0 - */ - -var GetBounds = { - - /** - * Gets the center coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getCenter + * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension * @since 3.0.0 * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. + * @param {string} extensionName - [description] + * + * @return {object} [description] */ - getCenter: function (output) + getExtension: function (extensionName) { - if (output === undefined) { output = new Vector2(); } + if (!this.hasExtension(extensionName)) { return null; } - output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); - output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); + if (!(extensionName in this.extensions)) + { + this.extensions[extensionName] = this.gl.getExtension(extensionName); + } - return output; + return this.extensions[extensionName]; }, /** - * Gets the top-left corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getTopLeft - * @since 3.0.0 + * [description] * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. + * @method Phaser.Renderer.WebGL.WebGLRenderer#flush + * @since 3.0.0 */ - getTopLeft: function (output) + flush: function () { - if (output === undefined) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = this.y - (this.displayHeight * this.originY); - - if (this.rotation !== 0) + if (this.currentPipeline) { - RotateAround(output, this.x, this.y, this.rotation); + this.currentPipeline.flush(); } - - return output; }, + /* Renderer State Manipulation Functions */ + /** - * Gets the top-right corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getTopRight + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline * @since 3.0.0 * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. + * @param {string} pipelineName - [description] + * + * @return {boolean} [description] */ - getTopRight: function (output) + hasPipeline: function (pipelineName) { - if (output === undefined) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = this.y - (this.displayHeight * this.originY); - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } - - return output; + return (pipelineName in this.pipelines); }, /** - * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline * @since 3.0.0 * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. + * @param {string} pipelineName - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - getBottomLeft: function (output) + getPipeline: function (pipelineName) { - if (output === undefined) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } - - return output; + return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; }, /** - * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getBottomRight + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline * @since 3.0.0 * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. + * @param {string} pipelineName - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - getBottomRight: function (output) + removePipeline: function (pipelineName) { - if (output === undefined) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } - - return output; + delete this.pipelines[pipelineName]; + return this; }, /** - * Gets the bounds of this Game Object, regardless of origin. - * The values are stored and returned in a Rectangle, or Rectangle-like, object. - * - * @method Phaser.GameObjects.Components.GetBounds#getBounds + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle|object} [output] - An object to store the values in. If not provided a new Rectangle will be created. - * - * @return {Phaser.Geom.Rectangle|object} The values stored in the output object. + * @param {string} pipelineName - [description] + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - getBounds: function (output) + addPipeline: function (pipelineName, pipelineInstance) { - if (output === undefined) { output = new Rectangle(); } - - // We can use the output object to temporarily store the x/y coords in: - - this.getTopLeft(output); - - var TLx = output.x; - var TLy = output.y; - - this.getTopRight(output); - - var TRx = output.x; - var TRy = output.y; - - this.getBottomLeft(output); - - var BLx = output.x; - var BLy = output.y; - - this.getBottomRight(output); - - var BRx = output.x; - var BRy = output.y; + if (!this.hasPipeline(pipelineName)) { this.pipelines[pipelineName] = pipelineInstance; } + else { console.warn('Pipeline', pipelineName, ' already exists.'); } - output.x = Math.min(TLx, TRx, BLx, BRx); - output.y = Math.min(TLy, TRy, BLy, BRy); - output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; - output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; + pipelineInstance.name = pipelineName; + this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); - return output; - } + return pipelineInstance; + }, -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor + * @since 3.0.0 + * + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} w - [description] + * @param {integer} h - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setScissor: function (x, y, w, h) + { + var gl = this.gl; + var currentScissor = this.currentScissor; + var enabled = (x === 0 && y === 0 && w === gl.canvas.width && h === gl.canvas.height && w >= 0 && h >= 0); -module.exports = GetBounds; + if (currentScissor[0] !== x || + currentScissor[1] !== y || + currentScissor[2] !== w || + currentScissor[3] !== h) + { + this.flush(); + } + currentScissor[0] = x; + currentScissor[1] = y; + currentScissor[2] = w; + currentScissor[3] = h; -/***/ }), -/* 387 */ -/***/ (function(module, exports) { + this.currentScissorEnabled = enabled; -var MatrixStack = { + if (enabled) + { + gl.disable(gl.SCISSOR_TEST); + return; + } - matrixStack: null, - currentMatrix: null, - currentMatrixIndex: 0, + gl.enable(gl.SCISSOR_TEST); + gl.scissor(x, (gl.drawingBufferHeight - y - h), w, h); - initMatrixStack: function () - { - this.matrixStack = new Float32Array(6000); // up to 1000 matrices - this.currentMatrix = new Float32Array([1.0, 0.0, 0.0, 1.0, 0.0, 0.0]); - this.currentMatrixIndex = 0; return this; }, - save: function () + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor + * @since 3.0.0 + * + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} w - [description] + * @param {integer} h - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + pushScissor: function (x, y, w, h) { - if (this.currentMatrixIndex >= this.matrixStack.length) return this; - - var matrixStack = this.matrixStack; - var currentMatrix = this.currentMatrix; - var currentMatrixIndex = this.currentMatrixIndex; - this.currentMatrixIndex += 6; + var scissorStack = this.scissorStack; + var stackIndex = this.currentScissorIdx; + var currentScissor = this.currentScissor; - matrixStack[currentMatrixIndex + 0] = currentMatrix[0]; - matrixStack[currentMatrixIndex + 1] = currentMatrix[1]; - matrixStack[currentMatrixIndex + 2] = currentMatrix[2]; - matrixStack[currentMatrixIndex + 3] = currentMatrix[3]; - matrixStack[currentMatrixIndex + 4] = currentMatrix[4]; - matrixStack[currentMatrixIndex + 5] = currentMatrix[5]; + scissorStack[stackIndex + 0] = currentScissor[0]; + scissorStack[stackIndex + 1] = currentScissor[1]; + scissorStack[stackIndex + 2] = currentScissor[2]; + scissorStack[stackIndex + 3] = currentScissor[3]; + this.currentScissorIdx += 4; + this.setScissor(x, y, w, h); + return this; }, - restore: function () + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + popScissor: function () { - if (this.currentMatrixIndex <= 0) return this; - - this.currentMatrixIndex -= 6; - - var matrixStack = this.matrixStack; - var currentMatrix = this.currentMatrix; - var currentMatrixIndex = this.currentMatrixIndex; - - currentMatrix[0] = matrixStack[currentMatrixIndex + 0]; - currentMatrix[1] = matrixStack[currentMatrixIndex + 1]; - currentMatrix[2] = matrixStack[currentMatrixIndex + 2]; - currentMatrix[3] = matrixStack[currentMatrixIndex + 3]; - currentMatrix[4] = matrixStack[currentMatrixIndex + 4]; - currentMatrix[5] = matrixStack[currentMatrixIndex + 5]; + var scissorStack = this.scissorStack; + var stackIndex = this.currentScissorIdx - 4; + + var x = scissorStack[stackIndex + 0]; + var y = scissorStack[stackIndex + 1]; + var w = scissorStack[stackIndex + 2]; + var h = scissorStack[stackIndex + 3]; + this.currentScissorIdx = stackIndex; + this.setScissor(x, y, w, h); + return this; }, - loadIdentity: function () + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setPipeline: function (pipelineInstance) { - this.setTransform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - return this; + if (this.currentPipeline !== pipelineInstance || + this.currentPipeline.vertexBuffer !== this.currentVertexBuffer || + this.currentPipeline.program !== this.currentProgram) + { + this.flush(); + this.currentPipeline = pipelineInstance; + this.currentPipeline.bind(); + } + + this.currentPipeline.onBind(); + + return this.currentPipeline; }, - transform: function (a, b, c, d, tx, ty) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode + * @since 3.0.0 + * + * @param {integer} blendModeId - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setBlendMode: function (blendModeId) { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var m4 = currentMatrix[4]; - var m5 = currentMatrix[5]; + var gl = this.gl; + var blendMode = this.blendModes[blendModeId]; - currentMatrix[0] = m0 * a + m2 * b; - currentMatrix[1] = m1 * a + m3 * b; - currentMatrix[2] = m0 * c + m2 * d; - currentMatrix[3] = m1 * c + m3 * d; - currentMatrix[4] = m0 * tx + m2 * ty + m4; - currentMatrix[5] = m1 * tx + m3 * ty + m5; + if (blendModeId !== CONST.BlendModes.SKIP_CHECK && + this.currentBlendMode !== blendModeId) + { + this.flush(); - return this; - }, + gl.enable(gl.BLEND); + gl.blendEquation(blendMode.equation); - setTransform: function (a, b, c, d, tx, ty) - { - var currentMatrix = this.currentMatrix; + if (blendMode.func.length > 2) + { + gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); + } + else + { + gl.blendFunc(blendMode.func[0], blendMode.func[1]); + } - currentMatrix[0] = a; - currentMatrix[1] = b; - currentMatrix[2] = c; - currentMatrix[3] = d; - currentMatrix[4] = tx; - currentMatrix[5] = ty; + this.currentBlendMode = blendModeId; + } return this; }, - translate: function (x, y) + addBlendMode: function (func, equation) { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var m4 = currentMatrix[4]; - var m5 = currentMatrix[5]; - - currentMatrix[4] = m0 * x + m2 * y + m4; - currentMatrix[5] = m1 * x + m3 * y + m5; + var index = this.blendModes.push({ func: func, equation: equation }); - return this; + return index - 1; }, - scale: function (x, y) + updateBlendMode: function (index, func, equation) { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; + if (this.blendModes[index]) + { + this.blendModes[index].func = func; - currentMatrix[0] = m0 * x; - currentMatrix[1] = m1 * x; - currentMatrix[2] = m2 * y; - currentMatrix[3] = m3 * y; + if (equation) + { + this.blendModes[index].equation = equation; + } + } return this; }, - rotate: function (t) + removeBlendMode: function (index) { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var st = Math.sin(t); - var ct = Math.cos(t); - - currentMatrix[0] = m0 * ct + m2 * st; - currentMatrix[1] = m1 * ct + m3 * st; - currentMatrix[2] = m2 * -st + m2 * ct; - currentMatrix[3] = m3 * -st + m3 * ct; + if (index > 16 && this.blendModes[index]) + { + this.blendModes.splice(index, 1); + } return this; - } - -}; - -module.exports = MatrixStack; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D + * @since 3.0.0 + * + * @param {WebGLTexture} texture - [description] + * @param {integer} textureUnit - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setTexture2D: function (texture, textureUnit) + { + var gl = this.gl; -/***/ }), -/* 388 */ -/***/ (function(module, exports) { + if (texture !== this.currentTextures[textureUnit]) + { + this.flush(); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this.currentActiveTextureUnit !== textureUnit) + { + gl.activeTexture(gl.TEXTURE0 + textureUnit); + this.currentActiveTextureUnit = textureUnit; + } + gl.bindTexture(gl.TEXTURE_2D, texture); -/** - * Provides methods used for getting and setting the origin of a Game Object. - * Values are normalized, given in the range 0 to 1. - * Display values contain the calculated pixel values. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Origin - * @since 3.0.0 - */ + this.currentTextures[textureUnit] = texture; + } -var Origin = { + return this; + }, /** - * The horizontal origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the left of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originX - * @type {float} - * @default 0.5 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer * @since 3.0.0 + * + * @param {WebGLFramebuffer} framebuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - originX: 0.5, + setFramebuffer: function (framebuffer) + { + var gl = this.gl; - /** - * The vertical origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the top of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originY - * @type {float} - * @default 0.5 - * @since 3.0.0 - */ - originY: 0.5, + if (framebuffer !== this.currentFramebuffer) + { + this.flush(); - // private + read only - _displayOriginX: 0, - _displayOriginY: 0, + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + this.currentFramebuffer = framebuffer; + } + + return this; + }, /** - * The horizontal display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. - * - * @name Phaser.GameObjects.Components.Origin#displayOriginX - * @type {float} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - displayOriginX: { + setProgram: function (program) + { + var gl = this.gl; - get: function () + if (program !== this.currentProgram) { - return this._displayOriginX; - }, + this.flush(); - set: function (value) - { - this._displayOriginX = value; - this.originX = value / this.width; + gl.useProgram(program); + this.currentProgram = program; } + return this; }, /** - * The vertical display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. - * - * @name Phaser.GameObjects.Components.Origin#displayOriginY - * @type {float} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - displayOriginY: { + setVertexBuffer: function (vertexBuffer) + { + var gl = this.gl; - get: function () + if (vertexBuffer !== this.currentVertexBuffer) { - return this._displayOriginY; - }, + this.flush(); - set: function (value) - { - this._displayOriginY = value; - this.originY = value / this.height; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + this.currentVertexBuffer = vertexBuffer; } + return this; }, /** - * Sets the origin of this Game Object. + * [description] * - * The values are given in the range 0 to 1. - * - * @method Phaser.GameObjects.Components.Origin#setOrigin + * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer * @since 3.0.0 * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=0.5] - The vertical origin value. If not defined it will be set to the value of `x`. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLBuffer} indexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setOrigin: function (x, y) + setIndexBuffer: function (indexBuffer) { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } + var gl = this.gl; - this.originX = x; - this.originY = y; + if (indexBuffer !== this.currentIndexBuffer) + { + this.flush(); + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + this.currentIndexBuffer = indexBuffer; + } - return this.updateDisplayOrigin(); + return this; }, + /* Renderer Resource Creation Functions */ /** - * Sets the origin of this Game Object based on the Pivot values in its Frame. - * - * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {object} source - [description] + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {integer} scaleMode - [description] + * + * @return {WebGLTexture} [description] */ - setOriginFromFrame: function () + createTextureFromSource: function (source, width, height, scaleMode) { - if (!this.frame || !this.frame.customPivot) + var gl = this.gl; + var filter = gl.NEAREST; + var wrap = gl.CLAMP_TO_EDGE; + var texture = null; + + width = source ? source.width : width; + height = source ? source.height : height; + + if (IsSizePowerOfTwo(width, height)) { - return this.setOrigin(); + wrap = gl.REPEAT; + } + + if (scaleMode === CONST.ScaleModes.LINEAR) + { + filter = gl.LINEAR; + } + else if (scaleMode === CONST.ScaleModes.NEAREST || this.config.pixelArt) + { + filter = gl.NEAREST; + } + + if (!source && typeof width === 'number' && typeof height === 'number') + { + texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); } else { - this.originX = this.frame.pivotX; - this.originY = this.frame.pivotY; + texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, source); } - return this.updateDisplayOrigin(); + return texture; }, /** - * Sets the display origin of this Game Object. - * The difference between this and setting the origin is that you can use pixel values for setting the display origin. - * - * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D * @since 3.0.0 * - * @param {number} [x=0] - The horizontal display origin value. - * @param {number} [y=0] - The vertical display origin value. If not defined it will be set to the value of `x`. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {integer} mipLevel - [description] + * @param {integer} minFilter - [description] + * @param {integer} magFilter - [description] + * @param {integer} wrapT - [description] + * @param {integer} wrapS - [description] + * @param {integer} format - [description] + * @param {object} pixels - [description] + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {boolean} pma - [description] + * + * @return {WebGLTexture} [description] */ - setDisplayOrigin: function (x, y) + createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } + var gl = this.gl; + var texture = gl.createTexture(); - this.displayOriginX = x; - this.displayOriginY = y; + pma = (pma === undefined || pma === null) ? true : pma; - return this; + this.setTexture2D(texture, 0); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); + + if (pixels === null || pixels === undefined) + { + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); + } + else + { + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); + width = pixels.width; + height = pixels.height; + } + + this.setTexture2D(null, 0); + + texture.isAlphaPremultiplied = pma; + texture.isRenderTexture = false; + texture.width = width; + texture.height = height; + + this.nativeTextures.push(texture); + + return texture; }, /** - * Updates the Display Origin cached values internally stored on this Game Object. - * You don't usually call this directly, but it is exposed for edge-cases where you may. - * - * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {WebGLFramebuffer} renderTexture - [description] + * @param {boolean} addDepthStencilBuffer - [description] + * + * @return {WebGLFramebuffer} [description] */ - updateDisplayOrigin: function () + createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) { - this._displayOriginX = Math.round(this.originX * this.width); - this._displayOriginY = Math.round(this.originY * this.height); - - return this; - } + var gl = this.gl; + var framebuffer = gl.createFramebuffer(); + var complete = 0; -}; + this.setFramebuffer(framebuffer); -module.exports = Origin; + if (addDepthStencilBuffer) + { + var depthStencilBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); + } + renderTexture.isRenderTexture = true; + renderTexture.isAlphaPremultiplied = false; -/***/ }), -/* 389 */ -/***/ (function(module, exports, __webpack_require__) { + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); -var ScaleModes = __webpack_require__(62); + if (complete !== gl.FRAMEBUFFER_COMPLETE) + { + var errors = { + 36054: 'Incomplete Attachment', + 36055: 'Missing Attachment', + 36057: 'Incomplete Dimensions', + 36061: 'Framebuffer Unsupported' + }; + throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); + } -/** - * Provides methods used for getting and setting the scale of a Game Object. - * - * @name Phaser.GameObjects.Components.ScaleMode - * @since 3.0.0 - */ + framebuffer.renderTexture = renderTexture; -var ScaleMode = { + this.setFramebuffer(null); - _scaleMode: ScaleModes.DEFAULT, + return framebuffer; + }, /** - * The Scale Mode being used by this Game Object. - * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. - * - * @name Phaser.GameObjects.Components.ScaleMode#scaleMode - * @type {integer} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram * @since 3.0.0 + * + * @param {string} vertexShader - [description] + * @param {string} fragmentShader - [description] + * + * @return {WebGLProgram} [description] */ - scaleMode: { + createProgram: function (vertexShader, fragmentShader) + { + var gl = this.gl; + var program = gl.createProgram(); + var vs = gl.createShader(gl.VERTEX_SHADER); + var fs = gl.createShader(gl.FRAGMENT_SHADER); - get: function () + gl.shaderSource(vs, vertexShader); + gl.shaderSource(fs, fragmentShader); + gl.compileShader(vs); + gl.compileShader(fs); + + if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) { - return this._scaleMode; - }, + throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); + } + if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) + { + throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); + } - set: function (value) + gl.attachShader(program, vs); + gl.attachShader(program, fs); + gl.linkProgram(program); + + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - if (value === ScaleModes.LINEAR || value === ScaleModes.NEAREST) - { - this._scaleMode = value; - } + throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); } + return program; }, /** - * Sets the Scale Mode being used by this Game Object. - * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. - * - * @method Phaser.GameObjects.Components.ScaleMode#setScaleMode + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer * @since 3.0.0 * - * @param {integer} value - The Scale Mode to be used by this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {ArrayBuffer} initialDataOrSize - [description] + * @param {integer} bufferUsage - [description] + * + * @return {WebGLBuffer} [description] */ - setScaleMode: function (value) + createVertexBuffer: function (initialDataOrSize, bufferUsage) { - this.scaleMode = value; + var gl = this.gl; + var vertexBuffer = gl.createBuffer(); + + this.setVertexBuffer(vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); + this.setVertexBuffer(null); + + return vertexBuffer; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer + * @since 3.0.0 + * + * @param {ArrayBuffer} initialDataOrSize - [description] + * @param {integer} bufferUsage - [description] + * + * @return {WebGLBuffer} [description] + */ + createIndexBuffer: function (initialDataOrSize, bufferUsage) + { + var gl = this.gl; + var indexBuffer = gl.createBuffer(); + this.setIndexBuffer(indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); + this.setIndexBuffer(null); + + return indexBuffer; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture + * @since 3.0.0 + * + * @param {WebGLTexture} texture - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + deleteTexture: function (texture) + { + this.gl.deleteTexture(texture); return this; - } + }, -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer + * @since 3.0.0 + * + * @param {WebGLFramebuffer} framebuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + deleteFramebuffer: function (framebuffer) + { + this.gl.deleteFramebuffer(framebuffer); + return this; + }, -module.exports = ScaleMode; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + deleteProgram: function (program) + { + this.gl.deleteProgram(program); + return this; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer + * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + deleteBuffer: function (buffer) + { + this.gl.deleteBuffer(buffer); + return this; + }, -/***/ }), -/* 390 */ -/***/ (function(module, exports) { + /* Rendering Functions */ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + preRenderCamera: function (camera) + { + var resolution = this.config.resolution; -/** - * Provides methods used for getting and setting the Scroll Factor of a Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor - * @since 3.0.0 - */ + this.pushScissor(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); + + if (camera.backgroundColor.alphaGL > 0) + { + var color = camera.backgroundColor; + var FlatTintPipeline = this.pipelines.FlatTintPipeline; -var ScrollFactor = { + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1.0), + color.alphaGL, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + FlatTintPipeline.flush(); + } + }, /** - * The horizontal scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX - * @type {number} - * @default 1 + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - scrollFactorX: 1, + postRenderCamera: function (camera) + { + if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) + { + var FlatTintPipeline = this.pipelines.FlatTintPipeline; + + // Fade + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0), + camera._fadeAlpha, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + // Flash + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0), + camera._flashAlpha, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + FlatTintPipeline.flush(); + } + + this.popScissor(); + }, /** - * The vertical scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY - * @type {number} - * @default 1 + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender * @since 3.0.0 */ - scrollFactorY: 1, + preRender: function () + { + if (this.contextLost) { return; } + + var gl = this.gl; + var color = this.config.backgroundColor; + var pipelines = this.pipelines; + + // Bind custom framebuffer here + gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); + + if (this.config.clearBeforeRender) + { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } + + for (var key in pipelines) + { + pipelines[key].onPreRender(); + } + }, /** - * Sets the scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor + * @method Phaser.Renderer.WebGL.WebGLRenderer#render * @since 3.0.0 * - * @param {number} x - The horizontal scroll factor of this Game Object. - * @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.GameObject} children - [description] + * @param {number} interpolationPercentage - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setScrollFactor: function (x, y) + render: function (scene, children, interpolationPercentage, camera) { - if (y === undefined) { y = x; } + if (this.contextLost) { return; } - this.scrollFactorX = x; - this.scrollFactorY = y; + var list = children.list; + var childCount = list.length; + var pipelines = this.pipelines; - return this; - } + for (var key in pipelines) + { + pipelines[key].onRender(scene, camera); + } -}; + this.preRenderCamera(camera); -module.exports = ScrollFactor; + for (var index = 0; index < childCount; ++index) + { + var child = list[index]; + if (!child.willRender()) + { + continue; + } -/***/ }), -/* 391 */ -/***/ (function(module, exports) { + if (child.blendMode !== this.currentBlendMode) + { + this.setBlendMode(child.blendMode); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (child.mask) + { + child.mask.preRenderWebGL(this, child, camera); + } -/** - * Provides methods used for getting and setting the size of a Game Object. - * - * @name Phaser.GameObjects.Components.Size - * @since 3.0.0 - */ + child.renderWebGL(this, child, interpolationPercentage, camera); -var Size = { + if (child.mask) + { + child.mask.postRenderWebGL(this, child); + } + } - /** - * The native (un-scaled) width of this Game Object. - * - * @name Phaser.GameObjects.Components.Size#width - * @type {number} - * @since 3.0.0 - */ - width: 0, + this.flush(); + this.setBlendMode(CONST.BlendModes.NORMAL); + this.postRenderCamera(camera); + }, /** - * The native (un-scaled) height of this Game Object. - * - * @name Phaser.GameObjects.Components.Size#height - * @type {number} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender * @since 3.0.0 */ - height: 0, + postRender: function () + { + if (this.contextLost) { return; } - /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.Size#displayWidth - * @type {number} - * @since 3.0.0 - */ - displayWidth: { + // Unbind custom framebuffer here - get: function () + if (this.snapshotState.callback) { - return this.scaleX * this.frame.realWidth; - }, + this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); + this.snapshotState.callback = null; + } - set: function (value) + var pipelines = this.pipelines; + + for (var key in pipelines) { - this.scaleX = value / this.frame.realWidth; + pipelines[key].onPostRender(); } + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot + * @since 3.0.0 + * + * @param {function} callback - [description] + * @param {string} type - [description] + * @param {float} encoderOptions - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + snapshot: function (callback, type, encoderOptions) + { + this.snapshotState.callback = callback; + this.snapshotState.type = type; + this.snapshotState.encoder = encoderOptions; + return this; }, /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.Size#displayHeight - * @type {number} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture * @since 3.0.0 + * + * @param {HTMLCanvasElement} srcCanvas - [description] + * @param {WebGLTexture} dstTexture - [description] + * @param {boolean} shouldReallocate - [description] + * @param {integer} scaleMode - [description] + * + * @return {WebGLTexture} [description] */ - displayHeight: { + canvasToTexture: function (srcCanvas, dstTexture) + { + var gl = this.gl; - get: function () + if (!dstTexture) { - return this.scaleY * this.frame.realHeight; - }, + var wrapping = gl.CLAMP_TO_EDGE; - set: function (value) + if (IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height)) + { + wrapping = gl.REPEAT; + } + + dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + } + else { - this.scaleY = value / this.frame.realHeight; + this.setTexture2D(dstTexture, 0); + + // if (!shouldReallocate && dstTexture.width >= srcCanvas.width || dstTexture.height >= srcCanvas.height) + // { + // gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, srcCanvas.width, srcCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); + // } + // else + { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); + dstTexture.width = srcCanvas.width; + dstTexture.height = srcCanvas.height; + } + + this.setTexture2D(null, 0); } + return dstTexture; }, /** - * Sets the size of this Game Object to be that of the given Frame. - * - * @method Phaser.GameObjects.Components.Size#setSizeToFrame + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter * @since 3.0.0 * - * @param {Phaser.Textures.Frame} frame - The frame to base the size of this Game Object on. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {integer} texture - [description] + * @param {integer} filter - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setSizeToFrame: function (frame) + setTextureFilter: function (texture, filter) { - if (frame === undefined) { frame = this.frame; } + var gl = this.gl; + var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; - this.width = frame.realWidth; - this.height = frame.realHeight; + this.setTexture2D(texture, 0); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); + + this.setTexture2D(null, 0); return this; }, /** - * Sets the size of this Game Object. - * - * @method Phaser.GameObjects.Components.Size#setSize + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setSize: function (width, height) + setFloat1: function (program, name, x) { - this.width = width; - this.height = height; - + this.setProgram(program); + this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); return this; }, /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Components.Size#setDisplaySize + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setDisplaySize: function (width, height) + setFloat2: function (program, name, x, y) { - this.displayWidth = width; - this.displayHeight = height; - + this.setProgram(program); + this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); return this; - } - -}; - -module.exports = Size; - - -/***/ }), -/* 392 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// bitmask flag for GameObject.renderMask -var _FLAG = 8; // 1000 - -/** - * Provides methods used for getting and setting the texture of a Game Object. - * - * @name Phaser.GameObjects.Components.Texture - * @since 3.0.0 - */ - -var Texture = { + }, /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#texture - * @type {Phaser.Textures.Texture} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - texture: null, + setFloat3: function (program, name, x, y, z) + { + this.setProgram(program); + this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); + return this; + }, /** - * The Texture Frame this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#frame - * @type {Phaser.Textures.Frame} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * @param {float} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - frame: null, + setFloat4: function (program, name, x, y, z, w) + { + this.setProgram(program); + this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); + return this; + }, /** - * Sets the texture and frame this Game Object will use to render with. + * [description] * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * @method Phaser.GameObjects.Components.Texture#setTexture + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 * @since 3.0.0 * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {string|integer} [frame] - The name or index of the frame within the Texture. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setTexture: function (key, frame) + setInt1: function (program, name, x) { - this.texture = this.scene.sys.textures.get(key); - - return this.setFrame(frame); + this.setProgram(program); + this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); + return this; }, /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. + * [description] * - * It can be either a string or an index. - * - * @method Phaser.GameObjects.Components.Texture#setFrame + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 * @since 3.0.0 * - * @param {string|integer} frame - The name or index of the frame within the Texture. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setFrame: function (frame) + setInt2: function (program, name, x, y) { - this.frame = this.texture.get(frame); - - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - - if (this.frame.customPivot) - { - this.setOrigin(this.frame.pivotX, this.frame.pivotY); - } - + this.setProgram(program); + this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); return this; - } - -}; - -module.exports = Texture; - - -/***/ }), -/* 393 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetColor = function (value) -{ - return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); -}; - -/** - * Provides methods used for setting the tint of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Tint - * @webglOnly - * @since 3.0.0 - */ - -var Tint = { + }, - // 0: topLeft, 1: topRight, 2: bottomLeft, 3: bottomRight - _tintTL: 16777215, - _tintTR: 16777215, - _tintBL: 16777215, - _tintBR: 16777215, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setInt3: function (program, name, x, y, z) + { + this.setProgram(program); + this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); + return this; + }, /** - * Clears all tint values associated with this Game Object. - * Immediately sets the alpha levels back to 0xffffff (no tint) + * [description] * - * @method Phaser.GameObjects.Components.Tint#clearTint - * @webglOnly + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} z - [description] + * @param {integer} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - clearTint: function () + setInt4: function (program, name, x, y, z, w) { - this.setTint(0xffffff); - + this.setProgram(program); + this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); return this; }, /** - * Sets the tint values for this Game Object. + * [description] * - * @method Phaser.GameObjects.Components.Tint#setTint - * @webglOnly + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 * @since 3.0.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setTint: function (topLeft, topRight, bottomLeft, bottomRight) + setMatrix2: function (program, name, transpose, matrix) { - if (topLeft === undefined) { topLeft = 0xffffff; } - - if (topRight === undefined) - { - topRight = topLeft; - bottomLeft = topLeft; - bottomRight = topLeft; - } - - this._tintTL = GetColor(topLeft); - this._tintTR = GetColor(topRight); - this._tintBL = GetColor(bottomLeft); - this._tintBR = GetColor(bottomRight); - + this.setProgram(program); + this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); return this; }, /** - * The tint value being applied to the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopLeft - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - tintTopLeft: { - - get: function () - { - return this._tintTL; - }, - - set: function (value) - { - this._tintTL = GetColor(value); - } - + setMatrix3: function (program, name, transpose, matrix) + { + this.setProgram(program); + this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); + return this; }, /** - * The tint value being applied to the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopRight - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - tintTopRight: { - - get: function () - { - return this._tintTR; - }, - - set: function (value) - { - this._tintTR = GetColor(value); - } - + setMatrix4: function (program, name, transpose, matrix) + { + this.setProgram(program); + this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); + return this; }, /** - * The tint value being applied to the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomLeft - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy * @since 3.0.0 */ - tintBottomLeft: { - - get: function () - { - return this._tintBL; - }, - - set: function (value) + destroy: function () + { + // Clear-up anything that should be cleared :) + for (var key in this.pipelines) { - this._tintBL = GetColor(value); + this.pipelines[key].destroy(); + delete this.pipelines[key]; } - }, - - /** - * The tint value being applied to the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomRight - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintBottomRight: { - - get: function () - { - return this._tintBR; - }, - - set: function (value) + for (var index = 0; index < this.nativeTextures.length; ++index) { - this._tintBR = GetColor(value); + this.deleteTexture(this.nativeTextures[index]); + delete this.nativeTextures[index]; } - }, - - /** - * The tint value being applied to the whole of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tint - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tint: { - - set: function (value) + if (this.hasExtension('WEBGL_lose_context')) { - this.setTint(value, value, value, value); + this.getExtension('WEBGL_lose_context').loseContext(); } + + delete this.gl; + delete this.game; + + this.contextLost = true; + this.extensions = {}; + this.nativeTextures.length = 0; } -}; +}); -module.exports = Tint; +module.exports = WebGLRenderer; /***/ }), -/* 394 */ +/* 373 */ /***/ (function(module, exports) { /** @@ -73776,51 +74555,67 @@ module.exports = Tint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Default Game Object JSON export -// Is extended further by Game Object specific implementations - -var ToJSON = function (gameObject) +/** + * [description] + * + * @function Phaser.Renderer.Snapshot.WebGL + * @since 3.0.0 + * + * @param {HTMLCanvasElement} sourceCanvas - [description] + * @param {string} [type='image/png'] - [description] + * @param {float} [encoderOptions=0.92] - [description] + * + * @return {Image} [description] + */ +var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) { - var out = { - name: gameObject.name, - type: gameObject.type, - x: gameObject.x, - y: gameObject.y, - depth: gameObject.depth, - scale: { - x: gameObject.scaleX, - y: gameObject.scaleY - }, - origin: { - x: gameObject.originX, - y: gameObject.originY - }, - flipX: gameObject.flipX, - flipY: gameObject.flipY, - rotation: gameObject.rotation, - alpha: gameObject.alpha, - visible: gameObject.visible, - scaleMode: gameObject.scaleMode, - blendMode: gameObject.blendMode, - textureKey: '', - frameKey: '', - data: {} - }; + if (!type) { type = 'image/png'; } + if (!encoderOptions) { encoderOptions = 0.92; } - if (gameObject.texture) + var gl = sourceCanvas.getContext('experimental-webgl'); + var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); + gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + + // CanvasPool? + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var imageData; + + canvas.width = gl.drawingBufferWidth; + canvas.height = gl.drawingBufferHeight; + + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + + var data = imageData.data; + + for (var y = 0; y < canvas.height; y += 1) { - out.textureKey = gameObject.texture.key; - out.frameKey = gameObject.frame.name; + for (var x = 0; x < canvas.width; x += 1) + { + var si = ((canvas.height - y) * canvas.width + x) * 4; + var di = (y * canvas.width + x) * 4; + data[di + 0] = pixels[si + 0]; + data[di + 1] = pixels[si + 1]; + data[di + 2] = pixels[si + 2]; + data[di + 3] = pixels[si + 3]; + } } - return out; + ctx.putImageData(imageData, 0, 0); + + var src = canvas.toDataURL(type, encoderOptions); + var image = new Image(); + + image.src = src; + + return image; }; -module.exports = ToJSON; +module.exports = WebGLSnapshot; /***/ }), -/* 395 */ +/* 374 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73829,1375 +74624,1932 @@ module.exports = ToJSON; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MATH_CONST = __webpack_require__(16); -var WrapAngle = __webpack_require__(162); -var WrapAngleDegrees = __webpack_require__(163); - -// global bitmask flag for GameObject.renderMask (used by Scale) -var _FLAG = 4; // 0100 +var Class = __webpack_require__(0); +var ShaderSourceFS = __webpack_require__(512); +var ShaderSourceVS = __webpack_require__(513); +var WebGLPipeline = __webpack_require__(103); /** - * Provides methods used for getting and setting the position, scale and rotation of a Game Object. - * - * @name Phaser.GameObjects.Components.Transform + * @classdesc + * [description] + * + * @class BitmapMaskPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 + * + * @param {object} config - [description] */ +var BitmapMaskPipeline = new Class({ -var Transform = { - - // "private" properties - _scaleX: 1, - _scaleY: 1, - _rotation: 0, - - /** - * The x position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - x: 0, - - /** - * The y position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - y: 0, - - /** - * The z position of this Game Object. - * Note: Do not use this value to set the z-index, instead see the `depth` property. - * - * @name Phaser.GameObjects.Components.Transform#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - z: 0, - - /** - * The w position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - w: 0, - - /** - * The horizontal scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleX - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scaleX: { - - get: function () - { - return this._scaleX; - }, - - set: function (value) - { - this._scaleX = value; - - if (this._scaleX === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } - - }, - - /** - * The vertical scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleY - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scaleY: { - - get: function () - { - return this._scaleY; - }, - - set: function (value) - { - this._scaleY = value; - - if (this._scaleY === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + Extends: WebGLPipeline, + + initialize: - }, + function BitmapMaskPipeline (config) + { + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapacity ? config.vertexCapacity : 3), - /** - * The angle of this Game Object as expressed in degrees. - * - * Where 0 is to the right, 90 is down, 180 is left. - * - * If you prefer to work in radians, see the `rotation` property instead. - * - * @name Phaser.GameObjects.Components.Transform#angle - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - angle: { + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2), - get: function () - { - return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); - }, + vertices: new Float32Array([ + -1, +1, -1, -7, +7, +1 + ]).buffer, - set: function (value) - { - // value is in degrees - this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; - } - }, + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + } + ] + }); - /** - * The angle of this Game Object in radians. - * - * If you prefer to work in degrees, see the `angle` property instead. - * - * @name Phaser.GameObjects.Components.Transform#rotation - * @type {number} - * @default 1 - * @since 3.0.0 - */ - rotation: { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); - get: function () - { - return this._rotation; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#maxQuads + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.maxQuads = 1; - set: function (value) - { - // value is in radians - this._rotation = WrapAngle(value); - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#resolutionDirty + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.resolutionDirty = true; }, /** - * Sets the position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setPosition - * @since 3.0.0 + * [description] * - * @param {number} [x=0] - The x position of this Game Object. - * @param {number} [y] - The y position of this Game Object. If not set it will use the `x` value. - * @param {number} [z=0] - The z position of this Game Object. - * @param {number} [w=0] - The w position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setPosition: function (x, y, z, w) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - if (z === undefined) { z = 0; } - if (w === undefined) { w = 0; } - - this.x = x; - this.y = y; - this.z = z; - this.w = w; - - return this; - }, - - /** - * Sets the rotation of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setRotation + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#onBind * @since 3.0.0 * - * @param {number} [radians=0] - The rotation of this Game Object, in radians. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] */ - setRotation: function (radians) + onBind: function () { - if (radians === undefined) { radians = 0; } + WebGLPipeline.prototype.onBind.call(this); - this.rotation = radians; + var renderer = this.renderer; + var program = this.program; + + if (this.resolutionDirty) + { + renderer.setFloat2(program, 'uResolution', this.width, this.height); + renderer.setInt1(program, 'uMainSampler', 0); + renderer.setInt1(program, 'uMaskSampler', 1); + this.resolutionDirty = false; + } return this; }, /** - * Sets the angle of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setAngle + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#resize * @since 3.0.0 * - * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] */ - setAngle: function (degrees) + resize: function (width, height, resolution) { - if (degrees === undefined) { degrees = 0; } - - this.angle = degrees; - + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.resolutionDirty = true; return this; }, /** - * Sets the scale of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setScale + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#beginMask * @since 3.0.0 * - * @param {number} x - The horizontal scale of this Game Object. - * @param {number} [y] - The vertical scale of this Game Object. If not set it will use the `x` value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {Phaser.GameObjects.GameObject} mask - [description] + * @param {Phaser.GameObjects.GameObject} maskedObject - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setScale: function (x, y) + beginMask: function (mask, maskedObject, camera) { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } + var bitmapMask = mask.bitmapMask; + var renderer = this.renderer; + var gl = this.gl; + var visible = bitmapMask.visible; - this.scaleX = x; - this.scaleY = y; + if (bitmapMask && gl) + { + // First we clear the mask framebuffer + renderer.setFramebuffer(mask.maskFramebuffer); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); - return this; + // We render out mask source + bitmapMask.visible = true; + bitmapMask.renderWebGL(renderer, bitmapMask, 0.0, camera); + bitmapMask.visible = visible; + renderer.flush(); + + // Bind and clear our main source (masked object) + renderer.setFramebuffer(mask.mainFramebuffer); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } }, /** - * Sets the x position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setX + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#endMask * @since 3.0.0 * - * @param {number} [value=0] - The x position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {Phaser.GameObjects.GameObject} mask - [description] */ - setX: function (value) + endMask: function (mask) { - if (value === undefined) { value = 0; } + var bitmapMask = mask.bitmapMask; + var renderer = this.renderer; + var gl = this.gl; - this.x = value; + if (bitmapMask) + { + // Return to default framebuffer + renderer.setFramebuffer(null); + + // Bind bitmap mask pipeline and draw + renderer.setPipeline(this); + + renderer.setTexture2D(mask.maskTexture, 1); + renderer.setTexture2D(mask.mainTexture, 0); + renderer.setInt1(this.program, 'uInvertMaskAlpha', mask.invertAlpha); - return this; + // Finally draw a triangle filling the whole screen + gl.drawArrays(this.topology, 0, 3); + } + } + +}); + +module.exports = BitmapMaskPipeline; + + +/***/ }), +/* 375 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var Commands = __webpack_require__(127); +var Earcut = __webpack_require__(238); +var ModelViewProjection = __webpack_require__(239); +var ShaderSourceFS = __webpack_require__(514); +var ShaderSourceVS = __webpack_require__(515); +var Utils = __webpack_require__(41); +var WebGLPipeline = __webpack_require__(103); + +var Point = function (x, y, width, rgb, alpha) +{ + this.x = x; + this.y = y; + this.width = width; + this.rgb = rgb; + this.alpha = alpha; +}; + +var Path = function (x, y, width, rgb, alpha) +{ + this.points = []; + this.pointsLength = 1; + this.points[0] = new Point(x, y, width, rgb, alpha); +}; + +var currentMatrix = new Float32Array([ 1, 0, 0, 1, 0, 0 ]); +var matrixStack = new Float32Array(6 * 1000); +var matrixStackLength = 0; +var pathArray = []; + +/** + * @classdesc + * [description] + * + * @class FlatTintPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {object} config - [description] + */ +var FlatTintPipeline = new Class({ + + Extends: WebGLPipeline, + + Mixins: [ + ModelViewProjection + ], + + initialize: + + function FlatTintPipeline (config) + { + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapcity ? config.vertexCapacity : 12000), + + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2 + + Uint8Array.BYTES_PER_ELEMENT * 4), + + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + }, + { + name: 'inTint', + size: 4, + type: config.renderer.gl.UNSIGNED_BYTE, + normalized: true, + offset: Float32Array.BYTES_PER_ELEMENT * 2 + } + ] + }); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32 = new Uint32Array(this.vertexData); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#tempTriangle + * @type {array} + * @since 3.0.0 + */ + this.tempTriangle = [ + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0} + ]; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#polygonCache + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.polygonCache = []; + + this.mvpInit(); }, /** - * Sets the y position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setY + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#onBind * @since 3.0.0 * - * @param {number} [value=0] - The y position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] */ - setY: function (value) + onBind: function () { - if (value === undefined) { value = 0; } - - this.y = value; + WebGLPipeline.prototype.onBind.call(this); + this.mvpUpdate(); return this; }, /** - * Sets the z position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setZ + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#resize * @since 3.0.0 * - * @param {number} [value=0] - The z position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] */ - setZ: function (value) + resize: function (width, height, resolution) { - if (value === undefined) { value = 0; } - - this.z = value; - + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); + return this; }, /** - * Sets the w position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setW + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillRect * @since 3.0.0 * - * @param {number} [value=0] - The w position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} width - [description] + * @param {float} height - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] */ - setW: function (value) + batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) { - if (value === undefined) { value = 0; } - - this.w = value; - - return this; - } - -}; + this.renderer.setPipeline(this); -module.exports = Transform; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = this.vertexCount * this.vertexComponentCount; + var xw = x + width; + var yh = y + height; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tx0 = x * a + y * c + e; + var ty0 = x * b + y * d + f; + var tx1 = x * a + yh * c + e; + var ty1 = x * b + yh * d + f; + var tx2 = xw * a + yh * c + e; + var ty2 = xw * b + yh * d + f; + var tx3 = xw * a + y * c + e; + var ty3 = xw * b + y * d + f; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; + vertexViewF32[vertexOffset + 9] = tx0; + vertexViewF32[vertexOffset + 10] = ty0; + vertexViewU32[vertexOffset + 11] = tint; + vertexViewF32[vertexOffset + 12] = tx2; + vertexViewF32[vertexOffset + 13] = ty2; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx3; + vertexViewF32[vertexOffset + 16] = ty3; + vertexViewU32[vertexOffset + 17] = tint; -/***/ }), -/* 396 */ -/***/ (function(module, exports) { + this.vertexCount += 6; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillTriangle + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x0 - [description] + * @param {float} y0 - [description] + * @param {float} x1 - [description] + * @param {float} y1 - [description] + * @param {float} x2 - [description] + * @param {float} y2 - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + { + this.renderer.setPipeline(this); -// bitmask flag for GameObject.renderMask -var _FLAG = 1; // 0001 + if (this.vertexCount + 3 > this.vertexCapacity) + { + this.flush(); + } -/** - * Provides methods used for setting the visibility of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Visible - * @since 3.0.0 - */ + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = this.vertexCount * this.vertexComponentCount; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tx0 = x0 * a + y0 * c + e; + var ty0 = x0 * b + y0 * d + f; + var tx1 = x1 * a + y1 * c + e; + var ty1 = x1 * b + y1 * d + f; + var tx2 = x2 * a + y2 * c + e; + var ty2 = x2 * b + y2 * d + f; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); -var Visible = { + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; - _visible: true, + this.vertexCount += 3; + }, /** - * The visible state of the Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. - * - * @name Phaser.GameObjects.Components.Visible#visible - * @type {boolean} + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokeTriangle * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x0 - [description] + * @param {float} y0 - [description] + * @param {float} x1 - [description] + * @param {float} y1 - [description] + * @param {float} x2 - [description] + * @param {float} y2 - [description] + * @param {float} lineWidth - [description] + * @param {integer} lineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a - [description] + * @param {float} b - [description] + * @param {float} c - [description] + * @param {float} d - [description] + * @param {float} e - [description] + * @param {float} f - [description] + * @param {Float32Array} currentMatrix - [description] */ - visible: { - - get: function () - { - return this._visible; - }, + batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix) + { + var tempTriangle = this.tempTriangle; - set: function (value) - { - if (value) - { - this._visible = true; - this.renderFlags |= _FLAG; - } - else - { - this._visible = false; - this.renderFlags &= ~_FLAG; - } - } + tempTriangle[0].x = x0; + tempTriangle[0].y = y0; + tempTriangle[0].width = lineWidth; + tempTriangle[0].rgb = lineColor; + tempTriangle[0].alpha = lineAlpha; + tempTriangle[1].x = x1; + tempTriangle[1].y = y1; + tempTriangle[1].width = lineWidth; + tempTriangle[1].rgb = lineColor; + tempTriangle[1].alpha = lineAlpha; + tempTriangle[2].x = x2; + tempTriangle[2].y = y2; + tempTriangle[2].width = lineWidth; + tempTriangle[2].rgb = lineColor; + tempTriangle[2].alpha = lineAlpha; + tempTriangle[3].x = x0; + tempTriangle[3].y = y0; + tempTriangle[3].width = lineWidth; + tempTriangle[3].rgb = lineColor; + tempTriangle[3].alpha = lineAlpha; + this.batchStrokePath( + srcX, srcY, srcScaleX, srcScaleY, srcRotation, + tempTriangle, lineWidth, lineColor, lineAlpha, + a, b, c, d, e, f, + false, + currentMatrix + ); }, /** - * Sets the visibility of this Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. + * [description] * - * @method Phaser.GameObjects.Components.Visible#setVisible + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillPath * @since 3.0.0 * - * @param {boolean} value - The visible state of the Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} path - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] */ - setVisible: function (value) + batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) { - this.visible = value; + this.renderer.setPipeline(this); - return this; - } -}; + var length = path.length; + var polygonCache = this.polygonCache; + var polygonIndexArray; + var point; + var v0, v1, v2; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = 0; + var x0, y0, x1, y1, x2, y2; + var tx0, ty0, tx1, ty1, tx2, ty2; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); -module.exports = Visible; + for (var pathIndex = 0; pathIndex < length; ++pathIndex) + { + point = path[pathIndex]; + polygonCache.push(point.x, point.y); + } + polygonIndexArray = Earcut(polygonCache); + length = polygonIndexArray.length; -/***/ }), -/* 397 */ -/***/ (function(module, exports) { + for (var index = 0; index < length; index += 3) + { + v0 = polygonIndexArray[index + 0] * 2; + v1 = polygonIndexArray[index + 1] * 2; + v2 = polygonIndexArray[index + 2] * 2; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this.vertexCount + 3 > this.vertexCapacity) + { + this.flush(); + } -/** - * [description] - * - * @function Phaser.Actions.IncAlpha - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncAlpha = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].alpha += value; - } + vertexOffset = this.vertexCount * this.vertexComponentCount; - return items; -}; + x0 = polygonCache[v0 + 0]; + y0 = polygonCache[v0 + 1]; + x1 = polygonCache[v1 + 0]; + y1 = polygonCache[v1 + 1]; + x2 = polygonCache[v2 + 0]; + y2 = polygonCache[v2 + 1]; -module.exports = IncAlpha; + tx0 = x0 * a + y0 * c + e; + ty0 = x0 * b + y0 * d + f; + tx1 = x1 * a + y1 * c + e; + ty1 = x1 * b + y1 * d + f; + tx2 = x2 * a + y2 * c + e; + ty2 = x2 * b + y2 * d + f; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; -/***/ }), -/* 398 */ -/***/ (function(module, exports) { + this.vertexCount += 3; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + polygonCache.length = 0; + }, -/** - * [description] - * - * @function Phaser.Actions.IncX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncX = function (items, value) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokePath + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {array} path - [description] + * @param {float} lineWidth - [description] + * @param {integer} lineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a - [description] + * @param {float} b - [description] + * @param {float} c - [description] + * @param {float} d - [description] + * @param {float} e - [description] + * @param {float} f - [description] + * @param {boolean} isLastPath - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix) { - items[i].x += value; - } - - return items; -}; - -module.exports = IncX; + this.renderer.setPipeline(this); + var point0, point1; + var pathLength = path.length; + var polylines = this.polygonCache; + var last, curr; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset; + var line; + var getTint = Utils.getTintAppendFloatAlphaAndSwap; -/***/ }), -/* 399 */ -/***/ (function(module, exports) { + for (var pathIndex = 0; pathIndex + 1 < pathLength; pathIndex += 1) + { + point0 = path[pathIndex]; + point1 = path[pathIndex + 1]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + line = this.batchLine( + srcX, srcY, srcScaleX, srcScaleY, srcRotation, + point0.x, point0.y, + point1.x, point1.y, + point0.width / 2, point1.width / 2, + point0.rgb, point1.rgb, lineAlpha, + a, b, c, d, e, f, + currentMatrix + ); -/** - * [description] - * - * @function Phaser.Actions.IncXY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncXY = function (items, x, y) -{ - for (var i = 0; i < items.length; i++) - { - items[i].x += x; - items[i].y += y; - } + polylines.push(line); + } - return items; -}; + /* Render joints */ + for (var index = 1, polylinesLength = polylines.length; index < polylinesLength; ++index) + { + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } -module.exports = IncXY; + last = polylines[index - 1] || polylines[polylinesLength - 1]; + curr = polylines[index]; + vertexOffset = this.vertexCount * this.vertexComponentCount; + vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0]; + vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1]; + vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha); + vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0]; + vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1]; + vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha); + vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0]; + vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1]; + vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha); + vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0]; + vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1]; + vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha); + vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0]; + vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1]; + vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha); + vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0]; + vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1]; + vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha); -/***/ }), -/* 400 */ -/***/ (function(module, exports) { + this.vertexCount += 6; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + polylines.length = 0; + }, -/** - * [description] - * - * @function Phaser.Actions.IncY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncY = function (items, value) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchLine + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} ax - [description] + * @param {float} ay - [description] + * @param {float} bx - [description] + * @param {float} by - [description] + * @param {float} aLineWidth - [description] + * @param {float} bLineWidth - [description] + * @param {integer} aLineColor - [description] + * @param {integer} bLineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) { - items[i].y += value; - } - - return items; -}; - -module.exports = IncY; - + this.renderer.setPipeline(this); -/***/ }), -/* 401 */ -/***/ (function(module, exports) { + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var dx = bx - ax; + var dy = by - ay; + var len = Math.sqrt(dx * dx + dy * dy); + var al0 = aLineWidth * (by - ay) / len; + var al1 = aLineWidth * (ax - bx) / len; + var bl0 = bLineWidth * (by - ay) / len; + var bl1 = bLineWidth * (ax - bx) / len; + var lx0 = bx - bl0; + var ly0 = by - bl1; + var lx1 = ax - al0; + var ly1 = ay - al1; + var lx2 = bx + bl0; + var ly2 = by + bl1; + var lx3 = ax + al0; + var ly3 = ay + al1; + var x0 = lx0 * a + ly0 * c + e; + var y0 = lx0 * b + ly0 * d + f; + var x1 = lx1 * a + ly1 * c + e; + var y1 = lx1 * b + ly1 * d + f; + var x2 = lx2 * a + ly2 * c + e; + var y2 = lx2 * b + ly2 * d + f; + var x3 = lx3 * a + ly3 * c + e; + var y3 = lx3 * b + ly3 * d + f; + var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var aTint = getTint(aLineColor, lineAlpha); + var bTint = getTint(bLineColor, lineAlpha); + var vertexOffset = this.vertexCount * this.vertexComponentCount; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + vertexViewF32[vertexOffset + 0] = x0; + vertexViewF32[vertexOffset + 1] = y0; + vertexViewU32[vertexOffset + 2] = bTint; + vertexViewF32[vertexOffset + 3] = x1; + vertexViewF32[vertexOffset + 4] = y1; + vertexViewU32[vertexOffset + 5] = aTint; + vertexViewF32[vertexOffset + 6] = x2; + vertexViewF32[vertexOffset + 7] = y2; + vertexViewU32[vertexOffset + 8] = bTint; + vertexViewF32[vertexOffset + 9] = x1; + vertexViewF32[vertexOffset + 10] = y1; + vertexViewU32[vertexOffset + 11] = aTint; + vertexViewF32[vertexOffset + 12] = x3; + vertexViewF32[vertexOffset + 13] = y3; + vertexViewU32[vertexOffset + 14] = aTint; + vertexViewF32[vertexOffset + 15] = x2; + vertexViewF32[vertexOffset + 16] = y2; + vertexViewU32[vertexOffset + 17] = bTint; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnCircle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=6.28] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnCircle = function (items, circle, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + this.vertexCount += 6; - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + return [ + x0, y0, bLineColor, + x1, y1, aLineColor, + x2, y2, bLineColor, + x3, y3, aLineColor + ]; + }, - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchGraphics + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchGraphics: function (graphics, camera) { - items[i].x = circle.x + (circle.radius * Math.cos(angle)); - items[i].y = circle.y + (circle.radius * Math.sin(angle)); - - angle += angleStep; - } - - return items; -}; - -module.exports = PlaceOnCircle; + if (graphics.commandBuffer.length <= 0) { return; } + + this.renderer.setPipeline(this); + var cameraScrollX = camera.scrollX * graphics.scrollFactorX; + var cameraScrollY = camera.scrollY * graphics.scrollFactorY; + var srcX = graphics.x - cameraScrollX; + var srcY = graphics.y - cameraScrollY; + var srcScaleX = graphics.scaleX; + var srcScaleY = graphics.scaleY; + var srcRotation = -graphics.rotation; + var commands = graphics.commandBuffer; + var lineAlpha = 1.0; + var fillAlpha = 1.0; + var lineColor = 0; + var fillColor = 0; + var lineWidth = 1.0; + var cameraMatrix = camera.matrix.matrix; + var lastPath = null; + var iteration = 0; + var iterStep = 0.01; + var tx = 0; + var ty = 0; + var ta = 0; + var x = 0; + var y = 0; + var radius = 0; + var startAngle = 0; + var endAngle = 0; + var anticlockwise = 0; + var path = null; + var sin = Math.sin; + var cos = Math.cos; + var PI2 = Math.PI * 2; + var sr = sin(srcRotation); + var cr = cos(srcRotation); + var sra = cr * srcScaleX; + var srb = -sr * srcScaleX; + var src = sr * srcScaleY; + var srd = cr * srcScaleY; + var sre = srcX; + var srf = srcY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; -/***/ }), -/* 402 */ -/***/ (function(module, exports) { + var pathArrayIndex; + var pathArrayLength; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + pathArray.length = 0; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnEllipse - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=6.28] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + for (var cmdIndex = 0, cmdLength = commands.length; cmdIndex < cmdLength; ++cmdIndex) + { + cmd = commands[cmdIndex]; - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + switch (cmd) + { + case Commands.ARC: + iteration = 0; + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + radius = commands[cmdIndex + 3]; + startAngle = commands[cmdIndex + 4]; + endAngle = commands[cmdIndex + 5]; + anticlockwise = commands[cmdIndex + 6]; - var a = ellipse.width / 2; - var b = ellipse.height / 2; + if (lastPath === null) + { + lastPath = new Path(x + cos(startAngle) * radius, y + sin(startAngle) * radius, lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + iteration += iterStep; + } - for (var i = 0; i < items.length; i++) - { - items[i].x = ellipse.x + a * Math.cos(angle); - items[i].y = ellipse.y + b * Math.sin(angle); + endAngle -= startAngle; + if (anticlockwise) + { + if (endAngle < -PI2) + { + endAngle = -PI2; + } + else if (endAngle > 0) + { + endAngle = -PI2 + endAngle % PI2; + } + } + else if (endAngle > PI2) + { + endAngle = PI2; + } + else if (endAngle < 0) + { + endAngle = PI2 + endAngle % PI2; + } - angle += angleStep; - } + while (iteration < 1) + { + ta = endAngle * iteration + startAngle; + tx = x + cos(ta) * radius; + ty = y + sin(ta) * radius; - return items; -}; + lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); -module.exports = PlaceOnEllipse; + iteration += iterStep; + } + ta = endAngle + startAngle; + tx = x + cos(ta) * radius; + ty = y + sin(ta) * radius; -/***/ }), -/* 403 */ -/***/ (function(module, exports, __webpack_require__) { + lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + cmdIndex += 6; + break; -var GetPoints = __webpack_require__(108); + case Commands.LINE_STYLE: + lineWidth = commands[cmdIndex + 1]; + lineColor = commands[cmdIndex + 2]; + lineAlpha = commands[cmdIndex + 3]; + cmdIndex += 3; + break; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnLine - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnLine = function (items, line) -{ - var points = GetPoints(line, items.length); + case Commands.FILL_STYLE: + fillColor = commands[cmdIndex + 1]; + fillAlpha = commands[cmdIndex + 2]; + cmdIndex += 2; + break; - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - var point = points[i]; + case Commands.BEGIN_PATH: + pathArray.length = 0; + lastPath = null; + break; - item.x = point.x; - item.y = point.y; - } + case Commands.CLOSE_PATH: + if (lastPath && lastPath.points.length) + { + lastPath.points.push(lastPath.points[0]); + } + break; - return items; -}; + case Commands.FILL_PATH: + for (pathArrayIndex = 0, pathArrayLength = pathArray.length; + pathArrayIndex < pathArrayLength; + ++pathArrayIndex) + { + this.batchFillPath( -module.exports = PlaceOnLine; + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, + /* Rectangle properties */ + pathArray[pathArrayIndex].points, + fillColor, + fillAlpha, -/***/ }), -/* 404 */ -/***/ (function(module, exports, __webpack_require__) { + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + } + break; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + case Commands.STROKE_PATH: + for (pathArrayIndex = 0, pathArrayLength = pathArray.length; + pathArrayIndex < pathArrayLength; + ++pathArrayIndex) + { + path = pathArray[pathArrayIndex]; + this.batchStrokePath( -var MarchingAnts = __webpack_require__(188); -var RotateLeft = __webpack_require__(189); -var RotateRight = __webpack_require__(190); + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -// Place the items in the array around the perimeter of the given rectangle. + /* Rectangle properties */ + path.points, + lineWidth, + lineColor, + lineAlpha, -// Placement starts from the top-left of the rectangle, and proceeds in a -// clockwise direction. If the shift parameter is given you can offset where -// placement begins. + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + path === this._lastPath, + currentMatrix + ); + } + break; + + case Commands.FILL_RECT: + this.batchFillRect( -/** - * [description] - * - * @function Phaser.Actions.PlaceOnRectangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {integer} [shift=1] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnRectangle = function (items, rect, shift) -{ - if (shift === undefined) { shift = 0; } + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, - var points = MarchingAnts(rect, false, items.length); + /* Rectangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + fillColor, + fillAlpha, - if (shift > 0) - { - RotateLeft(points, shift); - } - else if (shift < 0) - { - RotateRight(points, Math.abs(shift)); - } + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 4; + break; - for (var i = 0; i < items.length; i++) - { - items[i].x = points[i].x; - items[i].y = points[i].y; - } + case Commands.FILL_TRIANGLE: + this.batchFillTriangle( - return items; -}; + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -module.exports = PlaceOnRectangle; + /* Triangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5], + commands[cmdIndex + 6], + fillColor, + fillAlpha, + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 6; + break; -/***/ }), -/* 405 */ -/***/ (function(module, exports, __webpack_require__) { + case Commands.STROKE_TRIANGLE: + this.batchStrokeTriangle( -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -// var GetPointsOnLine = require('../geom/line/GetPointsOnLine'); -var BresenhamPoints = __webpack_require__(191); + /* Triangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5], + commands[cmdIndex + 6], + lineWidth, + lineColor, + lineAlpha, -/** - * [description] - * - * @function Phaser.Actions.PlaceOnTriangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} [stepRate=1] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnTriangle = function (items, triangle, stepRate) -{ - var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); - var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); - var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 6; + break; - // Remove overlaps - p1.pop(); - p2.pop(); - p3.pop(); + case Commands.LINE_TO: + if (lastPath !== null) + { + lastPath.points.push(new Point(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha)); + } + else + { + lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + } + cmdIndex += 2; + break; - p1 = p1.concat(p2, p3); + case Commands.MOVE_TO: + lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + cmdIndex += 2; + break; - var step = p1.length / items.length; - var p = 0; + case Commands.LINE_FX_TO: + if (lastPath !== null) + { + lastPath.points.push(new Point( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + )); + } + else + { + lastPath = new Path( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + ); + pathArray.push(lastPath); + } + cmdIndex += 5; + break; - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - var point = p1[Math.floor(p)]; + case Commands.MOVE_FX_TO: + lastPath = new Path( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + ); + pathArray.push(lastPath); + cmdIndex += 5; + break; - item.x = point.x; - item.y = point.y; + case Commands.SAVE: + matrixStack[matrixStackLength + 0] = currentMatrix[0]; + matrixStack[matrixStackLength + 1] = currentMatrix[1]; + matrixStack[matrixStackLength + 2] = currentMatrix[2]; + matrixStack[matrixStackLength + 3] = currentMatrix[3]; + matrixStack[matrixStackLength + 4] = currentMatrix[4]; + matrixStack[matrixStackLength + 5] = currentMatrix[5]; + matrixStackLength += 6; + break; - p += step; - } + case Commands.RESTORE: + matrixStackLength -= 6; + currentMatrix[0] = matrixStack[matrixStackLength + 0]; + currentMatrix[1] = matrixStack[matrixStackLength + 1]; + currentMatrix[2] = matrixStack[matrixStackLength + 2]; + currentMatrix[3] = matrixStack[matrixStackLength + 3]; + currentMatrix[4] = matrixStack[matrixStackLength + 4]; + currentMatrix[5] = matrixStack[matrixStackLength + 5]; + break; - return items; -}; + case Commands.TRANSLATE: + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + currentMatrix[4] = currentMatrix[0] * x + currentMatrix[2] * y + currentMatrix[4]; + currentMatrix[5] = currentMatrix[1] * x + currentMatrix[3] * y + currentMatrix[5]; + cmdIndex += 2; + break; -module.exports = PlaceOnTriangle; + case Commands.SCALE: + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + currentMatrix[0] *= x; + currentMatrix[1] *= x; + currentMatrix[2] *= y; + currentMatrix[3] *= y; + cmdIndex += 2; + break; + case Commands.ROTATE: + y = commands[cmdIndex + 1]; + x = sin(y); + y = cos(y); + sra = currentMatrix[0]; + srb = currentMatrix[1]; + src = currentMatrix[2]; + srd = currentMatrix[3]; + currentMatrix[0] = y * sra + x * src; + currentMatrix[1] = y * srb + x * srd; + currentMatrix[2] = -x * sra + y * src; + currentMatrix[3] = -x * srb + y * srd; + cmdIndex += 1; + break; -/***/ }), -/* 406 */ -/***/ (function(module, exports) { + default: + // eslint-disable-next-line no-console + console.error('Phaser: Invalid Graphics Command ID ' + cmd); + break; + } + } + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Stubs -/** - * [description] - * - * @function Phaser.Actions.PlayAnimation - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} key - [description] - * @param {string|integer} [startFrame] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlayAnimation = function (items, key, startFrame) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawStaticTilemapLayer: function () { - items[i].anims.play(key, startFrame); - } - - return items; -}; - -module.exports = PlayAnimation; - - -/***/ }), -/* 407 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -var Random = __webpack_require__(105); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmittermanager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawEmitterManager: function () + { + }, -/** - * [description] - * - * @function Phaser.Actions.RandomCircle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomCircle = function (items, circle) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawBlitter: function () { - Random(circle, items[i]); - } + }, - return items; -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchSprite: function () + { + }, -module.exports = RandomCircle; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchMesh: function () + { + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchBitmapText: function () + { + }, -/***/ }), -/* 408 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchDynamicBitmapText: function () + { + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchText: function () + { + }, -var Random = __webpack_require__(109); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchDynamicTilemapLayer: function () + { + }, -/** - * [description] - * - * @function Phaser.Actions.RandomEllipse - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomEllipse = function (items, ellipse) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchTileSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchTileSprite: function () { - Random(ellipse, items[i]); } - return items; -}; +}); -module.exports = RandomEllipse; +module.exports = FlatTintPipeline; /***/ }), -/* 409 */ +/* 376 */, +/* 377 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +__webpack_require__(378); +__webpack_require__(379); +__webpack_require__(380); +__webpack_require__(381); +__webpack_require__(382); +__webpack_require__(383); +__webpack_require__(384); +__webpack_require__(385); +__webpack_require__(386); -var Random = __webpack_require__(110); + +/***/ }), +/* 378 */ +/***/ (function(module, exports) { /** - * [description] - * - * @function Phaser.Actions.RandomLine - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomLine = function (items, line) +* A polyfill for Array.forEach +* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach +*/ +if (!Array.prototype.forEach) { - for (var i = 0; i < items.length; i++) + Array.prototype.forEach = function (fun /*, thisArg */) { - Random(line, items[i]); - } + 'use strict'; - return items; -}; + if (this === void 0 || this === null) + { + throw new TypeError(); + } -module.exports = RandomLine; + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== 'function') + { + throw new TypeError(); + } -/***/ }), -/* 410 */ -/***/ (function(module, exports, __webpack_require__) { + var thisArg = arguments.length >= 2 ? arguments[1] : void 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var i = 0; i < len; i++) + { + if (i in t) + { + fun.call(thisArg, t[i], i, t); + } + } + }; +} -var Random = __webpack_require__(107); + +/***/ }), +/* 379 */ +/***/ (function(module, exports) { /** - * [description] - * - * @function Phaser.Actions.RandomRectangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomRectangle = function (items, rect) +* A polyfill for Array.isArray +*/ +if (!Array.isArray) { - for (var i = 0; i < items.length; i++) + Array.isArray = function (arg) { - Random(rect, items[i]); - } + return Object.prototype.toString.call(arg) === '[object Array]'; + }; +} - return items; -}; -module.exports = RandomRectangle; +/***/ }), +/* 380 */ +/***/ (function(module, exports) { +/* Copyright 2013 Chris Wilson -/***/ }), -/* 411 */ -/***/ (function(module, exports, __webpack_require__) { + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + http://www.apache.org/licenses/LICENSE-2.0 -var Random = __webpack_require__(111); + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ -/** - * [description] - * - * @function Phaser.Actions.RandomTriangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomTriangle = function (items, triangle) -{ - for (var i = 0; i < items.length; i++) - { - Random(triangle, items[i]); - } +/* - return items; -}; +This monkeypatch library is intended to be included in projects that are +written to the proper AudioContext spec (instead of webkitAudioContext), +and that use the new naming and proper bits of the Web Audio API (e.g. +using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may +have to run on systems that only support the deprecated bits. -module.exports = RandomTriangle; +This library should be harmless to include if the browser supports +unprefixed "AudioContext", and/or if it supports the new names. +The patches this library handles: +if window.AudioContext is unsupported, it will be aliased to webkitAudioContext(). +if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or +noteGrainOn(), depending on parameters. -/***/ }), -/* 412 */ -/***/ (function(module, exports) { +The following aliases only take effect if the new names are not already in place: -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +AudioBufferSourceNode.stop() is aliased to noteOff() +AudioContext.createGain() is aliased to createGainNode() +AudioContext.createDelay() is aliased to createDelayNode() +AudioContext.createScriptProcessor() is aliased to createJavaScriptNode() +AudioContext.createPeriodicWave() is aliased to createWaveTable() +OscillatorNode.start() is aliased to noteOn() +OscillatorNode.stop() is aliased to noteOff() +OscillatorNode.setPeriodicWave() is aliased to setWaveTable() +AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime() -/** - * [description] - * - * @function Phaser.Actions.Rotate - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Rotate = function (items, value, step) -{ - if (step === undefined) { step = 0; } +This library does NOT patch the enumerated type changes, as it is +recommended in the specification that implementations support both integer +and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel +BiquadFilterNode.type and OscillatorNode.type. - for (var i = 0; i < items.length; i++) - { - items[i].rotation += value + (i * step); - } +*/ +(function (global, exports, perf) { + 'use strict'; - return items; -}; + function fixSetTarget(param) { + if (!param) // if NYI, just return + return; + if (!param.setTargetAtTime) + param.setTargetAtTime = param.setTargetValueAtTime; + } -module.exports = Rotate; + if (window.hasOwnProperty('webkitAudioContext') && + !window.hasOwnProperty('AudioContext')) { + window.AudioContext = webkitAudioContext; + if (!AudioContext.prototype.hasOwnProperty('createGain')) + AudioContext.prototype.createGain = AudioContext.prototype.createGainNode; + if (!AudioContext.prototype.hasOwnProperty('createDelay')) + AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode; + if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor')) + AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode; + if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave')) + AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable; -/***/ }), -/* 413 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain; + AudioContext.prototype.createGain = function() { + var node = this.internal_createGain(); + fixSetTarget(node.gain); + return node; + }; -var RotateAroundDistance = __webpack_require__(112); -var DistanceBetween = __webpack_require__(41); + AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay; + AudioContext.prototype.createDelay = function(maxDelayTime) { + var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay(); + fixSetTarget(node.delayTime); + return node; + }; -/** - * [description] - * - * @function Phaser.Actions.RotateAround - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RotateAround = function (items, point, angle) -{ - var x = point.x; - var y = point.y; + AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource; + AudioContext.prototype.createBufferSource = function() { + var node = this.internal_createBufferSource(); + if (!node.start) { + node.start = function ( when, offset, duration ) { + if ( offset || duration ) + this.noteGrainOn( when || 0, offset, duration ); + else + this.noteOn( when || 0 ); + }; + } else { + node.internal_start = node.start; + node.start = function( when, offset, duration ) { + if( typeof duration !== 'undefined' ) + node.internal_start( when || 0, offset, duration ); + else + node.internal_start( when || 0, offset || 0 ); + }; + } + if (!node.stop) { + node.stop = function ( when ) { + this.noteOff( when || 0 ); + }; + } else { + node.internal_stop = node.stop; + node.stop = function( when ) { + node.internal_stop( when || 0 ); + }; + } + fixSetTarget(node.playbackRate); + return node; + }; - for (var i = 0; i < items.length; i++) - { - var item = items[i]; + AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor; + AudioContext.prototype.createDynamicsCompressor = function() { + var node = this.internal_createDynamicsCompressor(); + fixSetTarget(node.threshold); + fixSetTarget(node.knee); + fixSetTarget(node.ratio); + fixSetTarget(node.reduction); + fixSetTarget(node.attack); + fixSetTarget(node.release); + return node; + }; - RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); - } + AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter; + AudioContext.prototype.createBiquadFilter = function() { + var node = this.internal_createBiquadFilter(); + fixSetTarget(node.frequency); + fixSetTarget(node.detune); + fixSetTarget(node.Q); + fixSetTarget(node.gain); + return node; + }; - return items; -}; + if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) { + AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator; + AudioContext.prototype.createOscillator = function() { + var node = this.internal_createOscillator(); + if (!node.start) { + node.start = function ( when ) { + this.noteOn( when || 0 ); + }; + } else { + node.internal_start = node.start; + node.start = function ( when ) { + node.internal_start( when || 0); + }; + } + if (!node.stop) { + node.stop = function ( when ) { + this.noteOff( when || 0 ); + }; + } else { + node.internal_stop = node.stop; + node.stop = function( when ) { + node.internal_stop( when || 0 ); + }; + } + if (!node.setPeriodicWave) + node.setPeriodicWave = node.setWaveTable; + fixSetTarget(node.frequency); + fixSetTarget(node.detune); + return node; + }; + } + } -module.exports = RotateAround; + if (window.hasOwnProperty('webkitOfflineAudioContext') && + !window.hasOwnProperty('OfflineAudioContext')) { + window.OfflineAudioContext = webkitOfflineAudioContext; + } +}(window)); -/***/ }), -/* 414 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ -var MathRotateAroundDistance = __webpack_require__(112); +/***/ }), +/* 381 */ +/***/ (function(module, exports) { /** - * [description] - * - * @function Phaser.Actions.RotateAroundDistance - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * @param {number} distance - The distance from the point of rotation in pixels. - * - * @return {array} The array of Game Objects that was passed to this Action. + * Also fix for the absent console in IE9 */ -var RotateAroundDistance = function (items, point, angle, distance) -{ - var x = point.x; - var y = point.y; - - // There's nothing to do - if (distance === 0) - { - return items; - } - - for (var i = 0; i < items.length; i++) - { - MathRotateAroundDistance(items[i], x, y, angle, distance); - } - - return items; -}; - -module.exports = RotateAroundDistance; +if (!window.console) +{ + window.console = {}; + window.console.log = window.console.assert = function(){}; + window.console.warn = window.console.assert = function(){}; +} /***/ }), -/* 415 */ +/* 382 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +* A polyfill for Function.prototype.bind +*/ +if (!Function.prototype.bind) { -/** - * [description] - * - * @function Phaser.Actions.ScaleX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ScaleX = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].scaleX += value; - } + /* jshint freeze: false */ + Function.prototype.bind = (function () { - return items; -}; + var slice = Array.prototype.slice; -module.exports = ScaleX; + return function (thisArg) { + var target = this, boundArgs = slice.call(arguments, 1); -/***/ }), -/* 416 */ -/***/ (function(module, exports) { + if (typeof target !== 'function') + { + throw new TypeError(); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + function bound() { + var args = boundArgs.concat(slice.call(arguments)); + target.apply(this instanceof bound ? this : thisArg, args); + } -/** - * [description] - * - * @function Phaser.Actions.ScaleXY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ScaleXY = function (items, x, y) -{ - for (var i = 0; i < items.length; i++) - { - items[i].scaleX += x; - items[i].scaleY += y; - } + bound.prototype = (function F(proto) { + if (proto) + { + F.prototype = proto; + } - return items; -}; + if (!(this instanceof F)) + { + /* jshint supernew: true */ + return new F; + } + })(target.prototype); + + return bound; + }; + })(); +} -module.exports = ScaleXY; /***/ }), -/* 417 */ +/* 383 */ /***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc +if (!Math.trunc) { + Math.trunc = function trunc(x) { + return x < 0 ? Math.ceil(x) : Math.floor(x); + }; +} + + +/***/ }), +/* 384 */ +/***/ (function(module, exports) { /** - * [description] - * - * @function Phaser.Actions.ScaleY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * performance.now */ -var ScaleY = function (items, value) -{ - for (var i = 0; i < items.length; i++) +(function () { + + if ('performance' in window === false) { - items[i].scaleY += value; + window.performance = {}; } - return items; -}; + // Thanks IE8 + Date.now = (Date.now || function () { + return new Date().getTime(); + }); -module.exports = ScaleY; + if ('now' in window.performance === false) + { + var nowOffset = Date.now(); + + if (performance.timing && performance.timing.navigationStart) + { + nowOffset = performance.timing.navigationStart; + } + + window.performance.now = function now () + { + return Date.now() - nowOffset; + } + } + +})(); /***/ }), -/* 418 */ -/***/ (function(module, exports) { +/* 385 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +/* WEBPACK VAR INJECTION */(function(global) {// References: +// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// https://gist.github.com/1579671 +// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision +// https://gist.github.com/timhall/4078614 +// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame -/** - * [description] - * - * @function Phaser.Actions.SetAlpha - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetAlpha = function (items, value, step) -{ - if (step === undefined) { step = 0; } +// Expected to be used with Browserfiy +// Browserify automatically detects the use of `global` and passes the +// correct reference of `global`, `self`, and finally `window` - for (var i = 0; i < items.length; i++) - { - items[i].alpha = value + (i * step); +// Date.now +if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { + return new Date().getTime(); + }; +} + +// performance.now +if (!(global.performance && global.performance.now)) { + var startTime = Date.now(); + if (!global.performance) { + global.performance = {}; } + global.performance.now = function () { + return Date.now() - startTime; + }; +} - return items; -}; +// requestAnimationFrame +var lastTime = Date.now(); +var vendors = ['ms', 'moz', 'webkit', 'o']; -module.exports = SetAlpha; +for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { + global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; + global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || + global[vendors[x] + 'CancelRequestAnimationFrame']; +} +if (!global.requestAnimationFrame) { + global.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + 'is not a function'); + } -/***/ }), -/* 419 */ -/***/ (function(module, exports) { + var currentTime = Date.now(), + delay = 16 + lastTime - currentTime; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (delay < 0) { + delay = 0; + } -/** - * [description] - * - * @function Phaser.Actions.SetBlendMode - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetBlendMode = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setBlendMode(value); - } + lastTime = currentTime; - return items; -}; + return setTimeout(function () { + lastTime = Date.now(); + callback(performance.now()); + }, delay); + }; +} -module.exports = SetBlendMode; +if (!global.cancelAnimationFrame) { + global.cancelAnimationFrame = function(id) { + clearTimeout(id); + }; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(167))) /***/ }), -/* 420 */ +/* 386 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetDepth - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetDepth = function (items, value, step) +* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9 +* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/ +* Cameron Foale (http://www.kibibu.com) +*/ +if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object") { - if (step === undefined) { step = 0; } - - for (var i = 0; i < items.length; i++) + var CheapArray = function(type) { - items[i].depth = value + (i * step); - } + var proto = new Array(); // jshint ignore:line - return items; -}; + window[type] = function(arg) { -module.exports = SetDepth; + if (typeof(arg) === "number") + { + Array.call(this, arg); + this.length = arg; + + for (var i = 0; i < this.length; i++) + { + this[i] = 0; + } + } + else + { + Array.call(this, arg.length); + + this.length = arg.length; + + for (var i = 0; i < this.length; i++) + { + this[i] = arg[i]; + } + } + }; + + window[type].prototype = proto; + window[type].constructor = window[type]; + }; + + CheapArray('Float32Array'); // jshint ignore:line + CheapArray('Uint32Array'); // jshint ignore:line + CheapArray('Uint16Array'); // jshint ignore:line + CheapArray('Int16Array'); // jshint ignore:line + CheapArray('ArrayBuffer'); // jshint ignore:line +} /***/ }), -/* 421 */ +/* 387 */ /***/ (function(module, exports) { /** @@ -75209,30 +76561,29 @@ module.exports = SetDepth; /** * [description] * - * @function Phaser.Actions.SetHitArea + * @function Phaser.Actions.Angle * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {any} hitArea - [description] - * @param {function} hitAreaCallback - [description] + * @param {number} value - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var SetHitArea = function (items, hitArea, hitAreaCallback) +var Angle = function (items, value) { for (var i = 0; i < items.length; i++) { - items[i].setInteractive(hitArea, hitAreaCallback); + items[i].angle += value; } return items; }; -module.exports = SetHitArea; +module.exports = Angle; /***/ }), -/* 422 */ +/* 388 */ /***/ (function(module, exports) { /** @@ -75244,30 +76595,32 @@ module.exports = SetHitArea; /** * [description] * - * @function Phaser.Actions.SetOrigin + * @function Phaser.Actions.Call * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] + * @param {function} callback - [description] + * @param {object} thisArg - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var SetOrigin = function (items, x, y) +var Call = function (items, callback, thisArg) { for (var i = 0; i < items.length; i++) { - items[i].setOrigin(x, y); + var item = items[i]; + + callback.call(thisArg, item); } return items; }; -module.exports = SetOrigin; +module.exports = Call; /***/ }), -/* 423 */ +/* 389 */ /***/ (function(module, exports) { /** @@ -75276,36 +76629,55 @@ module.exports = SetOrigin; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// compare = Object: +// { +// scaleX: 0.5, +// scaleY: 1 +// } + /** * [description] * - * @function Phaser.Actions.SetRotation + * @function Phaser.Actions.GetFirst * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * + * @param {object} compare - [description] + * @param {integer} index - [description] + * * @return {array} The array of Game Objects that was passed to this Action. */ -var SetRotation = function (items, value, step) +var GetFirst = function (items, compare, index) { - if (step === undefined) { step = 0; } - - for (var i = 0; i < items.length; i++) + for (var i = index; i < items.length; i++) { - items[i].rotation = value + (i * step); + var item = items[i]; + + var match = true; + + for (var property in compare) + { + if (item[property] !== compare[property]) + { + match = false; + } + } + + if (match) + { + return item; + } } - return items; + return null; }; -module.exports = SetRotation; +module.exports = GetFirst; /***/ }), -/* 424 */ -/***/ (function(module, exports) { +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -75313,79 +76685,113 @@ module.exports = SetRotation; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var AlignIn = __webpack_require__(170); +var CONST = __webpack_require__(171); +var GetValue = __webpack_require__(4); +var NOOP = __webpack_require__(3); +var Zone = __webpack_require__(77); + +var tempZone = new Zone({ sys: { queueDepthSort: NOOP }}, 0, 0, 1, 1); + /** * [description] * - * @function Phaser.Actions.SetScale + * @function Phaser.Actions.GridAlign * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} [stepX=0] - [description] - * @param {number} [stepY=0] - [description] + * @param {object} options - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var SetScale = function (items, x, y, stepX, stepY) +var GridAlign = function (items, options) { - if (stepX === undefined) { stepX = 0; } - if (stepY === undefined) { stepY = 0; } + var width = GetValue(options, 'width', -1); + var height = GetValue(options, 'height', -1); + var cellWidth = GetValue(options, 'cellWidth', 1); + var cellHeight = GetValue(options, 'cellHeight', cellWidth); + var position = GetValue(options, 'position', CONST.TOP_LEFT); + var x = GetValue(options, 'x', 0); + var y = GetValue(options, 'y', 0); - for (var i = 0; i < items.length; i++) - { - items[i].setScale( - x + (i * stepX), - y + (i * stepY) - ); - } + // var centerX = GetValue(options, 'centerX', null); + // var centerY = GetValue(options, 'centerY', null); - return items; -}; + var cx = 0; + var cy = 0; + var w = (width * cellWidth); + var h = (height * cellHeight); -module.exports = SetScale; + // If the Grid is centered on a position then we need to calculate it now + // if (centerX !== null && centerY !== null) + // { + // + // } + tempZone.setPosition(x, y); + tempZone.setSize(cellWidth, cellHeight); -/***/ }), -/* 425 */ -/***/ (function(module, exports) { + for (var i = 0; i < items.length; i++) + { + AlignIn(items[i], tempZone, position); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (width === -1) + { + // We keep laying them out horizontally until we've done them all + cy += cellHeight; + tempZone.y += cellHeight; -/** - * [description] - * - * @function Phaser.Actions.SetScaleX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetScaleX = function (items, value, step) -{ - if (step === undefined) { step = 0; } + if (cy === h) + { + cy = 0; + tempZone.x += cellWidth; + tempZone.y = y; + } + } + else if (height === -1) + { + // We keep laying them out vertically until we've done them all + cx += cellWidth; + tempZone.x += cellWidth; + + if (cx === w) + { + cx = 0; + tempZone.x = x; + tempZone.y += cellHeight; + } + } + else + { + // We keep laying them out until we hit the column limit + cx += cellWidth; + tempZone.x += cellWidth; - for (var i = 0; i < items.length; i++) - { - items[i].scaleX = value + (i * step); + if (cx === w) + { + cx = 0; + cy += cellHeight; + tempZone.x = x; + tempZone.y += cellHeight; + + if (cy === h) + { + // We've hit the column limit, so return, even if there are items left + break; + } + } + } } return items; }; -module.exports = SetScaleX; +module.exports = GridAlign; /***/ }), -/* 426 */ -/***/ (function(module, exports) { +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -75393,144 +76799,461 @@ module.exports = SetScaleX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); + /** + * @classdesc * [description] * - * @function Phaser.Actions.SetScaleY + * @class RandomDataGenerator + * @memberOf Phaser.Math + * @constructor * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] * - * @return {array} The array of Game Objects that was passed to this Action. + * @param {array} [seeds] - [description] */ -var SetScaleY = function (items, value, step) -{ - if (step === undefined) { step = 0; } +var RandomDataGenerator = new Class({ - for (var i = 0; i < items.length; i++) + initialize: + + function RandomDataGenerator (seeds) { - items[i].scaleY = value + (i * step); - } + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#c + * @type {number} + * @default 1 + * @private + * @since 3.0.0 + */ + this.c = 1; - return items; -}; + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s0 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s0 = 0; -module.exports = SetScaleY; + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s1 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s1 = 0; + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s2 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s2 = 0; -/***/ }), -/* 427 */ -/***/ (function(module, exports) { + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#n + * @type {number} + * @default 0 + * @private + * @since 3.2.0 + */ + this.n = 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Math.RandomDataGenerator#sign + * @type {array} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; -/** - * [description] - * - * @function Phaser.Actions.SetTint - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} topLeft - [description] - * @param {number} [topRight] - [description] - * @param {number} [bottomLeft] - [description] - * @param {number} [bottomRight] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) -{ - for (var i = 0; i < items.length; i++) + if (seeds) + { + this.init(seeds); + } + }, + + /** + * Private random helper. + * + * @method Phaser.Math.RandomDataGenerator#rnd + * @since 3.0.0 + * @private + * + * @return {number} [description] + */ + rnd: function () { - items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); - } + var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 - return items; -}; + this.c = t | 0; + this.s0 = this.s1; + this.s1 = this.s2; + this.s2 = t - this.c; -module.exports = SetTint; + return this.s2; + }, + /** + * Internal method that creates a seed hash. + * + * @method Phaser.Math.RandomDataGenerator#hash + * @since 3.0.0 + * @private + * + * @param {[type]} data - [description] + * + * @return {number} The hashed value. + */ + hash: function (data) + { + var h; + var n = this.n; -/***/ }), -/* 428 */ -/***/ (function(module, exports) { + data = data.toString(); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var i = 0; i < data.length; i++) + { + n += data.charCodeAt(i); + h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000;// 2^32 + } -/** - * [description] - * - * @function Phaser.Actions.SetVisible - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {boolean} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetVisible = function (items, value) -{ - for (var i = 0; i < items.length; i++) + this.n = n; + + return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 + }, + + /** + * [description] + * + * @method Phaser.Math.RandomDataGenerator#init + * @since 3.0.0 + * + * @param {string|array} seeds - [description] + */ + init: function (seeds) { - items[i].visible = value; - } + if (typeof seeds === 'string') + { + this.state(seeds); + } + else + { + this.sow(seeds); + } + }, - return items; -}; + /** + * Reset the seed of the random data generator. + * + * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. + * + * @method Phaser.Math.RandomDataGenerator#sow + * @since 3.0.0 + * + * @param {any[]} seeds - The array of seeds: the `toString()` of each value is used. + */ + sow: function (seeds) + { + // Always reset to default seed + this.n = 0xefc8249d; + this.s0 = this.hash(' '); + this.s1 = this.hash(' '); + this.s2 = this.hash(' '); + this.c = 1; -module.exports = SetVisible; + if (!seeds) + { + return; + } + // Apply any seeds + for (var i = 0; i < seeds.length && (seeds[i] != null); i++) + { + var seed = seeds[i]; -/***/ }), -/* 429 */ -/***/ (function(module, exports) { + this.s0 -= this.hash(seed); + this.s0 += ~~(this.s0 < 0); + this.s1 -= this.hash(seed); + this.s1 += ~~(this.s1 < 0); + this.s2 -= this.hash(seed); + this.s2 += ~~(this.s2 < 0); + } + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * Returns a random integer between 0 and 2^32. + * + * @method Phaser.Math.RandomDataGenerator#integer + * @since 3.0.0 + * + * @return {number} A random integer between 0 and 2^32. + */ + integer: function () + { + // 2^32 + return this.rnd() * 0x100000000; + }, -/** - * [description] - * - * @function Phaser.Actions.SetX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetX = function (items, value, step) -{ - if (step === undefined) { step = 0; } + /** + * Returns a random real number between 0 and 1. + * + * @method Phaser.Math.RandomDataGenerator#frac + * @since 3.0.0 + * + * @return {number} A random real number between 0 and 1. + */ + frac: function () + { + // 2^-53 + return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; + }, - for (var i = 0; i < items.length; i++) + /** + * Returns a random real number between 0 and 2^32. + * + * @method Phaser.Math.RandomDataGenerator#real + * @since 3.0.0 + * + * @return {number} A random real number between 0 and 2^32. + */ + real: function () + { + return this.integer() + this.frac(); + }, + + /** + * Returns a random integer between and including min and max. + * + * @method Phaser.Math.RandomDataGenerator#integerInRange + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + integerInRange: function (min, max) + { + return Math.floor(this.realInRange(0, max - min + 1) + min); + }, + + /** + * Returns a random integer between and including min and max. + * This method is an alias for RandomDataGenerator.integerInRange. + * + * @method Phaser.Math.RandomDataGenerator#between + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + between: function (min, max) + { + return Math.floor(this.realInRange(0, max - min + 1) + min); + }, + + /** + * Returns a random real number between min and max. + * + * @method Phaser.Math.RandomDataGenerator#realInRange + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + realInRange: function (min, max) + { + return this.frac() * (max - min) + min; + }, + + /** + * Returns a random real number between -1 and 1. + * + * @method Phaser.Math.RandomDataGenerator#normal + * @since 3.0.0 + * + * @return {number} A random real number between -1 and 1. + */ + normal: function () + { + return 1 - (2 * this.frac()); + }, + + /** + * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * + * @method Phaser.Math.RandomDataGenerator#uuid + * @since 3.0.0 + * + * @return {string} A valid RFC4122 version4 ID hex string + */ + uuid: function () + { + var a = ''; + var b = ''; + + for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') + { + // eslint-disable-next-line no-empty + } + + return b; + }, + + /** + * Returns a random element from within the given array. + * + * @method Phaser.Math.RandomDataGenerator#pick + * @since 3.0.0 + * + * @param {array} array - The array to pick a random element from. + * + * @return {any} A random member of the array. + */ + pick: function (array) + { + return array[this.integerInRange(0, array.length - 1)]; + }, + + /** + * Returns a sign to be used with multiplication operator. + * + * @method Phaser.Math.RandomDataGenerator#sign + * @since 3.0.0 + * + * @return {number} -1 or +1. + */ + sign: function () + { + return this.pick(this.signs); + }, + + /** + * Returns a random element from within the given array, favoring the earlier entries. + * + * @method Phaser.Math.RandomDataGenerator#weightedPick + * @since 3.0.0 + * + * @param {array} array - The array to pick a random element from. + * + * @return {any} A random member of the array. + */ + weightedPick: function (array) + { + return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; + }, + + /** + * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. + * + * @method Phaser.Math.RandomDataGenerator#timestamp + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random timestamp between min and max. + */ + timestamp: function (min, max) + { + return this.realInRange(min || 946684800000, max || 1577862000000); + }, + + /** + * Returns a random angle between -180 and 180. + * + * @method Phaser.Math.RandomDataGenerator#angle + * @since 3.0.0 + * + * @return {number} A random number between -180 and 180. + */ + angle: function () + { + return this.integerInRange(-180, 180); + }, + + /** + * Returns a random rotation in radians, between -3.141 and 3.141 + * + * @method Phaser.Math.RandomDataGenerator#rotation + * @since 3.0.0 + * + * @return {number} A random number between -3.141 and 3.141 + */ + rotation: function () + { + return this.realInRange(-3.1415926, 3.1415926); + }, + + /** + * Gets or Sets the state of the generator. This allows you to retain the values + * that the generator is using between games, i.e. in a game save file. + * + * To seed this generator with a previously saved state you can pass it as the + * `seed` value in your game config, or call this method directly after Phaser has booted. + * + * Call this method with no parameters to return the current state. + * + * If providing a state it should match the same format that this method + * returns, which is a string with a header `!rnd` followed by the `c`, + * `s0`, `s1` and `s2` values respectively, each comma-delimited. + * + * @method Phaser.Math.RandomDataGenerator#state + * @since 3.0.0 + * + * @param {string} [state] - Generator state to be set. + * + * @return {string} The current state of the generator. + */ + state: function (state) { - items[i].x = value + (i * step); + if (typeof state === 'string' && state.match(/^!rnd/)) + { + state = state.split(','); + + this.c = parseFloat(state[1]); + this.s0 = parseFloat(state[2]); + this.s1 = parseFloat(state[3]); + this.s2 = parseFloat(state[4]); + } + + return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); } - return items; -}; +}); -module.exports = SetX; +module.exports = RandomDataGenerator; /***/ }), -/* 430 */ -/***/ (function(module, exports) { +/* 392 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -75538,203 +77261,244 @@ module.exports = SetX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Clamp = __webpack_require__(61); + +// bitmask flag for GameObject.renderMask +var _FLAG = 2; // 0010 + /** - * [description] - * - * @function Phaser.Actions.SetXY - * @since 3.0.0 + * Provides methods used for setting the alpha properties of a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} [stepX=0] - [description] - * @param {number} [stepY=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.Alpha + * @since 3.0.0 */ -var SetXY = function (items, x, y, stepX, stepY) -{ - if (stepX === undefined) { stepX = 0; } - if (stepY === undefined) { stepY = 0; } - for (var i = 0; i < items.length; i++) - { - items[i].x = x + (i * stepX); - items[i].y = y + (i * stepY); - } +var Alpha = { - return items; -}; + _alpha: 1, -module.exports = SetXY; + _alphaTL: 1, + _alphaTR: 1, + _alphaBL: 1, + _alphaBR: 1, + /** + * Clears all alpha values associated with this Game Object. + * Immediately sets the alpha levels back to 1 (fully opaque) + * + * @method Phaser.GameObjects.Components.Alpha#clearAlpha + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + clearAlpha: function () + { + return this.setAlpha(1); + }, -/***/ }), -/* 431 */ -/***/ (function(module, exports) { + /** + * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * If your game is running under WebGL you can optionally specify four different alpha values, each of which + * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. + * + * @method Phaser.GameObjects.Components.Alpha#setAlpha + * @since 3.0.0 + * + * @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. + * @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. + * @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. + * @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) + { + if (topLeft === undefined) { topLeft = 1; } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Treat as if there is only one alpha value for the whole Game Object + if (topRight === undefined) + { + this.alpha = topLeft; + } + else + { + this._alphaTL = Clamp(topLeft, 0, 1); + this._alphaTR = Clamp(topRight, 0, 1); + this._alphaBL = Clamp(bottomLeft, 0, 1); + this._alphaBR = Clamp(bottomRight, 0, 1); + } -/** - * [description] - * - * @function Phaser.Actions.SetY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetY = function (items, value, step) -{ - if (step === undefined) { step = 0; } + return this; + }, - for (var i = 0; i < items.length; i++) - { - items[i].y = value + (i * step); - } + /** + * The alpha value of the Game Object. + * + * This is a global value, impacting the entire Game Object, not just a region of it. + * + * @name Phaser.GameObjects.Components.Alpha#alpha + * @type {float} + * @since 3.0.0 + */ + alpha: { - return items; -}; + get: function () + { + return this._alpha; + }, -module.exports = SetY; + set: function (value) + { + var v = Clamp(value, 0, 1); + this._alpha = v; + this._alphaTL = v; + this._alphaTR = v; + this._alphaBL = v; + this._alphaBR = v; -/***/ }), -/* 432 */ -/***/ (function(module, exports, __webpack_require__) { + if (v === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -var Vector2 = __webpack_require__(6); + /** + * The alpha value starting from the top-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaTopLeft: { -// Iterate through items changing the position of each element to -// be that of the element that came before it in the array (or after it if direction = 1) -// The first items position is set to x/y. -// The final x/y coords are returned + get: function () + { + return this._alphaTL; + }, -/** - * [description] - * - * @function Phaser.Actions.ShiftPosition - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {integer} [direction=0] - [description] - * @param {Phaser.Math.Vector2|object} [output] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ShiftPosition = function (items, x, y, direction, output) -{ - if (direction === undefined) { direction = 0; } - if (output === undefined) { output = new Vector2(); } + set: function (value) + { + var v = Clamp(value, 0, 1); - var px; - var py; + this._alphaTL = v; - if (items.length > 1) - { - var i; - var cx; - var cy; - var cur; + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } - if (direction === 0) + }, + + /** + * The alpha value starting from the top-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopRight + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaTopRight: { + + get: function () { - // Bottom to Top + return this._alphaTR; + }, - var len = items.length - 1; + set: function (value) + { + var v = Clamp(value, 0, 1); - px = items[len].x; - py = items[len].y; + this._alphaTR = v; - for (i = len - 1; i >= 0; i--) + if (v !== 0) { - // Current item - cur = items[i]; + this.renderFlags |= _FLAG; + } + } - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; + }, - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; + /** + * The alpha value starting from the bottom-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomLeft: { - // Set current as previous - px = cx; - py = cy; - } + get: function () + { + return this._alphaBL; + }, - // Update the head item to the new x/y coordinates - items[len].x = x; - items[len].y = y; - } - else + set: function (value) { - // Top to Bottom + var v = Clamp(value, 0, 1); - px = items[0].x; - py = items[0].y; + this._alphaBL = v; - for (i = 1; i < items.length; i++) + if (v !== 0) { - // Current item - cur = items[i]; + this.renderFlags |= _FLAG; + } + } - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; + }, - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; + /** + * The alpha value starting from the bottom-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomRight: { - // Set current as previous - px = cx; - py = cy; - } + get: function () + { + return this._alphaBR; + }, - // Update the head item to the new x/y coordinates - items[0].x = x; - items[0].y = y; - } - } - else - { - px = items[0].x; - py = items[0].y; + set: function (value) + { + var v = Clamp(value, 0, 1); - items[0].x = x; - items[0].y = y; - } + this._alphaBR = v; - // Return the final set of coordinates as they're effectively lost from the shift and may be needed + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } - output.x = px; - output.y = py; + } - return output; }; -module.exports = ShiftPosition; +module.exports = Alpha; /***/ }), -/* 433 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75743,29 +77507,110 @@ module.exports = ShiftPosition; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayShuffle = __webpack_require__(80); +var BlendModes = __webpack_require__(45); /** - * [description] - * - * @function Phaser.Actions.Shuffle - * @since 3.0.0 + * Provides methods used for setting the blend mode of a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.BlendMode + * @since 3.0.0 */ -var Shuffle = function (items) -{ - return ArrayShuffle(items); + +var BlendMode = { + + _blendMode: BlendModes.NORMAL, + + /** + * Sets the Blend Mode being used by this Game Object. + * + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) + * + * Under WebGL only the following Blend Modes are available: + * + * * ADD + * * MULTIPLY + * * SCREEN + * + * Canvas has more available depending on browser support. + * + * You can also create your own custom Blend Modes in WebGL. + * + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency of which blend modes + * are used. + * + * @name Phaser.GameObjects.Components.BlendMode#blendMode + * @type {integer|string} + * @since 3.0.0 + */ + blendMode: { + + get: function () + { + return this._blendMode; + }, + + set: function (value) + { + if (typeof value === 'string') + { + value = BlendModes[value]; + } + + value | 0; + + if (value >= 0) + { + this._blendMode = value; + } + } + + }, + + /** + * Sets the Blend Mode being used by this Game Object. + * + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) + * + * Under WebGL only the following Blend Modes are available: + * + * * ADD + * * MULTIPLY + * * SCREEN + * + * Canvas has more available depending on browser support. + * + * You can also create your own custom Blend Modes in WebGL. + * + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency of which blend modes + * are used. + * + * @method Phaser.GameObjects.Components.BlendMode#setBlendMode + * @since 3.0.0 + * + * @param {string|integer} value - The BlendMode value. Either a string or a CONST. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setBlendMode: function (value) + { + this.blendMode = value; + + return this; + } + }; -module.exports = Shuffle; +module.exports = BlendMode; /***/ }), -/* 434 */ -/***/ (function(module, exports, __webpack_require__) { +/* 394 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -75773,53 +77618,86 @@ module.exports = Shuffle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmootherStep = __webpack_require__(192); - /** - * [description] - * - * @function Phaser.Actions.SmootherStep - * @since 3.0.0 + * Provides methods used for setting the blend mode of a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.ComputedSize + * @since 3.0.0 */ -var SmootherStep = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } - var step = Math.abs(max - min) / items.length; - var i; +var ComputedSize = { + + /** + * The native (un-scaled) width of this Game Object. + * + * @name Phaser.GameObjects.Components.ComputedSize#width + * @type {number} + * @since 3.0.0 + */ + width: 0, + + /** + * The native (un-scaled) height of this Game Object. + * + * @name Phaser.GameObjects.Components.ComputedSize#height + * @type {number} + * @since 3.0.0 + */ + height: 0, + + /** + * The displayed width of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.ComputedSize#displayWidth + * @type {number} + * @since 3.0.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.width; + }, - if (inc) - { - for (i = 0; i < items.length; i++) + set: function (value) { - items[i][property] += MathSmootherStep(i * step, min, max); + this.scaleX = value / this.width; } - } - else - { - for (i = 0; i < items.length; i++) + + }, + + /** + * The displayed height of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.ComputedSize#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () { - items[i][property] = MathSmootherStep(i * step, min, max); + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; } + } - return items; }; -module.exports = SmootherStep; +module.exports = ComputedSize; /***/ }), -/* 435 */ -/***/ (function(module, exports, __webpack_require__) { +/* 395 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -75827,52 +77705,82 @@ module.exports = SmootherStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmoothStep = __webpack_require__(193); - /** - * [description] - * - * @function Phaser.Actions.SmoothStep - * @since 3.0.0 + * Provides methods used for setting the depth of a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.Depth + * @since 3.0.0 */ -var SmoothStep = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } - var step = Math.abs(max - min) / items.length; - var i; +var Depth = { - if (inc) - { - for (i = 0; i < items.length; i++) + _depth: 0, + + /** + * The depth of this Game Object within the Scene. + * + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. + * + * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth + * value will always render in front of one with a lower value. + * + * Setting the depth will queue a depth sort event within the Scene. + * + * @name Phaser.GameObjects.Components.Depth#depth + * @type {number} + * @since 3.0.0 + */ + depth: { + + get: function () { - items[i][property] += MathSmoothStep(i * step, min, max); - } - } - else - { - for (i = 0; i < items.length; i++) + return this._depth; + }, + + set: function (value) { - items[i][property] = MathSmoothStep(i * step, min, max); + this.scene.sys.queueDepthSort(); + this._depth = value; } + + }, + + /** + * The depth of this Game Object within the Scene. + * + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. + * + * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth + * value will always render in front of one with a lower value. + * + * Setting the depth will queue a depth sort event within the Scene. + * + * @method Phaser.GameObjects.Components.Depth#setDepth + * @since 3.0.0 + * + * @param {integer} value - The depth of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setDepth: function (value) + { + if (value === undefined) { value = 0; } + + this.depth = value; + + return this; } - return items; }; -module.exports = SmoothStep; +module.exports = Depth; /***/ }), -/* 436 */ +/* 396 */ /***/ (function(module, exports) { /** @@ -75882,82 +77790,145 @@ module.exports = SmoothStep; */ /** - * [description] - * - * @function Phaser.Actions.Spread - * @since 3.0.0 + * Provides methods used for visually flipping a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.Flip + * @since 3.0.0 */ -var Spread = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } - var step = Math.abs(max - min) / items.length; - var i; +var Flip = { - if (inc) + /** + * The horizontally flipped state of the Game Object. + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * + * @name Phaser.GameObjects.Components.Flip#flipX + * @type {boolean} + * @default false + * @since 3.0.0 + */ + flipX: false, + + /** + * The vertically flipped state of the Game Object. + * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * + * @name Phaser.GameObjects.Components.Flip#flipY + * @type {boolean} + * @default false + * @since 3.0.0 + */ + flipY: false, + + /** + * Toggles the horizontal flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipX + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + toggleFlipX: function () { - for (i = 0; i < items.length; i++) - { - items[i][property] += i * step; - } - } - else + this.flipX = !this.flipX; + + return this; + }, + + /** + * Toggles the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipY + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + toggleFlipY: function () { - for (i = 0; i < items.length; i++) - { - items[i][property] = i * step; - } - } + this.flipY = !this.flipY; - return items; -}; + return this; + }, -module.exports = Spread; + /** + * Sets the horizontal flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlipX + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setFlipX: function (value) + { + this.flipX = value; + return this; + }, -/***/ }), -/* 437 */ -/***/ (function(module, exports) { + /** + * Sets the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlipY + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setFlipY: function (value) + { + this.flipY = value; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + }, -/** - * [description] - * - * @function Phaser.Actions.ToggleVisible - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ToggleVisible = function (items) -{ - for (var i = 0; i < items.length; i++) + /** + * Sets the horizontal and vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlip + * @since 3.0.0 + * + * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setFlip: function (x, y) { - items[i].visible = !items[i].visible; + this.flipX = x; + this.flipY = y; + + return this; + }, + + /** + * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. + * + * @method Phaser.GameObjects.Components.Flip#resetFlip + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + resetFlip: function () + { + this.flipX = false; + this.flipY = false; + + return this; } - return items; }; -module.exports = ToggleVisible; +module.exports = Flip; /***/ }), -/* 438 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75966,89 +77937,193 @@ module.exports = ToggleVisible; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Rectangle = __webpack_require__(8); +var RotateAround = __webpack_require__(186); +var Vector2 = __webpack_require__(6); + /** - * @namespace Phaser.Animations + * Provides methods used for obtaining the bounds of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.GetBounds + * @since 3.0.0 */ -module.exports = { +var GetBounds = { - Animation: __webpack_require__(194), - AnimationFrame: __webpack_require__(195), - AnimationManager: __webpack_require__(196) + /** + * Gets the center coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getCenter + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getCenter: function (output) + { + if (output === undefined) { output = new Vector2(); } -}; + output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); + output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); + return output; + }, -/***/ }), -/* 439 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets the top-left corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getTopLeft + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getTopLeft: function (output) + { + if (output === undefined) { output = new Vector2(); } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + output.x = this.x - (this.displayWidth * this.originX); + output.y = this.y - (this.displayHeight * this.originY); -/** - * @namespace Phaser.Cache - */ + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } -module.exports = { + return output; + }, + + /** + * Gets the top-right corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getTopRight + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getTopRight: function (output) + { + if (output === undefined) { output = new Vector2(); } - BaseCache: __webpack_require__(198), - CacheManager: __webpack_require__(199) + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = this.y - (this.displayHeight * this.originY); -}; + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } + return output; + }, -/***/ }), -/* 440 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getBottomLeft: function (output) + { + if (output === undefined) { output = new Vector2(); } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + output.x = this.x - (this.displayWidth * this.originX); + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; -/** - * @namespace Phaser.Cameras - */ + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } -module.exports = { + return output; + }, + + /** + * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getBottomRight + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getBottomRight: function (output) + { + if (output === undefined) { output = new Vector2(); } - Controls: __webpack_require__(441), - Scene2D: __webpack_require__(444), - Sprite3D: __webpack_require__(446) + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; -}; + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } + return output; + }, -/***/ }), -/* 441 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets the bounds of this Game Object, regardless of origin. + * The values are stored and returned in a Rectangle, or Rectangle-like, object. + * + * @method Phaser.GameObjects.Components.GetBounds#getBounds + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle|object} [output] - An object to store the values in. If not provided a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle|object} The values stored in the output object. + */ + getBounds: function (output) + { + if (output === undefined) { output = new Rectangle(); } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // We can use the output object to temporarily store the x/y coords in: -/** - * @namespace Phaser.Cameras.Controls - */ + this.getTopLeft(output); -module.exports = { + var TLx = output.x; + var TLy = output.y; + + this.getTopRight(output); + + var TRx = output.x; + var TRy = output.y; + + this.getBottomLeft(output); - Fixed: __webpack_require__(442), - Smoothed: __webpack_require__(443) + var BLx = output.x; + var BLy = output.y; + + this.getBottomRight(output); + + var BRx = output.x; + var BRy = output.y; + + output.x = Math.min(TLx, TRx, BLx, BRx); + output.y = Math.min(TLy, TRy, BLy, BRy); + output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; + output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; + + return output; + } }; +module.exports = GetBounds; + /***/ }), -/* 442 */ -/***/ (function(module, exports, __webpack_require__) { +/* 398 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -76056,779 +78131,653 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(4); - -// var camControl = new CameraControl({ -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// speed: float OR { x: 0, y: 0 } -// }) - /** - * @classdesc - * [description] - * - * @class FixedKeyControl - * @memberOf Phaser.Cameras.Controls - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] + * Provides methods used for getting and setting the transform values of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.MatrixStack + * @since 3.2.0 */ -var FixedKeyControl = new Class({ - initialize: +var MatrixStack = { - function FixedKeyControl (config) - { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#matrixStack + * @type {Float32Array} + * @private + * @since 3.2.0 + */ + matrixStack: null, - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#left - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#currentMatrix + * @type {Float32Array} + * @private + * @since 3.2.0 + */ + currentMatrix: null, - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#right - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#currentMatrixIndex + * @type {integer} + * @private + * @since 3.2.0 + */ + currentMatrixIndex: 0, - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#up - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#initMatrixStack + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + initMatrixStack: function () + { + this.matrixStack = new Float32Array(6000); // up to 1000 matrices + this.currentMatrix = new Float32Array([ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]); + this.currentMatrixIndex = 0; - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#down - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); + return this; + }, - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#save + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + save: function () + { + if (this.currentMatrixIndex >= this.matrixStack.length) { return this; } - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); + var matrixStack = this.matrixStack; + var currentMatrix = this.currentMatrix; + var currentMatrixIndex = this.currentMatrixIndex; + this.currentMatrixIndex += 6; - /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed - * @type {float} - * @default 0.01 - * @since 3.0.0 - */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + matrixStack[currentMatrixIndex + 0] = currentMatrix[0]; + matrixStack[currentMatrixIndex + 1] = currentMatrix[1]; + matrixStack[currentMatrixIndex + 2] = currentMatrix[2]; + matrixStack[currentMatrixIndex + 3] = currentMatrix[3]; + matrixStack[currentMatrixIndex + 4] = currentMatrix[4]; + matrixStack[currentMatrixIndex + 5] = currentMatrix[5]; + + return this; + }, - /** - * The horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedX - * @type {float} - * @default 0 - * @since 3.0.0 - */ + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#restore + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + restore: function () + { + if (this.currentMatrixIndex <= 0) { return this; } - /** - * The vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var speed = GetValue(config, 'speed', null); + this.currentMatrixIndex -= 6; - if (typeof speed === 'number') - { - this.speedX = speed; - this.speedY = speed; - } - else - { - this.speedX = GetValue(config, 'speed.x', 0); - this.speedY = GetValue(config, 'speed.y', 0); - } + var matrixStack = this.matrixStack; + var currentMatrix = this.currentMatrix; + var currentMatrixIndex = this.currentMatrixIndex; - /** - * [description] - * - * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; + currentMatrix[0] = matrixStack[currentMatrixIndex + 0]; + currentMatrix[1] = matrixStack[currentMatrixIndex + 1]; + currentMatrix[2] = matrixStack[currentMatrixIndex + 2]; + currentMatrix[3] = matrixStack[currentMatrixIndex + 3]; + currentMatrix[4] = matrixStack[currentMatrixIndex + 4]; + currentMatrix[5] = matrixStack[currentMatrixIndex + 5]; - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); + return this; }, /** - * Starts the Key Control running, providing it has been linked to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#start - * @since 3.0.0 - * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#loadIdentity + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - start: function () + loadIdentity: function () { - this.active = (this.camera !== null); + this.setTransform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); return this; }, /** - * Stops this Key Control from running. Call `start` to start it again. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#stop - * @since 3.0.0 + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#transform + * @since 3.2.0 * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - stop: function () + transform: function (a, b, c, d, tx, ty) { - this.active = false; + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var m4 = currentMatrix[4]; + var m5 = currentMatrix[5]; + + currentMatrix[0] = m0 * a + m2 * b; + currentMatrix[1] = m1 * a + m3 * b; + currentMatrix[2] = m0 * c + m2 * d; + currentMatrix[3] = m1 * c + m3 * d; + currentMatrix[4] = m0 * tx + m2 * ty + m4; + currentMatrix[5] = m1 * tx + m3 * ty + m5; return this; }, /** - * Binds this Key Control to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#setTransform + * @since 3.2.0 * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - setCamera: function (camera) + setTransform: function (a, b, c, d, tx, ty) { - this.camera = camera; + var currentMatrix = this.currentMatrix; + + currentMatrix[0] = a; + currentMatrix[1] = b; + currentMatrix[2] = c; + currentMatrix[3] = d; + currentMatrix[4] = tx; + currentMatrix[5] = ty; return this; }, /** * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#translate + * @since 3.2.0 * - * @method Phaser.Cameras.Controls.FixedKeyControl#update - * @since 3.0.0 - * - * @param {number} delta - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - update: function (delta) + translate: function (x, y) { - if (!this.active) - { - return; - } - - if (delta === undefined) { delta = 1; } - - var cam = this.camera; + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var m4 = currentMatrix[4]; + var m5 = currentMatrix[5]; - if (this.up && this.up.isDown) - { - cam.scrollY -= ((this.speedY * delta) | 0); - } - else if (this.down && this.down.isDown) - { - cam.scrollY += ((this.speedY * delta) | 0); - } + currentMatrix[4] = m0 * x + m2 * y + m4; + currentMatrix[5] = m1 * x + m3 * y + m5; - if (this.left && this.left.isDown) - { - cam.scrollX -= ((this.speedX * delta) | 0); - } - else if (this.right && this.right.isDown) - { - cam.scrollX += ((this.speedX * delta) | 0); - } + return this; + }, - // Camera zoom + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#scale + * @since 3.2.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + scale: function (x, y) + { + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; - if (this.zoomIn && this.zoomIn.isDown) - { - cam.zoom -= this.zoomSpeed; + currentMatrix[0] = m0 * x; + currentMatrix[1] = m1 * x; + currentMatrix[2] = m2 * y; + currentMatrix[3] = m3 * y; - if (cam.zoom < 0.1) - { - cam.zoom = 0.1; - } - } - else if (this.zoomOut && this.zoomOut.isDown) - { - cam.zoom += this.zoomSpeed; - } + return this; }, /** - * Destroys this Key Control. + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#rotate + * @since 3.2.0 * - * @method Phaser.Cameras.Controls.FixedKeyControl#destroy - * @since 3.0.0 + * @param {number} t - The angle of rotation, in radians. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - destroy: function () + rotate: function (t) { - this.camera = null; + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var st = Math.sin(t); + var ct = Math.cos(t); - this.left = null; - this.right = null; - this.up = null; - this.down = null; + currentMatrix[0] = m0 * ct + m2 * st; + currentMatrix[1] = m1 * ct + m3 * st; + currentMatrix[2] = m0 * -st + m2 * ct; + currentMatrix[3] = m1 * -st + m3 * ct; - this.zoomIn = null; - this.zoomOut = null; + return this; } -}); +}; -module.exports = FixedKeyControl; +module.exports = MatrixStack; /***/ }), -/* 443 */ -/***/ (function(module, exports, __webpack_require__) { +/* 399 */ +/***/ (function(module, exports) { /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(4); - -// var controlConfig = { -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// up: cursors.up, -// down: cursors.down, -// zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), -// zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), -// zoomSpeed: 0.02, -// acceleration: 0.06, -// drag: 0.0005, -// maxSpeed: 1.0 -// }; - -/** - * @classdesc - * [description] - * - * @class SmoothedKeyControl - * @memberOf Phaser.Cameras.Controls - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] - */ -var SmoothedKeyControl = new Class({ - - initialize: - - function SmoothedKeyControl (config) - { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); - - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#left - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); - - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#right - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); - - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#up - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); - - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#down - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); - - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); - - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); + */ - /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed - * @type {float} - * @default 0.01 - * @since 3.0.0 - */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); +/** + * Provides methods used for getting and setting the origin of a Game Object. + * Values are normalized, given in the range 0 to 1. + * Display values contain the calculated pixel values. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Origin + * @since 3.0.0 + */ - /** - * The horizontal acceleration the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX - * @type {float} - * @default 0 - * @since 3.0.0 - */ +var Origin = { - /** - * The vertical acceleration the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var accel = GetValue(config, 'acceleration', null); + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Origin#_originComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _originComponent: true, - if (typeof accel === 'number') - { - this.accelX = accel; - this.accelY = accel; - } - else - { - this.accelX = GetValue(config, 'acceleration.x', 0); - this.accelY = GetValue(config, 'acceleration.y', 0); - } + /** + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. + * + * @name Phaser.GameObjects.Components.Origin#originX + * @type {float} + * @default 0.5 + * @since 3.0.0 + */ + originX: 0.5, - /** - * The horizontal drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX - * @type {float} - * @default 0 - * @since 3.0.0 - */ + /** + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. + * + * @name Phaser.GameObjects.Components.Origin#originY + * @type {float} + * @default 0.5 + * @since 3.0.0 + */ + originY: 0.5, - /** - * The vertical drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var drag = GetValue(config, 'drag', null); + // private + read only + _displayOriginX: 0, + _displayOriginY: 0, - if (typeof drag === 'number') + /** + * The horizontal display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginX + * @type {float} + * @since 3.0.0 + */ + displayOriginX: { + + get: function () { - this.dragX = drag; - this.dragY = drag; - } - else + return this._displayOriginX; + }, + + set: function (value) { - this.dragX = GetValue(config, 'drag.x', 0); - this.dragY = GetValue(config, 'drag.y', 0); + this._displayOriginX = value; + this.originX = value / this.width; } - /** - * The maximum horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX - * @type {float} - * @default 0 - * @since 3.0.0 - */ + }, - /** - * The maximum vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var maxSpeed = GetValue(config, 'maxSpeed', null); + /** + * The vertical display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginY + * @type {float} + * @since 3.0.0 + */ + displayOriginY: { - if (typeof maxSpeed === 'number') + get: function () { - this.maxSpeedX = maxSpeed; - this.maxSpeedY = maxSpeed; - } - else + return this._displayOriginY; + }, + + set: function (value) { - this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); - this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); + this._displayOriginY = value; + this.originY = value / this.height; } - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedX = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedY = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; - - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); }, /** - * Starts the Key Control running, providing it has been linked to a camera. + * Sets the origin of this Game Object. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#start + * The values are given in the range 0 to 1. + * + * @method Phaser.GameObjects.Components.Origin#setOrigin * @since 3.0.0 * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=0.5] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - start: function () + setOrigin: function (x, y) { - this.active = (this.camera !== null); + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } - return this; + this.originX = x; + this.originY = y; + + return this.updateDisplayOrigin(); }, /** - * Stops this Key Control from running. Call `start` to start it again. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop + * Sets the origin of this Game Object based on the Pivot values in its Frame. + * + * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame * @since 3.0.0 - * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - stop: function () + setOriginFromFrame: function () { - this.active = false; + if (!this.frame || !this.frame.customPivot) + { + return this.setOrigin(); + } + else + { + this.originX = this.frame.pivotX; + this.originY = this.frame.pivotY; + } - return this; + return this.updateDisplayOrigin(); }, /** - * Binds this Key Control to a camera. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera + * Sets the display origin of this Game Object. + * The difference between this and setting the origin is that you can use pixel values for setting the display origin. + * + * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. - * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + * @param {number} [x=0] - The horizontal display origin value. + * @param {number} [y=0] - The vertical display origin value. If not defined it will be set to the value of `x`. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - setCamera: function (camera) + setDisplayOrigin: function (x, y) { - this.camera = camera; + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + + this.displayOriginX = x; + this.displayOriginY = y; return this; }, /** - * [description] - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#update + * Updates the Display Origin cached values internally stored on this Game Object. + * You don't usually call this directly, but it is exposed for edge-cases where you may. + * + * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin * @since 3.0.0 - * - * @param {[type]} delta - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - update: function (delta) + updateDisplayOrigin: function () { - if (!this.active) - { - return; - } + this._displayOriginX = Math.round(this.originX * this.width); + this._displayOriginY = Math.round(this.originY * this.height); - if (delta === undefined) { delta = 1; } + return this; + } - var cam = this.camera; +}; - // Apply Deceleration +module.exports = Origin; - if (this._speedX > 0) - { - this._speedX -= this.dragX * delta; - if (this._speedX < 0) - { - this._speedX = 0; - } - } - else if (this._speedX < 0) - { - this._speedX += this.dragX * delta; +/***/ }), +/* 400 */ +/***/ (function(module, exports, __webpack_require__) { - if (this._speedX > 0) - { - this._speedX = 0; - } - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (this._speedY > 0) - { - this._speedY -= this.dragY * delta; +var ScaleModes = __webpack_require__(63); - if (this._speedY < 0) - { - this._speedY = 0; - } - } - else if (this._speedY < 0) - { - this._speedY += this.dragY * delta; +/** + * Provides methods used for getting and setting the scale of a Game Object. + * + * @name Phaser.GameObjects.Components.ScaleMode + * @since 3.0.0 + */ - if (this._speedY > 0) - { - this._speedY = 0; - } - } +var ScaleMode = { - // Check for keys + _scaleMode: ScaleModes.DEFAULT, - if (this.up && this.up.isDown) - { - this._speedY += this.accelY; + /** + * The Scale Mode being used by this Game Object. + * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. + * + * @name Phaser.GameObjects.Components.ScaleMode#scaleMode + * @type {integer} + * @since 3.0.0 + */ + scaleMode: { - if (this._speedY > this.maxSpeedY) - { - this._speedY = this.maxSpeedY; - } - } - else if (this.down && this.down.isDown) + get: function () { - this._speedY -= this.accelY; + return this._scaleMode; + }, - if (this._speedY < -this.maxSpeedY) + set: function (value) + { + if (value === ScaleModes.LINEAR || value === ScaleModes.NEAREST) { - this._speedY = -this.maxSpeedY; + this._scaleMode = value; } } - if (this.left && this.left.isDown) - { - this._speedX += this.accelX; + }, - if (this._speedX > this.maxSpeedX) - { - this._speedX = this.maxSpeedX; - } - } - else if (this.right && this.right.isDown) - { - this._speedX -= this.accelX; + /** + * Sets the Scale Mode being used by this Game Object. + * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. + * + * @method Phaser.GameObjects.Components.ScaleMode#setScaleMode + * @since 3.0.0 + * + * @param {integer} value - The Scale Mode to be used by this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setScaleMode: function (value) + { + this.scaleMode = value; - if (this._speedX < -this.maxSpeedX) - { - this._speedX = -this.maxSpeedX; - } - } + return this; + } - // Camera zoom +}; - if (this.zoomIn && this.zoomIn.isDown) - { - this._zoom = -this.zoomSpeed; - } - else if (this.zoomOut && this.zoomOut.isDown) - { - this._zoom = this.zoomSpeed; - } - else - { - this._zoom = 0; - } +module.exports = ScaleMode; - // Apply to Camera - if (this._speedX !== 0) - { - cam.scrollX -= ((this._speedX * delta) | 0); - } +/***/ }), +/* 401 */ +/***/ (function(module, exports) { - if (this._speedY !== 0) - { - cam.scrollY -= ((this._speedY * delta) | 0); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (this._zoom !== 0) - { - cam.zoom += this._zoom; +/** + * Provides methods used for getting and setting the Scroll Factor of a Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor + * @since 3.0.0 + */ - if (cam.zoom < 0.1) - { - cam.zoom = 0.1; - } - } - }, +var ScrollFactor = { /** - * Destroys this Key Control. + * The horizontal scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX + * @type {number} + * @default 1 * @since 3.0.0 */ - destroy: function () + scrollFactorX: 1, + + /** + * The vertical scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scrollFactorY: 1, + + /** + * Sets the scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor + * @since 3.0.0 + * + * @param {number} x - The horizontal scroll factor of this Game Object. + * @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setScrollFactor: function (x, y) { - this.camera = null; + if (y === undefined) { y = x; } - this.left = null; - this.right = null; - this.up = null; - this.down = null; + this.scrollFactorX = x; + this.scrollFactorY = y; - this.zoomIn = null; - this.zoomOut = null; + return this; } -}); - -module.exports = SmoothedKeyControl; - - -/***/ }), -/* 444 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Cameras.Scene2D - */ - -module.exports = { - - Camera: __webpack_require__(114), - CameraManager: __webpack_require__(445) - }; +module.exports = ScrollFactor; + /***/ }), -/* 445 */ -/***/ (function(module, exports, __webpack_require__) { +/* 402 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -76836,534 +78785,465 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(114); -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var PluginManager = __webpack_require__(12); -var RectangleContains = __webpack_require__(33); - /** - * @classdesc - * [description] - * - * @class CameraManager - * @memberOf Phaser.Cameras.Scene2D - * @constructor + * Provides methods used for getting and setting the size of a Game Object. + * + * @name Phaser.GameObjects.Components.Size * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. */ -var CameraManager = new Class({ - - initialize: - - function CameraManager (scene) - { - /** - * The Scene that owns the Camera Manager plugin. - * - * @name Phaser.Cameras.Scene2D.CameraManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - /** - * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; +var Size = { - if (!scene.sys.settings.isBooted) - { - scene.sys.events.once('boot', this.boot, this); - } + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Size#_sizeComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _sizeComponent: true, - /** - * The current Camera ID. - * - * @name Phaser.Cameras.Scene2D.CameraManager#currentCameraId - * @type {number} - * @default 1 - * @readOnly - * @since 3.0.0 - */ - this.currentCameraId = 1; + /** + * The native (un-scaled) width of this Game Object. + * + * @name Phaser.GameObjects.Components.Size#width + * @type {number} + * @since 3.0.0 + */ + width: 0, - /** - * An Array of the Camera objects being managed by this Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#cameras - * @type {Phaser.Cameras.Scene2D.Camera[]} - * @since 3.0.0 - */ - this.cameras = []; + /** + * The native (un-scaled) height of this Game Object. + * + * @name Phaser.GameObjects.Components.Size#height + * @type {number} + * @since 3.0.0 + */ + height: 0, - /** - * A pool of Camera objects available to be used by the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#cameraPool - * @type {Phaser.Cameras.Scene2D.Camera[]} - * @since 3.0.0 - */ - this.cameraPool = []; + /** + * The displayed width of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.Size#displayWidth + * @type {number} + * @since 3.0.0 + */ + displayWidth: { - if (scene.sys.settings.cameras) + get: function () { - // We have cameras to create - this.fromJSON(scene.sys.settings.cameras); - } - else + return this.scaleX * this.frame.realWidth; + }, + + set: function (value) { - // Make one - this.add(); + this.scaleX = value / this.frame.realWidth; } - /** - * The default Camera in the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#main - * @type {Phaser.Cameras.Scene2D.Camera} - * @since 3.0.0 - */ - this.main = this.cameras[0]; - - /** - * This scale affects all cameras. It's used by Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1.0; }, /** - * Called when the Camera Manager boots. - * Starts the event listeners running. - * - * @method Phaser.Cameras.Scene2D.CameraManager#boot + * The displayed height of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.Size#displayHeight + * @type {number} * @since 3.0.0 */ - boot: function () - { - var eventEmitter = this.systems.events; + displayHeight: { + + get: function () + { + return this.scaleY * this.frame.realHeight; + }, + + set: function (value) + { + this.scaleY = value / this.frame.realHeight; + } - eventEmitter.on('update', this.update, this); - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#add + * Sets the size of this Game Object to be that of the given Frame. + * + * @method Phaser.GameObjects.Components.Size#setSizeToFrame * @since 3.0.0 * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] - * @param {number} [width] - [description] - * @param {number} [height] - [description] - * @param {boolean} [makeMain=false] - [description] - * @param {string} [name=''] - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {Phaser.Textures.Frame} frame - The frame to base the size of this Game Object on. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - add: function (x, y, width, height, makeMain, name) + setSizeToFrame: function (frame) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.scene.sys.game.config.width; } - if (height === undefined) { height = this.scene.sys.game.config.height; } - if (makeMain === undefined) { makeMain = false; } - if (name === undefined) { name = ''; } - - var camera = null; - - if (this.cameraPool.length > 0) - { - camera = this.cameraPool.pop(); - - camera.setViewport(x, y, width, height); - } - else - { - camera = new Camera(x, y, width, height); - } - - camera.setName(name); - camera.setScene(this.scene); - - this.cameras.push(camera); - - if (makeMain) - { - this.main = camera; - } - - camera._id = this.currentCameraId; + if (frame === undefined) { frame = this.frame; } - this.currentCameraId = this.currentCameraId << 1; + this.width = frame.realWidth; + this.height = frame.realHeight; - return camera; + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#addExisting + * Sets the size of this Game Object. + * + * @method Phaser.GameObjects.Components.Size#setSize * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - addExisting: function (camera) + setSize: function (width, height) { - var index = this.cameras.indexOf(camera); - var poolIndex = this.cameraPool.indexOf(camera); + this.width = width; + this.height = height; - if (index < 0 && poolIndex >= 0) - { - this.cameras.push(camera); - this.cameraPool.slice(poolIndex, 1); - return camera; - } - - return null; + return this; }, - /* - { - cameras: [ - { - name: string - x: int - y: int - width: int - height: int - zoom: float - rotation: float - roundPixels: bool - scrollX: float - scrollY: float - backgroundColor: string - bounds: { - x: int - y: int - width: int - height: int - } - } - ] - } - */ - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON + * Sets the display size of this Game Object. + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Components.Size#setDisplaySize * @since 3.0.0 * - * @param {[type]} config - [description] - * - * @return {[type]} [description] + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - fromJSON: function (config) + setDisplaySize: function (width, height) { - if (!Array.isArray(config)) - { - config = [ config ]; - } - - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; - - for (var i = 0; i < config.length; i++) - { - var cameraConfig = config[i]; + this.displayWidth = width; + this.displayHeight = height; - var x = GetFastValue(cameraConfig, 'x', 0); - var y = GetFastValue(cameraConfig, 'y', 0); - var width = GetFastValue(cameraConfig, 'width', gameWidth); - var height = GetFastValue(cameraConfig, 'height', gameHeight); + return this; + } - var camera = this.add(x, y, width, height); +}; - // Direct properties - camera.name = GetFastValue(cameraConfig, 'name', ''); - camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); - camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); - camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); - camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); - camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); +module.exports = Size; - // Background Color - var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); +/***/ }), +/* 403 */ +/***/ (function(module, exports) { - if (backgroundColor) - { - camera.setBackgroundColor(backgroundColor); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Bounds +// bitmask flag for GameObject.renderMask +var _FLAG = 8; // 1000 - var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); +/** + * Provides methods used for getting and setting the texture of a Game Object. + * + * @name Phaser.GameObjects.Components.Texture + * @since 3.0.0 + */ - if (boundsConfig) - { - var bx = GetFastValue(boundsConfig, 'x', 0); - var by = GetFastValue(boundsConfig, 'y', 0); - var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); - var bheight = GetFastValue(boundsConfig, 'height', gameHeight); +var Texture = { - camera.setBounds(bx, by, bwidth, bheight); - } - } + /** + * The Texture this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#texture + * @type {Phaser.Textures.Texture} + * @since 3.0.0 + */ + texture: null, - return this; - }, + /** + * The Texture Frame this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + frame: null, /** - * [description] + * Sets the texture and frame this Game Object will use to render with. * - * @method Phaser.Cameras.Scene2D.CameraManager#getCamera + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * @method Phaser.GameObjects.Components.Texture#setTexture * @since 3.0.0 * - * @param {string} name - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {string|integer} [frame] - The name or index of the frame within the Texture. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - getCamera: function (name) + setTexture: function (key, frame) { - this.cameras.forEach(function (camera) - { - if (camera.name === name) - { - return camera; - } - }); + this.texture = this.scene.sys.textures.get(key); - return null; + return this.setFrame(frame); }, /** - * [description] + * Sets the frame this Game Object will use to render with. * - * @method Phaser.Cameras.Scene2D.CameraManager#getCameraBelowPointer - * @since 3.0.0 + * The Frame has to belong to the current Texture being used. * - * @param {[type]} pointer - [description] + * It can be either a string or an index. * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. + * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. + * + * @method Phaser.GameObjects.Components.Texture#setFrame + * @since 3.0.0 + * + * @param {string|integer} frame - The name or index of the frame within the Texture. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - getCameraBelowPointer: function (pointer) + setFrame: function (frame) { - var cameras = this.cameras; + this.frame = this.texture.get(frame); - // Start from the most recently added camera (the 'top' camera) - for (var i = cameras.length - 1; i >= 0; i--) + if (!this.frame.cutWidth || !this.frame.cutHeight) { - var camera = cameras[i]; + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } - if (camera.inputEnabled && RectangleContains(camera, pointer.x, pointer.y)) + if (this._sizeComponent) + { + this.setSizeToFrame(); + } + + if (this._originComponent) + { + if (this.frame.customPivot) { - return camera; + this.setOrigin(this.frame.pivotX, this.frame.pivotY); + } + else + { + this.updateDisplayOrigin(); } } - }, - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#remove - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - remove: function (camera) - { - var cameraIndex = this.cameras.indexOf(camera); + return this; + } - if (cameraIndex >= 0 && this.cameras.length > 1) - { - this.cameraPool.push(this.cameras[cameraIndex]); - this.cameras.splice(cameraIndex, 1); +}; + +module.exports = Texture; + + +/***/ }), +/* 404 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetColor = function (value) +{ + return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); +}; + +/** + * Provides methods used for setting the tint of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Tint + * @webglOnly + * @since 3.0.0 + */ + +var Tint = { - if (this.main === camera) - { - this.main = this.cameras[0]; - } - } - }, + // 0: topLeft, 1: topRight, 2: bottomLeft, 3: bottomRight + _tintTL: 16777215, + _tintTR: 16777215, + _tintBL: 16777215, + _tintBR: 16777215, /** - * [description] + * Clears all tint values associated with this Game Object. + * Immediately sets the alpha levels back to 0xffffff (no tint) * - * @method Phaser.Cameras.Scene2D.CameraManager#render + * @method Phaser.GameObjects.Components.Tint#clearTint + * @webglOnly * @since 3.0.0 - * - * @param {[type]} renderer - [description] - * @param {[type]} children - [description] - * @param {[type]} interpolation - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - render: function (renderer, children, interpolation) + clearTint: function () { - var cameras = this.cameras; - var baseScale = this.baseScale; - - for (var i = 0, l = cameras.length; i < l; ++i) - { - var camera = cameras[i]; - - camera.preRender(baseScale, renderer.config.resolution); + this.setTint(0xffffff); - renderer.render(this.scene, children, interpolation, camera); - } + return this; }, /** - * [description] + * Sets the tint values for this Game Object. * - * @method Phaser.Cameras.Scene2D.CameraManager#resetAll + * @method Phaser.GameObjects.Components.Tint#setTint + * @webglOnly * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. + * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - resetAll: function () + setTint: function (topLeft, topRight, bottomLeft, bottomRight) { - while (this.cameras.length > 0) + if (topLeft === undefined) { topLeft = 0xffffff; } + + if (topRight === undefined) { - this.cameraPool.push(this.cameras.pop()); + topRight = topLeft; + bottomLeft = topLeft; + bottomRight = topLeft; } - this.main = this.add(); + this._tintTL = GetColor(topLeft); + this._tintTR = GetColor(topRight); + this._tintBL = GetColor(bottomLeft); + this._tintBR = GetColor(bottomRight); - return this.main; + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#update + * The tint value being applied to the top-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintTopLeft + * @type {integer} + * @webglOnly * @since 3.0.0 - * - * @param {number} timestep - [description] - * @param {number} delta - [description] */ - update: function (timestep, delta) - { - for (var i = 0, l = this.cameras.length; i < l; ++i) + tintTopLeft: { + + get: function () { - this.cameras[i].update(timestep, delta); + return this._tintTL; + }, + + set: function (value) + { + this._tintTL = GetColor(value); } + }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#shutdown + * The tint value being applied to the top-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintTopRight + * @type {integer} + * @webglOnly * @since 3.0.0 */ - shutdown: function () - { - // TODO + tintTopRight: { + + get: function () + { + return this._tintTR; + }, + + set: function (value) + { + this._tintTR = GetColor(value); + } + }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#destroy + * The tint value being applied to the bottom-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintBottomLeft + * @type {integer} + * @webglOnly * @since 3.0.0 */ - destroy: function () - { - this.main = undefined; + tintBottomLeft: { - for (var i = 0; i < this.cameras.length; i++) + get: function () { - this.cameras[i].destroy(); - } + return this._tintBL; + }, - for (i = 0; i < this.cameraPool.length; i++) + set: function (value) { - this.cameraPool[i].destroy(); + this._tintBL = GetColor(value); } - this.cameras = []; - this.cameraPool = []; - this.scene = undefined; - } - -}); - -PluginManager.register('CameraManager', CameraManager, 'cameras'); - -module.exports = CameraManager; + }, + /** + * The tint value being applied to the bottom-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintBottomRight + * @type {integer} + * @webglOnly + * @since 3.0.0 + */ + tintBottomRight: { -/***/ }), -/* 446 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this._tintBR; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + set: function (value) + { + this._tintBR = GetColor(value); + } -/** - * @namespace Phaser.Cameras.Sprite3D - */ + }, -module.exports = { + /** + * The tint value being applied to the whole of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tint + * @type {integer} + * @webglOnly + * @since 3.0.0 + */ + tint: { - Camera: __webpack_require__(117), - CameraManager: __webpack_require__(450), - OrthographicCamera: __webpack_require__(211), - PerspectiveCamera: __webpack_require__(212) + set: function (value) + { + this.setTint(value, value, value, value); + } + } }; - -/***/ }), -/* 447 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var renderWebGL = __webpack_require__(3); -var renderCanvas = __webpack_require__(3); - -if (true) -{ - renderWebGL = __webpack_require__(448); -} - -if (true) -{ - renderCanvas = __webpack_require__(449); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; +module.exports = Tint; /***/ }), -/* 448 */ -/***/ (function(module, exports, __webpack_require__) { +/* 405 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -77371,37 +79251,51 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObject = __webpack_require__(1); +// Default Game Object JSON export +// Is extended further by Game Object specific implementations -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +var ToJSON = function (gameObject) { - if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + var out = { + name: gameObject.name, + type: gameObject.type, + x: gameObject.x, + y: gameObject.y, + depth: gameObject.depth, + scale: { + x: gameObject.scaleX, + y: gameObject.scaleY + }, + origin: { + x: gameObject.originX, + y: gameObject.originY + }, + flipX: gameObject.flipX, + flipY: gameObject.flipY, + rotation: gameObject.rotation, + alpha: gameObject.alpha, + visible: gameObject.visible, + scaleMode: gameObject.scaleMode, + blendMode: gameObject.blendMode, + textureKey: '', + frameKey: '', + data: {} + }; + + if (gameObject.texture) { - return; + out.textureKey = gameObject.texture.key; + out.frameKey = gameObject.frame.name; } - this.pipeline.batchSprite(src, camera); + return out; }; -module.exports = SpriteWebGLRenderer; +module.exports = ToJSON; /***/ }), -/* 449 */ +/* 406 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -77410,293 +79304,352 @@ module.exports = SpriteWebGLRenderer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObject = __webpack_require__(1); +var MATH_CONST = __webpack_require__(16); +var WrapAngle = __webpack_require__(161); +var WrapAngleDegrees = __webpack_require__(162); + +// global bitmask flag for GameObject.renderMask (used by Scale) +var _FLAG = 4; // 0100 /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderCanvas + * Provides methods used for getting and setting the position, scale and rotation of a Game Object. + * + * @name Phaser.GameObjects.Components.Transform * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera) -{ - if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) - { - return; - } - renderer.drawImage(src, camera); -}; +var Transform = { -module.exports = SpriteCanvasRenderer; + // "private" properties + _scaleX: 1, + _scaleY: 1, + _rotation: 0, + /** + * The x position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + x: 0, -/***/ }), -/* 450 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The y position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + y: 0, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * The z position of this Game Object. + * Note: Do not use this value to set the z-index, instead see the `depth` property. + * + * @name Phaser.GameObjects.Components.Transform#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + z: 0, -var Class = __webpack_require__(0); -var OrthographicCamera = __webpack_require__(211); -var PerspectiveCamera = __webpack_require__(212); -var PluginManager = __webpack_require__(12); + /** + * The w position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: 0, -/** - * @classdesc - * [description] - * - * @class CameraManager - * @memberOf Phaser.Cameras.Sprite3D - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - */ -var CameraManager = new Class({ + /** + * The horizontal scale of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#scaleX + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scaleX: { - initialize: + get: function () + { + return this._scaleX; + }, - function CameraManager (scene) - { - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.CameraManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + set: function (value) + { + this._scaleX = value; - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.CameraManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + if (this._scaleX === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } - /** - * An Array of the Camera objects being managed by this Camera Manager. - * - * @name Phaser.Cameras.Sprite3D.CameraManager#cameras - * @type {array} - * @since 3.0.0 - */ - this.cameras = []; + }, - if (!scene.sys.settings.isBooted) + /** + * The vertical scale of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#scaleY + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scaleY: { + + get: function () { - scene.sys.events.once('boot', this.boot, this); + return this._scaleY; + }, + + set: function (value) + { + this._scaleY = value; + + if (this._scaleY === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } } + }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#boot + * The angle of this Game Object as expressed in degrees. + * + * Where 0 is to the right, 90 is down, 180 is left. + * + * If you prefer to work in radians, see the `rotation` property instead. + * + * @name Phaser.GameObjects.Components.Transform#angle + * @type {integer} + * @default 0 * @since 3.0.0 */ - boot: function () - { - var eventEmitter = this.systems.events; + angle: { - eventEmitter.on('update', this.update, this); - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + get: function () + { + return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); + }, + + set: function (value) + { + // value is in degrees + this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; + } }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#add + * The angle of this Game Object in radians. + * + * If you prefer to work in degrees, see the `angle` property instead. + * + * @name Phaser.GameObjects.Components.Transform#rotation + * @type {number} + * @default 1 * @since 3.0.0 - * - * @param {[type]} fieldOfView - [description] - * @param {[type]} width - [description] - * @param {[type]} height - [description] - * - * @return {[type]} [description] */ - add: function (fieldOfView, width, height) - { - return this.addPerspectiveCamera(fieldOfView, width, height); + rotation: { + + get: function () + { + return this._rotation; + }, + + set: function (value) + { + // value is in radians + this._rotation = WrapAngle(value); + } }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#addOrthographicCamera + * Sets the position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setPosition * @since 3.0.0 * - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {[type]} [description] + * @param {number} [x=0] - The x position of this Game Object. + * @param {number} [y] - The y position of this Game Object. If not set it will use the `x` value. + * @param {number} [z=0] - The z position of this Game Object. + * @param {number} [w=0] - The w position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - addOrthographicCamera: function (width, height) + setPosition: function (x, y, z, w) { - var config = this.scene.sys.game.config; - - if (width === undefined) { width = config.width; } - if (height === undefined) { height = config.height; } - - var camera = new OrthographicCamera(this.scene, width, height); + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + if (z === undefined) { z = 0; } + if (w === undefined) { w = 0; } - this.cameras.push(camera); + this.x = x; + this.y = y; + this.z = z; + this.w = w; - return camera; + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#addPerspectiveCamera + * Sets the rotation of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setRotation * @since 3.0.0 * - * @param {number} [fieldOfView=80] - [description] - * @param {number} [width] - [description] - * @param {number} [height] - [description] - * - * @return {[type]} [description] + * @param {number} [radians=0] - The rotation of this Game Object, in radians. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - addPerspectiveCamera: function (fieldOfView, width, height) + setRotation: function (radians) { - var config = this.scene.sys.game.config; - - if (fieldOfView === undefined) { fieldOfView = 80; } - if (width === undefined) { width = config.width; } - if (height === undefined) { height = config.height; } - - var camera = new PerspectiveCamera(this.scene, fieldOfView, width, height); + if (radians === undefined) { radians = 0; } - this.cameras.push(camera); + this.rotation = radians; - return camera; + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#getCamera + * Sets the angle of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setAngle * @since 3.0.0 * - * @param {string} name - [description] - * - * @return {[type]} [description] + * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - getCamera: function (name) + setAngle: function (degrees) { - this.cameras.forEach(function (camera) - { - if (camera.name === name) - { - return camera; - } - }); + if (degrees === undefined) { degrees = 0; } - return null; + this.angle = degrees; + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#removeCamera + * Sets the scale of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setScale * @since 3.0.0 * - * @param {[type]} camera - [description] + * @param {number} x - The horizontal scale of this Game Object. + * @param {number} [y] - The vertical scale of this Game Object. If not set it will use the `x` value. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - removeCamera: function (camera) + setScale: function (x, y) { - var cameraIndex = this.cameras.indexOf(camera); + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - if (cameraIndex !== -1) - { - this.cameras.splice(cameraIndex, 1); - } + this.scaleX = x; + this.scaleY = y; + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#removeAll + * Sets the x position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setX * @since 3.0.0 * - * @return {[type]} [description] + * @param {number} [value=0] - The x position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - removeAll: function () + setX: function (value) { - while (this.cameras.length > 0) - { - var camera = this.cameras.pop(); + if (value === undefined) { value = 0; } - camera.destroy(); - } + this.x = value; - return this.main; + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#update + * Sets the y position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setY * @since 3.0.0 * - * @param {number} timestep - [description] - * @param {number} delta - [description] + * @param {number} [value=0] - The y position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - update: function (timestep, delta) + setY: function (value) { - for (var i = 0, l = this.cameras.length; i < l; ++i) - { - this.cameras[i].update(timestep, delta); - } + if (value === undefined) { value = 0; } + + this.y = value; + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#shutdown + * Sets the z position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setZ * @since 3.0.0 + * + * @param {number} [value=0] - The z position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - shutdown: function () + setZ: function (value) { + if (value === undefined) { value = 0; } + + this.z = value; + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#destroy + * Sets the w position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setW * @since 3.0.0 + * + * @param {number} [value=0] - The w position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - destroy: function () + setW: function (value) { - this.scene = undefined; - } + if (value === undefined) { value = 0; } -}); + this.w = value; -PluginManager.register('CameraManager3D', CameraManager, 'cameras3d'); + return this; + } -module.exports = CameraManager; +}; + +module.exports = Transform; /***/ }), -/* 451 */ -/***/ (function(module, exports, __webpack_require__) { +/* 407 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -77704,45 +79657,78 @@ module.exports = CameraManager; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// bitmask flag for GameObject.renderMask +var _FLAG = 1; // 0001 + /** - * @namespace Phaser.Create + * Provides methods used for setting the visibility of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Visible + * @since 3.0.0 */ -module.exports = { - - GenerateTexture: __webpack_require__(213), - Palettes: __webpack_require__(452) +var Visible = { -}; + _visible: true, + /** + * The visible state of the Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @name Phaser.GameObjects.Components.Visible#visible + * @type {boolean} + * @since 3.0.0 + */ + visible: { -/***/ }), -/* 452 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this._visible; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + set: function (value) + { + if (value) + { + this._visible = true; + this.renderFlags |= _FLAG; + } + else + { + this._visible = false; + this.renderFlags &= ~_FLAG; + } + } -/** - * @namespace Phaser.Create.Palettes - */ + }, -module.exports = { + /** + * Sets the visibility of this Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @method Phaser.GameObjects.Components.Visible#setVisible + * @since 3.0.0 + * + * @param {boolean} value - The visible state of the Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setVisible: function (value) + { + this.visible = value; - ARNE16: __webpack_require__(214), - C64: __webpack_require__(453), - CGA: __webpack_require__(454), - JMP: __webpack_require__(455), - MSX: __webpack_require__(456) - + return this; + } }; +module.exports = Visible; + /***/ }), -/* 453 */ +/* 408 */ /***/ (function(module, exports) { /** @@ -77752,51 +79738,31 @@ module.exports = { */ /** - * A 16 color palette inspired by the Commodore 64. - * - * @name Phaser.Create.Palettes.C64 + * [description] + * + * @function Phaser.Actions.IncAlpha * @since 3.0.0 * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -module.exports = { - 0: '#000', - 1: '#fff', - 2: '#8b4131', - 3: '#7bbdc5', - 4: '#8b41ac', - 5: '#6aac41', - 6: '#3931a4', - 7: '#d5de73', - 8: '#945a20', - 9: '#5a4100', - A: '#bd736a', - B: '#525252', - C: '#838383', - D: '#acee8b', - E: '#7b73de', - F: '#acacac' +var IncAlpha = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].alpha += value; + } + + return items; }; +module.exports = IncAlpha; + /***/ }), -/* 454 */ +/* 409 */ /***/ (function(module, exports) { /** @@ -77806,51 +79772,31 @@ module.exports = { */ /** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.CGA + * [description] + * + * @function Phaser.Actions.IncX * @since 3.0.0 * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -module.exports = { - 0: '#000', - 1: '#2234d1', - 2: '#0c7e45', - 3: '#44aacc', - 4: '#8a3622', - 5: '#5c2e78', - 6: '#aa5c3d', - 7: '#b5b5b5', - 8: '#5e606e', - 9: '#4c81fb', - A: '#6cd947', - B: '#7be2f9', - C: '#eb8a60', - D: '#e23d69', - E: '#ffd93f', - F: '#fff' +var IncX = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].x += value; + } + + return items; }; +module.exports = IncX; + /***/ }), -/* 455 */ +/* 410 */ /***/ (function(module, exports) { /** @@ -77860,51 +79806,33 @@ module.exports = { */ /** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @type {object} + * [description] + * + * @function Phaser.Actions.IncXY * @since 3.0.0 * - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#f5f4eb' +var IncXY = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) + { + items[i].x += x; + items[i].y += y; + } + + return items; }; +module.exports = IncXY; + /***/ }), -/* 456 */ +/* 411 */ /***/ (function(module, exports) { /** @@ -77914,52 +79842,32 @@ module.exports = { */ /** - * A 16 color palette inspired by Japanese computers like the MSX. - * - * @name Phaser.Create.Palettes.MSX + * [description] + * + * @function Phaser.Actions.IncY * @since 3.0.0 * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#fff' +var IncY = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].y += value; + } + + return items; }; +module.exports = IncY; + /***/ }), -/* 457 */ -/***/ (function(module, exports, __webpack_require__) { +/* 412 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -77968,25 +79876,43 @@ module.exports = { */ /** - * @namespace Phaser.Curves + * [description] + * + * @function Phaser.Actions.PlaceOnCircle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=6.28] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var PlaceOnCircle = function (items, circle, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } -module.exports = { + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; - Path: __webpack_require__(458), + for (var i = 0; i < items.length; i++) + { + items[i].x = circle.x + (circle.radius * Math.cos(angle)); + items[i].y = circle.y + (circle.radius * Math.sin(angle)); - CubicBezier: __webpack_require__(215), - Curve: __webpack_require__(66), - Ellipse: __webpack_require__(217), - Line: __webpack_require__(219), - Spline: __webpack_require__(220) + angle += angleStep; + } + return items; }; +module.exports = PlaceOnCircle; + /***/ }), -/* 458 */ -/***/ (function(module, exports, __webpack_require__) { +/* 413 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -77994,764 +79920,582 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var Class = __webpack_require__(0); -var CubicBezierCurve = __webpack_require__(215); -var EllipseCurve = __webpack_require__(217); -var GameObjectFactory = __webpack_require__(9); -var LineCurve = __webpack_require__(219); -var MovePathTo = __webpack_require__(459); -var Rectangle = __webpack_require__(8); -var SplineCurve = __webpack_require__(220); -var Vector2 = __webpack_require__(6); - /** - * @classdesc * [description] * - * @class Path - * @memberOf Phaser.Curves - * @constructor + * @function Phaser.Actions.PlaceOnEllipse * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=6.28] - [description] * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] + * @return {array} The array of Game Objects that was passed to this Action. */ -var Path = new Class({ +var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } - initialize: + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; - function Path (x, y) + var a = ellipse.width / 2; + var b = ellipse.height / 2; + + for (var i = 0; i < items.length; i++) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + items[i].x = ellipse.x + a * Math.cos(angle); + items[i].y = ellipse.y + b * Math.sin(angle); - /** - * [description] - * - * @name Phaser.Curves.Path#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; + angle += angleStep; + } - /** - * [description] - * - * @name Phaser.Curves.Path#curves - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.curves = []; + return items; +}; - /** - * [description] - * - * @name Phaser.Curves.Path#cacheLengths - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; +module.exports = PlaceOnEllipse; - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); +/***/ }), +/* 414 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); +var GetPoints = __webpack_require__(109); - if (typeof x === 'object') - { - this.fromJSON(x); - } - else - { - this.startPoint.set(x, y); - } - }, +/** + * [description] + * + * @function Phaser.Actions.PlaceOnLine + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnLine = function (items, line) +{ + var points = GetPoints(line, items.length); - /** - * [description] - * - * @method Phaser.Curves.Path#add - * @since 3.0.0 - * - * @param {Phaser.Curves.Curve} curve - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - add: function (curve) + for (var i = 0; i < items.length; i++) { - this.curves.push(curve); + var item = items[i]; + var point = points[i]; - return this; - }, + item.x = point.x; + item.y = point.y; + } - /** - * [description] - * - * @method Phaser.Curves.Path#circleTo - * @since 3.0.0 - * - * @param {number} radius - [description] - * @param {boolean} [clockwise] - [description] - * @param {number} [rotation] - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - circleTo: function (radius, clockwise, rotation) - { - if (clockwise === undefined) { clockwise = false; } + return items; +}; - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); - }, +module.exports = PlaceOnLine; - /** - * [description] - * - * @method Phaser.Curves.Path#closePath - * @since 3.0.0 - * - * @return {Phaser.Curves.Path} [description] - */ - closePath: function () - { - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (!startPoint.equals(endPoint)) - { - // This will copy a reference to the vectors, which probably isn't sensible - this.curves.push(new LineCurve(endPoint, startPoint)); - } +/***/ }), +/* 415 */ +/***/ (function(module, exports, __webpack_require__) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points +var MarchingAnts = __webpack_require__(189); +var RotateLeft = __webpack_require__(190); +var RotateRight = __webpack_require__(191); - /** - * [description] - * - * @method Phaser.Curves.Path#cubicBezierTo - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {Phaser.Math.Vector2} control1X - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control1Y - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control2X - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control2Y - {Phaser.Math[description] - * - * @return {Phaser.Curves.Path} [description] - */ - cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) - { - var p0 = this.getEndPoint(); - var p1; - var p2; - var p3; +// Place the items in the array around the perimeter of the given rectangle. - // Assume they're all vec2s - if (x instanceof Vector2) - { - p1 = x; - p2 = y; - p3 = control1X; - } - else - { - p1 = new Vector2(control1X, control1Y); - p2 = new Vector2(control2X, control2Y); - p3 = new Vector2(x, y); - } +// Placement starts from the top-left of the rectangle, and proceeds in a +// clockwise direction. If the shift parameter is given you can offset where +// placement begins. - return this.add(new CubicBezierCurve(p0, p1, p2, p3)); - }, +/** + * [description] + * + * @function Phaser.Actions.PlaceOnRectangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {integer} [shift=1] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnRectangle = function (items, rect, shift) +{ + if (shift === undefined) { shift = 0; } - /** - * [description] - * - * @method Phaser.Curves.Path#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.curves.length = 0; - this.cacheLengths.length = 0; - this.startPoint = undefined; - }, + var points = MarchingAnts(rect, false, items.length); - /** - * [description] - * - * @method Phaser.Curves.Path#draw - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {integer} [pointsTotal=32] - [description] - * - * @return {Phaser.GameObjects.Graphics} [description] - */ - draw: function (graphics, pointsTotal) + if (shift > 0) { - for (var i = 0; i < this.curves.length; i++) - { - var curve = this.curves[i]; - - if (!curve.active) - { - continue; - } - - curve.draw(graphics, pointsTotal); - } - - return graphics; - }, + RotateLeft(points, shift); + } + else if (shift < 0) + { + RotateRight(points, Math.abs(shift)); + } - /** - * Creates an ellipse curve positioned at the previous end point, using the given parameters. - * - * @method Phaser.Curves.Path#ellipseTo - * @since 3.0.0 - * - * @param {number} xRadius - [description] - * @param {number} yRadius - [description] - * @param {number} startAngle - [description] - * @param {number} endAngle - [description] - * @param {boolean} clockwise - [description] - * @param {number} rotation - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + for (var i = 0; i < items.length; i++) { - var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); + items[i].x = points[i].x; + items[i].y = points[i].y; + } - var end = this.getEndPoint(this._tmpVec2A); + return items; +}; - // Calculate where to center the ellipse - var start = ellipse.getStartPoint(this._tmpVec2B); +module.exports = PlaceOnRectangle; - end.subtract(start); - ellipse.x = end.x; - ellipse.y = end.y; +/***/ }), +/* 416 */ +/***/ (function(module, exports, __webpack_require__) { - return this.add(ellipse); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.Path#fromJSON - * @since 3.0.0 - * - * @param {object} data - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - fromJSON: function (data) - { - // data should be an object matching the Path.toJSON object structure. +// var GetPointsOnLine = require('../geom/line/GetPointsOnLine'); +var BresenhamPoints = __webpack_require__(192); - this.curves = []; - this.cacheLengths = []; +/** + * [description] + * + * @function Phaser.Actions.PlaceOnTriangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {number} [stepRate=1] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnTriangle = function (items, triangle, stepRate) +{ + var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); + var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); + var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); - this.startPoint.set(data.x, data.y); + // Remove overlaps + p1.pop(); + p2.pop(); + p3.pop(); - this.autoClose = data.autoClose; + p1 = p1.concat(p2, p3); - for (var i = 0; i < data.curves.length; i++) - { - var curve = data.curves[i]; + var step = p1.length / items.length; + var p = 0; - switch (curve.type) - { - case 'LineCurve': - this.add(LineCurve.fromJSON(curve)); - break; + for (var i = 0; i < items.length; i++) + { + var item = items[i]; + var point = p1[Math.floor(p)]; - case 'EllipseCurve': - this.add(EllipseCurve.fromJSON(curve)); - break; + item.x = point.x; + item.y = point.y; - case 'SplineCurve': - this.add(SplineCurve.fromJSON(curve)); - break; + p += step; + } - case 'CubicBezierCurve': - this.add(CubicBezierCurve.fromJSON(curve)); - break; - } - } + return items; +}; - return this; - }, +module.exports = PlaceOnTriangle; - /** - * [description] - * - * @method Phaser.Curves.Path#getBounds - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} [out] - [description] - * @param {integer} [accuracy=16] - [description] - * - * @return {Phaser.Geom.Rectangle} [description] - */ - getBounds: function (out, accuracy) - { - if (out === undefined) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } - out.x = Number.MAX_VALUE; - out.y = Number.MAX_VALUE; +/***/ }), +/* 417 */ +/***/ (function(module, exports) { - var bounds = new Rectangle(); - var maxRight = Number.MIN_SAFE_INTEGER; - var maxBottom = Number.MIN_SAFE_INTEGER; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (var i = 0; i < this.curves.length; i++) - { - var curve = this.curves[i]; +/** + * [description] + * + * @function Phaser.Actions.PlayAnimation + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} key - [description] + * @param {string|integer} [startFrame] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlayAnimation = function (items, key, startFrame) +{ + for (var i = 0; i < items.length; i++) + { + items[i].anims.play(key, startFrame); + } - if (!curve.active) - { - continue; - } + return items; +}; - curve.getBounds(bounds, accuracy); +module.exports = PlayAnimation; - out.x = Math.min(out.x, bounds.x); - out.y = Math.min(out.y, bounds.y); - maxRight = Math.max(maxRight, bounds.right); - maxBottom = Math.max(maxBottom, bounds.bottom); - } +/***/ }), +/* 418 */ +/***/ (function(module, exports, __webpack_require__) { - out.right = maxRight; - out.bottom = maxBottom; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return out; - }, +var Random = __webpack_require__(106); - /** - * [description] - * - * @method Phaser.Curves.Path#getCurveLengths - * @since 3.0.0 - * - * @return {array} [description] - */ - getCurveLengths: function () +/** + * [description] + * + * @function Phaser.Actions.RandomCircle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomCircle = function (items, circle) +{ + for (var i = 0; i < items.length; i++) { - // We use cache values if curves and cache array are same length - - if (this.cacheLengths.length === this.curves.length) - { - return this.cacheLengths; - } + Random(circle, items[i]); + } - // Get length of sub-curve - // Push sums into cached array + return items; +}; - var lengths = []; - var sums = 0; +module.exports = RandomCircle; - for (var i = 0; i < this.curves.length; i++) - { - sums += this.curves[i].getLength(); - lengths.push(sums); - } +/***/ }), +/* 419 */ +/***/ (function(module, exports, __webpack_require__) { - this.cacheLengths = lengths; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return lengths; - }, +var Random = __webpack_require__(110); - /** - * [description] - * - * @method Phaser.Curves.Path#getEndPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getEndPoint: function (out) +/** + * [description] + * + * @function Phaser.Actions.RandomEllipse + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomEllipse = function (items, ellipse) +{ + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + Random(ellipse, items[i]); + } - if (this.curves.length > 0) - { - this.curves[this.curves.length - 1].getPoint(1, out); - } - else - { - out.copy(this.startPoint); - } + return items; +}; - return out; - }, +module.exports = RandomEllipse; - /** - * [description] - * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lens = this.getCurveLengths(); - return lens[lens.length - 1]; - }, +/***/ }), +/* 420 */ +/***/ (function(module, exports, __webpack_require__) { - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') +var Random = __webpack_require__(111); - /** - * [description] - * - * @method Phaser.Curves.Path#getPoint - * @since 3.0.0 - * - * @param {number} t - [description] - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2|null} [description] - */ - getPoint: function (t, out) +/** + * [description] + * + * @function Phaser.Actions.RandomLine + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomLine = function (items, line) +{ + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + Random(line, items[i]); + } - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; + return items; +}; - while (i < curveLengths.length) - { - if (curveLengths[i] >= d) - { - var diff = curveLengths[i] - d; - var curve = this.curves[i]; +module.exports = RandomLine; - var segmentLength = curve.getLength(); - var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; - return curve.getPointAt(u, out); - } +/***/ }), +/* 421 */ +/***/ (function(module, exports, __webpack_require__) { - i++; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // loop where sum != 0, sum > d , sum+1 + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (var j = 0; j < pts.length; j++) - { - var point = pts[j]; +var Random = __webpack_require__(112); - if (last && last.equals(point)) - { - // ensures no consecutive points are duplicates - continue; - } +/** + * [description] + * + * @function Phaser.Actions.RandomTriangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomTriangle = function (items, triangle) +{ + for (var i = 0; i < items.length; i++) + { + Random(triangle, items[i]); + } - points.push(point); + return items; +}; - last = point; - } - } +module.exports = RandomTriangle; - if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) - { - points.push(points[0]); - } - return points; - }, +/***/ }), +/* 423 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Curves.Path#getRandomPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getRandomPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this.getPoint(Math.random(), out); - }, +/** + * [description] + * + * @function Phaser.Actions.Rotate + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var Rotate = function (items, value, step) +{ + if (step === undefined) { step = 0; } - /** - * [description] - * - * @method Phaser.Curves.Path#getSpacedPoints - * @since 3.0.0 - * - * @param {integer} [divisions=40] - [description] - * - * @return {Phaser.Math.Vector2[]} [description] - */ - getSpacedPoints: function (divisions) + for (var i = 0; i < items.length; i++) { - if (divisions === undefined) { divisions = 40; } + items[i].rotation += value + (i * step); + } - var points = []; + return items; +}; - for (var i = 0; i <= divisions; i++) - { - points.push(this.getPoint(i / divisions)); - } +module.exports = Rotate; - if (this.autoClose) - { - points.push(points[0]); - } - return points; - }, +/***/ }), +/* 424 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Curves.Path#getStartPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return out.copy(this.startPoint); - }, +var RotateAroundDistance = __webpack_require__(113); +var DistanceBetween = __webpack_require__(42); - // Creates a line curve from the previous end point to x/y +/** + * [description] + * + * @function Phaser.Actions.RotateAround + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RotateAround = function (items, point, angle) +{ + var x = point.x; + var y = point.y; - /** - * [description] - * - * @method Phaser.Curves.Path#lineTo - * @since 3.0.0 - * - * @param {number|Phaser.Math.Vector2} x - {Phaser.Math[description] - * @param {number} [y] - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - lineTo: function (x, y) + for (var i = 0; i < items.length; i++) { - if (x instanceof Vector2) - { - this._tmpVec2B.copy(x); - } - else - { - this._tmpVec2B.set(x, y); - } + var item = items[i]; - var end = this.getEndPoint(this._tmpVec2A); + RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); + } - return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); - }, + return items; +}; - // Creates a spline curve starting at the previous end point, using the given parameters +module.exports = RotateAround; - /** - * [description] - * - * @method Phaser.Curves.Path#splineTo - * @since 3.0.0 - * - * @param {[type]} points - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - splineTo: function (points) - { - points.unshift(this.getEndPoint()); - return this.add(new SplineCurve(points)); - }, +/***/ }), +/* 425 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Curves.Path#moveTo - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - moveTo: function (x, y) - { - return this.add(new MovePathTo(x, y)); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () +var MathRotateAroundDistance = __webpack_require__(113); + +/** + * [description] + * + * @function Phaser.Actions.RotateAroundDistance + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * @param {number} distance - The distance from the point of rotation in pixels. + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RotateAroundDistance = function (items, point, angle, distance) +{ + var x = point.x; + var y = point.y; + + // There's nothing to do + if (distance === 0) { - var out = []; + return items; + } - for (var i = 0; i < this.curves.length; i++) - { - out.push(this.curves[i].toJSON()); - } + for (var i = 0; i < items.length; i++) + { + MathRotateAroundDistance(items[i], x, y, angle, distance); + } - return { - type: 'Path', - x: this.startPoint.x, - y: this.startPoint.y, - autoClose: this.autoClose, - curves: out - }; - }, + return items; +}; - // cacheLengths must be recalculated. +module.exports = RotateAroundDistance; - /** - * [description] - * - * @method Phaser.Curves.Path#updateArcLengths - * @since 3.0.0 - */ - updateArcLengths: function () - { - this.cacheLengths = []; - this.getCurveLengths(); - } +/***/ }), +/* 426 */ +/***/ (function(module, exports) { -}); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ /** - * Creates a new Path Object. + * [description] * - * @method Phaser.GameObjects.GameObjectFactory#path + * @function Phaser.Actions.ScaleX * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Path. - * @param {number} y - The vertical position of this Path. * - * @return {Phaser.Curves.Path} The Path Object that was created. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -GameObjectFactory.register('path', function (x, y) +var ScaleX = function (items, value) { - return new Path(x, y); -}); + for (var i = 0; i < items.length; i++) + { + items[i].scaleX += value; + } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + return items; +}; -module.exports = Path; +module.exports = ScaleX; /***/ }), -/* 459 */ -/***/ (function(module, exports, __webpack_require__) { +/* 427 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -78759,135 +80503,35 @@ module.exports = Path; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Vector2 = __webpack_require__(6); - /** - * @classdesc * [description] * - * @class MoveTo - * @memberOf Phaser.Curves - * @constructor + * @function Phaser.Actions.ScaleXY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] * - * @param {number} [x] - [description] - * @param {number} [y] - [description] + * @return {array} The array of Game Objects that was passed to this Action. */ -var MoveTo = new Class({ - - initialize: - - function MoveTo (x, y) - { - // Skip length calcs in paths - - /** - * [description] - * - * @name Phaser.Curves.MoveTo#active - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.active = false; - - /** - * [description] - * - * @name Phaser.Curves.MoveTo#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = new Vector2(x, y); - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @param {[type]} t - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } - - return out.copy(this.p0); - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getPointAt - * @since 3.0.0 - * - * @param {[type]} u - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getResolution: function () - { - return 1; - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getLength: function () - { - return 0; - }, - - /** - * [description] - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {[type]} [description] - */ - toJSON: function () +var ScaleXY = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; + items[i].scaleX += x; + items[i].scaleY += y; } -}); + return items; +}; -module.exports = MoveTo; +module.exports = ScaleXY; /***/ }), -/* 460 */ -/***/ (function(module, exports, __webpack_require__) { +/* 428 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -78896,20 +80540,32 @@ module.exports = MoveTo; */ /** - * @namespace Phaser.Data + * [description] + * + * @function Phaser.Actions.ScaleY + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var ScaleY = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].scaleY += value; + } -module.exports = { - - DataManager: __webpack_require__(79), - DataManagerPlugin: __webpack_require__(461) - + return items; }; +module.exports = ScaleY; + /***/ }), -/* 461 */ -/***/ (function(module, exports, __webpack_require__) { +/* 429 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -78917,107 +80573,36 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var DataManager = __webpack_require__(79); -var PluginManager = __webpack_require__(12); - /** - * @classdesc - * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. + * [description] * - * @class DataManagerPlugin - * @extends Phaser.Data.DataManager - * @memberOf Phaser.Data - * @constructor + * @function Phaser.Actions.SetAlpha * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.Scene} scene - [description] + * @return {array} The array of Game Objects that was passed to this Action. */ -var DataManagerPlugin = new Class({ - - Extends: DataManager, - - initialize: - - function DataManagerPlugin (scene) - { - /** - * [description] - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * [description] - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - if (!scene.sys.settings.isBooted) - { - scene.sys.events.once('boot', this.boot, this); - } - - DataManager.call(this, this.scene, scene.sys.events); - }, - - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#boot - * @since 3.0.0 - */ - boot: function () - { - var eventEmitter = this.systems.events; - - eventEmitter.on('shutdown', this.shutdownPlugin, this); - eventEmitter.on('destroy', this.destroyPlugin, this); - }, - - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#shutdownPlugin - * @since 3.0.0 - */ - shutdownPlugin: function () - { - // Should we reset the events? - }, +var SetAlpha = function (items, value, step) +{ + if (step === undefined) { step = 0; } - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#destroyPlugin - * @since 3.0.0 - */ - destroyPlugin: function () + for (var i = 0; i < items.length; i++) { - this.destroy(); - - this.scene = undefined; - this.systems = undefined; + items[i].alpha = value + (i * step); } -}); - -PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data'); + return items; +}; -module.exports = DataManagerPlugin; +module.exports = SetAlpha; /***/ }), -/* 462 */ -/***/ (function(module, exports, __webpack_require__) { +/* 430 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79026,23 +80611,32 @@ module.exports = DataManagerPlugin; */ /** - * @namespace Phaser.Display + * [description] + * + * @function Phaser.Actions.SetBlendMode + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetBlendMode = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setBlendMode(value); + } -module.exports = { - - Align: __webpack_require__(463), - Bounds: __webpack_require__(478), - Canvas: __webpack_require__(481), - Color: __webpack_require__(222), - Masks: __webpack_require__(492) - + return items; }; +module.exports = SetBlendMode; + /***/ }), -/* 463 */ -/***/ (function(module, exports, __webpack_require__) { +/* 431 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79051,20 +80645,35 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align + * [description] + * + * @function Phaser.Actions.SetDepth + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetDepth = function (items, value, step) +{ + if (step === undefined) { step = 0; } -module.exports = { - - In: __webpack_require__(464), - To: __webpack_require__(465) + for (var i = 0; i < items.length; i++) + { + items[i].depth = value + (i * step); + } + return items; }; +module.exports = SetDepth; + /***/ }), -/* 464 */ -/***/ (function(module, exports, __webpack_require__) { +/* 432 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79073,28 +80682,33 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align.In + * [description] + * + * @function Phaser.Actions.SetHitArea + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {any} hitArea - [description] + * @param {function} hitAreaCallback - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetHitArea = function (items, hitArea, hitAreaCallback) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setInteractive(hitArea, hitAreaCallback); + } -module.exports = { - - BottomCenter: __webpack_require__(171), - BottomLeft: __webpack_require__(172), - BottomRight: __webpack_require__(173), - Center: __webpack_require__(174), - LeftCenter: __webpack_require__(176), - QuickSet: __webpack_require__(169), - RightCenter: __webpack_require__(177), - TopCenter: __webpack_require__(178), - TopLeft: __webpack_require__(179), - TopRight: __webpack_require__(180) - + return items; }; +module.exports = SetHitArea; + /***/ }), -/* 465 */ -/***/ (function(module, exports, __webpack_require__) { +/* 433 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79103,30 +80717,33 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align.To + * [description] + * + * @function Phaser.Actions.SetOrigin + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetOrigin = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setOrigin(x, y); + } -module.exports = { - - BottomCenter: __webpack_require__(466), - BottomLeft: __webpack_require__(467), - BottomRight: __webpack_require__(468), - LeftBottom: __webpack_require__(469), - LeftCenter: __webpack_require__(470), - LeftTop: __webpack_require__(471), - RightBottom: __webpack_require__(472), - RightCenter: __webpack_require__(473), - RightTop: __webpack_require__(474), - TopCenter: __webpack_require__(475), - TopLeft: __webpack_require__(476), - TopRight: __webpack_require__(477) - + return items; }; +module.exports = SetOrigin; + /***/ }), -/* 466 */ -/***/ (function(module, exports, __webpack_require__) { +/* 434 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79134,41 +80751,36 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetCenterX = __webpack_require__(46); -var SetCenterX = __webpack_require__(47); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. + * [description] * - * @function Phaser.Display.Align.To.BottomCenter + * @function Phaser.Actions.SetRotation * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetRotation = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].rotation = value + (i * step); + } - return gameObject; + return items; }; -module.exports = BottomCenter; +module.exports = SetRotation; /***/ }), -/* 467 */ -/***/ (function(module, exports, __webpack_require__) { +/* 435 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79176,41 +80788,42 @@ module.exports = BottomCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. + * [description] * - * @function Phaser.Display.Align.To.BottomLeft + * @function Phaser.Actions.SetScale * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} [stepX=0] - [description] + * @param {number} [stepY=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) +var SetScale = function (items, x, y, stepX, stepY) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (stepX === undefined) { stepX = 0; } + if (stepY === undefined) { stepY = 0; } - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].setScale( + x + (i * stepX), + y + (i * stepY) + ); + } - return gameObject; + return items; }; -module.exports = BottomLeft; +module.exports = SetScale; /***/ }), -/* 468 */ -/***/ (function(module, exports, __webpack_require__) { +/* 436 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79218,41 +80831,36 @@ module.exports = BottomLeft; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. - * - * @function Phaser.Display.Align.To.BottomRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * [description] * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @function Phaser.Actions.SetScaleX + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomRight = function (gameObject, alignTo, offsetX, offsetY) +var SetScaleX = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].scaleX = value + (i * step); + } - return gameObject; + return items; }; -module.exports = BottomRight; +module.exports = SetScaleX; /***/ }), -/* 469 */ -/***/ (function(module, exports, __webpack_require__) { +/* 437 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79260,41 +80868,36 @@ module.exports = BottomRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftBottom + * @function Phaser.Actions.SetScaleY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) +var SetScaleY = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].scaleY = value + (i * step); + } - return gameObject; + return items; }; -module.exports = LeftBottom; +module.exports = SetScaleY; /***/ }), -/* 470 */ -/***/ (function(module, exports, __webpack_require__) { +/* 438 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79302,41 +80905,36 @@ module.exports = LeftBottom; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(49); -var GetLeft = __webpack_require__(26); -var SetCenterY = __webpack_require__(48); -var SetRight = __webpack_require__(29); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftCenter + * @function Phaser.Actions.SetTint * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} topLeft - [description] + * @param {number} [topRight] - [description] + * @param {number} [bottomLeft] - [description] + * @param {number} [bottomRight] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); + } - return gameObject; + return items; }; -module.exports = LeftCenter; +module.exports = SetTint; /***/ }), -/* 471 */ -/***/ (function(module, exports, __webpack_require__) { +/* 439 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79344,41 +80942,33 @@ module.exports = LeftCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftTop + * @function Phaser.Actions.SetVisible * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {boolean} value - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftTop = function (gameObject, alignTo, offsetX, offsetY) +var SetVisible = function (items, value) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].visible = value; + } - return gameObject; + return items; }; -module.exports = LeftTop; +module.exports = SetVisible; /***/ }), -/* 472 */ -/***/ (function(module, exports, __webpack_require__) { +/* 440 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79386,41 +80976,36 @@ module.exports = LeftTop; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightBottom + * @function Phaser.Actions.SetX * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightBottom = function (gameObject, alignTo, offsetX, offsetY) +var SetX = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].x = value + (i * step); + } - return gameObject; + return items; }; -module.exports = RightBottom; +module.exports = SetX; /***/ }), -/* 473 */ -/***/ (function(module, exports, __webpack_require__) { +/* 441 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79428,41 +81013,40 @@ module.exports = RightBottom; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(49); -var GetRight = __webpack_require__(28); -var SetCenterY = __webpack_require__(48); -var SetLeft = __webpack_require__(27); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightCenter + * @function Phaser.Actions.SetXY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} [stepX=0] - [description] + * @param {number} [stepY=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetXY = function (items, x, y, stepX, stepY) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (stepX === undefined) { stepX = 0; } + if (stepY === undefined) { stepY = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].x = x + (i * stepX); + items[i].y = y + (i * stepY); + } - return gameObject; + return items; }; -module.exports = RightCenter; +module.exports = SetXY; /***/ }), -/* 474 */ -/***/ (function(module, exports, __webpack_require__) { +/* 442 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -79470,40 +81054,35 @@ module.exports = RightCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightTop + * @function Phaser.Actions.SetY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightTop = function (gameObject, alignTo, offsetX, offsetY) +var SetY = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].y = value + (i * step); + } - return gameObject; + return items; }; -module.exports = RightTop; +module.exports = SetY; /***/ }), -/* 475 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79512,40 +81091,125 @@ module.exports = RightTop; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterX = __webpack_require__(46); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetCenterX = __webpack_require__(47); +var Vector2 = __webpack_require__(6); + +// Iterate through items changing the position of each element to +// be that of the element that came before it in the array (or after it if direction = 1) +// The first items position is set to x/y. +// The final x/y coords are returned /** - * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopCenter + * @function Phaser.Actions.ShiftPosition * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {integer} [direction=0] - [description] + * @param {Phaser.Math.Vector2|object} [output] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopCenter = function (gameObject, alignTo, offsetX, offsetY) +var ShiftPosition = function (items, x, y, direction, output) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (direction === undefined) { direction = 0; } + if (output === undefined) { output = new Vector2(); } - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + var px; + var py; - return gameObject; + if (items.length > 1) + { + var i; + var cx; + var cy; + var cur; + + if (direction === 0) + { + // Bottom to Top + + var len = items.length - 1; + + px = items[len].x; + py = items[len].y; + + for (i = len - 1; i >= 0; i--) + { + // Current item + cur = items[i]; + + // Get current item x/y, to be passed to the next item in the list + cx = cur.x; + cy = cur.y; + + // Set current item to the previous items x/y + cur.x = px; + cur.y = py; + + // Set current as previous + px = cx; + py = cy; + } + + // Update the head item to the new x/y coordinates + items[len].x = x; + items[len].y = y; + } + else + { + // Top to Bottom + + px = items[0].x; + py = items[0].y; + + for (i = 1; i < items.length; i++) + { + // Current item + cur = items[i]; + + // Get current item x/y, to be passed to the next item in the list + cx = cur.x; + cy = cur.y; + + // Set current item to the previous items x/y + cur.x = px; + cur.y = py; + + // Set current as previous + px = cx; + py = cy; + } + + // Update the head item to the new x/y coordinates + items[0].x = x; + items[0].y = y; + } + } + else + { + px = items[0].x; + py = items[0].y; + + items[0].x = x; + items[0].y = y; + } + + // Return the final set of coordinates as they're effectively lost from the shift and may be needed + + output.x = px; + output.y = py; + + return output; }; -module.exports = TopCenter; +module.exports = ShiftPosition; /***/ }), -/* 476 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79554,40 +81218,28 @@ module.exports = TopCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); +var ArrayShuffle = __webpack_require__(80); /** - * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopLeft + * @function Phaser.Actions.Shuffle * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopLeft = function (gameObject, alignTo, offsetX, offsetY) +var Shuffle = function (items) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; + return ArrayShuffle(items); }; -module.exports = TopLeft; +module.exports = Shuffle; /***/ }), -/* 477 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79596,40 +81248,52 @@ module.exports = TopLeft; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); +var MathSmootherStep = __webpack_require__(193); /** - * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopRight + * @function Phaser.Actions.SmootherStep * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopRight = function (gameObject, alignTo, offsetX, offsetY) +var SmootherStep = function (items, property, min, max, inc) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (inc === undefined) { inc = false; } - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + var step = Math.abs(max - min) / items.length; + var i; - return gameObject; + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmootherStep(i * step, min, max); + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmootherStep(i * step, min, max); + } + } + + return items; }; -module.exports = TopRight; +module.exports = SmootherStep; /***/ }), -/* 478 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79638,33 +81302,52 @@ module.exports = TopRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var MathSmoothStep = __webpack_require__(194); + /** - * @namespace Phaser.Display.Bounds + * [description] + * + * @function Phaser.Actions.SmoothStep + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SmoothStep = function (items, property, min, max, inc) +{ + if (inc === undefined) { inc = false; } -module.exports = { + var step = Math.abs(max - min) / items.length; + var i; - CenterOn: __webpack_require__(175), - GetBottom: __webpack_require__(24), - GetCenterX: __webpack_require__(46), - GetCenterY: __webpack_require__(49), - GetLeft: __webpack_require__(26), - GetOffsetX: __webpack_require__(479), - GetOffsetY: __webpack_require__(480), - GetRight: __webpack_require__(28), - GetTop: __webpack_require__(30), - SetBottom: __webpack_require__(25), - SetCenterX: __webpack_require__(47), - SetCenterY: __webpack_require__(48), - SetLeft: __webpack_require__(27), - SetRight: __webpack_require__(29), - SetTop: __webpack_require__(31) - + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmoothStep(i * step, min, max); + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmoothStep(i * step, min, max); + } + } + + return items; }; +module.exports = SmoothStep; + /***/ }), -/* 479 */ +/* 447 */ /***/ (function(module, exports) { /** @@ -79674,27 +81357,49 @@ module.exports = { */ /** - * Returns the amount the Game Object is visually offset from its x coordinate. - * This is the same as `width * origin.x`. - * This value will only be > 0 if `origin.x` is not equal to zero. + * [description] * - * @function Phaser.Display.Bounds.GetOffsetX + * @function Phaser.Actions.Spread * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The horizontal offset of the Game Object. + * @return {array} The array of Game Objects that was passed to this Action. */ -var GetOffsetX = function (gameObject) +var Spread = function (items, property, min, max, inc) { - return gameObject.width * gameObject.originX; + if (inc === undefined) { inc = false; } + + var step = Math.abs(max - min) / items.length; + var i; + + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += i * step; + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = i * step; + } + } + + return items; }; -module.exports = GetOffsetX; +module.exports = Spread; /***/ }), -/* 480 */ +/* 448 */ /***/ (function(module, exports) { /** @@ -79704,27 +81409,30 @@ module.exports = GetOffsetX; */ /** - * Returns the amount the Game Object is visually offset from its y coordinate. - * This is the same as `width * origin.y`. - * This value will only be > 0 if `origin.y` is not equal to zero. + * [description] * - * @function Phaser.Display.Bounds.GetOffsetY + * @function Phaser.Actions.ToggleVisible * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The vertical offset of the Game Object. + * @return {array} The array of Game Objects that was passed to this Action. */ -var GetOffsetY = function (gameObject) +var ToggleVisible = function (items) { - return gameObject.height * gameObject.originY; + for (var i = 0; i < items.length; i++) + { + items[i].visible = !items[i].visible; + } + + return items; }; -module.exports = GetOffsetY; +module.exports = ToggleVisible; /***/ }), -/* 481 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79734,23 +81442,21 @@ module.exports = GetOffsetY; */ /** - * @namespace Phaser.Display.Canvas + * @namespace Phaser.Animations */ module.exports = { - Interpolation: __webpack_require__(221), - Pool: __webpack_require__(21), - Smoothing: __webpack_require__(120), - TouchAction: __webpack_require__(482), - UserSelect: __webpack_require__(483) - + Animation: __webpack_require__(195), + AnimationFrame: __webpack_require__(196), + AnimationManager: __webpack_require__(197) + }; /***/ }), -/* 482 */ -/***/ (function(module, exports) { +/* 450 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -79759,33 +81465,20 @@ module.exports = { */ /** - * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. - * - * @function Phaser.Display.Canvas.TouchAction - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. - * - * @return {HTMLCanvasElement} The canvas element. + * @namespace Phaser.Cache */ -var TouchAction = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - canvas.style['msTouchAction'] = value; - canvas.style['ms-touch-action'] = value; - canvas.style['touch-action'] = value; +module.exports = { - return canvas; -}; + BaseCache: __webpack_require__(199), + CacheManager: __webpack_require__(200) -module.exports = TouchAction; +}; /***/ }), -/* 483 */ -/***/ (function(module, exports) { +/* 451 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -79794,45 +81487,21 @@ module.exports = TouchAction; */ /** - * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. - * - * @function Phaser.Display.Canvas.UserSelect - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. - * - * @return {HTMLCanvasElement} The canvas element. + * @namespace Phaser.Cameras */ -var UserSelect = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - - var vendors = [ - '-webkit-', - '-khtml-', - '-moz-', - '-ms-', - '' - ]; - vendors.forEach(function (vendor) - { - canvas.style[vendor + 'user-select'] = value; - }); +module.exports = { - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; + Controls: __webpack_require__(452), + Scene2D: __webpack_require__(455), + Sprite3D: __webpack_require__(457) - return canvas; }; -module.exports = UserSelect; - /***/ }), -/* 484 */ -/***/ (function(module, exports) { +/* 452 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -79841,45 +81510,19 @@ module.exports = UserSelect; */ /** - * @typedef {Object} ColorObject - * @property {number} r - The red color value in the range 0 to 255. - * @property {number} g - The green color value in the range 0 to 255. - * @property {number} b - The blue color value in the range 0 to 255. - * @property {number} a - The alpha color value in the range 0 to 255. + * @namespace Phaser.Cameras.Controls */ -/** - * Converts the given color value into an Object containing r,g,b and a properties. - * - * @function Phaser.Display.Color.ColorToRGBA - * @since 3.0.0 - * - * @param {number} color - A color value, optionally including the alpha value. - * - * @return {ColorObject} An object containing the parsed color values. - */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; +module.exports = { - if (color > 16777215) - { - output.a = color >>> 24; - } + Fixed: __webpack_require__(453), + Smoothed: __webpack_require__(454) - return output; }; -module.exports = ColorToRGBA; - /***/ }), -/* 485 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79888,117 +81531,291 @@ module.exports = ColorToRGBA; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(36); -var HueToComponent = __webpack_require__(224); +var Class = __webpack_require__(0); +var GetValue = __webpack_require__(4); + +// var camControl = new CameraControl({ +// camera: this.cameras.main, +// left: cursors.left, +// right: cursors.right, +// speed: float OR { x: 0, y: 0 } +// }) /** - * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. + * @classdesc + * [description] * - * @function Phaser.Display.Color.HSLToColor + * @class FixedKeyControl + * @memberOf Phaser.Cameras.Controls + * @constructor * @since 3.0.0 * - * @param {number} h - The hue value in the range 0 to 1. - * @param {number} s - The saturation value in the range 0 to 1. - * @param {number} l - The lightness value in the range 0 to 1. - * - * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. + * @param {object} config - [description] */ -var HSLToColor = function (h, s, l) -{ - // achromatic by default - var r = l; - var g = l; - var b = l; +var FixedKeyControl = new Class({ - if (s !== 0) + initialize: + + function FixedKeyControl (config) { - var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#left + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - var color = new Color(); + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#right + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); - return color.setGLTo(r, g, b, 1); -}; + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#up + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); -module.exports = HSLToColor; + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#down + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); -/***/ }), -/* 486 */ -/***/ (function(module, exports) { + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed + * @type {float} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + /** + * The horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/***/ }), -/* 487 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var speed = GetValue(config, 'speed', null); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (typeof speed === 'number') + { + this.speedX = speed; + this.speedY = speed; + } + else + { + this.speedX = GetValue(config, 'speed.x', 0); + this.speedY = GetValue(config, 'speed.y', 0); + } -var HSVToRGB = __webpack_require__(225); + /** + * [description] + * + * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; -/** - * Get HSV color wheel values in an array which will be 360 elements in size. - * - * @function Phaser.Display.Color.HSVColorWheel - * @since 3.0.0 - * - * @param {number} [s=1] - The saturation, in the range 0 - 1. - * @param {number} [v=1] - The value, in the range 0 - 1. - * - * @return {array} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. - */ -var HSVColorWheel = function (s, v) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, - var colors = []; + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#start + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + start: function () + { + this.active = (this.camera !== null); - for (var c = 0; c <= 359; c++) + return this; + }, + + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#stop + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + stop: function () { - colors.push(HSVToRGB(c / 359, s, v)); + this.active = false; + + return this; + }, + + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Controls.FixedKeyControl#update + * @since 3.0.0 + * + * @param {number} delta - [description] + */ + update: function (delta) + { + if (!this.active) + { + return; + } + + if (delta === undefined) { delta = 1; } + + var cam = this.camera; + + if (this.up && this.up.isDown) + { + cam.scrollY -= ((this.speedY * delta) | 0); + } + else if (this.down && this.down.isDown) + { + cam.scrollY += ((this.speedY * delta) | 0); + } + + if (this.left && this.left.isDown) + { + cam.scrollX -= ((this.speedX * delta) | 0); + } + else if (this.right && this.right.isDown) + { + cam.scrollX += ((this.speedX * delta) | 0); + } + + // Camera zoom + + if (this.zoomIn && this.zoomIn.isDown) + { + cam.zoom -= this.zoomSpeed; + + if (cam.zoom < 0.1) + { + cam.zoom = 0.1; + } + } + else if (this.zoomOut && this.zoomOut.isDown) + { + cam.zoom += this.zoomSpeed; + } + }, + + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.camera = null; + + this.left = null; + this.right = null; + this.up = null; + this.down = null; + + this.zoomIn = null; + this.zoomOut = null; } - return colors; -}; +}); -module.exports = HSVColorWheel; +module.exports = FixedKeyControl; /***/ }), -/* 488 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80007,245 +81824,463 @@ module.exports = HSVColorWheel; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Linear = __webpack_require__(226); +var Class = __webpack_require__(0); +var GetValue = __webpack_require__(4); -/** - * Interpolates color values - * - * @namespace Phaser.Display.Color.Interpolate - * @since 3.0.0 - */ +// var controlConfig = { +// camera: this.cameras.main, +// left: cursors.left, +// right: cursors.right, +// up: cursors.up, +// down: cursors.down, +// zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), +// zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), +// zoomSpeed: 0.02, +// acceleration: 0.06, +// drag: 0.0005, +// maxSpeed: 1.0 +// }; /** - * Interpolates between the two given color ranges over the length supplied. + * @classdesc + * [description] * - * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @class SmoothedKeyControl + * @memberOf Phaser.Cameras.Controls + * @constructor * @since 3.0.0 * - * @param {number} r1 - Red value. - * @param {number} g1 - Blue value. - * @param {number} b1 - Green value. - * @param {number} r2 - Red value. - * @param {number} g2 - Blue value. - * @param {number} b2 - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. + * @param {object} config - [description] */ -var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } +var SmoothedKeyControl = new Class({ - var t = index / length; + initialize: - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; + function SmoothedKeyControl (config) + { + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); -/** - * Interpolates between the two given color objects over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithColor - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {Phaser.Display.Color} color2 - The second Color object. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. - */ -var ColorWithColor = function (color1, color2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#left + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); -}; + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#right + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); -/** - * Interpolates between the Color object and color values over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithRGB - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {number} r - Red value. - * @param {number} g - Blue value. - * @param {number} b - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. - */ -var ColorWithRGB = function (color, r, g, b, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#up + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#down + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); -module.exports = { + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); -}; + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed + * @type {float} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + /** + * The horizontal acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/***/ }), -/* 489 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The vertical acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var accel = GetValue(config, 'acceleration', null); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (typeof accel === 'number') + { + this.accelX = accel; + this.accelY = accel; + } + else + { + this.accelX = GetValue(config, 'acceleration.x', 0); + this.accelY = GetValue(config, 'acceleration.y', 0); + } -var Between = __webpack_require__(228); -var Color = __webpack_require__(36); + /** + * The horizontal drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/** - * Creates a new Color object where the r, g, and b values have been set to random values - * based on the given min max values. - * - * @function Phaser.Display.Color.RandomRGB - * @since 3.0.0 - * - * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) - * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) - * - * @return {Phaser.Display.Color} A Color object. - */ -var RandomRGB = function (min, max) -{ - if (min === undefined) { min = 0; } - if (max === undefined) { max = 255; } + /** + * The vertical drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var drag = GetValue(config, 'drag', null); - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; + if (typeof drag === 'number') + { + this.dragX = drag; + this.dragY = drag; + } + else + { + this.dragX = GetValue(config, 'drag.x', 0); + this.dragY = GetValue(config, 'drag.y', 0); + } -module.exports = RandomRGB; + /** + * The maximum horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX + * @type {float} + * @default 0 + * @since 3.0.0 + */ + /** + * The maximum vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var maxSpeed = GetValue(config, 'maxSpeed', null); -/***/ }), -/* 490 */ -/***/ (function(module, exports) { + if (typeof maxSpeed === 'number') + { + this.maxSpeedX = maxSpeed; + this.maxSpeedY = maxSpeed; + } + else + { + this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); + this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedX = 0; -/** - * Converts an RGB color value to HSV (hue, saturation and value). - * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. - * Based on code by Michael Jackson (https://github.com/mjijackson) - * - * @function Phaser.Display.Color.RGBToHSV - * @since 3.0.0 - * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * - * @return {object} An object with the properties `h`, `s` and `v`. - */ -var RGBToHSV = function (r, g, b) -{ - r /= 255; - g /= 255; - b /= 255; + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedY = 0; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var d = max - min; + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; - // achromatic by default - var h = 0; - var s = (max === 0) ? 0 : d / max; - var v = max; + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, - if (max !== min) + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#start + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + start: function () { - if (max === r) + this.active = (this.camera !== null); + + return this; + }, + + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + stop: function () + { + this.active = false; + + return this; + }, + + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#update + * @since 3.0.0 + * + * @param {[type]} delta - [description] + */ + update: function (delta) + { + if (!this.active) + { + return; + } + + if (delta === undefined) { delta = 1; } + + var cam = this.camera; + + // Apply Deceleration + + if (this._speedX > 0) + { + this._speedX -= this.dragX * delta; + + if (this._speedX < 0) + { + this._speedX = 0; + } + } + else if (this._speedX < 0) + { + this._speedX += this.dragX * delta; + + if (this._speedX > 0) + { + this._speedX = 0; + } + } + + if (this._speedY > 0) + { + this._speedY -= this.dragY * delta; + + if (this._speedY < 0) + { + this._speedY = 0; + } + } + else if (this._speedY < 0) + { + this._speedY += this.dragY * delta; + + if (this._speedY > 0) + { + this._speedY = 0; + } + } + + // Check for keys + + if (this.up && this.up.isDown) + { + this._speedY += this.accelY; + + if (this._speedY > this.maxSpeedY) + { + this._speedY = this.maxSpeedY; + } + } + else if (this.down && this.down.isDown) + { + this._speedY -= this.accelY; + + if (this._speedY < -this.maxSpeedY) + { + this._speedY = -this.maxSpeedY; + } + } + + if (this.left && this.left.isDown) + { + this._speedX += this.accelX; + + if (this._speedX > this.maxSpeedX) + { + this._speedX = this.maxSpeedX; + } + } + else if (this.right && this.right.isDown) + { + this._speedX -= this.accelX; + + if (this._speedX < -this.maxSpeedX) + { + this._speedX = -this.maxSpeedX; + } + } + + // Camera zoom + + if (this.zoomIn && this.zoomIn.isDown) { - h = (g - b) / d + ((g < b) ? 6 : 0); + this._zoom = -this.zoomSpeed; } - else if (max === g) + else if (this.zoomOut && this.zoomOut.isDown) { - h = (b - r) / d + 2; + this._zoom = this.zoomSpeed; } - else if (max === b) + else { - h = (r - g) / d + 4; + this._zoom = 0; } - h /= 6; - } - - return { h: h, s: s, v: v }; -}; + // Apply to Camera -module.exports = RGBToHSV; + if (this._speedX !== 0) + { + cam.scrollX -= ((this._speedX * delta) | 0); + } + if (this._speedY !== 0) + { + cam.scrollY -= ((this._speedY * delta) | 0); + } -/***/ }), -/* 491 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._zoom !== 0) + { + cam.zoom += this._zoom; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (cam.zoom < 0.1) + { + cam.zoom = 0.1; + } + } + }, -var ComponentToHex = __webpack_require__(223); + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.camera = null; -/** - * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. - * - * @function Phaser.Display.Color.RGBToString - * @since 3.0.0 - * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * @param {integer} [a=255] - The alpha value. A number between 0 and 255. - * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. - * - * @return {string} A string-based representation of the color values. - */ -var RGBToString = function (r, g, b, a, prefix) -{ - if (a === undefined) { a = 255; } - if (prefix === undefined) { prefix = '#'; } + this.left = null; + this.right = null; + this.up = null; + this.down = null; - if (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - else - { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + this.zoomIn = null; + this.zoomOut = null; } -}; -module.exports = RGBToString; +}); + +module.exports = SmoothedKeyControl; /***/ }), -/* 492 */ +/* 455 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80255,19 +82290,19 @@ module.exports = RGBToString; */ /** - * @namespace Phaser.Display.Masks + * @namespace Phaser.Cameras.Scene2D */ module.exports = { - BitmapMask: __webpack_require__(493), - GeometryMask: __webpack_require__(494) + Camera: __webpack_require__(115), + CameraManager: __webpack_require__(456) }; /***/ }), -/* 493 */ +/* 456 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80276,357 +82311,495 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Camera = __webpack_require__(115); var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var PluginManager = __webpack_require__(12); +var RectangleContains = __webpack_require__(33); /** * @classdesc * [description] * - * @class BitmapMask - * @memberOf Phaser.Display.Masks + * @class CameraManager + * @memberOf Phaser.Cameras.Scene2D * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {[type]} renderable - [description] + * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. */ -var BitmapMask = new Class({ - +var CameraManager = new Class({ + initialize: - function BitmapMask (scene, renderable) + function CameraManager (scene) { - var renderer = scene.sys.game.renderer; - /** - * [description] + * The Scene that owns the Camera Manager plugin. * - * @name Phaser.Display.Masks.BitmapMask#bitmapMask - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.bitmapMask = renderable; + this.scene = scene; /** - * [description] + * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#maskRenderTarget - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#systems + * @type {Phaser.Scenes.Systems} * @since 3.0.0 */ - this.maskRenderTarget = null; + this.systems = scene.sys; - /** - * [description] - * - * @name Phaser.Display.Masks.BitmapMask#mainRenderTarget - * @type {[type]} - * @default null - * @since 3.0.0 - */ - this.mainRenderTarget = null; + if (!scene.sys.settings.isBooted) + { + scene.sys.events.once('boot', this.boot, this); + } /** - * [description] + * The current Camera ID. * - * @name Phaser.Display.Masks.BitmapMask#maskTexture - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#currentCameraId + * @type {number} + * @default 1 + * @readOnly * @since 3.0.0 */ - this.maskTexture = null; + this.currentCameraId = 1; /** - * [description] + * An Array of the Camera objects being managed by this Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#mainTexture - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#cameras + * @type {Phaser.Cameras.Scene2D.Camera[]} * @since 3.0.0 */ - this.mainTexture = null; + this.cameras = []; /** - * [description] + * A pool of Camera objects available to be used by the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#dirty - * @type {boolean} - * @default true + * @name Phaser.Cameras.Scene2D.CameraManager#cameraPool + * @type {Phaser.Cameras.Scene2D.Camera[]} * @since 3.0.0 */ - this.dirty = true; + this.cameraPool = []; + + if (scene.sys.settings.cameras) + { + // We have cameras to create + this.fromJSON(scene.sys.settings.cameras); + } + else + { + // Make one + this.add(); + } /** - * [description] + * The default Camera in the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#main + * @type {Phaser.Cameras.Scene2D.Camera} * @since 3.0.0 */ - this.mainFramebuffer = null; + this.main = this.cameras[0]; /** - * [description] + * This scale affects all cameras. It's used by Scale Manager. * - * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#baseScale + * @type {number} * @since 3.0.0 */ - this.maskFramebuffer = null; + this.baseScale = 1.0; + }, - if (renderer.gl) + /** + * Called when the Camera Manager boots. + * Starts the event listeners running. + * + * @method Phaser.Cameras.Scene2D.CameraManager#boot + * @since 3.0.0 + */ + boot: function () + { + var eventEmitter = this.systems.events; + + eventEmitter.on('update', this.update, this); + eventEmitter.on('shutdown', this.shutdown, this); + eventEmitter.on('destroy', this.destroy, this); + }, + + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.CameraManager#add + * @since 3.0.0 + * + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] + * @param {number} [width] - [description] + * @param {number} [height] - [description] + * @param {boolean} [makeMain=false] - [description] + * @param {string} [name=''] - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] + */ + add: function (x, y, width, height, makeMain, name) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.scene.sys.game.config.width; } + if (height === undefined) { height = this.scene.sys.game.config.height; } + if (makeMain === undefined) { makeMain = false; } + if (name === undefined) { name = ''; } + + var camera = null; + + if (this.cameraPool.length > 0) { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; + camera = this.cameraPool.pop(); - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); - - renderer.onContextRestored(function (renderer) - { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; + camera.setViewport(x, y, width, height); + } + else + { + camera = new Camera(x, y, width, height); + } - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); + camera.setName(name); + camera.setScene(this.scene); - }, this); + this.cameras.push(camera); + + if (makeMain) + { + this.main = camera; } + + camera._id = this.currentCameraId; + + this.currentCameraId = this.currentCameraId << 1; + + return camera; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#setBitmap + * @method Phaser.Cameras.Scene2D.CameraManager#addExisting * @since 3.0.0 * - * @param {[type]} renderable - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - setBitmap: function (renderable) + addExisting: function (camera) { - this.bitmapMask = renderable; + var index = this.cameras.indexOf(camera); + var poolIndex = this.cameraPool.indexOf(camera); + + if (index < 0 && poolIndex >= 0) + { + this.cameras.push(camera); + this.cameraPool.slice(poolIndex, 1); + return camera; + } + + return null; }, + /* + { + cameras: [ + { + name: string + x: int + y: int + width: int + height: int + zoom: float + rotation: float + roundPixels: bool + scrollX: float + scrollY: float + backgroundColor: string + bounds: { + x: int + y: int + width: int + height: int + } + } + ] + } + */ + /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} maskedObject - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {[type]} config - [description] + * + * @return {[type]} [description] */ - preRenderWebGL: function (renderer, maskedObject, camera) + fromJSON: function (config) { - renderer.pipelines.BitmapMaskPipeline.beginMask(this, maskedObject, camera); + if (!Array.isArray(config)) + { + config = [ config ]; + } + + var gameWidth = this.scene.sys.game.config.width; + var gameHeight = this.scene.sys.game.config.height; + + for (var i = 0; i < config.length; i++) + { + var cameraConfig = config[i]; + + var x = GetFastValue(cameraConfig, 'x', 0); + var y = GetFastValue(cameraConfig, 'y', 0); + var width = GetFastValue(cameraConfig, 'width', gameWidth); + var height = GetFastValue(cameraConfig, 'height', gameHeight); + + var camera = this.add(x, y, width, height); + + // Direct properties + camera.name = GetFastValue(cameraConfig, 'name', ''); + camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); + camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); + camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); + camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); + camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); + + // Background Color + + var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); + + if (backgroundColor) + { + camera.setBackgroundColor(backgroundColor); + } + + // Bounds + + var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); + + if (boundsConfig) + { + var bx = GetFastValue(boundsConfig, 'x', 0); + var by = GetFastValue(boundsConfig, 'y', 0); + var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); + var bheight = GetFastValue(boundsConfig, 'height', gameHeight); + + camera.setBounds(bx, by, bwidth, bheight); + } + } + + return this; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#getCamera * @since 3.0.0 * - * @param {[type]} renderer - [description] + * @param {string} name - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - postRenderWebGL: function (renderer) + getCamera: function (name) { - renderer.pipelines.BitmapMaskPipeline.endMask(this); + this.cameras.forEach(function (camera) + { + if (camera.name === name) + { + return camera; + } + }); + + return null; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#getCameraBelowPointer * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {[type]} pointer - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - preRenderCanvas: function () + getCameraBelowPointer: function (pointer) { - // NOOP + var cameras = this.cameras; + + // Start from the most recently added camera (the 'top' camera) + for (var i = cameras.length - 1; i >= 0; i--) + { + var camera = cameras[i]; + + if (camera.inputEnabled && RectangleContains(camera, pointer.x, pointer.y)) + { + return camera; + } + } }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#remove * @since 3.0.0 * - * @param {[type]} renderer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - postRenderCanvas: function () + remove: function (camera) { - // NOOP - } - -}); - -module.exports = BitmapMask; - - -/***/ }), -/* 494 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); + var cameraIndex = this.cameras.indexOf(camera); -/** - * @classdesc - * [description] - * - * @class GeometryMask - * @memberOf Phaser.Display.Masks - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {[type]} graphicsGeometry - [description] - */ -var GeometryMask = new Class({ + if (cameraIndex >= 0 && this.cameras.length > 1) + { + this.cameraPool.push(this.cameras[cameraIndex]); + this.cameras.splice(cameraIndex, 1); - initialize: + if (this.main === camera) + { + this.main = this.cameras[0]; + } + } + }, - function GeometryMask (scene, graphicsGeometry) + /** + * [description] + * + * @method Phaser.Cameras.Scene2D.CameraManager#render + * @since 3.0.0 + * + * @param {[type]} renderer - [description] + * @param {[type]} children - [description] + * @param {[type]} interpolation - [description] + */ + render: function (renderer, children, interpolation) { - /** - * [description] - * - * @name Phaser.Display.Masks.GeometryMask#geometryMask - * @type {Phaser.GameObjects.Graphics} - * @since 3.0.0 - */ - this.geometryMask = graphicsGeometry; + var cameras = this.cameras; + var baseScale = this.baseScale; + + for (var i = 0, l = cameras.length; i < l; ++i) + { + var camera = cameras[i]; + + camera.preRender(baseScale, renderer.config.resolution); + + renderer.render(this.scene, children, interpolation, camera); + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#setShape + * @method Phaser.Cameras.Scene2D.CameraManager#resetAll * @since 3.0.0 * - * @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description] + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - setShape: function (graphicsGeometry) + resetAll: function () { - this.geometryMask = graphicsGeometry; + while (this.cameras.length > 0) + { + this.cameraPool.push(this.cameras.pop()); + } + + this.main = this.add(); + + return this.main; }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#update * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {number} timestep - [description] + * @param {number} delta - [description] */ - preRenderWebGL: function (renderer, mask, camera) + update: function (timestep, delta) { - var gl = renderer.gl; - var geometryMask = this.geometryMask; - - // Force flushing before drawing to stencil buffer - renderer.flush(); - - // Enable and setup GL state to write to stencil buffer - gl.enable(gl.STENCIL_TEST); - gl.clear(gl.STENCIL_BUFFER_BIT); - gl.colorMask(false, false, false, false); - gl.stencilFunc(gl.NOTEQUAL, 1, 1); - gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); - - // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); - renderer.flush(); - - // Use stencil buffer to affect next rendering object - gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); - gl.stencilOp(gl.INVERT, gl.INVERT, gl.INVERT); + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].update(timestep, delta); + } }, /** - * [description] + * Resizes all cameras to the given dimensions. * - * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL - * @since 3.0.0 - * - * @param {[type]} renderer - [description] + * @method Phaser.Cameras.Scene2D.CameraManager#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the camera. + * @param {number} height - The new height of the camera. */ - postRenderWebGL: function (renderer) + resize: function (width, height) { - var gl = renderer.gl; - - // Force flush before disabling stencil test - renderer.flush(); - gl.disable(gl.STENCIL_TEST); + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].setSize(width, height); + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#shutdown * @since 3.0.0 - * - * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - preRenderCanvas: function (renderer, mask, camera) + shutdown: function () { - var geometryMask = this.geometryMask; - - renderer.currentContext.save(); - - geometryMask.renderCanvas(renderer, geometryMask, 0.0, camera, null, true); - - renderer.currentContext.clip(); + // TODO }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#destroy * @since 3.0.0 - * - * @param {[type]} renderer - [description] */ - postRenderCanvas: function (renderer) + destroy: function () { - renderer.currentContext.restore(); + this.main = undefined; + + for (var i = 0; i < this.cameras.length; i++) + { + this.cameras[i].destroy(); + } + + for (i = 0; i < this.cameraPool.length; i++) + { + this.cameraPool[i].destroy(); + } + + this.cameras = []; + this.cameraPool = []; + this.scene = undefined; } }); -module.exports = GeometryMask; +PluginManager.register('CameraManager', CameraManager, 'cameras'); + +module.exports = CameraManager; /***/ }), -/* 495 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80636,394 +82809,648 @@ module.exports = GeometryMask; */ /** - * @namespace Phaser.DOM + * @namespace Phaser.Cameras.Sprite3D */ module.exports = { - AddToDOM: __webpack_require__(123), - DOMContentLoaded: __webpack_require__(229), - ParseXML: __webpack_require__(230), - RemoveFromDOM: __webpack_require__(231), - RequestAnimationFrame: __webpack_require__(232) + Camera: __webpack_require__(118), + CameraManager: __webpack_require__(461), + OrthographicCamera: __webpack_require__(212), + PerspectiveCamera: __webpack_require__(213) }; /***/ }), -/* 496 */ -/***/ (function(module, exports) { - -// shim for using process in browser -var process = module.exports = {}; +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -var cachedSetTimeout; -var cachedClearTimeout; +var renderWebGL = __webpack_require__(3); +var renderCanvas = __webpack_require__(3); -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); +if (true) +{ + renderWebGL = __webpack_require__(459); } -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); + +if (true) +{ + renderCanvas = __webpack_require__(460); } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } +module.exports = { -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } + renderWebGL: renderWebGL, + renderCanvas: renderCanvas +}; -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; +/***/ }), +/* 459 */ +/***/ (function(module, exports, __webpack_require__) { -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +var GameObject = __webpack_require__(1); - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Sprite#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + { + return; } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } + this.pipeline.batchSprite(src, camera); }; -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; +module.exports = SpriteWebGLRenderer; -function noop() {} -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; +/***/ }), +/* 460 */ +/***/ (function(module, exports, __webpack_require__) { -process.listeners = function (name) { return [] } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; +var GameObject = __webpack_require__(1); -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Sprite#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + { + return; + } + + renderer.drawImage(src, camera); }; -process.umask = function() { return 0; }; + +module.exports = SpriteCanvasRenderer; /***/ }), -/* 497 */ +/* 461 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var OrthographicCamera = __webpack_require__(212); +var PerspectiveCamera = __webpack_require__(213); +var PluginManager = __webpack_require__(12); + +/** + * @classdesc + * [description] + * + * @class CameraManager + * @memberOf Phaser.Cameras.Sprite3D + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + */ +var CameraManager = new Class({ + + initialize: + + function CameraManager (scene) + { + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.CameraManager#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.CameraManager#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + /** + * An Array of the Camera objects being managed by this Camera Manager. + * + * @name Phaser.Cameras.Sprite3D.CameraManager#cameras + * @type {array} + * @since 3.0.0 + */ + this.cameras = []; + + if (!scene.sys.settings.isBooted) + { + scene.sys.events.once('boot', this.boot, this); + } + }, + + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#boot + * @since 3.0.0 + */ + boot: function () + { + var eventEmitter = this.systems.events; + + eventEmitter.on('update', this.update, this); + eventEmitter.on('shutdown', this.shutdown, this); + eventEmitter.on('destroy', this.destroy, this); + }, + + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#add + * @since 3.0.0 + * + * @param {[type]} fieldOfView - [description] + * @param {[type]} width - [description] + * @param {[type]} height - [description] + * + * @return {[type]} [description] + */ + add: function (fieldOfView, width, height) + { + return this.addPerspectiveCamera(fieldOfView, width, height); + }, + + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#addOrthographicCamera + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {[type]} [description] + */ + addOrthographicCamera: function (width, height) + { + var config = this.scene.sys.game.config; + + if (width === undefined) { width = config.width; } + if (height === undefined) { height = config.height; } + + var camera = new OrthographicCamera(this.scene, width, height); + + this.cameras.push(camera); + + return camera; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#addPerspectiveCamera + * @since 3.0.0 + * + * @param {number} [fieldOfView=80] - [description] + * @param {number} [width] - [description] + * @param {number} [height] - [description] + * + * @return {[type]} [description] + */ + addPerspectiveCamera: function (fieldOfView, width, height) + { + var config = this.scene.sys.game.config; + + if (fieldOfView === undefined) { fieldOfView = 80; } + if (width === undefined) { width = config.width; } + if (height === undefined) { height = config.height; } + + var camera = new PerspectiveCamera(this.scene, fieldOfView, width, height); + + this.cameras.push(camera); + + return camera; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#getCamera + * @since 3.0.0 + * + * @param {string} name - [description] + * + * @return {[type]} [description] + */ + getCamera: function (name) + { + this.cameras.forEach(function (camera) + { + if (camera.name === name) + { + return camera; + } + }); + + return null; + }, -var Class = __webpack_require__(0); -var EE = __webpack_require__(14); -var PluginManager = __webpack_require__(12); + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#removeCamera + * @since 3.0.0 + * + * @param {[type]} camera - [description] + */ + removeCamera: function (camera) + { + var cameraIndex = this.cameras.indexOf(camera); -/** - * @namespace Phaser.Events - */ + if (cameraIndex !== -1) + { + this.cameras.splice(cameraIndex, 1); + } + }, -/** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. - * - * @class EventEmitter - * @extends EventEmitter - * @memberOf Phaser.Events - * @constructor - * @since 3.0.0 - */ -var EventEmitter = new Class({ + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#removeAll + * @since 3.0.0 + * + * @return {[type]} [description] + */ + removeAll: function () + { + while (this.cameras.length > 0) + { + var camera = this.cameras.pop(); - Extends: EE, + camera.destroy(); + } - initialize: + return this.main; + }, - function EventEmitter () + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.CameraManager#update + * @since 3.0.0 + * + * @param {number} timestep - [description] + * @param {number} delta - [description] + */ + update: function (timestep, delta) { - EE.call(this); + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].update(timestep, delta); + } }, /** - * Removes all listeners. + * [description] * - * @method Phaser.Events.EventEmitter#shutdown + * @method Phaser.Cameras.Sprite3D.CameraManager#shutdown * @since 3.0.0 */ shutdown: function () { - this.removeAllListeners(); }, /** - * Removes all listeners. + * [description] * - * @method Phaser.Events.EventEmitter#destroy + * @method Phaser.Cameras.Sprite3D.CameraManager#destroy * @since 3.0.0 */ destroy: function () { - this.removeAllListeners(); + this.scene = undefined; } }); +PluginManager.register('CameraManager3D', CameraManager, 'cameras3d'); + +module.exports = CameraManager; + + +/***/ }), +/* 462 */ +/***/ (function(module, exports, __webpack_require__) { + /** - * @namespace EventEmitter + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method EventEmitter#eventNames - * - * @return {array} + * @namespace Phaser.Create */ +module.exports = { + + GenerateTexture: __webpack_require__(214), + Palettes: __webpack_require__(463) + +}; + + +/***/ }), +/* 463 */ +/***/ (function(module, exports, __webpack_require__) { + /** - * Return the listeners registered for a given event. - * - * @method EventEmitter#listeners - * - * @param {string|symbol} event - The event name. - * - * @return {array} The registered listeners. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Return the number of listeners listening to a given event. - * - * @method EventEmitter#listenerCount - * - * @param {string|symbol} event - The event name. - * - * @return {number} The number of listeners. + * @namespace Phaser.Create.Palettes */ +module.exports = { + + ARNE16: __webpack_require__(215), + C64: __webpack_require__(464), + CGA: __webpack_require__(465), + JMP: __webpack_require__(466), + MSX: __webpack_require__(467) + +}; + + +/***/ }), +/* 464 */ +/***/ (function(module, exports) { + /** - * Calls each of the listeners registered for a given event. - * - * @method EventEmitter#emit - * - * @param {string|symbol} event - The event name. - * - * @return {Boolean} `true` if the event had listeners, else `false`. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Add a listener for a given event. - * - * @method EventEmitter#on + * A 16 color palette inspired by the Commodore 64. * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. + * @name Phaser.Create.Palettes.C64 + * @since 3.0.0 * - * @return {EventEmitter} `this`. + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ +module.exports = { + 0: '#000', + 1: '#fff', + 2: '#8b4131', + 3: '#7bbdc5', + 4: '#8b41ac', + 5: '#6aac41', + 6: '#3931a4', + 7: '#d5de73', + 8: '#945a20', + 9: '#5a4100', + A: '#bd736a', + B: '#525252', + C: '#838383', + D: '#acee8b', + E: '#7b73de', + F: '#acacac' +}; + + +/***/ }), +/* 465 */ +/***/ (function(module, exports) { /** - * Add a listener for a given event. - * - * @method EventEmitter#addListener - * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {EventEmitter} `this`. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Add a one-time listener for a given event. - * - * @method EventEmitter#once + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 * - * @return {EventEmitter} `this`. + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ +module.exports = { + 0: '#000', + 1: '#2234d1', + 2: '#0c7e45', + 3: '#44aacc', + 4: '#8a3622', + 5: '#5c2e78', + 6: '#aa5c3d', + 7: '#b5b5b5', + 8: '#5e606e', + 9: '#4c81fb', + A: '#6cd947', + B: '#7be2f9', + C: '#eb8a60', + D: '#e23d69', + E: '#ffd93f', + F: '#fff' +}; + + +/***/ }), +/* 466 */ +/***/ (function(module, exports) { /** - * Remove the listeners of a given event. - * - * @method EventEmitter#removeListener - * - * @param {string|symbol} event - The event name. - * @param {function} fn - Only remove the listeners that match this function. - * @param {*} context - Only remove the listeners that have this context. - * @param {boolean} once - Only remove one-time listeners. - * - * @return {EventEmitter} `this`. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * Remove the listeners of a given event. - * - * @method EventEmitter#off + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) * - * @param {string|symbol} event - The event name. - * @param {function} fn - Only remove the listeners that match this function. - * @param {*} context - Only remove the listeners that have this context. - * @param {boolean} once - Only remove one-time listeners. + * @name Phaser.Create.Palettes.JMP + * @type {object} + * @since 3.0.0 * - * @return {EventEmitter} `this`. + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#f5f4eb' +}; + + +/***/ }), +/* 467 */ +/***/ (function(module, exports) { /** - * Remove all listeners, or those of the specified event. - * - * @method EventEmitter#removeAllListeners + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * A 16 color palette inspired by Japanese computers like the MSX. * - * @param {string|symbol} [event] - The event name. + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 * - * @return {EventEmitter} `this`. + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ - -PluginManager.register('EventEmitter', EventEmitter, 'events'); - -module.exports = EventEmitter; +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#fff' +}; /***/ }), -/* 498 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -81032,1369 +83459,1097 @@ module.exports = EventEmitter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(123); -var AnimationManager = __webpack_require__(196); -var CacheManager = __webpack_require__(199); -var CanvasPool = __webpack_require__(21); -var Class = __webpack_require__(0); -var Config = __webpack_require__(499); -var CreateRenderer = __webpack_require__(500); -var DataManager = __webpack_require__(79); -var DebugHeader = __webpack_require__(517); -var Device = __webpack_require__(518); -var DOMContentLoaded = __webpack_require__(229); -var EventEmitter = __webpack_require__(14); -var InputManager = __webpack_require__(239); -var NOOP = __webpack_require__(3); -var PluginManager = __webpack_require__(12); -var SceneManager = __webpack_require__(251); -var SoundManagerCreator = __webpack_require__(255); -var TextureManager = __webpack_require__(262); -var TimeStep = __webpack_require__(541); -var VisibilityHandler = __webpack_require__(542); - /** - * @classdesc - * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible - * for handling the boot process, parsing the configuration values, creating the renderer, - * and setting-up all of the global Phaser systems, such as sound and input. - * Once that is complete it will start the Scene Manager and then begin the main game loop. - * - * You should generally avoid accessing any of the systems created by Game, and instead use those - * made available to you via the Phaser.Scene Systems class instead. - * - * @class Game - * @memberOf Phaser - * @constructor - * @since 3.0.0 - * - * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. + * @namespace Phaser.Curves */ -var Game = new Class({ - - initialize: - - function Game (config) - { - /** - * The parsed Game Configuration object. - * - * The values stored within this object are read-only and should not be changed at run-time. - * - * @name Phaser.Game#config - * @type {Phaser.Boot.Config} - * @readOnly - * @since 3.0.0 - */ - this.config = new Config(config); - /** - * A reference to either the Canvas or WebGL Renderer that this Game is using. - * - * @name Phaser.Game#renderer - * @type {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = null; +module.exports = { + Path: __webpack_require__(469), - /** - * A reference to the HTML Canvas Element on which the renderer is drawing. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; + CubicBezier: __webpack_require__(216), + Curve: __webpack_require__(52), + Ellipse: __webpack_require__(218), + Line: __webpack_require__(220), + QuadraticBezier: __webpack_require__(221), + Spline: __webpack_require__(223) +}; - /** - * A reference to the Canvas Rendering Context belonging to the Canvas Element this game is rendering to. - * - * @name Phaser.Game#context - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.context = null; - /** - * A flag indicating when this Game instance has finished its boot process. - * - * @name Phaser.Game#isBooted - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - this.isBooted = false; +/***/ }), +/* 469 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * A flag indicating if this Game is currently running its game step or not. - * - * @name Phaser.Game#isRunning - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - this.isRunning = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * An Event Emitter which is used to broadcast game-level events from the global systems. - * - * @name Phaser.Game#events - * @type {EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - /** - * An instance of the Animation Manager. - * - * The Animation Manager is a global system responsible for managing all animations used within your game. - * - * @name Phaser.Game#anims - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.anims = new AnimationManager(this); +var Class = __webpack_require__(0); +var CubicBezierCurve = __webpack_require__(216); +var EllipseCurve = __webpack_require__(218); +var GameObjectFactory = __webpack_require__(9); +var LineCurve = __webpack_require__(220); +var MovePathTo = __webpack_require__(470); +var QuadraticBezierCurve = __webpack_require__(221); +var Rectangle = __webpack_require__(8); +var SplineCurve = __webpack_require__(223); +var Vector2 = __webpack_require__(6); - /** - * An instance of the Texture Manager. - * - * The Texture Manager is a global system responsible for managing all textures being used by your game. - * - * @name Phaser.Game#textures - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 - */ - this.textures = new TextureManager(this); +/** + * @classdesc + * [description] + * + * @class Path + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] + */ +var Path = new Class({ - /** - * An instance of the Cache Manager. - * - * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. - * - * @name Phaser.Game#cache - * @type {Phaser.Cache.CacheManager} - * @since 3.0.0 - */ - this.cache = new CacheManager(this); + initialize: - /** - * [description] - * - * @name Phaser.Game#registry - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.registry = new DataManager(this); + function Path (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } /** - * An instance of the Input Manager. - * - * The Input Manager is a global system responsible for the capture of browser-level input events. + * [description] * - * @name Phaser.Game#input - * @type {Phaser.Input.InputManager} + * @name Phaser.Curves.Path#name + * @type {string} + * @default '' * @since 3.0.0 */ - this.input = new InputManager(this, this.config); + this.name = ''; /** - * An instance of the Scene Manager. - * - * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. + * [description] * - * @name Phaser.Game#scene - * @type {Phaser.Scenes.SceneManager} + * @name Phaser.Curves.Path#curves + * @type {array} + * @default [] * @since 3.0.0 */ - this.scene = new SceneManager(this, this.config.sceneConfig); + this.curves = []; /** - * A reference to the Device inspector. - * - * Contains information about the device running this game, such as OS, browser vendor and feature support. - * Used by various systems to determine capabilities and code paths. + * [description] * - * @name Phaser.Game#device - * @type {Phaser.Device} + * @name Phaser.Curves.Path#cacheLengths + * @type {array} + * @default [] * @since 3.0.0 */ - this.device = Device; + this.cacheLengths = []; /** - * An instance of the base Sound Manager. - * - * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. + * Automatically closes the path. * - * @name Phaser.Game#sound - * @type {Phaser.BaseSoundManager} + * @name Phaser.Curves.Path#autoClose + * @type {boolean} + * @default false * @since 3.0.0 */ - this.sound = SoundManagerCreator.create(this); + this.autoClose = false; /** - * An instance of the Time Step. - * - * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing - * them and calculating delta values. It then automatically calls the game step. + * [description] * - * @name Phaser.Game#loop - * @type {Phaser.Boot.TimeStep} + * @name {Phaser.MathPhaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.loop = new TimeStep(this, this.config.fps); + this.startPoint = new Vector2(); /** - * An instance of the Plugin Manager. - * - * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install - * those plugins into Scenes as required. + * [description] * - * @name Phaser.Game#plugins - * @type {Phaser.Boot.PluginManager} + * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.plugins = new PluginManager(this, this.config); + this._tmpVec2A = new Vector2(); /** - * The `onStepCallback` is a callback that is fired each time the Time Step ticks. - * It is set automatically when the Game boot process has completed. + * [description] * - * @name Phaser.Game#onStepCallback - * @type {function} + * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2B + * @type {Phaser.Math.Vector2} * @private * @since 3.0.0 */ - this.onStepCallback = NOOP; + this._tmpVec2B = new Vector2(); - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(this)); + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } }, /** - * Game boot event. + * [description] * - * This is an internal event dispatched when the game has finished booting, but before it is ready to start running. - * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. + * @method Phaser.Curves.Path#add + * @since 3.0.0 * - * @event Phaser.Game#boot - */ - - /** - * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, - * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. - * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. + * @param {Phaser.Curves.Curve} curve - [description] * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Game#boot - * @since 3.0.0 + * @return {Phaser.Curves.Path} [description] */ - boot: function () + add: function (curve) { - this.isBooted = true; - - this.config.preBoot(); - - CreateRenderer(this); - - DebugHeader(this); - - AddToDOM(this.canvas, this.config.parent); - - this.events.emit('boot'); + this.curves.push(curve); - // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready, so it will emit this event - this.events.once('ready', this.start, this); + return this; }, /** - * Called automatically by Game.boot once all of the global systems have finished setting themselves up. - * By this point the Game is now ready to start the main loop running. - * It will also enable the Visibility Handler. + * [description] * - * @method Phaser.Game#start - * @protected + * @method Phaser.Curves.Path#circleTo * @since 3.0.0 - */ - start: function () - { - this.isRunning = true; - - this.config.postBoot(); - - this.loop.start(this.step.bind(this)); - - VisibilityHandler(this.events); - - this.events.on('hidden', this.onHidden, this); - this.events.on('visible', this.onVisible, this); - this.events.on('blur', this.onBlur, this); - this.events.on('focus', this.onFocus, this); - }, - - /** - * Game Pre-Render event. * - * This event is dispatched immediately before any of the Scenes have started to render. - * The renderer will already have been initialized this frame, clearing itself and preparing to receive - * the Scenes for rendering, but it won't have actually drawn anything yet. + * @param {number} radius - [description] + * @param {boolean} [clockwise=false] - [description] + * @param {number} [rotation=0] - [description] * - * @event Phaser.Game#prerenderEvent - * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. + * @return {Phaser.Curves.Path} [description] */ + circleTo: function (radius, clockwise, rotation) + { + if (clockwise === undefined) { clockwise = false; } - /** - * Game Post-Render event. - * - * This event is dispatched right at the end of the render process. - * Every Scene will have rendered and drawn to the canvas. - * - * @event Phaser.Game#postrenderEvent - * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. - */ + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + }, /** - * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of - * Request Animation Frame, or Set Timeout on very old browsers.) - * - * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. - * - * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * [description] * - * @method Phaser.Game#step - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent + * @method Phaser.Curves.Path#closePath * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. + * @return {Phaser.Curves.Path} [description] */ - step: function (time, delta) + closePath: function () { - // Global Managers - - this.input.update(time, delta); - - this.sound.update(time, delta); - - // Scenes - - this.onStepCallback(); - - this.scene.update(time, delta); - - // Render - - var renderer = this.renderer; - - renderer.preRender(); - - this.events.emit('prerender', renderer); - - this.scene.render(renderer); + // Add a line curve if start and end of lines are not connected + var startPoint = this.curves[0].getPoint(0); + var endPoint = this.curves[this.curves.length - 1].getPoint(1); - renderer.postRender(); + if (!startPoint.equals(endPoint)) + { + // This will copy a reference to the vectors, which probably isn't sensible + this.curves.push(new LineCurve(endPoint, startPoint)); + } - this.events.emit('postrender', renderer); + return this; }, - /** - * Game Pause event. - * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. - * - * @event Phaser.Game#pauseEvent - */ + // Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points /** - * Called automatically by the Visibility Handler. - * This will pause the main loop and then emit a pause event. + * [description] * - * @method Phaser.Game#onHidden - * @protected - * @fires Phaser.Game#pauseEvent + * @method Phaser.Curves.Path#cubicBezierTo * @since 3.0.0 - */ - onHidden: function () - { - this.loop.pause(); - - this.events.emit('pause'); - }, - - /** - * Game Resume event. * - * This event is dispatched when the game loop leaves a paused state and resumes running. - * - * @event Phaser.Game#resumeEvent - */ - - /** - * Called automatically by the Visibility Handler. - * This will resume the main loop and then emit a resume event. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {Phaser.Math.Vector2} control1X - [description] + * @param {Phaser.Math.Vector2} control1Y - [description] + * @param {Phaser.Math.Vector2} control2X - [description] + * @param {Phaser.Math.Vector2} control2Y - [description] * - * @method Phaser.Game#onVisible - * @protected - * @fires Phaser.Game#resumeEvent - * @since 3.0.0 + * @return {Phaser.Curves.Path} [description] */ - onVisible: function () + cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) { - this.loop.resume(); + var p0 = this.getEndPoint(); + var p1; + var p2; + var p3; - this.events.emit('resume'); - }, + // Assume they're all vec2s + if (x instanceof Vector2) + { + p1 = x; + p2 = y; + p3 = control1X; + } + else + { + p1 = new Vector2(control1X, control1Y); + p2 = new Vector2(control2X, control2Y); + p3 = new Vector2(x, y); + } - /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'blurred' state, which pauses it. - * - * @method Phaser.Game#onBlur - * @protected - * @since 3.0.0 - */ - onBlur: function () - { - this.loop.blur(); + return this.add(new CubicBezierCurve(p0, p1, p2, p3)); }, - /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'focused' state, which resumes it. - * - * @method Phaser.Game#onFocus - * @protected - * @since 3.0.0 - */ - onFocus: function () - { - this.loop.focus(); - }, + // Creates a quadratic bezier curve starting at the previous end point and ending at p2, using p1 as a control point /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * [description] * - * @method Phaser.Game#destroy - * @since 3.0.0 + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 + * + * @param {number|Phaser.Math.Vector2[]} x - [description] + * @param {number} [y] - [description] + * @param {number} [controlX] - [description] + * @param {number} [controlY] - [description] + * + * @return {Phaser.Curves.Path} [description] */ - destroy: function (removeCanvas) + quadraticBezierTo: function (x, y, controlX, controlY) { - this.loop.destroy(); - - this.scene.destroy(); - - this.renderer.destroy(); - - this.events.emit('destroy'); - - this.events.removeAllListeners(); - - this.onStepCallback = null; + var p0 = this.getEndPoint(); + var p1; + var p2; - if (removeCanvas) + // Assume they're all vec2s + if (x instanceof Vector2) { - CanvasPool.remove(this.canvas); + p1 = x; + p2 = y; + } + else + { + p1 = new Vector2(controlX, controlY); + p2 = new Vector2(x, y); } - } - -}); - -module.exports = Game; - - -/***/ }), -/* 499 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var GetValue = __webpack_require__(4); -var MATH = __webpack_require__(16); -var NOOP = __webpack_require__(3); -var Plugins = __webpack_require__(233); -var ValueToColor = __webpack_require__(115); - -/** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP - */ - -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=10] - [description] - * @property {integer} [target=60] - [description] - * @property {boolean} [forceSetTimeOut=false] - [description] - * @property {integer} [deltaHistory=10] - [description] - * @property {integer} [panicMax=120] - [description] - */ - -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - [description] - * @property {string} [path] - [description] - * @property {boolean} [enableParallel=true] - [description] - * @property {integer} [maxParallelDownloads=4] - [description] - * @property {string|undefined} [crossOrigin=undefined] - [description] - * @property {string} [responseType] - [description] - * @property {boolean} [async=true] - [description] - * @property {string} [user] - [description] - * @property {string} [password] - [description] - * @property {integer} [timeout=0] - [description] - */ - -/** - * @typedef {object} GameConfig - * - * @property {integer|string} [width=1024] - [description] - * @property {integer|string} [height=768] - [description] - * @property {number} [zoom=1] - [description] - * @property {number} [resolution=1] - [description] - * @property {number} [type=CONST.AUTO] - [description] - * @property {object} [?parent=null] - [description] - * @property {HTMLCanvasElement} [?canvas=null] - [description] - * @property {string} [?canvasStyle=null] - [description] - * @property {object} [?scene=null] - [description] - * @property {array} [seed] - [description] - * @property {string} [title=''] - [description] - * @property {string} [url='http://phaser.io'] - [description] - * @property {string} [version=''] - [description] - * @property {object} [input] - [description] - * @property {boolean} [input.keyboard=true] - [description] - * @property {object} [input.keyboard.target=window] - [description] - * @property {boolean} [input.mouse=true] - [description] - * @property {object} [?input.mouse.target=null] - [description] - * @property {boolean} [input.touch=true] - [description] - * @property {object} [?input.touch.target=null] - [description] - * @property {object} [?input.touch.capture=true] - [description] - * @property {boolean} [input.gamepad=false] - [description] - * @property {boolean} [disableContextMenu=false] - [description] - * @property {boolean} [banner=false] - [description] - * @property {boolean} [banner.hidePhaser=false] - [description] - * @property {string} [banner.text='#ffffff'] - [description] - * @property {array} [banner.background] - [description] - * @property {FPSConfig} [?fps] - [description] - * @property {boolean} [pixelArt=false] - [description] - * @property {boolean} [transparent=false] - [description] - * @property {boolean} [clearBeforeRender=true] - [description] - * @property {string|number} [backgroundColor=0x000000] - [description] - * @property {object} [?callbacks] - [description] - * @property {function} [callbacks.preBoot=NOOP] - [description] - * @property {function} [callbacks.postBoot=NOOP] - [description] - * @property {LoaderConfig} [?loader] - [description] - * @property {object} [?images] - [description] - * @property {string} [images.default] - [description] - * @property {string} [images.missing] - [description] - */ - -/** - * @classdesc - * [description] - * - * @class Config - * @memberOf Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. - * - */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - this.width = GetValue(config, 'width', 1024); - this.height = GetValue(config, 'height', 768); - this.zoom = GetValue(config, 'zoom', 1); - this.resolution = GetValue(config, 'resolution', 1); + return this.add(new QuadraticBezierCurve(p0, p1, p2)); + }, - this.renderType = GetValue(config, 'type', CONST.AUTO); + /** + * [description] + * + * @method Phaser.Curves.Path#draw + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] + */ + draw: function (graphics, pointsTotal) + { + for (var i = 0; i < this.curves.length; i++) + { + var curve = this.curves[i]; - this.parent = GetValue(config, 'parent', null); - this.canvas = GetValue(config, 'canvas', null); - this.canvasStyle = GetValue(config, 'canvasStyle', null); + if (!curve.active) + { + continue; + } - this.sceneConfig = GetValue(config, 'scene', null); + curve.draw(graphics, pointsTotal); + } - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + return graphics; + }, - MATH.RND.init(this.seed); + /** + * Creates an ellipse curve positioned at the previous end point, using the given parameters. + * + * @method Phaser.Curves.Path#ellipseTo + * @since 3.0.0 + * + * @param {number} xRadius - [description] + * @param {number} yRadius - [description] + * @param {number} startAngle - [description] + * @param {number} endAngle - [description] + * @param {boolean} clockwise - [description] + * @param {number} rotation - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + { + var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); - this.gameTitle = GetValue(config, 'title', ''); - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - this.gameVersion = GetValue(config, 'version', ''); + var end = this.getEndPoint(this._tmpVec2A); - // Input - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + // Calculate where to center the ellipse + var start = ellipse.getStartPoint(this._tmpVec2B); - this.inputMouse = GetValue(config, 'input.mouse', true); - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + end.subtract(start); - this.inputTouch = GetValue(config, 'input.touch', true); - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + ellipse.x = end.x; + ellipse.y = end.y; - this.inputGamepad = GetValue(config, 'input.gamepad', false); + return this.add(ellipse); + }, - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + /** + * [description] + * + * @method Phaser.Curves.Path#fromJSON + * @since 3.0.0 + * + * @param {object} data - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + fromJSON: function (data) + { + // data should be an object matching the Path.toJSON object structure. - this.audio = GetValue(config, 'audio'); + this.curves = []; + this.cacheLengths = []; - // If you do: { banner: false } it won't display any banner at all - this.hideBanner = (GetValue(config, 'banner', null) === false); + this.startPoint.set(data.x, data.y); - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + this.autoClose = data.autoClose; - if (this.gameTitle === '' && this.hidePhaser) + for (var i = 0; i < data.curves.length; i++) { - this.hideBanner = true; - } + var curve = data.curves[i]; - // Frame Rate config - // fps: { - // min: 10, - // target: 60, - // forceSetTimeOut: false, - // deltaHistory: 10 - // } + switch (curve.type) + { + case 'LineCurve': + this.add(LineCurve.fromJSON(curve)); + break; - this.fps = GetValue(config, 'fps', null); + case 'EllipseCurve': + this.add(EllipseCurve.fromJSON(curve)); + break; - this.pixelArt = GetValue(config, 'pixelArt', false); - this.transparent = GetValue(config, 'transparent', false); - this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true); - this.backgroundColor = ValueToColor(GetValue(config, 'backgroundColor', 0)); + case 'SplineCurve': + this.add(SplineCurve.fromJSON(curve)); + break; - // Callbacks - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + case 'CubicBezierCurve': + this.add(CubicBezierCurve.fromJSON(curve)); + break; - // Physics - // physics: { - // system: 'impact', - // setBounds: true, - // gravity: 0, - // cellSize: 64 - // } - this.physics = GetValue(config, 'physics', {}); - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + case 'QuadraticBezierCurve': + this.add(QuadraticBezierCurve.fromJSON(curve)); + break; + } + } - // Loader Defaults - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - this.loaderPath = GetValue(config, 'loader.path', ''); - this.loaderEnableParallel = GetValue(config, 'loader.enableParallel', true); - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 4); - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - this.loaderAsync = GetValue(config, 'loader.async', true); - this.loaderUser = GetValue(config, 'loader.user', ''); - this.loaderPassword = GetValue(config, 'loader.password', ''); - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + return this; + }, - // Scene Plugins - this.defaultPlugins = GetValue(config, 'plugins', Plugins.DefaultScene); + /** + * [description] + * + * @method Phaser.Curves.Path#getBounds + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} [out] - [description] + * @param {integer} [accuracy=16] - [description] + * + * @return {Phaser.Geom.Rectangle} [description] + */ + getBounds: function (out, accuracy) + { + if (out === undefined) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + out.x = Number.MAX_VALUE; + out.y = Number.MAX_VALUE; - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - } + var bounds = new Rectangle(); + var maxRight = Number.MIN_SAFE_INTEGER; + var maxBottom = Number.MIN_SAFE_INTEGER; -}); + for (var i = 0; i < this.curves.length; i++) + { + var curve = this.curves[i]; -module.exports = Config; + if (!curve.active) + { + continue; + } + curve.getBounds(bounds, accuracy); -/***/ }), -/* 500 */ -/***/ (function(module, exports, __webpack_require__) { + out.x = Math.min(out.x, bounds.x); + out.y = Math.min(out.y, bounds.y); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + maxRight = Math.max(maxRight, bounds.right); + maxBottom = Math.max(maxBottom, bounds.bottom); + } -var CanvasInterpolation = __webpack_require__(221); -var CanvasPool = __webpack_require__(21); -var CONST = __webpack_require__(22); -var Features = __webpack_require__(124); + out.right = maxRight; + out.bottom = maxBottom; -/** - * Called automatically by Phaser.Game and responsible for creating the renderer it will use. - * - * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. - * - * @function Phaser.Boot.CreateRenderer - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. - */ -var CreateRenderer = function (game) -{ - var config = game.config; + return out; + }, - // Game either requested Canvas, - // or requested AUTO or WEBGL but the browser doesn't support it, so fall back to Canvas - if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL)) + /** + * [description] + * + * @method Phaser.Curves.Path#getCurveLengths + * @since 3.0.0 + * + * @return {array} [description] + */ + getCurveLengths: function () { - if (Features.canvas) - { - // They requested Canvas and their browser supports it - config.renderType = CONST.CANVAS; - } - else + // We use cache values if curves and cache array are same length + + if (this.cacheLengths.length === this.curves.length) { - throw new Error('Cannot create Canvas or WebGL context, aborting.'); + return this.cacheLengths; } - } - else - { - // Game requested WebGL and browser says it supports it - config.renderType = CONST.WEBGL; - } - // Pixel Art mode? - if (config.pixelArt) - { - CanvasPool.disableSmoothing(); - } + // Get length of sub-curve + // Push sums into cached array - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; - } - else - { - game.canvas = CanvasPool.create(game, config.width, config.height, config.renderType); - } + var lengths = []; + var sums = 0; - // Does the game config provide some canvas css styles to use? - if (config.canvasStyle) - { - game.canvas.style = config.canvasStyle; - } + for (var i = 0; i < this.curves.length; i++) + { + sums += this.curves[i].getLength(); - // Pixel Art mode? - if (config.pixelArt) - { - CanvasInterpolation.setCrisp(game.canvas); - } + lengths.push(sums); + } - // Zoomed? - if (config.zoom !== 1) - { - game.canvas.style.width = (config.width * config.zoom).toString() + 'px'; - game.canvas.style.height = (config.height * config.zoom).toString() + 'px'; - } + this.cacheLengths = lengths; - var CanvasRenderer; - var WebGLRenderer; + return lengths; + }, - if (true) + /** + * [description] + * + * @method Phaser.Curves.Path#getEndPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getEndPoint: function (out) { - CanvasRenderer = __webpack_require__(501); - WebGLRenderer = __webpack_require__(506); + if (out === undefined) { out = new Vector2(); } - // Let the config pick the renderer type, both are included - if (config.renderType === CONST.WEBGL) + if (this.curves.length > 0) { - game.renderer = new WebGLRenderer(game); - game.context = null; + this.curves[this.curves.length - 1].getPoint(1, out); } else { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; + out.copy(this.startPoint); } - } - if (false) - { - WebGLRenderer = require('../renderer/webgl/WebGLRenderer'); - - // Force the type to WebGL, regardless what was requested - config.renderType = CONST.WEBGL; - game.renderer = new WebGLRenderer(game); - game.context = null; - } + return out; + }, - if (false) + /** + * [description] + * + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 + * + * @return {number} [description] + */ + getLength: function () { - CanvasRenderer = require('../renderer/canvas/CanvasRenderer'); - - // Force the type to Canvas, regardless what was requested - config.renderType = CONST.CANVAS; - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } -}; - -module.exports = CreateRenderer; - - -/***/ }), -/* 501 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var lens = this.getCurveLengths(); -var BlitImage = __webpack_require__(502); -var CanvasSnapshot = __webpack_require__(503); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var DrawImage = __webpack_require__(504); -var GetBlendModes = __webpack_require__(505); -var ScaleModes = __webpack_require__(62); -var Smoothing = __webpack_require__(120); + return lens[lens.length - 1]; + }, -/** - * @classdesc - * [description] - * - * @class CanvasRenderer - * @memberOf Phaser.Renderer.Canvas - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. - */ -var CanvasRenderer = new Class({ + // To get accurate point with reference to + // entire path distance at time t, + // following has to be done: - initialize: + // 1. Length of each sub path have to be known + // 2. Locate and identify type of curve + // 3. Get t for the curve + // 4. Return curve.getPointAt(t') - function CanvasRenderer (game) + /** + * [description] + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2|null} [description] + */ + getPoint: function (t, out) { - /** - * The Phaser Game instance that owns this renderer. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#type - * @type {integer} - * @since 3.0.0 - */ - this.type = CONST.CANVAS; + if (out === undefined) { out = new Vector2(); } - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.drawCount = 0; + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = game.config.width; + while (i < curveLengths.length) + { + if (curveLengths[i] >= d) + { + var diff = curveLengths[i] - d; + var curve = this.curves[i]; - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = game.config.height; + var segmentLength = curve.getLength(); + var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: game.config.clearBeforeRender, - pixelArt: game.config.pixelArt, - backgroundColor: game.config.backgroundColor, - resolution: game.config.resolution, - autoResize: game.config.autoResize - }; + return curve.getPointAt(u, out); + } - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode - * @type {integer} - * @since 3.0.0 - */ - this.scaleMode = (game.config.pixelArt) ? ScaleModes.NEAREST : ScaleModes.LINEAR; + i++; + } - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.gameCanvas = game.canvas; + // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) + { + points.push(points[0]); + } - this.init(); + return points; }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#init + * @method Phaser.Curves.Path#getRandomPoint * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - init: function () + getRandomPoint: function (out) { - this.resize(this.width, this.height); + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); }, /** - * Resize the main game canvas. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resize + * @method Phaser.Curves.Path#getSpacedPoints * @since 3.0.0 * - * @param {integer} width - [description] - * @param {integer} height - [description] + * @param {integer} [divisions=40] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] */ - resize: function (width, height) + getSpacedPoints: function (divisions) { - var resolution = this.config.resolution; + if (divisions === undefined) { divisions = 40; } - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; + var points = []; - if (this.config.autoResize) + for (var i = 0; i <= divisions; i++) { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; + points.push(this.getPoint(i / divisions)); } - // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) - if (this.scaleMode === ScaleModes.NEAREST) + if (this.autoClose) { - Smoothing.disable(this.gameContext); + points.push(points[0]); } + + return points; }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost + * @method Phaser.Curves.Path#getStartPoint * @since 3.0.0 * - * @param {function} callback - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - onContextLost: function () + getStartPoint: function (out) { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.startPoint); }, + // Creates a line curve from the previous end point to x/y + /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored + * @method Phaser.Curves.Path#lineTo * @since 3.0.0 * - * @param {function} callback - [description] + * @param {number|Phaser.Math.Vector2} x - [description] + * @param {number} [y] - [description] + * + * @return {Phaser.Curves.Path} [description] */ - onContextRestored: function () + lineTo: function (x, y) { + if (x instanceof Vector2) + { + this._tmpVec2B.copy(x); + } + else + { + this._tmpVec2B.set(x, y); + } + + var end = this.getEndPoint(this._tmpVec2A); + + return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); }, + // Creates a spline curve starting at the previous end point, using the given parameters + /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform + * @method Phaser.Curves.Path#splineTo * @since 3.0.0 + * + * @param {[type]} points - [description] + * + * @return {Phaser.Curves.Path} [description] */ - resetTransform: function () + splineTo: function (points) { - this.currentContext.setTransform(1, 0, 0, 1, 0, 0); + points.unshift(this.getEndPoint()); + + return this.add(new SplineCurve(points)); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode + * @method Phaser.Curves.Path#moveTo * @since 3.0.0 * - * @param {[type]} blendMode - [description] + * @param {number} x - [description] + * @param {number} y - [description] * - * @return {[type]} [description] + * @return {Phaser.Curves.Path} [description] */ - setBlendMode: function (blendMode) + moveTo: function (x, y) { - if (this.currentBlendMode !== blendMode) + return this.add(new MovePathTo(x, y)); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () + { + var out = []; + + for (var i = 0; i < this.curves.length; i++) { - this.currentContext.globalCompositeOperation = blendMode; - this.currentBlendMode = blendMode; + out.push(this.curves[i].toJSON()); } - return this.currentBlendMode; + return { + type: 'Path', + x: this.startPoint.x, + y: this.startPoint.y, + autoClose: this.autoClose, + curves: out + }; }, + // cacheLengths must be recalculated. + /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha + * @method Phaser.Curves.Path#updateArcLengths * @since 3.0.0 + */ + updateArcLengths: function () + { + this.cacheLengths = []; + + this.getCurveLengths(); + }, + + /** + * [description] * - * @param {float} alpha - [description] - * - * @return {float} [description] + * @method Phaser.Curves.Path#destroy + * @since 3.0.0 */ - setAlpha: function (alpha) + destroy: function () { - if (this.currentAlpha !== alpha) - { - this.currentContext.globalAlpha = alpha; - this.currentAlpha = alpha; - } + this.curves.length = 0; + this.cacheLengths.length = 0; + this.startPoint = undefined; + } - return this.currentAlpha; +}); + +/** + * Creates a new Path Object. + * + * @method Phaser.GameObjects.GameObjectFactory#path + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Path. + * @param {number} y - The vertical position of this Path. + * + * @return {Phaser.Curves.Path} The Path Object that was created. + */ +GameObjectFactory.register('path', function (x, y) +{ + return new Path(x, y); +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns + +module.exports = Path; + + +/***/ }), +/* 470 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var Vector2 = __webpack_require__(6); + +/** + * @classdesc + * [description] + * + * @class MoveTo + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - [description] + * @param {number} [y] - [description] + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) + { + // Skip length calcs in paths + + /** + * [description] + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; + + /** + * [description] + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); }, /** - * Called at the start of the render loop. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender + * @method Phaser.Curves.MoveTo#getPoint * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] */ - preRender: function () + getPoint: function (t, out) { - var ctx = this.gameContext; - var config = this.config; + if (out === undefined) { out = new Vector2(); } - var width = this.width; - var height = this.height; + return out.copy(this.p0); + }, - if (config.clearBeforeRender) - { - ctx.clearRect(0, 0, width, height); - } + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @param {[type]} u - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, - if (!config.transparent) - { - ctx.fillStyle = config.backgroundColor.rgba; - ctx.fillRect(0, 0, width, height); - } + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getResolution: function () + { + return 1; + }, - this.drawCount = 0; + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getLength: function () + { + return 0; }, /** - * Renders the Scene to the given Camera. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#render + * @method Phaser.Curves.MoveTo#toJSON * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.DisplayList} children - [description] - * @param {float} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @return {[type]} [description] */ - render: function (scene, children, interpolationPercentage, camera) + toJSON: function () { - var ctx = scene.sys.context; - var scissor = (camera.x !== 0 || camera.y !== 0 || camera.width !== ctx.canvas.width || camera.height !== ctx.canvas.height); - var list = children.list; - var resolution = this.config.resolution; + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; + } - this.currentContext = ctx; +}); - // If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops) +module.exports = MoveTo; - if (!camera.transparent) - { - ctx.fillStyle = camera.backgroundColor.rgba; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); - } - if (this.currentAlpha !== 1) - { - ctx.globalAlpha = 1; - this.currentAlpha = 1; - } +/***/ }), +/* 471 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.currentBlendMode !== 0) - { - ctx.globalCompositeOperation = 'source-over'; - this.currentBlendMode = 0; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentScaleMode = 0; +/** + * @namespace Phaser.Data + */ - this.drawCount += list.length; +module.exports = { - if (scissor) - { - ctx.save(); - ctx.beginPath(); - ctx.rect(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); - ctx.clip(); - } + DataManager: __webpack_require__(79), + DataManagerPlugin: __webpack_require__(472) - var matrix = camera.matrix.matrix; +}; - ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); - for (var c = 0; c < list.length; c++) - { - var child = list[c]; +/***/ }), +/* 472 */ +/***/ (function(module, exports, __webpack_require__) { - if (child.mask) - { - child.mask.preRenderCanvas(this, child, camera); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - child.renderCanvas(this, child, interpolationPercentage, camera); +var Class = __webpack_require__(0); +var DataManager = __webpack_require__(79); +var PluginManager = __webpack_require__(12); - if (child.mask) - { - child.mask.postRenderCanvas(this, child, camera); - } - } +/** + * @classdesc + * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. + * + * @class DataManagerPlugin + * @extends Phaser.Data.DataManager + * @memberOf Phaser.Data + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + */ +var DataManagerPlugin = new Class({ - ctx.setTransform(1, 0, 0, 1, 0, 0); + Extends: DataManager, - if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) - { - ctx.globalCompositeOperation = 'source-over'; - - // fade rendering - ctx.fillStyle = 'rgb(' + (camera._fadeRed * 255) + ',' + (camera._fadeGreen * 255) + ',' + (camera._fadeBlue * 255) + ')'; - ctx.globalAlpha = camera._fadeAlpha; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + initialize: - // flash rendering - ctx.fillStyle = 'rgb(' + (camera._flashRed * 255) + ',' + (camera._flashGreen * 255) + ',' + (camera._flashBlue * 255) + ')'; - ctx.globalAlpha = camera._flashAlpha; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + function DataManagerPlugin (scene) + { + /** + * [description] + * + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - ctx.globalAlpha = 1.0; - } + /** + * [description] + * + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - // Reset the camera scissor - if (scissor) + if (!scene.sys.settings.isBooted) { - ctx.restore(); + scene.sys.events.once('boot', this.boot, this); } + + DataManager.call(this, this.scene, scene.sys.events); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender + * @method Phaser.Data.DataManagerPlugin#boot * @since 3.0.0 */ - postRender: function () + boot: function () { - var ctx = this.gameContext; - - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; - - this.currentAlpha = 1; - this.currentBlendMode = 0; + var eventEmitter = this.systems.events; - if (this.snapshotCallback) - { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; - } + eventEmitter.on('shutdown', this.shutdownPlugin, this); + eventEmitter.on('destroy', this.destroyPlugin, this); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot + * @method Phaser.Data.DataManagerPlugin#shutdownPlugin * @since 3.0.0 - * - * @param {[type]} callback - [description] - * @param {[type]} type - [description] - * @param {[type]} encoderOptions - [description] */ - snapshot: function (callback, type, encoderOptions) + shutdownPlugin: function () { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; + // Should we reset the events? }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy + * @method Phaser.Data.DataManagerPlugin#destroyPlugin * @since 3.0.0 */ - destroy: function () + destroyPlugin: function () { - this.gameCanvas = null; - this.gameContext = null; + this.destroy(); - this.game = null; + this.scene = undefined; + this.systems = undefined; } }); -module.exports = CanvasRenderer; +PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data'); + +module.exports = DataManagerPlugin; /***/ }), -/* 502 */ -/***/ (function(module, exports) { +/* 473 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -82403,39 +84558,23 @@ module.exports = CanvasRenderer; */ /** - * No scaling, anchor, rotation or effects, literally draws the frame directly to the canvas. - * - * @function Phaser.Renderer.Canvas.BlitImage - * @since 3.0.0 - * - * @param {number} dx - The x coordinate to render the Frame to. - * @param {number} dy - The y coordinate to render the Frame to. - * @param {Phaser.Textures.Frame} frame - The Frame to render. + * @namespace Phaser.Display */ -var BlitImage = function (dx, dy, frame) -{ - var ctx = this.currentContext; - var cd = frame.canvasData; - ctx.drawImage( - frame.source.image, - cd.sx, - cd.sy, - cd.sWidth, - cd.sHeight, - dx, - dy, - cd.dWidth, - cd.dHeight - ); -}; +module.exports = { -module.exports = BlitImage; + Align: __webpack_require__(474), + Bounds: __webpack_require__(489), + Canvas: __webpack_require__(492), + Color: __webpack_require__(225), + Masks: __webpack_require__(503) + +}; /***/ }), -/* 503 */ -/***/ (function(module, exports) { +/* 474 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -82444,37 +84583,20 @@ module.exports = BlitImage; */ /** - * [description] - * - * @function Phaser.Renderer.Snapshot.Canvas - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {float} [encoderOptions=0.92] - [description] - * - * @return {Image} [description] + * @namespace Phaser.Display.Align */ -var CanvasSnapshot = function (canvas, type, encoderOptions) -{ - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } - - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); +module.exports = { - image.src = src; + In: __webpack_require__(475), + To: __webpack_require__(476) - return image; }; -module.exports = CanvasSnapshot; - /***/ }), -/* 504 */ -/***/ (function(module, exports) { +/* 475 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -82483,92 +84605,59 @@ module.exports = CanvasSnapshot; */ /** - * [description] - * - * @function Phaser.Renderer.Canvas.DrawImage - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} src - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @namespace Phaser.Display.Align.In */ -var DrawImage = function (src, camera) -{ - var ctx = this.currentContext; - var frame = src.frame; - var cd = frame.canvasData; - - // Blend Mode - - if (this.currentBlendMode !== src.blendMode) - { - this.currentBlendMode = src.blendMode; - ctx.globalCompositeOperation = this.blendModes[src.blendMode]; - } - - // Alpha - - if (this.currentAlpha !== src.alpha) - { - this.currentAlpha = src.alpha; - ctx.globalAlpha = src.alpha; - } - - // Smoothing - - if (this.currentScaleMode !== src.scaleMode) - { - this.currentScaleMode = src.scaleMode; - - // ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR); - } - - var dx = frame.x; - var dy = frame.y; - var fx = 1; - var fy = 1; +module.exports = { - if (src.flipX) - { - fx = -1; - dx -= cd.dWidth - src.displayOriginX; - } - else - { - dx -= src.displayOriginX; - } + BottomCenter: __webpack_require__(172), + BottomLeft: __webpack_require__(173), + BottomRight: __webpack_require__(174), + Center: __webpack_require__(175), + LeftCenter: __webpack_require__(177), + QuickSet: __webpack_require__(170), + RightCenter: __webpack_require__(178), + TopCenter: __webpack_require__(179), + TopLeft: __webpack_require__(180), + TopRight: __webpack_require__(181) - if (src.flipY) - { - fy = -1; - dy -= cd.dHeight - src.displayOriginY; - } - else - { - dy -= src.displayOriginY; - } +}; - // Perform Matrix ITRS - ctx.save(); +/***/ }), +/* 476 */ +/***/ (function(module, exports, __webpack_require__) { - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - ctx.rotate(src.rotation); +/** + * @namespace Phaser.Display.Align.To + */ - ctx.scale(src.scaleX, src.scaleY); - ctx.scale(fx, fy); +module.exports = { - ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, dx, dy, cd.dWidth, cd.dHeight); + BottomCenter: __webpack_require__(477), + BottomLeft: __webpack_require__(478), + BottomRight: __webpack_require__(479), + LeftBottom: __webpack_require__(480), + LeftCenter: __webpack_require__(481), + LeftTop: __webpack_require__(482), + RightBottom: __webpack_require__(483), + RightCenter: __webpack_require__(484), + RightTop: __webpack_require__(485), + TopCenter: __webpack_require__(486), + TopLeft: __webpack_require__(487), + TopRight: __webpack_require__(488) - ctx.restore(); }; -module.exports = DrawImage; - /***/ }), -/* 505 */ +/* 477 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -82577,48 +84666,40 @@ module.exports = DrawImage; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var modes = __webpack_require__(45); -var CanvasFeatures = __webpack_require__(234); +var GetBottom = __webpack_require__(24); +var GetCenterX = __webpack_require__(46); +var SetCenterX = __webpack_require__(47); +var SetTop = __webpack_require__(31); /** - * [description] + * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. * - * @function Phaser.Renderer.Canvas.GetBlendModes + * @function Phaser.Display.Align.To.BottomCenter * @since 3.0.0 * - * @return {array} [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var GetBlendModes = function () +var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) { - var output = []; - var useNew = CanvasFeatures.supportNewBlendModes; + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - output[modes.NORMAL] = 'source-over'; - output[modes.ADD] = 'lighter'; - output[modes.MULTIPLY] = (useNew) ? 'multiply' : 'source-over'; - output[modes.SCREEN] = (useNew) ? 'screen' : 'source-over'; - output[modes.OVERLAY] = (useNew) ? 'overlay' : 'source-over'; - output[modes.DARKEN] = (useNew) ? 'darken' : 'source-over'; - output[modes.LIGHTEN] = (useNew) ? 'lighten' : 'source-over'; - output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : 'source-over'; - output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : 'source-over'; - output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : 'source-over'; - output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : 'source-over'; - output[modes.DIFFERENCE] = (useNew) ? 'difference' : 'source-over'; - output[modes.EXCLUSION] = (useNew) ? 'exclusion' : 'source-over'; - output[modes.HUE] = (useNew) ? 'hue' : 'source-over'; - output[modes.SATURATION] = (useNew) ? 'saturation' : 'source-over'; - output[modes.COLOR] = (useNew) ? 'color' : 'source-over'; - output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : 'source-over'; + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - return output; + return gameObject; }; -module.exports = GetBlendModes; +module.exports = BottomCenter; /***/ }), -/* 506 */ +/* 478 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -82627,1804 +84708,1467 @@ module.exports = GetBlendModes; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var IsSizePowerOfTwo = __webpack_require__(125); -var Utils = __webpack_require__(42); -var WebGLSnapshot = __webpack_require__(507); - -// Default Pipelines -var BitmapMaskPipeline = __webpack_require__(508); -var FlatTintPipeline = __webpack_require__(511); -var ForwardDiffuseLightPipeline = __webpack_require__(237); -var TextureTintPipeline = __webpack_require__(238); +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); /** - * @classdesc - * [description] + * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. * - * @class WebGLRenderer - * @memberOf Phaser.Renderer.WebGL - * @constructor + * @function Phaser.Display.Align.To.BottomLeft * @since 3.0.0 * - * @param {Phaser.Game} game - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var WebGLRenderer = new Class({ +var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - initialize: + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - function WebGLRenderer (game) - { - // eslint-disable-next-line consistent-this - var renderer = this; + return gameObject; +}; - var contextCreationConfig = { - alpha: game.config.transparent, - depth: false, // enable when 3D is added in the future - antialias: game.config.antialias, - premultipliedAlpha: game.config.transparent, - stencil: true, - preserveDrawingBuffer: game.config.preserveDrawingBuffer, - failIfMajorPerformanceCaveat: false, - powerPreference: game.config.powerPreference - }; +module.exports = BottomLeft; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: game.config.clearBeforeRender, - pixelArt: game.config.pixelArt, - backgroundColor: game.config.backgroundColor, - contextCreation: contextCreationConfig, - resolution: game.config.resolution, - autoResize: game.config.autoResize - }; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; +/***/ }), +/* 479 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {integer} - * @since 3.0.0 - */ - this.type = CONST.WEBGL; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = game.config.width; +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = game.config.height; +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. + * + * @function Phaser.Display.Align.To.BottomRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomRight = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = game.canvas; + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks - * @type {function[]} - * @since 3.0.0 - */ - this.lostContextCallbacks = []; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks - * @type {function[]} - * @since 3.0.0 - */ - this.restoredContextCallbacks = []; +module.exports = BottomRight; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.blendModes = []; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.nativeTextures = []; +/***/ }), +/* 480 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.contextLost = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines - * @type {object} - * @default null - * @since 3.0.0 - */ - this.pipelines = null; +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {object} - * @since 3.0.0 - */ - this.snapshotState = { - callback: null, - type: null, - encoder: null - }; +/** + * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. + * + * @function Phaser.Display.Align.To.LeftBottom + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit - * @type {integer} - * @since 3.1.0 - */ - this.currentActiveTextureUnit = 0; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures - * @type {array} - * @since 3.0.0 - */ - this.currentTextures = new Array(16); +module.exports = LeftBottom; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer - * @type {WebGLFramebuffer} - * @default null - * @since 3.0.0 - */ - this.currentFramebuffer = null; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @since 3.0.0 - */ - this.currentPipeline = null; +/***/ }), +/* 481 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram - * @type {WebGLProgram} - * @default null - * @since 3.0.0 - */ - this.currentProgram = null; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentVertexBuffer = null; +var GetCenterY = __webpack_require__(49); +var GetLeft = __webpack_require__(26); +var SetCenterY = __webpack_require__(48); +var SetRight = __webpack_require__(29); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentIndexBuffer = null; +/** + * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. + * + * @function Phaser.Display.Align.To.LeftCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {integer} - * @since 3.0.0 - */ - this.currentBlendMode = Infinity; + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.currentScissorEnabled = false; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor - * @type {Uint32Array} - * @since 3.0.0 - */ - this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); +module.exports = LeftCenter; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorIdx - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.currentScissorIdx = 0; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack - * @type {Uint32Array} - * @since 3.0.0 - */ - this.scissorStack = new Uint32Array(4 * 1000); +/***/ }), +/* 482 */ +/***/ (function(module, exports, __webpack_require__) { - // Setup context lost and restore event listeners +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.canvas.addEventListener('webglcontextlost', function (event) - { - renderer.contextLost = true; - event.preventDefault(); +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); - for (var index = 0; index < renderer.lostContextCallbacks.length; ++index) - { - var callback = renderer.lostContextCallbacks[index]; - callback[0].call(callback[1], renderer); - } - }, false); +/** + * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * + * @function Phaser.Display.Align.To.LeftTop + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - this.canvas.addEventListener('webglcontextrestored', function () - { - renderer.contextLost = false; - renderer.init(renderer.config); - for (var index = 0; index < renderer.restoredContextCallbacks.length; ++index) - { - var callback = renderer.restoredContextCallbacks[index]; - callback[0].call(callback[1], renderer); - } - }, false); + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - // This are initialized post context creation + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 - */ - this.gl = null; +module.exports = LeftTop; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {object} - * @default null - * @since 3.0.0 - */ - this.supportedExtensions = null; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.extensions = {}; +/***/ }), +/* 483 */ +/***/ (function(module, exports, __webpack_require__) { - this.init(this.config); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#init - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - init: function (config) - { - var canvas = this.canvas; - var clearColor = config.backgroundColor; - var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); - - if (!gl) - { - this.contextLost = true; - throw new Error('This browser does not support WebGL. Try using the Canvas pipeline.'); - } +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); - this.gl = gl; +/** + * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. + * + * @function Phaser.Display.Align.To.RightBottom + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - for (var i = 0; i <= 16; i++) - { - this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); - } + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); - this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; - this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; - this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; + return gameObject; +}; - // Load supported extensions - this.supportedExtensions = gl.getSupportedExtensions(); +module.exports = RightBottom; - // Setup initial WebGL state - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.CULL_FACE); - gl.disable(gl.SCISSOR_TEST); - gl.enable(gl.BLEND); - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1.0); - // Initialize all textures to null - for (var index = 0; index < this.currentTextures.length; ++index) - { - this.currentTextures[index] = null; - } +/***/ }), +/* 484 */ +/***/ (function(module, exports, __webpack_require__) { - // Clear previous pipelines and reload default ones - this.pipelines = {}; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.addPipeline('TextureTintPipeline', new TextureTintPipeline(this.game, gl, this)); - this.addPipeline('FlatTintPipeline', new FlatTintPipeline(this.game, gl, this)); - this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline(this.game, gl, this)); - this.addPipeline('Light2D', new ForwardDiffuseLightPipeline(this.game, gl, this)); - - this.setBlendMode(CONST.BlendModes.NORMAL); - this.resize(this.width, this.height); - - return this; - }, +var GetCenterY = __webpack_require__(49); +var GetRight = __webpack_require__(28); +var SetCenterY = __webpack_require__(48); +var SetLeft = __webpack_require__(27); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - resize: function (width, height) - { - var gl = this.gl; - var pipelines = this.pipelines; - var resolution = this.config.resolution; +/** + * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * + * @function Phaser.Display.Align.To.RightCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - this.width = width * resolution; - this.height = height * resolution; - - this.canvas.width = this.width; - this.canvas.height = this.height; + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - if (this.config.autoResize) - { - this.canvas.style.width = (this.width / resolution) + 'px'; - this.canvas.style.height = (this.height / resolution) + 'px'; - } + return gameObject; +}; - gl.viewport(0, 0, this.width, this.height); +module.exports = RightCenter; - // Update all registered pipelines - for (var pipelineName in pipelines) - { - pipelines[pipelineName].resize(width, height, resolution); - } - return this; - }, +/***/ }), +/* 485 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {object} target - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - onContextRestored: function (callback, target) - { - this.restoredContextCallbacks.push([ callback, target ]); - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {object} target - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - onContextLost: function (callback, target) - { - this.lostContextCallbacks.push([ callback, target ]); - return this; - }, +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension - * @since 3.0.0 - * - * @param {string} extensionName - [description] - * - * @return {boolean} [description] - */ - hasExtension: function (extensionName) - { - return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. + * + * @function Phaser.Display.Align.To.RightTop + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension - * @since 3.0.0 - * - * @param {string} extensionName - [description] - * - * @return {object} [description] - */ - getExtension: function (extensionName) - { - if (!this.hasExtension(extensionName)) { return null; } + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - if (!(extensionName in this.extensions)) - { - this.extensions[extensionName] = this.gl.getExtension(extensionName); - } + return gameObject; +}; - return this.extensions[extensionName]; - }, +module.exports = RightTop; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#flush - * @since 3.0.0 - */ - flush: function () - { - if (this.currentPipeline) - { - this.currentPipeline.flush(); - } - }, - /* Renderer State Manipulation Functions */ +/***/ }), +/* 486 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {boolean} [description] - */ - hasPipeline: function (pipelineName) - { - return (pipelineName in this.pipelines); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - getPipeline: function (pipelineName) - { - return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; - }, +var GetCenterX = __webpack_require__(46); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetCenterX = __webpack_require__(47); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - removePipeline: function (pipelineName) - { - delete this.pipelines[pipelineName]; - return this; - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. + * + * @function Phaser.Display.Align.To.TopCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - addPipeline: function (pipelineName, pipelineInstance) - { - if (!this.hasPipeline(pipelineName)) { this.pipelines[pipelineName] = pipelineInstance; } - else { console.warn('Pipeline', pipelineName, ' already exists.'); } + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - pipelineInstance.name = pipelineName; - this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); + return gameObject; +}; - return this; - }, +module.exports = TopCenter; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor - * @since 3.0.0 - * - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} w - [description] - * @param {integer} h - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setScissor: function (x, y, w, h) - { - var gl = this.gl; - var currentScissor = this.currentScissor; - var enabled = (x === 0 && y === 0 && w === gl.canvas.width && h === gl.canvas.height && w >= 0 && h >= 0); - if (currentScissor[0] !== x || - currentScissor[1] !== y || - currentScissor[2] !== w || - currentScissor[3] !== h) - { - this.flush(); - } +/***/ }), +/* 487 */ +/***/ (function(module, exports, __webpack_require__) { - currentScissor[0] = x; - currentScissor[1] = y; - currentScissor[2] = w; - currentScissor[3] = h; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentScissorEnabled = enabled; +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); - if (enabled) - { - gl.disable(gl.SCISSOR_TEST); - return; - } +/** + * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. + * + * @function Phaser.Display.Align.To.TopLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - gl.enable(gl.SCISSOR_TEST); - gl.scissor(x, (gl.drawingBufferHeight - y - h), w, h); + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - return this; - }, + return gameObject; +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor - * @since 3.0.0 - * - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} w - [description] - * @param {integer} h - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - pushScissor: function (x, y, w, h) - { - var scissorStack = this.scissorStack; - var stackIndex = this.currentScissorIdx; - var currentScissor = this.currentScissor; +module.exports = TopLeft; - scissorStack[stackIndex + 0] = currentScissor[0]; - scissorStack[stackIndex + 1] = currentScissor[1]; - scissorStack[stackIndex + 2] = currentScissor[2]; - scissorStack[stackIndex + 3] = currentScissor[3]; - - this.currentScissorIdx += 4; - this.setScissor(x, y, w, h); - return this; - }, +/***/ }), +/* 488 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - popScissor: function () - { - var scissorStack = this.scissorStack; - var stackIndex = this.currentScissorIdx - 4; - - var x = scissorStack[stackIndex + 0]; - var y = scissorStack[stackIndex + 1]; - var w = scissorStack[stackIndex + 2]; - var h = scissorStack[stackIndex + 3]; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentScissorIdx = stackIndex; - this.setScissor(x, y, w, h); - - return this; - }, +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline - * @since 3.0.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - setPipeline: function (pipelineInstance) - { - if (this.currentPipeline !== pipelineInstance || - this.currentPipeline.vertexBuffer !== this.currentVertexBuffer || - this.currentPipeline.program !== this.currentProgram) - { - this.flush(); - this.currentPipeline = pipelineInstance; - this.currentPipeline.bind(); - } +/** + * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * + * @function Phaser.Display.Align.To.TopRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - this.currentPipeline.onBind(); + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - return this.currentPipeline; - }, + return gameObject; +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode - * @since 3.0.0 - * - * @param {integer} blendModeId - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setBlendMode: function (blendModeId) - { - var gl = this.gl; - var blendMode = this.blendModes[blendModeId]; +module.exports = TopRight; - if (blendModeId !== CONST.BlendModes.SKIP_CHECK && - this.currentBlendMode !== blendModeId) - { - this.flush(); - gl.enable(gl.BLEND); - gl.blendEquation(blendMode.equation); +/***/ }), +/* 489 */ +/***/ (function(module, exports, __webpack_require__) { - if (blendMode.func.length > 2) - { - gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); - } - else - { - gl.blendFunc(blendMode.func[0], blendMode.func[1]); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentBlendMode = blendModeId; - } +/** + * @namespace Phaser.Display.Bounds + */ - return this; - }, +module.exports = { - addBlendMode: function (func, equation) - { - var index = this.blendModes.push({ func: func, equation: equation }); + CenterOn: __webpack_require__(176), + GetBottom: __webpack_require__(24), + GetCenterX: __webpack_require__(46), + GetCenterY: __webpack_require__(49), + GetLeft: __webpack_require__(26), + GetOffsetX: __webpack_require__(490), + GetOffsetY: __webpack_require__(491), + GetRight: __webpack_require__(28), + GetTop: __webpack_require__(30), + SetBottom: __webpack_require__(25), + SetCenterX: __webpack_require__(47), + SetCenterY: __webpack_require__(48), + SetLeft: __webpack_require__(27), + SetRight: __webpack_require__(29), + SetTop: __webpack_require__(31) + +}; - return index - 1; - }, - updateBlendMode: function (index, func, equation) - { - if (this.blendModes[index]) - { - this.blendModes[index].func = func; +/***/ }), +/* 490 */ +/***/ (function(module, exports) { - if (equation) - { - this.blendModes[index].equation = equation; - } - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +/** + * Returns the amount the Game Object is visually offset from its x coordinate. + * This is the same as `width * origin.x`. + * This value will only be > 0 if `origin.x` is not equal to zero. + * + * @function Phaser.Display.Bounds.GetOffsetX + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The horizontal offset of the Game Object. + */ +var GetOffsetX = function (gameObject) +{ + return gameObject.width * gameObject.originX; +}; - removeBlendMode: function (index) - { - if (index > 16 && this.blendModes[index]) - { - this.blendModes.splice(index, 1); - } +module.exports = GetOffsetX; - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D - * @since 3.0.0 - * - * @param {WebGLTexture} texture - [description] - * @param {integer} textureUnit - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setTexture2D: function (texture, textureUnit) - { - var gl = this.gl; +/***/ }), +/* 491 */ +/***/ (function(module, exports) { - if (texture !== this.currentTextures[textureUnit]) - { - this.flush(); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (this.currentActiveTextureUnit !== textureUnit) - { - gl.activeTexture(gl.TEXTURE0 + textureUnit); - this.currentActiveTextureUnit = textureUnit; - } - gl.bindTexture(gl.TEXTURE_2D, texture); +/** + * Returns the amount the Game Object is visually offset from its y coordinate. + * This is the same as `width * origin.y`. + * This value will only be > 0 if `origin.y` is not equal to zero. + * + * @function Phaser.Display.Bounds.GetOffsetY + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The vertical offset of the Game Object. + */ +var GetOffsetY = function (gameObject) +{ + return gameObject.height * gameObject.originY; +}; - this.currentTextures[textureUnit] = texture; - } +module.exports = GetOffsetY; - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setFramebuffer: function (framebuffer) - { - var gl = this.gl; +/***/ }), +/* 492 */ +/***/ (function(module, exports, __webpack_require__) { - if (framebuffer !== this.currentFramebuffer) - { - this.flush(); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - this.currentFramebuffer = framebuffer; - } +/** + * @namespace Phaser.Display.Canvas + */ - return this; - }, +module.exports = { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setProgram: function (program) - { - var gl = this.gl; + Interpolation: __webpack_require__(224), + Pool: __webpack_require__(19), + Smoothing: __webpack_require__(121), + TouchAction: __webpack_require__(493), + UserSelect: __webpack_require__(494) + +}; - if (program !== this.currentProgram) - { - this.flush(); - gl.useProgram(program); - this.currentProgram = program; - } +/***/ }), +/* 493 */ +/***/ (function(module, exports) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setVertexBuffer: function (vertexBuffer) - { - var gl = this.gl; +/** + * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. + * + * @function Phaser.Display.Canvas.TouchAction + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var TouchAction = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } + + canvas.style['msTouchAction'] = value; + canvas.style['ms-touch-action'] = value; + canvas.style['touch-action'] = value; + + return canvas; +}; - if (vertexBuffer !== this.currentVertexBuffer) - { - this.flush(); +module.exports = TouchAction; - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - this.currentVertexBuffer = vertexBuffer; - } - return this; - }, +/***/ }), +/* 494 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} indexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setIndexBuffer: function (indexBuffer) - { - var gl = this.gl; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (indexBuffer !== this.currentIndexBuffer) - { - this.flush(); - - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - this.currentIndexBuffer = indexBuffer; - } +/** + * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. + * + * @function Phaser.Display.Canvas.UserSelect + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var UserSelect = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } - return this; - }, + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; - /* Renderer Resource Creation Functions */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource - * @since 3.0.0 - * - * @param {object} source - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {integer} scaleMode - [description] - * - * @return {WebGLTexture} [description] - */ - createTextureFromSource: function (source, width, height, scaleMode) + vendors.forEach(function (vendor) { - var gl = this.gl; - var filter = gl.NEAREST; - var wrap = gl.CLAMP_TO_EDGE; - var texture = null; + canvas.style[vendor + 'user-select'] = value; + }); - width = source ? source.width : width; - height = source ? source.height : height; + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - if (IsSizePowerOfTwo(width, height)) - { - wrap = gl.REPEAT; - } + return canvas; +}; - if (scaleMode === CONST.ScaleModes.LINEAR) - { - filter = gl.LINEAR; - } - else if (scaleMode === CONST.ScaleModes.NEAREST || this.config.pixelArt) - { - filter = gl.NEAREST; - } +module.exports = UserSelect; - if (!source && typeof width === 'number' && typeof height === 'number') - { - texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - } - else - { - texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, source); - } - return texture; - }, +/***/ }), +/* 495 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D - * @since 3.0.0 - * - * @param {integer} mipLevel - [description] - * @param {integer} minFilter - [description] - * @param {integer} magFilter - [description] - * @param {integer} wrapT - [description] - * @param {integer} wrapS - [description] - * @param {integer} format - [description] - * @param {object} pixels - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {boolean} pma - [description] - * - * @return {WebGLTexture} [description] - */ - createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @typedef {Object} ColorObject + * @property {number} r - The red color value in the range 0 to 255. + * @property {number} g - The green color value in the range 0 to 255. + * @property {number} b - The blue color value in the range 0 to 255. + * @property {number} a - The alpha color value in the range 0 to 255. + */ + +/** + * Converts the given color value into an Object containing r,g,b and a properties. + * + * @function Phaser.Display.Color.ColorToRGBA + * @since 3.0.0 + * + * @param {number} color - A color value, optionally including the alpha value. + * + * @return {ColorObject} An object containing the parsed color values. + */ +var ColorToRGBA = function (color) +{ + var output = { + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF, + a: 255 + }; + + if (color > 16777215) { - var gl = this.gl; - var texture = gl.createTexture(); + output.a = color >>> 24; + } - pma = (pma === undefined || pma === null) ? true : pma; + return output; +}; - this.setTexture2D(texture, 0); - - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); +module.exports = ColorToRGBA; - if (pixels === null || pixels === undefined) - { - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); - } - else - { - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); - width = pixels.width; - height = pixels.height; - } - this.setTexture2D(null, 0); +/***/ }), +/* 496 */ +/***/ (function(module, exports, __webpack_require__) { - texture.isAlphaPremultiplied = pma; - texture.isRenderTexture = false; - texture.width = width; - texture.height = height; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.nativeTextures.push(texture); +var Color = __webpack_require__(36); +var HueToComponent = __webpack_require__(227); - return texture; - }, +/** + * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. + * + * @function Phaser.Display.Color.HSLToColor + * @since 3.0.0 + * + * @param {number} h - The hue value in the range 0 to 1. + * @param {number} s - The saturation value in the range 0 to 1. + * @param {number} l - The lightness value in the range 0 to 1. + * + * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. + */ +var HSLToColor = function (h, s, l) +{ + // achromatic by default + var r = l; + var g = l; + var b = l; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer - * @since 3.0.0 - * - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {WebGLFramebuffer} renderTexture - [description] - * @param {boolean} addDepthStencilBuffer - [description] - * - * @return {WebGLFramebuffer} [description] - */ - createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) + if (s !== 0) { - var gl = this.gl; - var framebuffer = gl.createFramebuffer(); - var complete = 0; + var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; - this.setFramebuffer(framebuffer); + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } - if (addDepthStencilBuffer) - { - var depthStencilBuffer = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); - } + var color = new Color(); - renderTexture.isRenderTexture = true; - renderTexture.isAlphaPremultiplied = false; + return color.setGLTo(r, g, b, 1); +}; - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); +module.exports = HSLToColor; - complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (complete !== gl.FRAMEBUFFER_COMPLETE) - { - var errors = { - 36054: 'Incomplete Attachment', - 36055: 'Missing Attachment', - 36057: 'Incomplete Dimensions', - 36061: 'Framebuffer Unsupported' - }; - throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); - } +/***/ }), +/* 497 */ +/***/ (function(module, exports) { - framebuffer.renderTexture = renderTexture; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; - this.setFramebuffer(null); - return framebuffer; - }, +/***/ }), +/* 498 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram - * @since 3.0.0 - * - * @param {string} vertexShader - [description] - * @param {string} fragmentShader - [description] - * - * @return {WebGLProgram} [description] - */ - createProgram: function (vertexShader, fragmentShader) +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var HSVToRGB = __webpack_require__(228); + +/** + * Get HSV color wheel values in an array which will be 360 elements in size. + * + * @function Phaser.Display.Color.HSVColorWheel + * @since 3.0.0 + * + * @param {number} [s=1] - The saturation, in the range 0 - 1. + * @param {number} [v=1] - The value, in the range 0 - 1. + * + * @return {array} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. + */ +var HSVColorWheel = function (s, v) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } + + var colors = []; + + for (var c = 0; c <= 359; c++) { - var gl = this.gl; - var program = gl.createProgram(); - var vs = gl.createShader(gl.VERTEX_SHADER); - var fs = gl.createShader(gl.FRAGMENT_SHADER); + colors.push(HSVToRGB(c / 359, s, v)); + } - gl.shaderSource(vs, vertexShader); - gl.shaderSource(fs, fragmentShader); - gl.compileShader(vs); - gl.compileShader(fs); + return colors; +}; - if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) - { - throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); - } - if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) - { - throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); - } +module.exports = HSVColorWheel; - gl.attachShader(program, vs); - gl.attachShader(program, fs); - gl.linkProgram(program); - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) - { - throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); - } +/***/ }), +/* 499 */ +/***/ (function(module, exports, __webpack_require__) { - return program; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - [description] - * @param {integer} bufferUsage - [description] - * - * @return {WebGLBuffer} [description] - */ - createVertexBuffer: function (initialDataOrSize, bufferUsage) - { - var gl = this.gl; - var vertexBuffer = gl.createBuffer(); +var Linear = __webpack_require__(229); - this.setVertexBuffer(vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - this.setVertexBuffer(null); +/** + * Interpolates color values + * + * @namespace Phaser.Display.Color.Interpolate + * @since 3.0.0 + */ - return vertexBuffer; - }, +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @since 3.0.0 + * + * @param {number} r1 - Red value. + * @param {number} g1 - Blue value. + * @param {number} b1 - Green value. + * @param {number} r2 - Red value. + * @param {number} g2 - Blue value. + * @param {number} b2 - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - [description] - * @param {integer} bufferUsage - [description] - * - * @return {WebGLBuffer} [description] - */ - createIndexBuffer: function (initialDataOrSize, bufferUsage) - { - var gl = this.gl; - var indexBuffer = gl.createBuffer(); + var t = index / length; - this.setIndexBuffer(indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); - this.setIndexBuffer(null); + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; - return indexBuffer; - }, +/** + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @since 3.0.0 + * + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {Phaser.Display.Color} color2 - The second Color object. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var ColorWithColor = function (color1, color2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture - * @since 3.0.0 - * - * @param {WebGLTexture} texture - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteTexture: function (texture) - { - this.gl.deleteTexture(texture); - return this; - }, + return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); +}; + +/** + * Interpolates between the Color object and color values over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithRGB + * @since 3.0.0 + * + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {number} r - Red value. + * @param {number} g - Blue value. + * @param {number} b - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var ColorWithRGB = function (color, r, g, b, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteFramebuffer: function (framebuffer) - { - this.gl.deleteFramebuffer(framebuffer); - return this; - }, + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteProgram: function (program) - { - this.gl.deleteProgram(program); - return this; - }, +module.exports = { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteBuffer: function (buffer) - { - this.gl.deleteBuffer(buffer); - return this; - }, + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor - /* Rendering Functions */ +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - preRenderCamera: function (camera) - { - var resolution = this.config.resolution; - this.pushScissor(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); - - if (camera.backgroundColor.alphaGL > 0) - { - var color = camera.backgroundColor; - var FlatTintPipeline = this.pipelines.FlatTintPipeline; +/***/ }), +/* 500 */ +/***/ (function(module, exports, __webpack_require__) { - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1.0), - color.alphaGL, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - FlatTintPipeline.flush(); - } - }, +var Between = __webpack_require__(231); +var Color = __webpack_require__(36); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - postRenderCamera: function (camera) - { - if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) - { - var FlatTintPipeline = this.pipelines.FlatTintPipeline; +/** + * Creates a new Color object where the r, g, and b values have been set to random values + * based on the given min max values. + * + * @function Phaser.Display.Color.RandomRGB + * @since 3.0.0 + * + * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) + * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) + * + * @return {Phaser.Display.Color} A Color object. + */ +var RandomRGB = function (min, max) +{ + if (min === undefined) { min = 0; } + if (max === undefined) { max = 255; } - // Fade - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0), - camera._fadeAlpha, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; - // Flash - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0), - camera._flashAlpha, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); +module.exports = RandomRGB; - FlatTintPipeline.flush(); - } - this.popScissor(); - }, +/***/ }), +/* 501 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender - * @since 3.0.0 - */ - preRender: function () - { - if (this.contextLost) { return; } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var gl = this.gl; - var color = this.config.backgroundColor; - var pipelines = this.pipelines; +/** + * Converts an RGB color value to HSV (hue, saturation and value). + * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.RGBToHSV + * @since 3.0.0 + * + * @param {integer} r - The red color value. A number between 0 and 255. + * @param {integer} g - The green color value. A number between 0 and 255. + * @param {integer} b - The blue color value. A number between 0 and 255. + * + * @return {object} An object with the properties `h`, `s` and `v`. + */ +var RGBToHSV = function (r, g, b) +{ + r /= 255; + g /= 255; + b /= 255; - // Bind custom framebuffer here - gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var d = max - min; - if (this.config.clearBeforeRender) - { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } + // achromatic by default + var h = 0; + var s = (max === 0) ? 0 : d / max; + var v = max; - for (var key in pipelines) + if (max !== min) + { + if (max === r) { - pipelines[key].onPreRender(); + h = (g - b) / d + ((g < b) ? 6 : 0); } - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#render - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.GameObject} children - [description] - * @param {number} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - render: function (scene, children, interpolationPercentage, camera) - { - if (this.contextLost) { return; } - - var list = children.list; - var childCount = list.length; - var pipelines = this.pipelines; - - for (var key in pipelines) + else if (max === g) { - pipelines[key].onRender(scene, camera); + h = (b - r) / d + 2; + } + else if (max === b) + { + h = (r - g) / d + 4; } - this.preRenderCamera(camera); + h /= 6; + } - for (var index = 0; index < childCount; ++index) - { - var child = list[index]; + return { h: h, s: s, v: v }; +}; - if (!child.willRender()) - { - continue; - } +module.exports = RGBToHSV; - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } - if (child.mask) - { - child.mask.preRenderWebGL(this, child, camera); - } +/***/ }), +/* 502 */ +/***/ (function(module, exports, __webpack_require__) { - child.renderWebGL(this, child, interpolationPercentage, camera); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (child.mask) - { - child.mask.postRenderWebGL(this, child); - } - } +var ComponentToHex = __webpack_require__(226); - this.flush(); - this.setBlendMode(CONST.BlendModes.NORMAL); - this.postRenderCamera(camera); - }, +/** + * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. + * + * @function Phaser.Display.Color.RGBToString + * @since 3.0.0 + * + * @param {integer} r - The red color value. A number between 0 and 255. + * @param {integer} g - The green color value. A number between 0 and 255. + * @param {integer} b - The blue color value. A number between 0 and 255. + * @param {integer} [a=255] - The alpha value. A number between 0 and 255. + * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. + * + * @return {string} A string-based representation of the color values. + */ +var RGBToString = function (r, g, b, a, prefix) +{ + if (a === undefined) { a = 255; } + if (prefix === undefined) { prefix = '#'; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender - * @since 3.0.0 - */ - postRender: function () + if (prefix === '#') { - if (this.contextLost) { return; } + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; - // Unbind custom framebuffer here +module.exports = RGBToString; - if (this.snapshotState.callback) - { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; - } - var pipelines = this.pipelines; +/***/ }), +/* 503 */ +/***/ (function(module, exports, __webpack_require__) { - for (var key in pipelines) - { - pipelines[key].onPostRender(); - } - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {string} type - [description] - * @param {float} encoderOptions - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - snapshot: function (callback, type, encoderOptions) - { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; - return this; - }, +/** + * @namespace Phaser.Display.Masks + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture - * @since 3.0.0 - * - * @param {HTMLCanvasElement} srcCanvas - [description] - * @param {WebGLTexture} dstTexture - [description] - * @param {boolean} shouldReallocate - [description] - * @param {integer} scaleMode - [description] - * - * @return {WebGLTexture} [description] - */ - canvasToTexture: function (srcCanvas, dstTexture, shouldReallocate) - { - var gl = this.gl; +module.exports = { - if (!dstTexture) - { - var wrapping = gl.CLAMP_TO_EDGE; + BitmapMask: __webpack_require__(504), + GeometryMask: __webpack_require__(505) - if (IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height)) - { - wrapping = gl.REPEAT; - } +}; - dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); - } - else - { - this.setTexture2D(dstTexture, 0); - if (!shouldReallocate) - { - gl.texSubImage2D(0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); - } - else - { - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); - dstTexture.width = srcCanvas.width; - dstTexture.height = srcCanvas.height; - } +/***/ }), +/* 504 */ +/***/ (function(module, exports, __webpack_require__) { - this.setTexture2D(null, 0); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return dstTexture; - }, +var Class = __webpack_require__(0); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter - * @since 3.0.0 - * - * @param {integer} texture - [description] - * @param {integer} filter - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setTextureFilter: function (texture, filter) +/** + * @classdesc + * [description] + * + * @class BitmapMask + * @memberOf Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {[type]} renderable - [description] + */ +var BitmapMask = new Class({ + + initialize: + + function BitmapMask (scene, renderable) { - var gl = this.gl; - var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; + var renderer = scene.sys.game.renderer; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#bitmapMask + * @type {[type]} + * @since 3.0.0 + */ + this.bitmapMask = renderable; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskRenderTarget + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.maskRenderTarget = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainRenderTarget + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.mainRenderTarget = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskTexture + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.maskTexture = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainTexture + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.mainTexture = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#dirty + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.dirty = true; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer + * @type {WebGLFramebuffer} + * @since 3.0.0 + */ + this.mainFramebuffer = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer + * @type {WebGLFramebuffer} + * @since 3.0.0 + */ + this.maskFramebuffer = null; + + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#invertAlpha + * @type {boolean} + * @since 3.1.2 + */ + this.invertAlpha = false; - this.setTexture2D(texture, 0); + if (renderer.gl) + { + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); + + renderer.onContextRestored(function (renderer) + { + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; - this.setTexture2D(null, 0); + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); - return this; + }, this); + } }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 + * @method Phaser.Display.Masks.BitmapMask#setBitmap * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderable - [description] */ - setFloat1: function (program, name, x) + setBitmap: function (renderable) { - this.setProgram(program); - this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); - return this; + this.bitmapMask = renderable; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 + * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} maskedObject - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ - setFloat2: function (program, name, x, y) + preRenderWebGL: function (renderer, maskedObject, camera) { - this.setProgram(program); - this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); - return this; + renderer.pipelines.BitmapMaskPipeline.beginMask(this, maskedObject, camera); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 + * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} z - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setFloat3: function (program, name, x, y, z) + postRenderWebGL: function (renderer) { - this.setProgram(program); - this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); - return this; + renderer.pipelines.BitmapMaskPipeline.endMask(this); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 + * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} z - [description] - * @param {float} w - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ - setFloat4: function (program, name, x, y, z, w) + preRenderCanvas: function () { - this.setProgram(program); - this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); - return this; + // NOOP }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 + * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setInt1: function (program, name, x) + postRenderCanvas: function () { - this.setProgram(program); - this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); - return this; - }, + // NOOP + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setInt2: function (program, name, x, y) - { - this.setProgram(program); - this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); - return this; - }, +}); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setInt3: function (program, name, x, y, z) +module.exports = BitmapMask; + + +/***/ }), +/* 505 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * [description] + * + * @class GeometryMask + * @memberOf Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {[type]} graphicsGeometry - [description] + */ +var GeometryMask = new Class({ + + initialize: + + function GeometryMask (scene, graphicsGeometry) { - this.setProgram(program); - this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); - return this; + /** + * [description] + * + * @name Phaser.Display.Masks.GeometryMask#geometryMask + * @type {Phaser.GameObjects.Graphics} + * @since 3.0.0 + */ + this.geometryMask = graphicsGeometry; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 + * @method Phaser.Display.Masks.GeometryMask#setShape * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] - * @param {integer} w - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description] */ - setInt4: function (program, name, x, y, z, w) + setShape: function (graphicsGeometry) { - this.setProgram(program); - this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); - return this; + this.geometryMask = graphicsGeometry; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 + * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setMatrix2: function (program, name, transpose, matrix) + preRenderWebGL: function (renderer, mask, camera) { - this.setProgram(program); - this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var gl = renderer.gl; + var geometryMask = this.geometryMask; + + // Force flushing before drawing to stencil buffer + renderer.flush(); + + // Enable and setup GL state to write to stencil buffer + gl.enable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); + + // Write stencil buffer + geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + renderer.flush(); + + // Use stencil buffer to affect next rendering object + gl.colorMask(true, true, true, true); + gl.stencilFunc(gl.EQUAL, 1, 1); + gl.stencilOp(gl.INVERT, gl.INVERT, gl.INVERT); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 + * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setMatrix3: function (program, name, transpose, matrix) + postRenderWebGL: function (renderer) { - this.setProgram(program); - this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var gl = renderer.gl; + + // Force flush before disabling stencil test + renderer.flush(); + gl.disable(gl.STENCIL_TEST); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 + * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setMatrix4: function (program, name, transpose, matrix) + preRenderCanvas: function (renderer, mask, camera) { - this.setProgram(program); - this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var geometryMask = this.geometryMask; + + renderer.currentContext.save(); + + geometryMask.renderCanvas(renderer, geometryMask, 0.0, camera, null, true); + + renderer.currentContext.clip(); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy + * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas * @since 3.0.0 + * + * @param {[type]} renderer - [description] */ - destroy: function () + postRenderCanvas: function (renderer) { - // Clear-up anything that should be cleared :) - for (var key in this.pipelines) - { - this.pipelines[key].destroy(); - delete this.pipelines[key]; - } - - for (var index = 0; index < this.nativeTextures.length; ++index) - { - this.deleteTexture(this.nativeTextures[index]); - delete this.nativeTextures[index]; - } - - if (this.hasExtension('WEBGL_lose_context')) - { - this.getExtension('WEBGL_lose_context').loseContext(); - } - - delete this.gl; - delete this.game; - - this.contextLost = true; - this.extensions = {}; - this.nativeTextures.length = 0; + renderer.currentContext.restore(); } }); -module.exports = WebGLRenderer; +module.exports = GeometryMask; /***/ }), -/* 507 */ -/***/ (function(module, exports) { +/* 506 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -84433,62 +86177,208 @@ module.exports = WebGLRenderer; */ /** - * [description] - * - * @function Phaser.Renderer.Snapshot.WebGL - * @since 3.0.0 - * - * @param {HTMLCanvasElement} sourceCanvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {float} [encoderOptions=0.92] - [description] - * - * @return {Image} [description] + * @namespace Phaser.DOM */ -var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) -{ - if (!type) { type = 'image/png'; } - if (!encoderOptions) { encoderOptions = 0.92; } - var gl = sourceCanvas.getContext('experimental-webgl'); - var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); - gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); +module.exports = { - // CanvasPool? - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - var imageData; + AddToDOM: __webpack_require__(124), + DOMContentLoaded: __webpack_require__(232), + ParseXML: __webpack_require__(233), + RemoveFromDOM: __webpack_require__(234), + RequestAnimationFrame: __webpack_require__(235) - canvas.width = gl.drawingBufferWidth; - canvas.height = gl.drawingBufferHeight; +}; - imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); - var data = imageData.data; +/***/ }), +/* 507 */ +/***/ (function(module, exports) { - for (var y = 0; y < canvas.height; y += 1) - { - for (var x = 0; x < canvas.width; x += 1) - { - var si = ((canvas.height - y) * canvas.width + x) * 4; - var di = (y * canvas.width + x) * 4; - data[di + 0] = pixels[si + 0]; - data[di + 1] = pixels[si + 1]; - data[di + 2] = pixels[si + 2]; - data[di + 3] = pixels[si + 3]; +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; - ctx.putImageData(imageData, 0, 0); +function noop() {} - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; - image.src = src; +process.listeners = function (name) { return [] } - return image; +process.binding = function (name) { + throw new Error('process.binding is not supported'); }; -module.exports = WebGLSnapshot; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; /***/ }), @@ -84502,220 +86392,179 @@ module.exports = WebGLSnapshot; */ var Class = __webpack_require__(0); -var ShaderSourceFS = __webpack_require__(509); -var ShaderSourceVS = __webpack_require__(510); -var WebGLPipeline = __webpack_require__(126); +var EE = __webpack_require__(14); +var PluginManager = __webpack_require__(12); + +/** + * @namespace Phaser.Events + */ /** * @classdesc - * [description] + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. * - * @class BitmapMaskPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL + * @class EventEmitter + * @extends EventEmitter + * @memberOf Phaser.Events * @constructor * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] */ -var BitmapMaskPipeline = new Class({ +var EventEmitter = new Class({ + + Extends: EE, - Extends: WebGLPipeline, - initialize: - function BitmapMaskPipeline (game, gl, renderer) + function EventEmitter () { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: ShaderSourceFS, - vertexCapacity: 3, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2, - - vertices: new Float32Array([ - -1, +1, -1, -7, +7, +1 - ]).buffer, - - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - } - ] - }); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#maxQuads - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.maxQuads = 1; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#resolutionDirty - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.resolutionDirty = true; + EE.call(this); }, /** - * [description] + * Removes all listeners. * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#onBind + * @method Phaser.Events.EventEmitter#shutdown * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] */ - onBind: function () + shutdown: function () { - WebGLPipeline.prototype.onBind.call(this); - - var renderer = this.renderer; - var program = this.program; - - if (this.resolutionDirty) - { - renderer.setFloat2(program, 'uResolution', this.width, this.height); - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uMaskSampler', 1); - this.resolutionDirty = false; - } - - return this; + this.removeAllListeners(); }, /** - * [description] + * Removes all listeners. * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#resize + * @method Phaser.Events.EventEmitter#destroy * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] */ - resize: function (width, height, resolution) + destroy: function () { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.resolutionDirty = true; - return this; - }, + this.removeAllListeners(); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#beginMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - [description] - * @param {Phaser.GameObjects.GameObject} maskedObject - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - beginMask: function (mask, maskedObject, camera) - { - var bitmapMask = mask.bitmapMask; - var renderer = this.renderer; - var gl = this.gl; - var visible = bitmapMask.visible; +}); - if (bitmapMask && gl) - { - // First we clear the mask framebuffer - renderer.setFramebuffer(mask.maskFramebuffer); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); +/** + * @namespace EventEmitter + */ - // We render out mask source - bitmapMask.visible = true; - bitmapMask.renderWebGL(renderer, bitmapMask, 0.0, camera); - bitmapMask.visible = visible; - renderer.flush(); +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method EventEmitter#eventNames + * + * @return {array} + */ - // Bind and clear our main source (masked object) - renderer.setFramebuffer(mask.mainFramebuffer); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - } - }, +/** + * Return the listeners registered for a given event. + * + * @method EventEmitter#listeners + * + * @param {string|symbol} event - The event name. + * + * @return {array} The registered listeners. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#endMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - [description] - */ - endMask: function (mask) - { - var bitmapMask = mask.bitmapMask; - var renderer = this.renderer; - var gl = this.gl; +/** + * Return the number of listeners listening to a given event. + * + * @method EventEmitter#listenerCount + * + * @param {string|symbol} event - The event name. + * + * @return {number} The number of listeners. + */ - if (bitmapMask) - { - // Return to default framebuffer - renderer.setFramebuffer(null); - - // Bind bitmap mask pipeline and draw - renderer.setPipeline(this); - - renderer.setTexture2D(mask.maskTexture, 1); - renderer.setTexture2D(mask.mainTexture, 0); - - // Finally draw a triangle filling the whole screen - gl.drawArrays(this.topology, 0, 3); - } - } +/** + * Calls each of the listeners registered for a given event. + * + * @method EventEmitter#emit + * + * @param {string|symbol} event - The event name. + * + * @return {Boolean} `true` if the event had listeners, else `false`. + */ -}); +/** + * Add a listener for a given event. + * + * @method EventEmitter#on + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ -module.exports = BitmapMaskPipeline; +/** + * Add a listener for a given event. + * + * @method EventEmitter#addListener + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ +/** + * Add a one-time listener for a given event. + * + * @method EventEmitter#once + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ -/***/ }), -/* 509 */ -/***/ (function(module, exports) { +/** + * Remove the listeners of a given event. + * + * @method EventEmitter#removeListener + * + * @param {string|symbol} event - The event name. + * @param {function} fn - Only remove the listeners that match this function. + * @param {*} context - Only remove the listeners that have this context. + * @param {boolean} once - Only remove one-time listeners. + * + * @return {EventEmitter} `this`. + */ -module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uMaskSampler;\r\n\r\nvoid main()\r\n{\r\n vec2 uv = gl_FragCoord.xy / uResolution;\r\n vec4 mainColor = texture2D(uMainSampler, uv);\r\n vec4 maskColor = texture2D(uMaskSampler, uv);\r\n float alpha = maskColor.a * mainColor.a;\r\n gl_FragColor = vec4(mainColor.rgb * alpha, alpha);\r\n}\r\n" +/** + * Remove the listeners of a given event. + * + * @method EventEmitter#off + * + * @param {string|symbol} event - The event name. + * @param {function} fn - Only remove the listeners that match this function. + * @param {*} context - Only remove the listeners that have this context. + * @param {boolean} once - Only remove one-time listeners. + * + * @return {EventEmitter} `this`. + */ -/***/ }), -/* 510 */ -/***/ (function(module, exports) { +/** + * Remove all listeners, or those of the specified event. + * + * @method EventEmitter#removeAllListeners + * + * @param {string|symbol} [event] - The event name. + * + * @return {EventEmitter} `this`. + */ + +PluginManager.register('EventEmitter', EventEmitter, 'events'); + +module.exports = EventEmitter; -module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision mediump float;\r\n\r\nattribute vec2 inPosition;\r\n\r\nvoid main()\r\n{\r\n gl_Position = vec4(inPosition, 0.0, 1.0);\r\n}\r\n" /***/ }), -/* 511 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84724,1247 +86573,981 @@ module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision med * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var AddToDOM = __webpack_require__(124); +var AnimationManager = __webpack_require__(197); +var CacheManager = __webpack_require__(200); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); -var Commands = __webpack_require__(127); -var Earcut = __webpack_require__(235); -var ModelViewProjection = __webpack_require__(236); -var ShaderSourceFS = __webpack_require__(512); -var ShaderSourceVS = __webpack_require__(513); -var Utils = __webpack_require__(42); -var WebGLPipeline = __webpack_require__(126); - -var Point = function (x, y, width, rgb, alpha) -{ - this.x = x; - this.y = y; - this.width = width; - this.rgb = rgb; - this.alpha = alpha; -}; - -var Path = function (x, y, width, rgb, alpha) -{ - this.points = []; - this.pointsLength = 1; - this.points[0] = new Point(x, y, width, rgb, alpha); -}; - -var currentMatrix = new Float32Array([ 1, 0, 0, 1, 0, 0 ]); -var matrixStack = new Float32Array(6 * 1000); -var matrixStackLength = 0; -var pathArray = []; +var Config = __webpack_require__(510); +var CreateRenderer = __webpack_require__(511); +var DataManager = __webpack_require__(79); +var DebugHeader = __webpack_require__(519); +var Device = __webpack_require__(520); +var DOMContentLoaded = __webpack_require__(232); +var EventEmitter = __webpack_require__(14); +var InputManager = __webpack_require__(240); +var NOOP = __webpack_require__(3); +var PluginManager = __webpack_require__(12); +var SceneManager = __webpack_require__(252); +var SoundManagerCreator = __webpack_require__(256); +var TextureManager = __webpack_require__(263); +var TimeStep = __webpack_require__(543); +var VisibilityHandler = __webpack_require__(544); /** * @classdesc - * [description] + * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible + * for handling the boot process, parsing the configuration values, creating the renderer, + * and setting-up all of the global Phaser systems, such as sound and input. + * Once that is complete it will start the Scene Manager and then begin the main game loop. * - * @class FlatTintPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL + * You should generally avoid accessing any of the systems created by Game, and instead use those + * made available to you via the Phaser.Scene Systems class instead. + * + * @class Game + * @memberOf Phaser * @constructor * @since 3.0.0 * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] + * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. */ -var FlatTintPipeline = new Class({ - - Extends: WebGLPipeline, - - Mixins: [ - ModelViewProjection - ], +var Game = new Class({ initialize: - function FlatTintPipeline (game, gl, renderer) + function Game (config) { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: ShaderSourceFS, - vertexCapacity: 12000, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2 + - Uint8Array.BYTES_PER_ELEMENT * 4, + /** + * The parsed Game Configuration object. + * + * The values stored within this object are read-only and should not be changed at run-time. + * + * @name Phaser.Game#config + * @type {Phaser.Boot.Config} + * @readOnly + * @since 3.0.0 + */ + this.config = new Config(config); + + /** + * A reference to either the Canvas or WebGL Renderer that this Game is using. + * + * @name Phaser.Game#renderer + * @type {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = null; + + /** + * A reference to the HTML Canvas Element on which the renderer is drawing. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; + + /** + * A reference to the Canvas Rendering Context belonging to the Canvas Element this game is rendering to. + * + * @name Phaser.Game#context + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.context = null; + + /** + * A flag indicating when this Game instance has finished its boot process. + * + * @name Phaser.Game#isBooted + * @type {boolean} + * @readOnly + * @since 3.0.0 + */ + this.isBooted = false; + + /** + * A flag indicating if this Game is currently running its game step or not. + * + * @name Phaser.Game#isRunning + * @type {boolean} + * @readOnly + * @since 3.0.0 + */ + this.isRunning = false; + + /** + * An Event Emitter which is used to broadcast game-level events from the global systems. + * + * @name Phaser.Game#events + * @type {EventEmitter} + * @since 3.0.0 + */ + this.events = new EventEmitter(); + + /** + * An instance of the Animation Manager. + * + * The Animation Manager is a global system responsible for managing all animations used within your game. + * + * @name Phaser.Game#anims + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.anims = new AnimationManager(this); + + /** + * An instance of the Texture Manager. + * + * The Texture Manager is a global system responsible for managing all textures being used by your game. + * + * @name Phaser.Game#textures + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.textures = new TextureManager(this); + + /** + * An instance of the Cache Manager. + * + * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. + * + * @name Phaser.Game#cache + * @type {Phaser.Cache.CacheManager} + * @since 3.0.0 + */ + this.cache = new CacheManager(this); + + /** + * [description] + * + * @name Phaser.Game#registry + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.registry = new DataManager(this); + + /** + * An instance of the Input Manager. + * + * The Input Manager is a global system responsible for the capture of browser-level input events. + * + * @name Phaser.Game#input + * @type {Phaser.Input.InputManager} + * @since 3.0.0 + */ + this.input = new InputManager(this, this.config); + + /** + * An instance of the Scene Manager. + * + * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. + * + * @name Phaser.Game#scene + * @type {Phaser.Scenes.SceneManager} + * @since 3.0.0 + */ + this.scene = new SceneManager(this, this.config.sceneConfig); - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: Float32Array.BYTES_PER_ELEMENT * 2 - } - ] - }); + /** + * A reference to the Device inspector. + * + * Contains information about the device running this game, such as OS, browser vendor and feature support. + * Used by various systems to determine capabilities and code paths. + * + * @name Phaser.Game#device + * @type {Phaser.Device} + * @since 3.0.0 + */ + this.device = Device; /** - * [description] + * An instance of the base Sound Manager. * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewF32 - * @type {Float32Array} + * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. + * + * @name Phaser.Game#sound + * @type {Phaser.BaseSoundManager} * @since 3.0.0 */ - this.vertexViewF32 = new Float32Array(this.vertexData); + this.sound = SoundManagerCreator.create(this); /** - * [description] + * An instance of the Time Step. * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewU32 - * @type {Uint32Array} + * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing + * them and calculating delta values. It then automatically calls the game step. + * + * @name Phaser.Game#loop + * @type {Phaser.Boot.TimeStep} * @since 3.0.0 */ - this.vertexViewU32 = new Uint32Array(this.vertexData); + this.loop = new TimeStep(this, this.config.fps); /** - * [description] + * An instance of the Plugin Manager. * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#tempTriangle - * @type {array} + * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install + * those plugins into Scenes as required. + * + * @name Phaser.Game#plugins + * @type {Phaser.Boot.PluginManager} * @since 3.0.0 */ - this.tempTriangle = [ - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0} - ]; + this.plugins = new PluginManager(this, this.config); /** - * [description] + * The `onStepCallback` is a callback that is fired each time the Time Step ticks. + * It is set automatically when the Game boot process has completed. * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#polygonCache - * @type {array} - * @default [] + * @name Phaser.Game#onStepCallback + * @type {function} + * @private * @since 3.0.0 */ - this.polygonCache = []; + this.onStepCallback = NOOP; - this.mvpInit(); + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); }, /** - * [description] + * Game boot event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#onBind - * @since 3.0.0 + * This is an internal event dispatched when the game has finished booting, but before it is ready to start running. + * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. * - * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] + * @event Phaser.Game#boot */ - onBind: function () - { - WebGLPipeline.prototype.onBind.call(this); - this.mvpUpdate(); - - return this; - }, /** - * [description] + * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, + * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. + * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#resize + * @method Phaser.Game#boot + * @protected + * @fires Phaser.Game#boot * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] */ - resize: function (width, height, resolution) + boot: function () { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); - - return this; + this.isBooted = true; + + this.config.preBoot(this); + + CreateRenderer(this); + + DebugHeader(this); + + AddToDOM(this.canvas, this.config.parent); + + this.events.emit('boot'); + + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready, so it will emit this event + this.events.once('ready', this.start, this); }, /** - * [description] + * Called automatically by Game.boot once all of the global systems have finished setting themselves up. + * By this point the Game is now ready to start the main loop running. + * It will also enable the Visibility Handler. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillRect + * @method Phaser.Game#start + * @protected * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} width - [description] - * @param {float} height - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] */ - batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + start: function () { - this.renderer.setPipeline(this); + this.isRunning = true; - if (this.vertexCount + 6 > this.vertexCapacity) + this.config.postBoot(this); + + if (this.renderer) { - this.flush(); + this.loop.start(this.step.bind(this)); + } + else + { + this.loop.start(this.headlessStep.bind(this)); } - - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = this.vertexCount * this.vertexComponentCount; - var xw = x + width; - var yh = y + height; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tx0 = x * a + y * c + e; - var ty0 = x * b + y * d + f; - var tx1 = x * a + yh * c + e; - var ty1 = x * b + yh * d + f; - var tx2 = xw * a + yh * c + e; - var ty2 = xw * b + yh * d + f; - var tx3 = xw * a + y * c + e; - var ty3 = xw * b + y * d + f; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; - vertexViewF32[vertexOffset + 9] = tx0; - vertexViewF32[vertexOffset + 10] = ty0; - vertexViewU32[vertexOffset + 11] = tint; - vertexViewF32[vertexOffset + 12] = tx2; - vertexViewF32[vertexOffset + 13] = ty2; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx3; - vertexViewF32[vertexOffset + 16] = ty3; - vertexViewU32[vertexOffset + 17] = tint; + VisibilityHandler(this.events); - this.vertexCount += 6; + this.events.on('hidden', this.onHidden, this); + this.events.on('visible', this.onVisible, this); + this.events.on('blur', this.onBlur, this); + this.events.on('focus', this.onFocus, this); }, /** - * [description] + * Game Pre-Render event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillTriangle - * @since 3.0.0 + * This event is dispatched immediately before any of the Scenes have started to render. + * The renderer will already have been initialized this frame, clearing itself and preparing to receive + * the Scenes for rendering, but it won't have actually drawn anything yet. * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x0 - [description] - * @param {float} y0 - [description] - * @param {float} x1 - [description] - * @param {float} y1 - [description] - * @param {float} x2 - [description] - * @param {float} y2 - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] + * @event Phaser.Game#prerenderEvent + * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. */ - batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) - { - this.renderer.setPipeline(this); - - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - } - - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = this.vertexCount * this.vertexComponentCount; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tx0 = x0 * a + y0 * c + e; - var ty0 = x0 * b + y0 * d + f; - var tx1 = x1 * a + y1 * c + e; - var ty1 = x1 * b + y1 * d + f; - var tx2 = x2 * a + y2 * c + e; - var ty2 = x2 * b + y2 * d + f; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); - - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; - this.vertexCount += 3; - }, + /** + * Game Post-Render event. + * + * This event is dispatched right at the end of the render process. + * Every Scene will have rendered and drawn to the canvas. + * + * @event Phaser.Game#postrenderEvent + * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. + */ /** - * [description] + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokeTriangle + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * + * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * + * @method Phaser.Game#step + * @fires Phaser.Game#prerenderEvent + * @fires Phaser.Game#postrenderEvent * @since 3.0.0 * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x0 - [description] - * @param {float} y0 - [description] - * @param {float} x1 - [description] - * @param {float} y1 - [description] - * @param {float} x2 - [description] - * @param {float} y2 - [description] - * @param {float} lineWidth - [description] - * @param {integer} lineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a - [description] - * @param {float} b - [description] - * @param {float} c - [description] - * @param {float} d - [description] - * @param {float} e - [description] - * @param {float} f - [description] - * @param {Float32Array} currentMatrix - [description] + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. */ - batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix) + step: function (time, delta) { - var tempTriangle = this.tempTriangle; + // Global Managers - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - tempTriangle[0].rgb = lineColor; - tempTriangle[0].alpha = lineAlpha; - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - tempTriangle[1].rgb = lineColor; - tempTriangle[1].alpha = lineAlpha; - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; - tempTriangle[2].rgb = lineColor; - tempTriangle[2].alpha = lineAlpha; - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; - tempTriangle[3].rgb = lineColor; - tempTriangle[3].alpha = lineAlpha; + this.input.update(time, delta); - this.batchStrokePath( - srcX, srcY, srcScaleX, srcScaleY, srcRotation, - tempTriangle, lineWidth, lineColor, lineAlpha, - a, b, c, d, e, f, - false, - currentMatrix - ); + this.sound.update(time, delta); + + // Scenes + + this.onStepCallback(); + + this.scene.update(time, delta); + + // Render + + var renderer = this.renderer; + + renderer.preRender(); + + this.events.emit('prerender', renderer); + + this.scene.render(renderer); + + renderer.postRender(); + + this.events.emit('postrender', renderer); }, /** - * [description] + * A special version of the Game Step for the HEADLESS renderer only. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillPath - * @since 3.0.0 + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} path - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * + * This process emits `prerender` and `postrender` events, even though nothing actually displays. + * + * @method Phaser.Game#headlessStep + * @fires Phaser.Game#prerenderEvent + * @fires Phaser.Game#postrenderEvent + * @since 3.2.0 + * + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. */ - batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + headlessStep: function (time, delta) { - this.renderer.setPipeline(this); + // Global Managers - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; - var v0, v1, v2; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = 0; - var x0, y0, x1, y1, x2, y2; - var tx0, ty0, tx1, ty1, tx2, ty2; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); + this.input.update(time, delta); - for (var pathIndex = 0; pathIndex < length; ++pathIndex) - { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); - } + this.sound.update(time, delta); - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; + // Scenes - for (var index = 0; index < length; index += 3) - { - v0 = polygonIndexArray[index + 0] * 2; - v1 = polygonIndexArray[index + 1] * 2; - v2 = polygonIndexArray[index + 2] * 2; + this.onStepCallback(); - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - } + this.scene.update(time, delta); - vertexOffset = this.vertexCount * this.vertexComponentCount; + // Render - x0 = polygonCache[v0 + 0]; - y0 = polygonCache[v0 + 1]; - x1 = polygonCache[v1 + 0]; - y1 = polygonCache[v1 + 1]; - x2 = polygonCache[v2 + 0]; - y2 = polygonCache[v2 + 1]; + this.events.emit('prerender'); - tx0 = x0 * a + y0 * c + e; - ty0 = x0 * b + y0 * d + f; - tx1 = x1 * a + y1 * c + e; - ty1 = x1 * b + y1 * d + f; - tx2 = x2 * a + y2 * c + e; - ty2 = x2 * b + y2 * d + f; + this.events.emit('postrender'); + }, - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; + /** + * Game Pause event. + * + * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. + * + * @event Phaser.Game#pauseEvent + */ - this.vertexCount += 3; - } + /** + * Called automatically by the Visibility Handler. + * This will pause the main loop and then emit a pause event. + * + * @method Phaser.Game#onHidden + * @protected + * @fires Phaser.Game#pauseEvent + * @since 3.0.0 + */ + onHidden: function () + { + this.loop.pause(); - polygonCache.length = 0; + this.events.emit('pause'); }, /** - * [description] + * Game Resume event. + * + * This event is dispatched when the game loop leaves a paused state and resumes running. + * + * @event Phaser.Game#resumeEvent + */ + + /** + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokePath + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Game#resumeEvent * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {array} path - [description] - * @param {float} lineWidth - [description] - * @param {integer} lineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a - [description] - * @param {float} b - [description] - * @param {float} c - [description] - * @param {float} d - [description] - * @param {float} e - [description] - * @param {float} f - [description] - * @param {boolean} isLastPath - [description] - * @param {Float32Array} currentMatrix - [description] */ - batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix) + onVisible: function () { - this.renderer.setPipeline(this); + this.loop.resume(); - var point0, point1; - var pathLength = path.length; - var polylines = this.polygonCache; - var last, curr; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset; - var line; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + this.events.emit('resume'); + }, - for (var pathIndex = 0; pathIndex + 1 < pathLength; pathIndex += 1) - { - point0 = path[pathIndex]; - point1 = path[pathIndex + 1]; + /** + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'blurred' state, which pauses it. + * + * @method Phaser.Game#onBlur + * @protected + * @since 3.0.0 + */ + onBlur: function () + { + this.loop.blur(); + }, - line = this.batchLine( - srcX, srcY, srcScaleX, srcScaleY, srcRotation, - point0.x, point0.y, - point1.x, point1.y, - point0.width / 2, point1.width / 2, - point0.rgb, point1.rgb, lineAlpha, - a, b, c, d, e, f, - currentMatrix - ); + /** + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'focused' state, which resumes it. + * + * @method Phaser.Game#onFocus + * @protected + * @since 3.0.0 + */ + onFocus: function () + { + this.loop.focus(); + }, - polylines.push(line); - } + /** + * Game Resize event. + * + * @event Phaser.Game#resizeEvent + * @param {number} width - The new width of the Game. + * @param {number} height - The new height of the Game. + */ - /* Render joints */ - for (var index = 1, polylinesLength = polylines.length; index < polylinesLength; ++index) - { - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + /** + * Updates the Game Config with the new width and height values given. + * Then resizes the Renderer and Input Manager scale. + * + * @method Phaser.Game#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + */ + resize: function (width, height) + { + this.config.width = width; + this.config.height = height; - last = polylines[index - 1] || polylines[polylinesLength - 1]; - curr = polylines[index]; - vertexOffset = this.vertexCount * this.vertexComponentCount; + this.renderer.resize(width, height); - vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0]; - vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1]; - vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha); - vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0]; - vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1]; - vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha); - vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0]; - vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1]; - vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha); - vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0]; - vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1]; - vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha); - vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0]; - vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1]; - vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha); - vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0]; - vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1]; - vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha); + this.input.resize(); - this.vertexCount += 6; - } + this.scene.resize(width, height); - polylines.length = 0; + this.events.emit('resize', width, height); }, /** - * [description] + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchLine + * @method Phaser.Game#destroy * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} ax - [description] - * @param {float} ay - [description] - * @param {float} bx - [description] - * @param {float} by - [description] - * @param {float} aLineWidth - [description] - * @param {float} bLineWidth - [description] - * @param {integer} aLineColor - [description] - * @param {integer} bLineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] */ - batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + destroy: function (removeCanvas) { - this.renderer.setPipeline(this); + this.loop.destroy(); - if (this.vertexCount + 6 > this.vertexCapacity) + this.scene.destroy(); + + this.renderer.destroy(); + + this.events.emit('destroy'); + + this.events.removeAllListeners(); + + this.onStepCallback = null; + + if (removeCanvas) { - this.flush(); + CanvasPool.remove(this.canvas); } - - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var dx = bx - ax; - var dy = by - ay; - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; - var x0 = lx0 * a + ly0 * c + e; - var y0 = lx0 * b + ly0 * d + f; - var x1 = lx1 * a + ly1 * c + e; - var y1 = lx1 * b + ly1 * d + f; - var x2 = lx2 * a + ly2 * c + e; - var y2 = lx2 * b + ly2 * d + f; - var x3 = lx3 * a + ly3 * c + e; - var y3 = lx3 * b + ly3 * d + f; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; - var aTint = getTint(aLineColor, lineAlpha); - var bTint = getTint(bLineColor, lineAlpha); - var vertexOffset = this.vertexCount * this.vertexComponentCount; + } - vertexViewF32[vertexOffset + 0] = x0; - vertexViewF32[vertexOffset + 1] = y0; - vertexViewU32[vertexOffset + 2] = bTint; - vertexViewF32[vertexOffset + 3] = x1; - vertexViewF32[vertexOffset + 4] = y1; - vertexViewU32[vertexOffset + 5] = aTint; - vertexViewF32[vertexOffset + 6] = x2; - vertexViewF32[vertexOffset + 7] = y2; - vertexViewU32[vertexOffset + 8] = bTint; - vertexViewF32[vertexOffset + 9] = x1; - vertexViewF32[vertexOffset + 10] = y1; - vertexViewU32[vertexOffset + 11] = aTint; - vertexViewF32[vertexOffset + 12] = x3; - vertexViewF32[vertexOffset + 13] = y3; - vertexViewU32[vertexOffset + 14] = aTint; - vertexViewF32[vertexOffset + 15] = x2; - vertexViewF32[vertexOffset + 16] = y2; - vertexViewU32[vertexOffset + 17] = bTint; +}); - this.vertexCount += 6; +module.exports = Game; - return [ - x0, y0, bLineColor, - x1, y1, aLineColor, - x2, y2, bLineColor, - x3, y3, aLineColor - ]; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchGraphics - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchGraphics: function (graphics, camera) - { - if (graphics.commandBuffer.length <= 0) { return; } - - this.renderer.setPipeline(this); +/***/ }), +/* 510 */ +/***/ (function(module, exports, __webpack_require__) { - var cameraScrollX = camera.scrollX * graphics.scrollFactorX; - var cameraScrollY = camera.scrollY * graphics.scrollFactorY; - var srcX = graphics.x - cameraScrollX; - var srcY = graphics.y - cameraScrollY; - var srcScaleX = graphics.scaleX; - var srcScaleY = graphics.scaleY; - var srcRotation = -graphics.rotation; - var commands = graphics.commandBuffer; - var lineAlpha = 1.0; - var fillAlpha = 1.0; - var lineColor = 0; - var fillColor = 0; - var lineWidth = 1.0; - var cameraMatrix = camera.matrix.matrix; - var lastPath = null; - var iteration = 0; - var iterStep = 0.01; - var tx = 0; - var ty = 0; - var ta = 0; - var x = 0; - var y = 0; - var radius = 0; - var startAngle = 0; - var endAngle = 0; - var anticlockwise = 0; - var path = null; - var sin = Math.sin; - var cos = Math.cos; - var sr = sin(srcRotation); - var cr = cos(srcRotation); - var sra = cr * srcScaleX; - var srb = -sr * srcScaleX; - var src = sr * srcScaleY; - var srd = cr * srcScaleY; - var sre = srcX; - var srf = srcY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var pathArrayIndex; - var pathArrayLength; +var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var GetValue = __webpack_require__(4); +var MATH = __webpack_require__(16); +var NOOP = __webpack_require__(3); +var Plugins = __webpack_require__(236); +var ValueToColor = __webpack_require__(116); - pathArray.length = 0; +/** + * This callback type is completely empty, a no-operation. + * + * @callback NOOP + */ - for (var cmdIndex = 0, cmdLength = commands.length; cmdIndex < cmdLength; ++cmdIndex) - { - cmd = commands[cmdIndex]; +/** + * @typedef {object} FPSConfig + * + * @property {integer} [min=10] - [description] + * @property {integer} [target=60] - [description] + * @property {boolean} [forceSetTimeOut=false] - [description] + * @property {integer} [deltaHistory=10] - [description] + * @property {integer} [panicMax=120] - [description] + */ - switch (cmd) - { - case Commands.ARC: - iteration = 0; - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - radius = commands[cmdIndex + 3]; - startAngle = commands[cmdIndex + 4]; - endAngle = commands[cmdIndex + 5]; - anticlockwise = commands[cmdIndex + 6]; +/** + * @typedef {object} LoaderConfig + * + * @property {string} [baseURL] - [description] + * @property {string} [path] - [description] + * @property {boolean} [enableParallel=true] - [description] + * @property {integer} [maxParallelDownloads=4] - [description] + * @property {string|undefined} [crossOrigin=undefined] - [description] + * @property {string} [responseType] - [description] + * @property {boolean} [async=true] - [description] + * @property {string} [user] - [description] + * @property {string} [password] - [description] + * @property {integer} [timeout=0] - [description] + */ - if (anticlockwise) - { - ta = endAngle; - endAngle = startAngle; - startAngle = -ta; - } - - while (iteration < 1) - { - ta = (endAngle - startAngle) * iteration + startAngle; - tx = x + cos(ta) * radius; - ty = y + sin(ta) * radius; +/** + * @typedef {object} GameConfig + * + * @property {integer|string} [width=1024] - [description] + * @property {integer|string} [height=768] - [description] + * @property {number} [zoom=1] - [description] + * @property {number} [resolution=1] - [description] + * @property {number} [type=CONST.AUTO] - [description] + * @property {object} [?parent=null] - [description] + * @property {HTMLCanvasElement} [?canvas=null] - [description] + * @property {string} [?canvasStyle=null] - [description] + * @property {object} [?scene=null] - [description] + * @property {array} [seed] - [description] + * @property {string} [title=''] - [description] + * @property {string} [url='http://phaser.io'] - [description] + * @property {string} [version=''] - [description] + * @property {object} [input] - [description] + * @property {boolean} [input.keyboard=true] - [description] + * @property {object} [input.keyboard.target=window] - [description] + * @property {boolean} [input.mouse=true] - [description] + * @property {object} [?input.mouse.target=null] - [description] + * @property {boolean} [input.touch=true] - [description] + * @property {object} [?input.touch.target=null] - [description] + * @property {object} [?input.touch.capture=true] - [description] + * @property {boolean} [input.gamepad=false] - [description] + * @property {boolean} [disableContextMenu=false] - [description] + * @property {boolean} [banner=false] - [description] + * @property {boolean} [banner.hidePhaser=false] - [description] + * @property {string} [banner.text='#ffffff'] - [description] + * @property {array} [banner.background] - [description] + * @property {FPSConfig} [?fps] - [description] + * @property {boolean} [pixelArt=false] - [description] + * @property {boolean} [autoResize=false] - [description] + * @property {boolean} [roundPixels=false] - [description] + * @property {boolean} [transparent=false] - [description] + * @property {boolean} [clearBeforeRender=true] - [description] + * @property {string|number} [backgroundColor=0x000000] - [description] + * @property {object} [?callbacks] - [description] + * @property {function} [callbacks.preBoot=NOOP] - [description] + * @property {function} [callbacks.postBoot=NOOP] - [description] + * @property {LoaderConfig} [?loader] - [description] + * @property {object} [?images] - [description] + * @property {string} [images.default] - [description] + * @property {string} [images.missing] - [description] + */ - if (iteration === 0) - { - lastPath = new Path(tx, ty, lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - } - else - { - lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); - } +/** + * @classdesc + * [description] + * + * @class Config + * @memberOf Phaser.Boot + * @constructor + * @since 3.0.0 + * + * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. + * + */ +var Config = new Class({ - iteration += iterStep; - } - cmdIndex += 6; - break; + initialize: - case Commands.LINE_STYLE: - lineWidth = commands[cmdIndex + 1]; - lineColor = commands[cmdIndex + 2]; - lineAlpha = commands[cmdIndex + 3]; - cmdIndex += 3; - break; + function Config (config) + { + if (config === undefined) { config = {}; } - case Commands.FILL_STYLE: - fillColor = commands[cmdIndex + 1]; - fillAlpha = commands[cmdIndex + 2]; - cmdIndex += 2; - break; + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; - case Commands.BEGIN_PATH: - pathArray.length = 0; - break; + var defaultBannerTextColor = '#ffffff'; - case Commands.CLOSE_PATH: - if (lastPath !== null && lastPath.points.length > 0) - { - var firstPoint = lastPath.points[0]; - var lastPoint = lastPath.points[lastPath.points.length - 1]; - lastPath.points.push(firstPoint); - lastPath = new Path(lastPoint.x, lastPoint.y, lastPoint.width, lastPoint.rgb, lastPoint.alpha); - pathArray.push(lastPath); - } - break; + this.width = GetValue(config, 'width', 1024); + this.height = GetValue(config, 'height', 768); + this.zoom = GetValue(config, 'zoom', 1); - case Commands.FILL_PATH: - for (pathArrayIndex = 0, pathArrayLength = pathArray.length; - pathArrayIndex < pathArrayLength; - ++pathArrayIndex) - { - this.batchFillPath( + this.resolution = GetValue(config, 'resolution', 1); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.renderType = GetValue(config, 'type', CONST.AUTO); - /* Rectangle properties */ - pathArray[pathArrayIndex].points, - fillColor, - fillAlpha, + this.parent = GetValue(config, 'parent', null); + this.canvas = GetValue(config, 'canvas', null); + this.canvasStyle = GetValue(config, 'canvasStyle', null); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - } - break; + this.sceneConfig = GetValue(config, 'scene', null); + + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + MATH.RND.init(this.seed); + + this.gameTitle = GetValue(config, 'title', ''); + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + this.gameVersion = GetValue(config, 'version', ''); + + // Input + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + this.inputMouse = GetValue(config, 'input.mouse', true); + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + this.inputTouch = GetValue(config, 'input.touch', true); + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - case Commands.STROKE_PATH: - for (pathArrayIndex = 0, pathArrayLength = pathArray.length; - pathArrayIndex < pathArrayLength; - ++pathArrayIndex) - { - path = pathArray[pathArrayIndex]; - this.batchStrokePath( + this.audio = GetValue(config, 'audio'); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + // If you do: { banner: false } it won't display any banner at all + this.hideBanner = (GetValue(config, 'banner', null) === false); - /* Rectangle properties */ - path.points, - lineWidth, - lineColor, - lineAlpha, + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - path === this._lastPath, - currentMatrix - ); - } - break; - - case Commands.FILL_RECT: - this.batchFillRect( + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + // Frame Rate config + // fps: { + // min: 10, + // target: 60, + // forceSetTimeOut: false, + // deltaHistory: 10 + // } - /* Rectangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - fillColor, - fillAlpha, + this.fps = GetValue(config, 'fps', null); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 4; - break; + this.pixelArt = GetValue(config, 'pixelArt', false); + this.autoResize = GetValue(config, 'autoResize', false); + this.roundPixels = GetValue(config, 'roundPixels', false); + this.transparent = GetValue(config, 'transparent', false); + this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true); - case Commands.FILL_TRIANGLE: - this.batchFillTriangle( + var bgc = GetValue(config, 'backgroundColor', 0); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.backgroundColor = ValueToColor(bgc); - /* Triangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5], - commands[cmdIndex + 6], - fillColor, - fillAlpha, + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 6; - break; + // Callbacks + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - case Commands.STROKE_TRIANGLE: - this.batchStrokeTriangle( + // Physics + // physics: { + // system: 'impact', + // setBounds: true, + // gravity: 0, + // cellSize: 64 + // } + this.physics = GetValue(config, 'physics', {}); + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + // Loader Defaults + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + this.loaderPath = GetValue(config, 'loader.path', ''); + this.loaderEnableParallel = GetValue(config, 'loader.enableParallel', true); + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 4); + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + this.loaderAsync = GetValue(config, 'loader.async', true); + this.loaderUser = GetValue(config, 'loader.user', ''); + this.loaderPassword = GetValue(config, 'loader.password', ''); + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - /* Triangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5], - commands[cmdIndex + 6], - lineWidth, - lineColor, - lineAlpha, + // Scene Plugins + this.defaultPlugins = GetValue(config, 'plugins', Plugins.DefaultScene); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 6; - break; + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - case Commands.LINE_TO: - if (lastPath !== null) - { - lastPath.points.push(new Point(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha)); - } - else - { - lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - } - cmdIndex += 2; - break; + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + } - case Commands.MOVE_TO: - lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - cmdIndex += 2; - break; +}); - case Commands.LINE_FX_TO: - if (lastPath !== null) - { - lastPath.points.push(new Point( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - )); - } - else - { - lastPath = new Path( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - ); - pathArray.push(lastPath); - } - cmdIndex += 5; - break; +module.exports = Config; - case Commands.MOVE_FX_TO: - lastPath = new Path( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - ); - pathArray.push(lastPath); - cmdIndex += 5; - break; - case Commands.SAVE: - matrixStack[matrixStackLength + 0] = currentMatrix[0]; - matrixStack[matrixStackLength + 1] = currentMatrix[1]; - matrixStack[matrixStackLength + 2] = currentMatrix[2]; - matrixStack[matrixStackLength + 3] = currentMatrix[3]; - matrixStack[matrixStackLength + 4] = currentMatrix[4]; - matrixStack[matrixStackLength + 5] = currentMatrix[5]; - matrixStackLength += 6; - break; +/***/ }), +/* 511 */ +/***/ (function(module, exports, __webpack_require__) { - case Commands.RESTORE: - matrixStackLength -= 6; - currentMatrix[0] = matrixStack[matrixStackLength + 0]; - currentMatrix[1] = matrixStack[matrixStackLength + 1]; - currentMatrix[2] = matrixStack[matrixStackLength + 2]; - currentMatrix[3] = matrixStack[matrixStackLength + 3]; - currentMatrix[4] = matrixStack[matrixStackLength + 4]; - currentMatrix[5] = matrixStack[matrixStackLength + 5]; - break; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - case Commands.TRANSLATE: - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - currentMatrix[4] = currentMatrix[0] * x + currentMatrix[2] * y + currentMatrix[4]; - currentMatrix[5] = currentMatrix[1] * x + currentMatrix[3] * y + currentMatrix[5]; - cmdIndex += 2; - break; +var CanvasInterpolation = __webpack_require__(224); +var CanvasPool = __webpack_require__(19); +var CONST = __webpack_require__(22); +var Features = __webpack_require__(125); - case Commands.SCALE: - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - currentMatrix[0] *= x; - currentMatrix[1] *= x; - currentMatrix[2] *= y; - currentMatrix[3] *= y; - cmdIndex += 2; - break; +/** + * Called automatically by Phaser.Game and responsible for creating the renderer it will use. + * + * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. + * + * @function Phaser.Boot.CreateRenderer + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. + */ +var CreateRenderer = function (game) +{ + var config = game.config; - case Commands.ROTATE: - y = commands[cmdIndex + 1]; - x = sin(y); - y = cos(y); - sra = currentMatrix[0]; - srb = currentMatrix[1]; - src = currentMatrix[2]; - srd = currentMatrix[3]; - currentMatrix[0] = y * sra + x * src; - currentMatrix[1] = y * srb + x * srd; - currentMatrix[2] = -x * sra + y * src; - currentMatrix[3] = -x * srb + y * srd; - cmdIndex += 1; - break; + // Game either requested Canvas, + // or requested AUTO or WEBGL but the browser doesn't support it, so fall back to Canvas - default: - // eslint-disable-next-line no-console - console.error('Phaser: Invalid Graphics Command ID ' + cmd); - break; + if (config.renderType !== CONST.HEADLESS) + { + if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL)) + { + if (Features.canvas) + { + // They requested Canvas and their browser supports it + config.renderType = CONST.CANVAS; + } + else + { + throw new Error('Cannot create Canvas or WebGL context, aborting.'); } } - }, - - // Stubs + else + { + // Game requested WebGL and browser says it supports it + config.renderType = CONST.WEBGL; + } + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawStaticTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawStaticTilemapLayer: function () + // Pixel Art mode? + if (config.pixelArt) { - }, + CanvasPool.disableSmoothing(); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawEmitterManager - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmittermanager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawEmitterManager: function () + // Does the game config provide its own canvas element to use? + if (config.canvas) { - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawBlitter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawBlitter: function () + game.canvas = config.canvas; + } + else { - }, + game.canvas = CanvasPool.create(game, config.width, config.height, config.renderType); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchSprite: function () + // Does the game config provide some canvas css styles to use? + if (config.canvasStyle) { - }, + game.canvas.style = config.canvasStyle; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchMesh - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchMesh: function () + // Pixel Art mode? + if (config.pixelArt) { - }, + CanvasInterpolation.setCrisp(game.canvas); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchBitmapText: function () + // Zoomed? + if (config.zoom !== 1) { - }, + game.canvas.style.width = (config.width * config.zoom).toString() + 'px'; + game.canvas.style.height = (config.height * config.zoom).toString() + 'px'; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicBitmapText: function () + if (config.renderType === CONST.HEADLESS) { - }, + // Nothing more to do here + return; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchText: function () - { - }, + var CanvasRenderer; + var WebGLRenderer; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicTilemapLayer: function () + if (true) { - }, + CanvasRenderer = __webpack_require__(367); + WebGLRenderer = __webpack_require__(372); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchTileSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTileSprite: function () + // Let the config pick the renderer type, both are included + if (config.renderType === CONST.WEBGL) + { + game.renderer = new WebGLRenderer(game); + game.context = null; + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } + } + + if (false) { + WebGLRenderer = require('../renderer/webgl/WebGLRenderer'); + + // Force the type to WebGL, regardless what was requested + config.renderType = CONST.WEBGL; + game.renderer = new WebGLRenderer(game); + game.context = null; } -}); + if (false) + { + CanvasRenderer = require('../renderer/canvas/CanvasRenderer'); -module.exports = FlatTintPipeline; + // Force the type to Canvas, regardless what was requested + config.renderType = CONST.CANVAS; + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } +}; + +module.exports = CreateRenderer; /***/ }), /* 512 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(outTint.rgb * outTint.a, outTint.a);\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uMaskSampler;\r\nuniform bool uInvertMaskAlpha;\r\n\r\nvoid main()\r\n{\r\n vec2 uv = gl_FragCoord.xy / uResolution;\r\n vec4 mainColor = texture2D(uMainSampler, uv);\r\n vec4 maskColor = texture2D(uMaskSampler, uv);\r\n float alpha = mainColor.a;\r\n\r\n if (!uInvertMaskAlpha)\r\n {\r\n alpha *= (maskColor.a);\r\n }\r\n else\r\n {\r\n alpha *= (1.0 - maskColor.a);\r\n }\r\n \r\n gl_FragColor = vec4(mainColor.rgb * alpha, alpha);\r\n}\r\n" /***/ }), /* 513 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec4 inTint;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main () {\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTint = inTint;\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision mediump float;\r\n\r\nattribute vec2 inPosition;\r\n\r\nvoid main()\r\n{\r\n gl_Position = vec4(inPosition, 0.0, 1.0);\r\n}\r\n" /***/ }), /* 514 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FORWARD_DIFFUSE_FS\r\n\r\nprecision mediump float;\r\n\r\nstruct Light\r\n{\r\n vec2 position;\r\n vec3 color;\r\n float intensity;\r\n float radius;\r\n};\r\n\r\nconst int kMaxLights = %LIGHT_COUNT%;\r\n\r\nuniform vec4 uCamera; /* x, y, rotation, zoom */\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uNormSampler;\r\nuniform vec3 uAmbientLightColor;\r\nuniform Light uLights[kMaxLights];\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main()\r\n{\r\n vec3 finalColor = vec3(0.0, 0.0, 0.0);\r\n vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);\r\n vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;\r\n vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));\r\n vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;\r\n\r\n for (int index = 0; index < kMaxLights; ++index)\r\n {\r\n Light light = uLights[index];\r\n vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);\r\n vec3 lightNormal = normalize(lightDir);\r\n float distToSurf = length(lightDir) * uCamera.w;\r\n float diffuseFactor = max(dot(normal, lightNormal), 0.0);\r\n float radius = (light.radius / res.x * uCamera.w) * uCamera.w;\r\n float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);\r\n vec3 diffuse = light.color * diffuseFactor;\r\n finalColor += (attenuation * diffuse) * light.intensity;\r\n }\r\n\r\n vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);\r\n gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);\r\n\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(outTint.rgb * outTint.a, outTint.a);\r\n}\r\n" /***/ }), /* 515 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform sampler2D uMainSampler;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main() \r\n{\r\n vec4 texel = texture2D(uMainSampler, outTexCoord);\r\n texel *= vec4(outTint.rgb * outTint.a, outTint.a);\r\n gl_FragColor = texel;\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec4 inTint;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main () {\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTint = inTint;\r\n}\r\n" /***/ }), /* 516 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec2 inTexCoord;\r\nattribute vec4 inTint;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main () \r\n{\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTexCoord = inTexCoord;\r\n outTint = inTint;\r\n}\r\n\r\n" +module.exports = "#define SHADER_NAME PHASER_FORWARD_DIFFUSE_FS\r\n\r\nprecision mediump float;\r\n\r\nstruct Light\r\n{\r\n vec2 position;\r\n vec3 color;\r\n float intensity;\r\n float radius;\r\n};\r\n\r\nconst int kMaxLights = %LIGHT_COUNT%;\r\n\r\nuniform vec4 uCamera; /* x, y, rotation, zoom */\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uNormSampler;\r\nuniform vec3 uAmbientLightColor;\r\nuniform Light uLights[kMaxLights];\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main()\r\n{\r\n vec3 finalColor = vec3(0.0, 0.0, 0.0);\r\n vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);\r\n vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;\r\n vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));\r\n vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;\r\n\r\n for (int index = 0; index < kMaxLights; ++index)\r\n {\r\n Light light = uLights[index];\r\n vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);\r\n vec3 lightNormal = normalize(lightDir);\r\n float distToSurf = length(lightDir) * uCamera.w;\r\n float diffuseFactor = max(dot(normal, lightNormal), 0.0);\r\n float radius = (light.radius / res.x * uCamera.w) * uCamera.w;\r\n float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);\r\n vec3 diffuse = light.color * diffuseFactor;\r\n finalColor += (attenuation * diffuse) * light.intensity;\r\n }\r\n\r\n vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);\r\n gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);\r\n\r\n}\r\n" /***/ }), /* 517 */ +/***/ (function(module, exports) { + +module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform sampler2D uMainSampler;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main() \r\n{\r\n vec4 texel = texture2D(uMainSampler, outTexCoord);\r\n texel *= vec4(outTint.rgb * outTint.a, outTint.a);\r\n gl_FragColor = texel;\r\n}\r\n" + +/***/ }), +/* 518 */ +/***/ (function(module, exports) { + +module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec2 inTexCoord;\r\nattribute vec4 inTint;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main () \r\n{\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTexCoord = inTexCoord;\r\n outTint = inTint;\r\n}\r\n\r\n" + +/***/ }), +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85994,7 +87577,16 @@ var DebugHeader = function (game) return; } - var renderType = (config.renderType === CONST.CANVAS) ? 'Canvas' : 'WebGL'; + var renderType = 'WebGL'; + + if (config.renderType === CONST.CANVAS) + { + renderType = 'Canvas'; + } + else if (config.renderType === CONST.HEADLESS) + { + renderType = 'Headless'; + } var audioConfig = config.audio; var deviceAudio = game.device.audio; @@ -86083,7 +87675,7 @@ module.exports = DebugHeader; /***/ }), -/* 518 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86105,18 +87697,18 @@ module.exports = { os: __webpack_require__(67), browser: __webpack_require__(82), - features: __webpack_require__(124), - input: __webpack_require__(519), - audio: __webpack_require__(520), - video: __webpack_require__(521), - fullscreen: __webpack_require__(522), - canvasFeatures: __webpack_require__(234) + features: __webpack_require__(125), + input: __webpack_require__(521), + audio: __webpack_require__(522), + video: __webpack_require__(523), + fullscreen: __webpack_require__(524), + canvasFeatures: __webpack_require__(237) }; /***/ }), -/* 519 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86196,7 +87788,7 @@ module.exports = init(); /***/ }), -/* 520 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86322,7 +87914,7 @@ module.exports = init(); /***/ }), -/* 521 */ +/* 523 */ /***/ (function(module, exports) { /** @@ -86408,7 +88000,7 @@ module.exports = init(); /***/ }), -/* 522 */ +/* 524 */ /***/ (function(module, exports) { /** @@ -86507,7 +88099,7 @@ module.exports = init(); /***/ }), -/* 523 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86516,7 +88108,7 @@ module.exports = init(); * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(524); +var AdvanceKeyCombo = __webpack_require__(526); /** * Used internally by the KeyCombo class. @@ -86587,7 +88179,7 @@ module.exports = ProcessKeyCombo; /***/ }), -/* 524 */ +/* 526 */ /***/ (function(module, exports) { /** @@ -86628,7 +88220,7 @@ module.exports = AdvanceKeyCombo; /***/ }), -/* 525 */ +/* 527 */ /***/ (function(module, exports) { /** @@ -86662,7 +88254,7 @@ module.exports = ResetKeyCombo; /***/ }), -/* 526 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86684,7 +88276,7 @@ module.exports = KeyMap; /***/ }), -/* 527 */ +/* 529 */ /***/ (function(module, exports) { /** @@ -86723,10 +88315,14 @@ var ProcessKeyDown = function (key, event) key.shiftKey = event.shiftKey; key.location = event.location; - key.isDown = true; - key.isUp = false; - key.timeDown = event.timeStamp; - key.duration = 0; + if (key.isDown === false) + { + key.isDown = true; + key.isUp = false; + key.timeDown = event.timeStamp; + key.duration = 0; + } + key.repeats++; key._justDown = true; @@ -86739,7 +88335,7 @@ module.exports = ProcessKeyDown; /***/ }), -/* 528 */ +/* 530 */ /***/ (function(module, exports) { /** @@ -86789,7 +88385,7 @@ module.exports = ProcessKeyUp; /***/ }), -/* 529 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86799,7 +88395,7 @@ module.exports = ProcessKeyUp; */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(253); +var UppercaseFirst = __webpack_require__(254); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -86851,7 +88447,7 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 530 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86897,7 +88493,7 @@ module.exports = GetScenePlugins; /***/ }), -/* 531 */ +/* 533 */ /***/ (function(module, exports) { /** @@ -86945,7 +88541,7 @@ module.exports = InjectionMap; /***/ }), -/* 532 */ +/* 534 */ /***/ (function(module, exports) { /** @@ -86978,7 +88574,7 @@ module.exports = Canvas; /***/ }), -/* 533 */ +/* 535 */ /***/ (function(module, exports) { /** @@ -87011,7 +88607,7 @@ module.exports = Image; /***/ }), -/* 534 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87020,7 +88616,7 @@ module.exports = Image; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -87050,7 +88646,7 @@ var JSONArray = function (texture, sourceIndex, json) texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); // By this stage frames is a fully parsed array - var frames = (Array.isArray(json.textures)) ? json.textures[0].frames : json.frames; + var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames; var newFrame; @@ -87116,7 +88712,7 @@ module.exports = JSONArray; /***/ }), -/* 535 */ +/* 537 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87125,7 +88721,7 @@ module.exports = JSONArray; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -87213,7 +88809,7 @@ module.exports = JSONHash; /***/ }), -/* 536 */ +/* 538 */ /***/ (function(module, exports) { /** @@ -87286,7 +88882,7 @@ module.exports = Pyxel; /***/ }), -/* 537 */ +/* 539 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87398,7 +88994,7 @@ module.exports = SpriteSheet; /***/ }), -/* 538 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87581,7 +89177,7 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 539 */ +/* 541 */ /***/ (function(module, exports) { /** @@ -87664,7 +89260,7 @@ module.exports = StarlingXML; /***/ }), -/* 540 */ +/* 542 */ /***/ (function(module, exports) { /** @@ -87831,7 +89427,7 @@ TextureImporter: /***/ }), -/* 541 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87843,7 +89439,7 @@ TextureImporter: var Class = __webpack_require__(0); var GetValue = __webpack_require__(4); var NOOP = __webpack_require__(3); -var RequestAnimationFrame = __webpack_require__(232); +var RequestAnimationFrame = __webpack_require__(235); // Frame Rate config // fps: { @@ -88453,7 +90049,7 @@ module.exports = TimeStep; /***/ }), -/* 542 */ +/* 544 */ /***/ (function(module, exports) { /** @@ -88567,7 +90163,7 @@ module.exports = VisibilityHandler; /***/ }), -/* 543 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88582,10 +90178,10 @@ module.exports = VisibilityHandler; var GameObjects = { - DisplayList: __webpack_require__(544), + DisplayList: __webpack_require__(546), GameObjectCreator: __webpack_require__(13), GameObjectFactory: __webpack_require__(9), - UpdateList: __webpack_require__(545), + UpdateList: __webpack_require__(547), Components: __webpack_require__(11), @@ -88596,7 +90192,7 @@ var GameObjects = { Group: __webpack_require__(69), Image: __webpack_require__(70), Particles: __webpack_require__(137), - PathFollower: __webpack_require__(289), + PathFollower: __webpack_require__(290), RenderTexture: __webpack_require__(139), Sprite3D: __webpack_require__(81), Sprite: __webpack_require__(37), @@ -88607,36 +90203,36 @@ var GameObjects = { // Game Object Factories Factories: { - Blitter: __webpack_require__(628), - DynamicBitmapText: __webpack_require__(629), - Graphics: __webpack_require__(630), - Group: __webpack_require__(631), - Image: __webpack_require__(632), - Particles: __webpack_require__(633), - PathFollower: __webpack_require__(634), - RenderTexture: __webpack_require__(635), - Sprite3D: __webpack_require__(636), - Sprite: __webpack_require__(637), - StaticBitmapText: __webpack_require__(638), - Text: __webpack_require__(639), - TileSprite: __webpack_require__(640), - Zone: __webpack_require__(641) + Blitter: __webpack_require__(631), + DynamicBitmapText: __webpack_require__(632), + Graphics: __webpack_require__(633), + Group: __webpack_require__(634), + Image: __webpack_require__(635), + Particles: __webpack_require__(636), + PathFollower: __webpack_require__(637), + RenderTexture: __webpack_require__(638), + Sprite3D: __webpack_require__(639), + Sprite: __webpack_require__(640), + StaticBitmapText: __webpack_require__(641), + Text: __webpack_require__(642), + TileSprite: __webpack_require__(643), + Zone: __webpack_require__(644) }, Creators: { - Blitter: __webpack_require__(642), - DynamicBitmapText: __webpack_require__(643), - Graphics: __webpack_require__(644), - Group: __webpack_require__(645), - Image: __webpack_require__(646), - Particles: __webpack_require__(647), - RenderTexture: __webpack_require__(648), - Sprite3D: __webpack_require__(649), - Sprite: __webpack_require__(650), - StaticBitmapText: __webpack_require__(651), - Text: __webpack_require__(652), - TileSprite: __webpack_require__(653), - Zone: __webpack_require__(654) + Blitter: __webpack_require__(645), + DynamicBitmapText: __webpack_require__(646), + Graphics: __webpack_require__(647), + Group: __webpack_require__(648), + Image: __webpack_require__(649), + Particles: __webpack_require__(650), + RenderTexture: __webpack_require__(651), + Sprite3D: __webpack_require__(652), + Sprite: __webpack_require__(653), + StaticBitmapText: __webpack_require__(654), + Text: __webpack_require__(655), + TileSprite: __webpack_require__(656), + Zone: __webpack_require__(657) } }; @@ -88645,25 +90241,25 @@ if (true) { // WebGL only Game Objects GameObjects.Mesh = __webpack_require__(88); - GameObjects.Quad = __webpack_require__(143); + GameObjects.Quad = __webpack_require__(142); - GameObjects.Factories.Mesh = __webpack_require__(658); - GameObjects.Factories.Quad = __webpack_require__(659); + GameObjects.Factories.Mesh = __webpack_require__(661); + GameObjects.Factories.Quad = __webpack_require__(662); - GameObjects.Creators.Mesh = __webpack_require__(660); - GameObjects.Creators.Quad = __webpack_require__(661); + GameObjects.Creators.Mesh = __webpack_require__(663); + GameObjects.Creators.Quad = __webpack_require__(664); - GameObjects.Light = __webpack_require__(291); + GameObjects.Light = __webpack_require__(293); - __webpack_require__(292); - __webpack_require__(662); + __webpack_require__(294); + __webpack_require__(665); } module.exports = GameObjects; /***/ }), -/* 544 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88675,7 +90271,7 @@ module.exports = GameObjects; var Class = __webpack_require__(0); var List = __webpack_require__(86); var PluginManager = __webpack_require__(12); -var StableSort = __webpack_require__(266); +var StableSort = __webpack_require__(267); /** * @classdesc @@ -88835,7 +90431,7 @@ module.exports = DisplayList; /***/ }), -/* 545 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89105,7 +90701,7 @@ module.exports = UpdateList; /***/ }), -/* 546 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89114,7 +90710,7 @@ module.exports = UpdateList; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(268); +var ParseXMLBitmapFont = __webpack_require__(269); var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing) { @@ -89139,7 +90735,7 @@ module.exports = ParseFromAtlas; /***/ }), -/* 547 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89333,245 +90929,10 @@ ParseRetroFont.TEXT_SET11 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()\':;0123456789'; module.exports = ParseRetroFont; -/***/ }), -/* 548 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var renderWebGL = __webpack_require__(3); -var renderCanvas = __webpack_require__(3); - -if (true) -{ - renderWebGL = __webpack_require__(549); -} - -if (true) -{ - renderCanvas = __webpack_require__(550); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 549 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GameObject = __webpack_require__(1); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.BitmapText#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.BitmapText} gameObject - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var BitmapTextWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera) -{ - var text = gameObject.text; - var textLength = text.length; - - if (GameObject.RENDER_MASK !== gameObject.renderFlags || textLength === 0 || (gameObject.cameraFilter > 0 && (gameObject.cameraFilter & camera._id))) - { - return; - } - - this.pipeline.batchBitmapText(this, camera); -}; - -module.exports = BitmapTextWebGLRenderer; - - /***/ }), /* 550 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GameObject = __webpack_require__(1); - -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.BitmapText#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera) -{ - var text = src.text; - var textLength = text.length; - - if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) - { - return; - } - - var textureFrame = src.frame; - - var cameraScrollX = camera.scrollX * src.scrollFactorX; - var cameraScrollY = camera.scrollY * src.scrollFactorY; - - var chars = src.fontData.chars; - var lineHeight = src.fontData.lineHeight; - - var xAdvance = 0; - var yAdvance = 0; - - var indexCount = 0; - var charCode = 0; - - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - - var x = 0; - var y = 0; - - var lastGlyph = null; - var lastCharCode = 0; - - var ctx = renderer.currentContext; - var image = src.frame.source.image; - - var textureX = textureFrame.cutX; - var textureY = textureFrame.cutY; - - var scale = (src.fontSize / src.fontData.size); - - // Blend Mode - if (renderer.currentBlendMode !== src.blendMode) - { - renderer.currentBlendMode = src.blendMode; - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - } - - // Alpha - if (renderer.currentAlpha !== src.alpha) - { - renderer.currentAlpha = src.alpha; - ctx.globalAlpha = src.alpha; - } - - // Smoothing - if (renderer.currentScaleMode !== src.scaleMode) - { - renderer.currentScaleMode = src.scaleMode; - } - - ctx.save(); - ctx.translate((src.x - cameraScrollX) + src.frame.x, (src.y - cameraScrollY) + src.frame.y); - ctx.rotate(src.rotation); - ctx.translate(-src.displayOriginX, -src.displayOriginY); - ctx.scale(src.scaleX, src.scaleY); - - // ctx.fillStyle = 'rgba(255,0,255,0.5)'; - - for (var index = 0; index < textLength; ++index) - { - charCode = text.charCodeAt(index); - - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; - } - - glyph = chars[charCode]; - - if (!glyph) - { - continue; - } - - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; - - glyphW = glyph.width; - glyphH = glyph.height; - - x = indexCount + glyph.xOffset + xAdvance; - y = glyph.yOffset + yAdvance; - - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } - - x *= scale; - y *= scale; - - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; - - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } - - ctx.save(); - ctx.translate(x, y); - ctx.scale(scale, scale); - - // ctx.fillRect(0, 0, glyphW, glyphH); - ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); - ctx.restore(); - } - - ctx.restore(); -}; - -module.exports = BitmapTextCanvasRenderer; - - -/***/ }), -/* 551 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -89583,12 +90944,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(552); + renderWebGL = __webpack_require__(551); } if (true) { - renderCanvas = __webpack_require__(553); + renderCanvas = __webpack_require__(552); } module.exports = { @@ -89599,6 +90960,48 @@ module.exports = { }; +/***/ }), +/* 551 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GameObject = __webpack_require__(1); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.BitmapText#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.BitmapText} gameObject - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var BitmapTextWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera) +{ + var text = gameObject.text; + var textLength = text.length; + + if (GameObject.RENDER_MASK !== gameObject.renderFlags || textLength === 0 || (gameObject.cameraFilter > 0 && (gameObject.cameraFilter & camera._id))) + { + return; + } + + this.pipeline.batchBitmapText(this, camera); +}; + +module.exports = BitmapTextWebGLRenderer; + + /***/ }), /* 552 */ /***/ (function(module, exports, __webpack_require__) { @@ -89611,6 +91014,217 @@ module.exports = { var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.BitmapText#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + var text = src.text; + var textLength = text.length; + + if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + { + return; + } + + var textureFrame = src.frame; + + var chars = src.fontData.chars; + var lineHeight = src.fontData.lineHeight; + + var xAdvance = 0; + var yAdvance = 0; + + var indexCount = 0; + var charCode = 0; + + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + + var x = 0; + var y = 0; + + var lastGlyph = null; + var lastCharCode = 0; + + var ctx = renderer.currentContext; + var image = src.frame.source.image; + + var textureX = textureFrame.cutX; + var textureY = textureFrame.cutY; + + var scale = (src.fontSize / src.fontData.size); + + // Blend Mode + if (renderer.currentBlendMode !== src.blendMode) + { + renderer.currentBlendMode = src.blendMode; + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; + } + + // Alpha + if (renderer.currentAlpha !== src.alpha) + { + renderer.currentAlpha = src.alpha; + ctx.globalAlpha = src.alpha; + } + + // Smoothing + if (renderer.currentScaleMode !== src.scaleMode) + { + renderer.currentScaleMode = src.scaleMode; + } + + var roundPixels = renderer.config.roundPixels; + + var tx = (src.x - camera.scrollX * src.scrollFactorX) + src.frame.x; + var ty = (src.y - camera.scrollY * src.scrollFactorY) + src.frame.y; + + if (roundPixels) + { + tx |= 0; + ty |= 0; + } + + ctx.save(); + + ctx.translate(tx, ty); + + ctx.rotate(src.rotation); + + ctx.translate(-src.displayOriginX, -src.displayOriginY); + + ctx.scale(src.scaleX, src.scaleY); + + for (var index = 0; index < textLength; ++index) + { + charCode = text.charCodeAt(index); + + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } + + glyph = chars[charCode]; + + if (!glyph) + { + continue; + } + + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; + + glyphW = glyph.width; + glyphH = glyph.height; + + x = indexCount + glyph.xOffset + xAdvance; + y = glyph.yOffset + yAdvance; + + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } + + x *= scale; + y *= scale; + + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; + + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } + + if (roundPixels) + { + x |= 0; + y |= 0; + } + + ctx.save(); + + ctx.translate(x, y); + + ctx.scale(scale, scale); + + ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); + + ctx.restore(); + } + + ctx.restore(); +}; + +module.exports = BitmapTextCanvasRenderer; + + +/***/ }), +/* 553 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var renderWebGL = __webpack_require__(3); +var renderCanvas = __webpack_require__(3); + +if (true) +{ + renderWebGL = __webpack_require__(554); +} + +if (true) +{ + renderCanvas = __webpack_require__(555); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 554 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GameObject = __webpack_require__(1); + /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -89639,7 +91253,7 @@ module.exports = BlitterWebGLRenderer; /***/ }), -/* 553 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89722,7 +91336,7 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 554 */ +/* 556 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90067,7 +91681,7 @@ module.exports = Bob; /***/ }), -/* 555 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90081,12 +91695,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(556); + renderWebGL = __webpack_require__(558); } if (true) { - renderCanvas = __webpack_require__(557); + renderCanvas = __webpack_require__(559); } module.exports = { @@ -90098,7 +91712,7 @@ module.exports = { /***/ }), -/* 556 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90140,7 +91754,7 @@ module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 557 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90233,9 +91847,13 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc } ctx.save(); + ctx.translate(src.x, src.y); + ctx.rotate(src.rotation); + ctx.translate(-src.displayOriginX, -src.displayOriginY); + ctx.scale(src.scaleX, src.scaleY); if (src.cropWidth > 0 && src.cropHeight > 0) @@ -90246,6 +91864,8 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc ctx.clip(); } + var roundPixels = renderer.config.roundPixels; + for (var index = 0; index < textLength; ++index) { // Reset the scale (in case the callback changed it) @@ -90303,13 +91923,19 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc x -= cameraScrollX; y -= cameraScrollY; + if (roundPixels) + { + x |= 0; + y |= 0; + } + ctx.save(); + ctx.translate(x, y); + ctx.rotate(rotation); - ctx.scale(scale, scale); - // ctx.fillStyle = 'rgba(0,255,0,0.2)'; - // ctx.fillRect(0, 0, glyphW, glyphH); + ctx.scale(scale, scale); ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); @@ -90333,7 +91959,7 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 558 */ +/* 560 */ /***/ (function(module, exports) { /** @@ -90367,7 +91993,7 @@ module.exports = Area; /***/ }), -/* 559 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90397,7 +92023,7 @@ module.exports = Clone; /***/ }), -/* 560 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90428,7 +92054,7 @@ module.exports = ContainsPoint; /***/ }), -/* 561 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90464,7 +92090,7 @@ module.exports = ContainsRect; /***/ }), -/* 562 */ +/* 564 */ /***/ (function(module, exports) { /** @@ -90494,7 +92120,7 @@ module.exports = CopyFrom; /***/ }), -/* 563 */ +/* 565 */ /***/ (function(module, exports) { /** @@ -90529,7 +92155,7 @@ module.exports = Equals; /***/ }), -/* 564 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90567,7 +92193,7 @@ module.exports = GetBounds; /***/ }), -/* 565 */ +/* 567 */ /***/ (function(module, exports) { /** @@ -90600,7 +92226,7 @@ module.exports = Offset; /***/ }), -/* 566 */ +/* 568 */ /***/ (function(module, exports) { /** @@ -90632,7 +92258,7 @@ module.exports = OffsetPoint; /***/ }), -/* 567 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90646,15 +92272,15 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(568); + renderWebGL = __webpack_require__(570); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(273); + renderCanvas = __webpack_require__(274); } if (true) { - renderCanvas = __webpack_require__(273); + renderCanvas = __webpack_require__(274); } module.exports = { @@ -90666,7 +92292,7 @@ module.exports = { /***/ }), -/* 568 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90705,7 +92331,7 @@ module.exports = GraphicsWebGLRenderer; /***/ }), -/* 569 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90719,12 +92345,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(570); + renderWebGL = __webpack_require__(572); } if (true) { - renderCanvas = __webpack_require__(571); + renderCanvas = __webpack_require__(573); } module.exports = { @@ -90736,7 +92362,7 @@ module.exports = { /***/ }), -/* 570 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90775,7 +92401,7 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 571 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90814,7 +92440,7 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 572 */ +/* 574 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91029,7 +92655,7 @@ module.exports = GravityWell; /***/ }), -/* 573 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91041,17 +92667,17 @@ module.exports = GravityWell; var BlendModes = __webpack_require__(45); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DeathZone = __webpack_require__(574); -var EdgeZone = __webpack_require__(575); -var EmitterOp = __webpack_require__(576); +var DeathZone = __webpack_require__(576); +var EdgeZone = __webpack_require__(577); +var EmitterOp = __webpack_require__(578); var GetFastValue = __webpack_require__(2); var GetRandomElement = __webpack_require__(138); -var HasAny = __webpack_require__(288); +var HasAny = __webpack_require__(289); var HasValue = __webpack_require__(72); -var Particle = __webpack_require__(610); -var RandomZone = __webpack_require__(611); +var Particle = __webpack_require__(612); +var RandomZone = __webpack_require__(613); var Rectangle = __webpack_require__(8); -var StableSort = __webpack_require__(266); +var StableSort = __webpack_require__(267); var Vector2 = __webpack_require__(6); var Wrap = __webpack_require__(50); @@ -93010,7 +94636,7 @@ module.exports = ParticleEmitter; /***/ }), -/* 574 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93088,7 +94714,7 @@ module.exports = DeathZone; /***/ }), -/* 575 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93327,7 +94953,7 @@ module.exports = EdgeZone; /***/ }), -/* 576 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93337,7 +94963,7 @@ module.exports = EdgeZone; */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(275); +var FloatBetween = __webpack_require__(276); var GetEaseFunction = __webpack_require__(71); var GetFastValue = __webpack_require__(2); var Wrap = __webpack_require__(50); @@ -93886,7 +95512,7 @@ module.exports = EmitterOp; /***/ }), -/* 577 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93895,18 +95521,18 @@ module.exports = EmitterOp; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Back = __webpack_require__(276); -var Bounce = __webpack_require__(277); -var Circular = __webpack_require__(278); -var Cubic = __webpack_require__(279); -var Elastic = __webpack_require__(280); -var Expo = __webpack_require__(281); -var Linear = __webpack_require__(282); -var Quadratic = __webpack_require__(283); -var Quartic = __webpack_require__(284); -var Quintic = __webpack_require__(285); -var Sine = __webpack_require__(286); -var Stepped = __webpack_require__(287); +var Back = __webpack_require__(277); +var Bounce = __webpack_require__(278); +var Circular = __webpack_require__(279); +var Cubic = __webpack_require__(280); +var Elastic = __webpack_require__(281); +var Expo = __webpack_require__(282); +var Linear = __webpack_require__(283); +var Quadratic = __webpack_require__(284); +var Quartic = __webpack_require__(285); +var Quintic = __webpack_require__(286); +var Sine = __webpack_require__(287); +var Stepped = __webpack_require__(288); // EaseMap module.exports = { @@ -93967,7 +95593,7 @@ module.exports = { /***/ }), -/* 578 */ +/* 580 */ /***/ (function(module, exports) { /** @@ -93998,7 +95624,7 @@ module.exports = In; /***/ }), -/* 579 */ +/* 581 */ /***/ (function(module, exports) { /** @@ -94029,7 +95655,7 @@ module.exports = Out; /***/ }), -/* 580 */ +/* 582 */ /***/ (function(module, exports) { /** @@ -94069,7 +95695,7 @@ module.exports = InOut; /***/ }), -/* 581 */ +/* 583 */ /***/ (function(module, exports) { /** @@ -94114,7 +95740,7 @@ module.exports = In; /***/ }), -/* 582 */ +/* 584 */ /***/ (function(module, exports) { /** @@ -94157,7 +95783,7 @@ module.exports = Out; /***/ }), -/* 583 */ +/* 585 */ /***/ (function(module, exports) { /** @@ -94221,7 +95847,7 @@ module.exports = InOut; /***/ }), -/* 584 */ +/* 586 */ /***/ (function(module, exports) { /** @@ -94249,7 +95875,7 @@ module.exports = In; /***/ }), -/* 585 */ +/* 587 */ /***/ (function(module, exports) { /** @@ -94277,7 +95903,7 @@ module.exports = Out; /***/ }), -/* 586 */ +/* 588 */ /***/ (function(module, exports) { /** @@ -94312,7 +95938,7 @@ module.exports = InOut; /***/ }), -/* 587 */ +/* 589 */ /***/ (function(module, exports) { /** @@ -94340,7 +95966,7 @@ module.exports = In; /***/ }), -/* 588 */ +/* 590 */ /***/ (function(module, exports) { /** @@ -94368,7 +95994,7 @@ module.exports = Out; /***/ }), -/* 589 */ +/* 591 */ /***/ (function(module, exports) { /** @@ -94403,7 +96029,7 @@ module.exports = InOut; /***/ }), -/* 590 */ +/* 592 */ /***/ (function(module, exports) { /** @@ -94458,7 +96084,7 @@ module.exports = In; /***/ }), -/* 591 */ +/* 593 */ /***/ (function(module, exports) { /** @@ -94513,7 +96139,7 @@ module.exports = Out; /***/ }), -/* 592 */ +/* 594 */ /***/ (function(module, exports) { /** @@ -94575,7 +96201,7 @@ module.exports = InOut; /***/ }), -/* 593 */ +/* 595 */ /***/ (function(module, exports) { /** @@ -94603,7 +96229,7 @@ module.exports = In; /***/ }), -/* 594 */ +/* 596 */ /***/ (function(module, exports) { /** @@ -94631,7 +96257,7 @@ module.exports = Out; /***/ }), -/* 595 */ +/* 597 */ /***/ (function(module, exports) { /** @@ -94666,7 +96292,7 @@ module.exports = InOut; /***/ }), -/* 596 */ +/* 598 */ /***/ (function(module, exports) { /** @@ -94694,7 +96320,7 @@ module.exports = Linear; /***/ }), -/* 597 */ +/* 599 */ /***/ (function(module, exports) { /** @@ -94722,7 +96348,7 @@ module.exports = In; /***/ }), -/* 598 */ +/* 600 */ /***/ (function(module, exports) { /** @@ -94750,7 +96376,7 @@ module.exports = Out; /***/ }), -/* 599 */ +/* 601 */ /***/ (function(module, exports) { /** @@ -94785,7 +96411,7 @@ module.exports = InOut; /***/ }), -/* 600 */ +/* 602 */ /***/ (function(module, exports) { /** @@ -94813,7 +96439,7 @@ module.exports = In; /***/ }), -/* 601 */ +/* 603 */ /***/ (function(module, exports) { /** @@ -94841,7 +96467,7 @@ module.exports = Out; /***/ }), -/* 602 */ +/* 604 */ /***/ (function(module, exports) { /** @@ -94876,7 +96502,7 @@ module.exports = InOut; /***/ }), -/* 603 */ +/* 605 */ /***/ (function(module, exports) { /** @@ -94904,7 +96530,7 @@ module.exports = In; /***/ }), -/* 604 */ +/* 606 */ /***/ (function(module, exports) { /** @@ -94932,7 +96558,7 @@ module.exports = Out; /***/ }), -/* 605 */ +/* 607 */ /***/ (function(module, exports) { /** @@ -94967,7 +96593,7 @@ module.exports = InOut; /***/ }), -/* 606 */ +/* 608 */ /***/ (function(module, exports) { /** @@ -95006,7 +96632,7 @@ module.exports = In; /***/ }), -/* 607 */ +/* 609 */ /***/ (function(module, exports) { /** @@ -95045,7 +96671,7 @@ module.exports = Out; /***/ }), -/* 608 */ +/* 610 */ /***/ (function(module, exports) { /** @@ -95084,7 +96710,7 @@ module.exports = InOut; /***/ }), -/* 609 */ +/* 611 */ /***/ (function(module, exports) { /** @@ -95126,7 +96752,7 @@ module.exports = Stepped; /***/ }), -/* 610 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95137,7 +96763,7 @@ module.exports = Stepped; var Class = __webpack_require__(0); var DegToRad = __webpack_require__(35); -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); /** * @classdesc @@ -95727,7 +97353,7 @@ module.exports = Particle; /***/ }), -/* 611 */ +/* 613 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95800,7 +97426,7 @@ module.exports = RandomZone; /***/ }), -/* 612 */ +/* 614 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95814,12 +97440,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(613); + renderWebGL = __webpack_require__(615); } if (true) { - renderCanvas = __webpack_require__(614); + renderCanvas = __webpack_require__(616); } module.exports = { @@ -95831,7 +97457,7 @@ module.exports = { /***/ }), -/* 613 */ +/* 615 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95872,7 +97498,7 @@ module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 614 */ +/* 616 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95930,6 +97556,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; } + var roundPixels = renderer.config.roundPixels; + for (var index = 0; index < length; ++index) { var particle = particles[index]; @@ -95951,13 +97579,27 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol var x = -ox; var y = -oy; + var tx = particle.x - cameraScrollX * particle.scrollFactorX; + var ty = particle.y - cameraScrollY * particle.scrollFactorY; + + if (roundPixels) + { + tx |= 0; + ty |= 0; + } + ctx.globalAlpha = alpha; ctx.save(); - ctx.translate(particle.x - cameraScrollX * particle.scrollFactorX, particle.y - cameraScrollY * particle.scrollFactorY); + + ctx.translate(tx, ty); + ctx.rotate(particle.rotation); + ctx.scale(particle.scaleX, particle.scaleY); + ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, x, y, cd.dWidth, cd.dHeight); + ctx.restore(); } @@ -95969,62 +97611,26 @@ module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 615 */ -/***/ (function(module, exports) { - -var RenderTextureWebGL = { - - fill: function (color) - { - return this; - }, - - clear: function () - { - this.renderer.setFramebuffer(this.framebuffer); - var gl = this.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - this.renderer.setFramebuffer(null); - return this; - }, - - draw: function (texture, x, y) - { - this.renderer.setFramebuffer(this.framebuffer); - this.renderer.pipelines.TextureTintPipeline.drawTexture(texture, x, y, 0, 0, texture.width, texture.height, this.currentMatrix); - this.renderer.setFramebuffer(null); - return this; - }, - - drawFrame: function (texture, x, y, frame) - { - this.renderer.setFramebuffer(this.framebuffer); - this.renderer.pipelines.TextureTintPipeline.drawTexture(texture, frame.x, frame.y, frame.width, frame.height, texture.width, texture.height, this.currentMatrix); - this.renderer.setFramebuffer(null); - return this; - } - -}; - -module.exports = RenderTextureWebGL; - - -/***/ }), -/* 616 */ +/* 617 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var renderWebGL = __webpack_require__(3); var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(617); + renderWebGL = __webpack_require__(618); } if (true) { - renderCanvas = __webpack_require__(618); + renderCanvas = __webpack_require__(619); } module.exports = { @@ -96036,11 +97642,31 @@ module.exports = { /***/ }), -/* 617 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.RenderTexture#renderWebgl + * @since 3.2.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.RenderTexture} renderTexture - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ var RenderTextureWebGLRenderer = function (renderer, renderTexture, interpolationPercentage, camera) { if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id))) @@ -96061,7 +97687,7 @@ var RenderTextureWebGLRenderer = function (renderer, renderTexture, interpolatio renderTexture.displayOriginX, renderTexture.displayOriginY, 0, 0, renderTexture.texture.width, renderTexture.texture.height, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0, 0, + 0, 0, camera ); }; @@ -96070,11 +97696,31 @@ module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 618 */ +/* 619 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.RenderTexture#renderCanvas + * @since 3.2.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.RenderTexture} renderTexture - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolationPercentage, camera) { if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id))) @@ -96082,13 +97728,149 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati return; } + var ctx = renderer.currentContext; + + if (renderer.currentBlendMode !== renderTexture.blendMode) + { + renderer.currentBlendMode = renderTexture.blendMode; + ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode]; + } + + if (renderer.currentAlpha !== renderTexture.alpha) + { + renderer.currentAlpha = renderTexture.alpha; + ctx.globalAlpha = renderTexture.alpha; + } + + if (renderer.currentScaleMode !== renderTexture.scaleMode) + { + renderer.currentScaleMode = renderTexture.scaleMode; + } + + var dx = 0; + var dy = 0; + + var fx = 1; + var fy = 1; + + if (renderTexture.flipX) + { + fx = -1; + dx -= renderTexture.canvas.width - renderTexture.displayOriginX; + } + else + { + dx -= renderTexture.displayOriginX; + } + + if (renderTexture.flipY) + { + fy = -1; + dy -= renderTexture.canvas.height - renderTexture.displayOriginY; + } + else + { + dy -= renderTexture.displayOriginY; + } + + ctx.save(); + ctx.translate(renderTexture.x - camera.scrollX * renderTexture.scrollFactorX, renderTexture.y - camera.scrollY * renderTexture.scrollFactorY); + ctx.rotate(renderTexture.rotation); + ctx.scale(renderTexture.scaleX, renderTexture.scaleY); + ctx.scale(fx, fy); + ctx.drawImage(renderTexture.canvas, dx, dy); + ctx.restore(); }; module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 619 */ +/* 620 */ +/***/ (function(module, exports) { + +var RenderTextureCanvas = { + + fill: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')'; + this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); + return this; + }, + + clear: function () + { + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + return this; + }, + + draw: function (texture, frame, x, y) + { + var matrix = this.currentMatrix; + + this.context.globalAlpha = this.globalAlpha; + this.context.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + this.context.drawImage(texture.source[frame.sourceIndex].image, frame.x, frame.y, frame.width, frame.height, x, y, frame.width, frame.height); + + return this; + } + +}; + +module.exports = RenderTextureCanvas; + + +/***/ }), +/* 621 */ +/***/ (function(module, exports) { + +var RenderTextureWebGL = { + + fill: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + this.renderer.setFramebuffer(null); + return this; + }, + + clear: function () + { + this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + this.renderer.setFramebuffer(null); + return this; + }, + + draw: function (texture, frame, x, y) + { + var glTexture = texture.source[frame.sourceIndex].glTexture; + var tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16); + this.renderer.setFramebuffer(this.framebuffer); + this.renderer.pipelines.TextureTintPipeline.drawTexture(glTexture, x, y, tint, this.globalAlpha, frame.x, frame.y, frame.width, frame.height, this.currentMatrix); + this.renderer.setFramebuffer(null); + return this; + } + +}; + +module.exports = RenderTextureWebGL; + + +/***/ }), +/* 622 */ /***/ (function(module, exports) { /** @@ -96167,7 +97949,7 @@ module.exports = GetTextSize; /***/ }), -/* 620 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96181,12 +97963,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(621); + renderWebGL = __webpack_require__(624); } if (true) { - renderCanvas = __webpack_require__(622); + renderCanvas = __webpack_require__(625); } module.exports = { @@ -96198,7 +97980,7 @@ module.exports = { /***/ }), -/* 621 */ +/* 624 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96243,7 +98025,7 @@ module.exports = TextWebGLRenderer; /***/ }), -/* 622 */ +/* 625 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96303,13 +98085,27 @@ var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.save(); - // ctx.scale(1.0 / resolution, 1.0 / resolution); - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; + + if (renderer.config.roundPixels) + { + tx |= 0; + ty |= 0; + } + + ctx.translate(tx, ty); + ctx.rotate(src.rotation); + ctx.scale(src.scaleX, src.scaleY); + ctx.translate(canvas.width * (src.flipX ? 1 : 0), canvas.height * (src.flipY ? 1 : 0)); + ctx.scale(src.flipX ? -1 : 1, src.flipY ? -1 : 1); + ctx.drawImage(canvas, 0, 0, canvas.width, canvas.height, -src.displayOriginX, -src.displayOriginY, canvas.width, canvas.height); + ctx.restore(); }; @@ -96317,7 +98113,7 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 623 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96329,7 +98125,7 @@ module.exports = TextCanvasRenderer; var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); -var MeasureText = __webpack_require__(624); +var MeasureText = __webpack_require__(627); // Key: [ Object Key, Default Value ] @@ -97232,7 +99028,7 @@ module.exports = TextStyle; /***/ }), -/* 624 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97241,7 +99037,7 @@ module.exports = TextStyle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); /** * Calculates the ascent, descent and fontSize of a given font style. @@ -97361,7 +99157,7 @@ module.exports = MeasureText; /***/ }), -/* 625 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97375,12 +99171,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(626); + renderWebGL = __webpack_require__(629); } if (true) { - renderCanvas = __webpack_require__(627); + renderCanvas = __webpack_require__(630); } module.exports = { @@ -97392,7 +99188,7 @@ module.exports = { /***/ }), -/* 626 */ +/* 629 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97433,7 +99229,7 @@ module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 627 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97468,6 +99264,8 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, var ctx = renderer.currentContext; var frame = src.frame; + src.updateTileTexture(); + // Blend Mode if (renderer.currentBlendMode !== src.blendMode) @@ -97494,12 +99292,29 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, var dx = frame.x - (src.originX * src.width); var dy = frame.y - (src.originY * src.height); + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; + + if (renderer.config.roundPixels) + { + dx |= 0; + dy |= 0; + tx |= 0; + ty |= 0; + } + ctx.save(); + ctx.translate(dx, dy); - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); + + ctx.translate(tx, ty); + ctx.fillStyle = src.canvasPattern; + ctx.translate(-this.tilePositionX, -this.tilePositionY); + ctx.fillRect(this.tilePositionX, this.tilePositionY, src.width, src.height); + ctx.restore(); }; @@ -97507,7 +99322,7 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 628 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97549,7 +99364,7 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) /***/ }), -/* 629 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97592,7 +99407,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 630 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97631,7 +99446,7 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 631 */ +/* 634 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97677,7 +99492,7 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 632 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97719,7 +99534,7 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 633 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97765,7 +99580,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) /***/ }), -/* 634 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97775,7 +99590,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) */ var GameObjectFactory = __webpack_require__(9); -var PathFollower = __webpack_require__(289); +var PathFollower = __webpack_require__(290); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -97813,12 +99628,33 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 635 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObjectFactory = __webpack_require__(9); var RenderTexture = __webpack_require__(139); +/** + * Creates a new Render Texture Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#renderTexture + * @since 3.2.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {integer} [width=32] - The width of the Render Texture. + * @param {integer} [height=32] - The height of the Render Texture. + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. + */ GameObjectFactory.register('renderTexture', function (x, y, width, height) { return this.displayList.add(new RenderTexture(this.scene, x, y, width, height)); @@ -97826,7 +99662,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height) /***/ }), -/* 636 */ +/* 639 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97874,7 +99710,7 @@ GameObjectFactory.register('sprite3D', function (x, y, z, key, frame) /***/ }), -/* 637 */ +/* 640 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97921,7 +99757,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 638 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97964,7 +99800,7 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size) /***/ }), -/* 639 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98006,7 +99842,7 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 640 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98050,7 +99886,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 641 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98092,7 +99928,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 642 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98102,7 +99938,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) */ var Blitter = __webpack_require__(132); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); @@ -98134,7 +99970,7 @@ GameObjectCreator.register('blitter', function (config) /***/ }), -/* 643 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98144,7 +99980,7 @@ GameObjectCreator.register('blitter', function (config) */ var BitmapText = __webpack_require__(133); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); @@ -98178,7 +100014,7 @@ GameObjectCreator.register('dynamicBitmapText', function (config) /***/ }), -/* 644 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98211,7 +100047,7 @@ GameObjectCreator.register('graphics', function (config) /***/ }), -/* 645 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98244,7 +100080,7 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 646 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98253,7 +100089,7 @@ GameObjectCreator.register('group', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Image = __webpack_require__(70); @@ -98286,7 +100122,7 @@ GameObjectCreator.register('image', function (config) /***/ }), -/* 647 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98343,15 +100179,32 @@ GameObjectCreator.register('particles', function (config) /***/ }), -/* 648 */ +/* 651 */ /***/ (function(module, exports, __webpack_require__) { -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var RenderTexture = __webpack_require__(139); +/** + * Creates a new Render Texture Game Object and returns it. + * + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#renderTexture + * @since 3.2.0 + * + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. + */ GameObjectCreator.register('renderTexture', function (config) { var x = GetAdvancedValue(config, 'x', 0); @@ -98367,7 +100220,7 @@ GameObjectCreator.register('renderTexture', function (config) /***/ }), -/* 649 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98376,8 +100229,8 @@ GameObjectCreator.register('renderTexture', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +var BuildGameObject = __webpack_require__(20); +var BuildGameObjectAnimation = __webpack_require__(292); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Sprite3D = __webpack_require__(81); @@ -98416,7 +100269,7 @@ GameObjectCreator.register('sprite3D', function (config) /***/ }), -/* 650 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98425,8 +100278,8 @@ GameObjectCreator.register('sprite3D', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +var BuildGameObject = __webpack_require__(20); +var BuildGameObjectAnimation = __webpack_require__(292); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Sprite = __webpack_require__(37); @@ -98465,7 +100318,7 @@ GameObjectCreator.register('sprite', function (config) /***/ }), -/* 651 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98475,7 +100328,7 @@ GameObjectCreator.register('sprite', function (config) */ var BitmapText = __webpack_require__(131); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); @@ -98511,7 +100364,7 @@ GameObjectCreator.register('bitmapText', function (config) /***/ }), -/* 652 */ +/* 655 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98520,7 +100373,7 @@ GameObjectCreator.register('bitmapText', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Text = __webpack_require__(140); @@ -98590,7 +100443,7 @@ GameObjectCreator.register('text', function (config) /***/ }), -/* 653 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98599,7 +100452,7 @@ GameObjectCreator.register('text', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var TileSprite = __webpack_require__(141); @@ -98636,7 +100489,7 @@ GameObjectCreator.register('tileSprite', function (config) /***/ }), -/* 654 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98675,7 +100528,7 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 655 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98689,12 +100542,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(656); + renderWebGL = __webpack_require__(659); } if (true) { - renderCanvas = __webpack_require__(657); + renderCanvas = __webpack_require__(660); } module.exports = { @@ -98706,7 +100559,7 @@ module.exports = { /***/ }), -/* 656 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98745,7 +100598,7 @@ module.exports = MeshWebGLRenderer; /***/ }), -/* 657 */ +/* 660 */ /***/ (function(module, exports) { /** @@ -98774,7 +100627,7 @@ module.exports = MeshCanvasRenderer; /***/ }), -/* 658 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98824,7 +100677,7 @@ if (true) /***/ }), -/* 659 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98833,7 +100686,7 @@ if (true) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Quad = __webpack_require__(143); +var Quad = __webpack_require__(142); var GameObjectFactory = __webpack_require__(9); /** @@ -98870,7 +100723,7 @@ if (true) /***/ }), -/* 660 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98879,7 +100732,7 @@ if (true) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); @@ -98917,7 +100770,7 @@ GameObjectCreator.register('mesh', function (config) /***/ }), -/* 661 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98926,10 +100779,10 @@ GameObjectCreator.register('mesh', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); -var Quad = __webpack_require__(143); +var Quad = __webpack_require__(142); /** * Creates a new Quad Game Object and returns it. @@ -98961,7 +100814,7 @@ GameObjectCreator.register('quad', function (config) /***/ }), -/* 662 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98971,7 +100824,7 @@ GameObjectCreator.register('quad', function (config) */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(292); +var LightsManager = __webpack_require__(294); var PluginManager = __webpack_require__(12); /** @@ -99056,7 +100909,7 @@ module.exports = LightsPlugin; /***/ }), -/* 663 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99065,29 +100918,29 @@ module.exports = LightsPlugin; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); -Circle.Area = __webpack_require__(664); -Circle.Circumference = __webpack_require__(183); -Circle.CircumferencePoint = __webpack_require__(104); -Circle.Clone = __webpack_require__(665); +Circle.Area = __webpack_require__(667); +Circle.Circumference = __webpack_require__(184); +Circle.CircumferencePoint = __webpack_require__(105); +Circle.Clone = __webpack_require__(668); Circle.Contains = __webpack_require__(32); -Circle.ContainsPoint = __webpack_require__(666); -Circle.ContainsRect = __webpack_require__(667); -Circle.CopyFrom = __webpack_require__(668); -Circle.Equals = __webpack_require__(669); -Circle.GetBounds = __webpack_require__(670); -Circle.GetPoint = __webpack_require__(181); -Circle.GetPoints = __webpack_require__(182); -Circle.Offset = __webpack_require__(671); -Circle.OffsetPoint = __webpack_require__(672); -Circle.Random = __webpack_require__(105); +Circle.ContainsPoint = __webpack_require__(669); +Circle.ContainsRect = __webpack_require__(670); +Circle.CopyFrom = __webpack_require__(671); +Circle.Equals = __webpack_require__(672); +Circle.GetBounds = __webpack_require__(673); +Circle.GetPoint = __webpack_require__(182); +Circle.GetPoints = __webpack_require__(183); +Circle.Offset = __webpack_require__(674); +Circle.OffsetPoint = __webpack_require__(675); +Circle.Random = __webpack_require__(106); module.exports = Circle; /***/ }), -/* 664 */ +/* 667 */ /***/ (function(module, exports) { /** @@ -99115,7 +100968,7 @@ module.exports = Area; /***/ }), -/* 665 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99124,7 +100977,7 @@ module.exports = Area; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); /** * Creates a new Circle instance based on the values contained in the given source. @@ -99145,7 +100998,7 @@ module.exports = Clone; /***/ }), -/* 666 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99176,7 +101029,7 @@ module.exports = ContainsPoint; /***/ }), -/* 667 */ +/* 670 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99212,7 +101065,7 @@ module.exports = ContainsRect; /***/ }), -/* 668 */ +/* 671 */ /***/ (function(module, exports) { /** @@ -99242,7 +101095,7 @@ module.exports = CopyFrom; /***/ }), -/* 669 */ +/* 672 */ /***/ (function(module, exports) { /** @@ -99276,7 +101129,7 @@ module.exports = Equals; /***/ }), -/* 670 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99314,7 +101167,7 @@ module.exports = GetBounds; /***/ }), -/* 671 */ +/* 674 */ /***/ (function(module, exports) { /** @@ -99347,7 +101200,7 @@ module.exports = Offset; /***/ }), -/* 672 */ +/* 675 */ /***/ (function(module, exports) { /** @@ -99379,7 +101232,7 @@ module.exports = OffsetPoint; /***/ }), -/* 673 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99388,7 +101241,7 @@ module.exports = OffsetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); /** * [description] @@ -99410,7 +101263,7 @@ module.exports = CircleToCircle; /***/ }), -/* 674 */ +/* 677 */ /***/ (function(module, exports) { /** @@ -99464,7 +101317,7 @@ module.exports = CircleToRectangle; /***/ }), -/* 675 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99474,7 +101327,7 @@ module.exports = CircleToRectangle; */ var Rectangle = __webpack_require__(8); -var RectangleToRectangle = __webpack_require__(295); +var RectangleToRectangle = __webpack_require__(297); /** * [description] @@ -99507,7 +101360,7 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 676 */ +/* 679 */ /***/ (function(module, exports) { /** @@ -99608,7 +101461,7 @@ module.exports = LineToRectangle; /***/ }), -/* 677 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99617,7 +101470,7 @@ module.exports = LineToRectangle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PointToLine = __webpack_require__(297); +var PointToLine = __webpack_require__(299); /** * [description] @@ -99649,7 +101502,7 @@ module.exports = PointToLineSegment; /***/ }), -/* 678 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99660,8 +101513,8 @@ module.exports = PointToLineSegment; var LineToLine = __webpack_require__(89); var Contains = __webpack_require__(33); -var ContainsArray = __webpack_require__(144); -var Decompose = __webpack_require__(298); +var ContainsArray = __webpack_require__(143); +var Decompose = __webpack_require__(300); /** * [description] @@ -99742,7 +101595,7 @@ module.exports = RectangleToTriangle; /***/ }), -/* 679 */ +/* 682 */ /***/ (function(module, exports) { /** @@ -99782,7 +101635,7 @@ module.exports = RectangleToValues; /***/ }), -/* 680 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99791,8 +101644,8 @@ module.exports = RectangleToValues; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToCircle = __webpack_require__(296); -var Contains = __webpack_require__(53); +var LineToCircle = __webpack_require__(298); +var Contains = __webpack_require__(54); /** * [description] @@ -99845,7 +101698,7 @@ module.exports = TriangleToCircle; /***/ }), -/* 681 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99854,7 +101707,7 @@ module.exports = TriangleToCircle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(53); +var Contains = __webpack_require__(54); var LineToLine = __webpack_require__(89); /** @@ -99899,7 +101752,7 @@ module.exports = TriangleToLine; /***/ }), -/* 682 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99908,8 +101761,8 @@ module.exports = TriangleToLine; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ContainsArray = __webpack_require__(144); -var Decompose = __webpack_require__(299); +var ContainsArray = __webpack_require__(143); +var Decompose = __webpack_require__(301); var LineToLine = __webpack_require__(89); /** @@ -99987,7 +101840,7 @@ module.exports = TriangleToTriangle; /***/ }), -/* 683 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99996,39 +101849,39 @@ module.exports = TriangleToTriangle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(300); +var Line = __webpack_require__(302); -Line.Angle = __webpack_require__(54); -Line.BresenhamPoints = __webpack_require__(191); -Line.CenterOn = __webpack_require__(684); -Line.Clone = __webpack_require__(685); -Line.CopyFrom = __webpack_require__(686); -Line.Equals = __webpack_require__(687); -Line.GetMidPoint = __webpack_require__(688); -Line.GetNormal = __webpack_require__(689); -Line.GetPoint = __webpack_require__(301); -Line.GetPoints = __webpack_require__(108); -Line.Height = __webpack_require__(690); -Line.Length = __webpack_require__(65); -Line.NormalAngle = __webpack_require__(302); -Line.NormalX = __webpack_require__(691); -Line.NormalY = __webpack_require__(692); -Line.Offset = __webpack_require__(693); -Line.PerpSlope = __webpack_require__(694); -Line.Random = __webpack_require__(110); -Line.ReflectAngle = __webpack_require__(695); -Line.Rotate = __webpack_require__(696); -Line.RotateAroundPoint = __webpack_require__(697); -Line.RotateAroundXY = __webpack_require__(145); -Line.SetToAngle = __webpack_require__(698); -Line.Slope = __webpack_require__(699); -Line.Width = __webpack_require__(700); +Line.Angle = __webpack_require__(55); +Line.BresenhamPoints = __webpack_require__(192); +Line.CenterOn = __webpack_require__(687); +Line.Clone = __webpack_require__(688); +Line.CopyFrom = __webpack_require__(689); +Line.Equals = __webpack_require__(690); +Line.GetMidPoint = __webpack_require__(691); +Line.GetNormal = __webpack_require__(692); +Line.GetPoint = __webpack_require__(303); +Line.GetPoints = __webpack_require__(109); +Line.Height = __webpack_require__(693); +Line.Length = __webpack_require__(66); +Line.NormalAngle = __webpack_require__(304); +Line.NormalX = __webpack_require__(694); +Line.NormalY = __webpack_require__(695); +Line.Offset = __webpack_require__(696); +Line.PerpSlope = __webpack_require__(697); +Line.Random = __webpack_require__(111); +Line.ReflectAngle = __webpack_require__(698); +Line.Rotate = __webpack_require__(699); +Line.RotateAroundPoint = __webpack_require__(700); +Line.RotateAroundXY = __webpack_require__(144); +Line.SetToAngle = __webpack_require__(701); +Line.Slope = __webpack_require__(702); +Line.Width = __webpack_require__(703); module.exports = Line; /***/ }), -/* 684 */ +/* 687 */ /***/ (function(module, exports) { /** @@ -100068,7 +101921,7 @@ module.exports = CenterOn; /***/ }), -/* 685 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100077,7 +101930,7 @@ module.exports = CenterOn; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(300); +var Line = __webpack_require__(302); /** * [description] @@ -100098,7 +101951,7 @@ module.exports = Clone; /***/ }), -/* 686 */ +/* 689 */ /***/ (function(module, exports) { /** @@ -100127,7 +101980,7 @@ module.exports = CopyFrom; /***/ }), -/* 687 */ +/* 690 */ /***/ (function(module, exports) { /** @@ -100161,7 +102014,7 @@ module.exports = Equals; /***/ }), -/* 688 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100197,7 +102050,7 @@ module.exports = GetMidPoint; /***/ }), -/* 689 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100207,7 +102060,7 @@ module.exports = GetMidPoint; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); var Point = __webpack_require__(5); /** @@ -100237,7 +102090,7 @@ module.exports = GetNormal; /***/ }), -/* 690 */ +/* 693 */ /***/ (function(module, exports) { /** @@ -100265,7 +102118,7 @@ module.exports = Height; /***/ }), -/* 691 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100275,7 +102128,7 @@ module.exports = Height; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -100296,7 +102149,7 @@ module.exports = NormalX; /***/ }), -/* 692 */ +/* 695 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100306,7 +102159,7 @@ module.exports = NormalX; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -100327,7 +102180,7 @@ module.exports = NormalY; /***/ }), -/* 693 */ +/* 696 */ /***/ (function(module, exports) { /** @@ -100363,7 +102216,7 @@ module.exports = Offset; /***/ }), -/* 694 */ +/* 697 */ /***/ (function(module, exports) { /** @@ -100391,7 +102244,7 @@ module.exports = PerpSlope; /***/ }), -/* 695 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100400,8 +102253,8 @@ module.exports = PerpSlope; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Angle = __webpack_require__(54); -var NormalAngle = __webpack_require__(302); +var Angle = __webpack_require__(55); +var NormalAngle = __webpack_require__(304); /** * Returns the reflected angle between two lines. @@ -100427,7 +102280,7 @@ module.exports = ReflectAngle; /***/ }), -/* 696 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100436,7 +102289,7 @@ module.exports = ReflectAngle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(145); +var RotateAroundXY = __webpack_require__(144); /** * [description] @@ -100461,7 +102314,7 @@ module.exports = Rotate; /***/ }), -/* 697 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100470,7 +102323,7 @@ module.exports = Rotate; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(145); +var RotateAroundXY = __webpack_require__(144); /** * [description] @@ -100493,7 +102346,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 698 */ +/* 701 */ /***/ (function(module, exports) { /** @@ -100531,7 +102384,7 @@ module.exports = SetToAngle; /***/ }), -/* 699 */ +/* 702 */ /***/ (function(module, exports) { /** @@ -100559,7 +102412,7 @@ module.exports = Slope; /***/ }), -/* 700 */ +/* 703 */ /***/ (function(module, exports) { /** @@ -100587,7 +102440,7 @@ module.exports = Width; /***/ }), -/* 701 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100598,27 +102451,27 @@ module.exports = Width; var Point = __webpack_require__(5); -Point.Ceil = __webpack_require__(702); -Point.Clone = __webpack_require__(703); -Point.CopyFrom = __webpack_require__(704); -Point.Equals = __webpack_require__(705); -Point.Floor = __webpack_require__(706); -Point.GetCentroid = __webpack_require__(707); -Point.GetMagnitude = __webpack_require__(303); -Point.GetMagnitudeSq = __webpack_require__(304); -Point.GetRectangleFromPoints = __webpack_require__(708); -Point.Interpolate = __webpack_require__(709); -Point.Invert = __webpack_require__(710); -Point.Negative = __webpack_require__(711); -Point.Project = __webpack_require__(712); -Point.ProjectUnit = __webpack_require__(713); -Point.SetMagnitude = __webpack_require__(714); +Point.Ceil = __webpack_require__(705); +Point.Clone = __webpack_require__(706); +Point.CopyFrom = __webpack_require__(707); +Point.Equals = __webpack_require__(708); +Point.Floor = __webpack_require__(709); +Point.GetCentroid = __webpack_require__(710); +Point.GetMagnitude = __webpack_require__(305); +Point.GetMagnitudeSq = __webpack_require__(306); +Point.GetRectangleFromPoints = __webpack_require__(711); +Point.Interpolate = __webpack_require__(712); +Point.Invert = __webpack_require__(713); +Point.Negative = __webpack_require__(714); +Point.Project = __webpack_require__(715); +Point.ProjectUnit = __webpack_require__(716); +Point.SetMagnitude = __webpack_require__(717); module.exports = Point; /***/ }), -/* 702 */ +/* 705 */ /***/ (function(module, exports) { /** @@ -100646,7 +102499,7 @@ module.exports = Ceil; /***/ }), -/* 703 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100676,7 +102529,7 @@ module.exports = Clone; /***/ }), -/* 704 */ +/* 707 */ /***/ (function(module, exports) { /** @@ -100705,7 +102558,7 @@ module.exports = CopyFrom; /***/ }), -/* 705 */ +/* 708 */ /***/ (function(module, exports) { /** @@ -100734,7 +102587,7 @@ module.exports = Equals; /***/ }), -/* 706 */ +/* 709 */ /***/ (function(module, exports) { /** @@ -100762,7 +102615,7 @@ module.exports = Floor; /***/ }), -/* 707 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100823,7 +102676,7 @@ module.exports = GetCentroid; /***/ }), -/* 708 */ +/* 711 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100891,7 +102744,7 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 709 */ +/* 712 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100930,7 +102783,7 @@ module.exports = Interpolate; /***/ }), -/* 710 */ +/* 713 */ /***/ (function(module, exports) { /** @@ -100958,7 +102811,7 @@ module.exports = Invert; /***/ }), -/* 711 */ +/* 714 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100991,7 +102844,7 @@ module.exports = Negative; /***/ }), -/* 712 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101001,7 +102854,7 @@ module.exports = Negative; */ var Point = __webpack_require__(5); -var GetMagnitudeSq = __webpack_require__(304); +var GetMagnitudeSq = __webpack_require__(306); /** * [description] @@ -101035,7 +102888,7 @@ module.exports = Project; /***/ }), -/* 713 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101077,7 +102930,7 @@ module.exports = ProjectUnit; /***/ }), -/* 714 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101086,7 +102939,7 @@ module.exports = ProjectUnit; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetMagnitude = __webpack_require__(303); +var GetMagnitude = __webpack_require__(305); /** * [description] @@ -101119,7 +102972,7 @@ module.exports = SetMagnitude; /***/ }), -/* 715 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101128,19 +102981,19 @@ module.exports = SetMagnitude; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(305); +var Polygon = __webpack_require__(307); -Polygon.Clone = __webpack_require__(716); -Polygon.Contains = __webpack_require__(146); -Polygon.ContainsPoint = __webpack_require__(717); -Polygon.GetAABB = __webpack_require__(718); -Polygon.GetNumberArray = __webpack_require__(719); +Polygon.Clone = __webpack_require__(719); +Polygon.Contains = __webpack_require__(145); +Polygon.ContainsPoint = __webpack_require__(720); +Polygon.GetAABB = __webpack_require__(721); +Polygon.GetNumberArray = __webpack_require__(722); module.exports = Polygon; /***/ }), -/* 716 */ +/* 719 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101149,7 +103002,7 @@ module.exports = Polygon; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(305); +var Polygon = __webpack_require__(307); /** * [description] @@ -101170,7 +103023,7 @@ module.exports = Clone; /***/ }), -/* 717 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101179,7 +103032,7 @@ module.exports = Clone; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(146); +var Contains = __webpack_require__(145); /** * [description] @@ -101201,7 +103054,7 @@ module.exports = ContainsPoint; /***/ }), -/* 718 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101255,7 +103108,7 @@ module.exports = GetAABB; /***/ }), -/* 719 */ +/* 722 */ /***/ (function(module, exports) { /** @@ -101294,7 +103147,7 @@ module.exports = GetNumberArray; /***/ }), -/* 720 */ +/* 723 */ /***/ (function(module, exports) { /** @@ -101322,7 +103175,7 @@ module.exports = Area; /***/ }), -/* 721 */ +/* 724 */ /***/ (function(module, exports) { /** @@ -101353,7 +103206,7 @@ module.exports = Ceil; /***/ }), -/* 722 */ +/* 725 */ /***/ (function(module, exports) { /** @@ -101386,7 +103239,7 @@ module.exports = CeilAll; /***/ }), -/* 723 */ +/* 726 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101416,7 +103269,7 @@ module.exports = Clone; /***/ }), -/* 724 */ +/* 727 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101447,7 +103300,7 @@ module.exports = ContainsPoint; /***/ }), -/* 725 */ +/* 728 */ /***/ (function(module, exports) { /** @@ -101489,7 +103342,7 @@ module.exports = ContainsRect; /***/ }), -/* 726 */ +/* 729 */ /***/ (function(module, exports) { /** @@ -101518,7 +103371,7 @@ module.exports = CopyFrom; /***/ }), -/* 727 */ +/* 730 */ /***/ (function(module, exports) { /** @@ -101552,7 +103405,7 @@ module.exports = Equals; /***/ }), -/* 728 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101561,7 +103414,7 @@ module.exports = Equals; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(147); +var GetAspectRatio = __webpack_require__(146); // Fits the target rectangle into the source rectangle. // Preserves aspect ratio. @@ -101603,7 +103456,7 @@ module.exports = FitInside; /***/ }), -/* 729 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101612,7 +103465,7 @@ module.exports = FitInside; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(147); +var GetAspectRatio = __webpack_require__(146); // Fits the target rectangle around the source rectangle. // Preserves aspect ration. @@ -101654,7 +103507,7 @@ module.exports = FitOutside; /***/ }), -/* 730 */ +/* 733 */ /***/ (function(module, exports) { /** @@ -101685,7 +103538,7 @@ module.exports = Floor; /***/ }), -/* 731 */ +/* 734 */ /***/ (function(module, exports) { /** @@ -101718,7 +103571,7 @@ module.exports = FloorAll; /***/ }), -/* 732 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101756,7 +103609,7 @@ module.exports = GetCenter; /***/ }), -/* 733 */ +/* 736 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101795,7 +103648,7 @@ module.exports = GetSize; /***/ }), -/* 734 */ +/* 737 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101804,7 +103657,7 @@ module.exports = GetSize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(307); +var CenterOn = __webpack_require__(309); // Increases the size of the Rectangle object by the specified amounts. // The center point of the Rectangle object stays the same, and its size increases @@ -101836,7 +103689,7 @@ module.exports = Inflate; /***/ }), -/* 735 */ +/* 738 */ /***/ (function(module, exports) { /** @@ -101886,7 +103739,7 @@ module.exports = MergePoints; /***/ }), -/* 736 */ +/* 739 */ /***/ (function(module, exports) { /** @@ -101930,7 +103783,7 @@ module.exports = MergeRect; /***/ }), -/* 737 */ +/* 740 */ /***/ (function(module, exports) { /** @@ -101972,7 +103825,7 @@ module.exports = MergeXY; /***/ }), -/* 738 */ +/* 741 */ /***/ (function(module, exports) { /** @@ -102005,7 +103858,7 @@ module.exports = Offset; /***/ }), -/* 739 */ +/* 742 */ /***/ (function(module, exports) { /** @@ -102037,7 +103890,7 @@ module.exports = OffsetPoint; /***/ }), -/* 740 */ +/* 743 */ /***/ (function(module, exports) { /** @@ -102071,7 +103924,7 @@ module.exports = Overlaps; /***/ }), -/* 741 */ +/* 744 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102126,7 +103979,7 @@ module.exports = PerimeterPoint; /***/ }), -/* 742 */ +/* 745 */ /***/ (function(module, exports) { /** @@ -102163,7 +104016,7 @@ module.exports = Scale; /***/ }), -/* 743 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102205,7 +104058,7 @@ module.exports = Union; /***/ }), -/* 744 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102214,38 +104067,38 @@ module.exports = Union; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); -Triangle.Area = __webpack_require__(745); -Triangle.BuildEquilateral = __webpack_require__(746); -Triangle.BuildFromPolygon = __webpack_require__(747); -Triangle.BuildRight = __webpack_require__(748); -Triangle.CenterOn = __webpack_require__(749); -Triangle.Centroid = __webpack_require__(310); -Triangle.CircumCenter = __webpack_require__(750); -Triangle.CircumCircle = __webpack_require__(751); -Triangle.Clone = __webpack_require__(752); -Triangle.Contains = __webpack_require__(53); -Triangle.ContainsArray = __webpack_require__(144); -Triangle.ContainsPoint = __webpack_require__(753); -Triangle.CopyFrom = __webpack_require__(754); -Triangle.Decompose = __webpack_require__(299); -Triangle.Equals = __webpack_require__(755); -Triangle.GetPoint = __webpack_require__(308); -Triangle.GetPoints = __webpack_require__(309); -Triangle.InCenter = __webpack_require__(312); -Triangle.Perimeter = __webpack_require__(756); -Triangle.Offset = __webpack_require__(311); -Triangle.Random = __webpack_require__(111); -Triangle.Rotate = __webpack_require__(757); -Triangle.RotateAroundPoint = __webpack_require__(758); -Triangle.RotateAroundXY = __webpack_require__(148); +Triangle.Area = __webpack_require__(748); +Triangle.BuildEquilateral = __webpack_require__(749); +Triangle.BuildFromPolygon = __webpack_require__(750); +Triangle.BuildRight = __webpack_require__(751); +Triangle.CenterOn = __webpack_require__(752); +Triangle.Centroid = __webpack_require__(312); +Triangle.CircumCenter = __webpack_require__(753); +Triangle.CircumCircle = __webpack_require__(754); +Triangle.Clone = __webpack_require__(755); +Triangle.Contains = __webpack_require__(54); +Triangle.ContainsArray = __webpack_require__(143); +Triangle.ContainsPoint = __webpack_require__(756); +Triangle.CopyFrom = __webpack_require__(757); +Triangle.Decompose = __webpack_require__(301); +Triangle.Equals = __webpack_require__(758); +Triangle.GetPoint = __webpack_require__(310); +Triangle.GetPoints = __webpack_require__(311); +Triangle.InCenter = __webpack_require__(314); +Triangle.Perimeter = __webpack_require__(759); +Triangle.Offset = __webpack_require__(313); +Triangle.Random = __webpack_require__(112); +Triangle.Rotate = __webpack_require__(760); +Triangle.RotateAroundPoint = __webpack_require__(761); +Triangle.RotateAroundXY = __webpack_require__(147); module.exports = Triangle; /***/ }), -/* 745 */ +/* 748 */ /***/ (function(module, exports) { /** @@ -102284,7 +104137,7 @@ module.exports = Area; /***/ }), -/* 746 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102293,7 +104146,7 @@ module.exports = Area; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); // Builds an equilateral triangle. // In the equilateral triangle, all the sides are the same length (congruent) @@ -102334,7 +104187,7 @@ module.exports = BuildEquilateral; /***/ }), -/* 747 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102343,8 +104196,8 @@ module.exports = BuildEquilateral; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EarCut = __webpack_require__(235); -var Triangle = __webpack_require__(55); +var EarCut = __webpack_require__(238); +var Triangle = __webpack_require__(56); /** * [description] @@ -102407,7 +104260,7 @@ module.exports = BuildFromPolygon; /***/ }), -/* 748 */ +/* 751 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102416,7 +104269,7 @@ module.exports = BuildFromPolygon; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); // Builds a right triangle, with one 90 degree angle and two acute angles // The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) @@ -102456,7 +104309,7 @@ module.exports = BuildRight; /***/ }), -/* 749 */ +/* 752 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102465,8 +104318,8 @@ module.exports = BuildRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Centroid = __webpack_require__(310); -var Offset = __webpack_require__(311); +var Centroid = __webpack_require__(312); +var Offset = __webpack_require__(313); /** * [description] @@ -102499,7 +104352,7 @@ module.exports = CenterOn; /***/ }), -/* 750 */ +/* 753 */ /***/ (function(module, exports) { /** @@ -102567,7 +104420,7 @@ module.exports = CircumCenter; /***/ }), -/* 751 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102576,7 +104429,7 @@ module.exports = CircumCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); // Adapted from https://gist.github.com/mutoo/5617691 @@ -102648,7 +104501,7 @@ module.exports = CircumCircle; /***/ }), -/* 752 */ +/* 755 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102657,7 +104510,7 @@ module.exports = CircumCircle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); /** * [description] @@ -102678,7 +104531,7 @@ module.exports = Clone; /***/ }), -/* 753 */ +/* 756 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102687,7 +104540,7 @@ module.exports = Clone; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(53); +var Contains = __webpack_require__(54); /** * [description] @@ -102709,7 +104562,7 @@ module.exports = ContainsPoint; /***/ }), -/* 754 */ +/* 757 */ /***/ (function(module, exports) { /** @@ -102738,7 +104591,7 @@ module.exports = CopyFrom; /***/ }), -/* 755 */ +/* 758 */ /***/ (function(module, exports) { /** @@ -102774,7 +104627,7 @@ module.exports = Equals; /***/ }), -/* 756 */ +/* 759 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102783,7 +104636,7 @@ module.exports = Equals; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); // The 2D area of a triangle. The area value is always non-negative. @@ -102810,7 +104663,7 @@ module.exports = Perimeter; /***/ }), -/* 757 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102819,8 +104672,8 @@ module.exports = Perimeter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(148); -var InCenter = __webpack_require__(312); +var RotateAroundXY = __webpack_require__(147); +var InCenter = __webpack_require__(314); /** * [description] @@ -102844,7 +104697,7 @@ module.exports = Rotate; /***/ }), -/* 758 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102853,7 +104706,7 @@ module.exports = Rotate; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(148); +var RotateAroundXY = __webpack_require__(147); /** * [description] @@ -102876,7 +104729,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 759 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102891,20 +104744,20 @@ module.exports = RotateAroundPoint; module.exports = { - Gamepad: __webpack_require__(760), - InputManager: __webpack_require__(239), - InputPlugin: __webpack_require__(765), - InteractiveObject: __webpack_require__(313), - Keyboard: __webpack_require__(766), - Mouse: __webpack_require__(771), - Pointer: __webpack_require__(248), - Touch: __webpack_require__(772) + Gamepad: __webpack_require__(763), + InputManager: __webpack_require__(240), + InputPlugin: __webpack_require__(768), + InteractiveObject: __webpack_require__(315), + Keyboard: __webpack_require__(769), + Mouse: __webpack_require__(774), + Pointer: __webpack_require__(249), + Touch: __webpack_require__(775) }; /***/ }), -/* 760 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102919,17 +104772,17 @@ module.exports = { module.exports = { - Axis: __webpack_require__(242), - Button: __webpack_require__(243), - Gamepad: __webpack_require__(241), - GamepadManager: __webpack_require__(240), + Axis: __webpack_require__(243), + Button: __webpack_require__(244), + Gamepad: __webpack_require__(242), + GamepadManager: __webpack_require__(241), - Configs: __webpack_require__(761) + Configs: __webpack_require__(764) }; /***/ }), -/* 761 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102944,15 +104797,15 @@ module.exports = { module.exports = { - DUALSHOCK_4: __webpack_require__(762), - SNES_USB: __webpack_require__(763), - XBOX_360: __webpack_require__(764) + DUALSHOCK_4: __webpack_require__(765), + SNES_USB: __webpack_require__(766), + XBOX_360: __webpack_require__(767) }; /***/ }), -/* 762 */ +/* 765 */ /***/ (function(module, exports) { /** @@ -103003,7 +104856,7 @@ module.exports = { /***/ }), -/* 763 */ +/* 766 */ /***/ (function(module, exports) { /** @@ -103043,7 +104896,7 @@ module.exports = { /***/ }), -/* 764 */ +/* 767 */ /***/ (function(module, exports) { /** @@ -103095,7 +104948,7 @@ module.exports = { /***/ }), -/* 765 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103104,19 +104957,19 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); var Ellipse = __webpack_require__(135); var EllipseContains = __webpack_require__(68); var EventEmitter = __webpack_require__(14); -var InteractiveObject = __webpack_require__(313); +var InteractiveObject = __webpack_require__(315); var PluginManager = __webpack_require__(12); var Rectangle = __webpack_require__(8); var RectangleContains = __webpack_require__(33); -var Triangle = __webpack_require__(55); -var TriangleContains = __webpack_require__(53); +var Triangle = __webpack_require__(56); +var TriangleContains = __webpack_require__(54); /** * @classdesc @@ -103284,6 +105137,17 @@ var InputPlugin = new Class({ */ this._temp = []; + /** + * Used to temporarily store the results of the Hit Test dropZones + * + * @name Phaser.Input.InputPlugin#_tempZones + * @type {array} + * @private + * @default [] + * @since 3.0.0 + */ + this._tempZones = []; + /** * A list of all Game Objects that have been set to be interactive. * @@ -103414,8 +105278,6 @@ var InputPlugin = new Class({ { current.splice(index, 1); - // TODO: Clear from _draggable, _drag and _over too - this.clear(gameObject); } } @@ -103433,9 +105295,9 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#clear * @since 3.0.0 * - * @param {[type]} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] * - * @return {[type]} [description] + * @return {Phaser.GameObjects.GameObject} [description] */ clear: function (gameObject) { @@ -103449,6 +105311,28 @@ var InputPlugin = new Class({ gameObject.input = null; + // Clear from _draggable, _drag and _over + var index = this._draggable.indexOf(gameObject); + + if (index > -1) + { + this._draggable.splice(index, 1); + } + + index = this._drag[0].indexOf(gameObject); + + if (index > -1) + { + this._drag[0].splice(index, 1); + } + + index = this._over[0].indexOf(gameObject); + + if (index > -1) + { + this._over[0].splice(index, 1); + } + return gameObject; }, @@ -103458,7 +105342,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#disable * @since 3.0.0 * - * @param {[type]} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] */ disable: function (gameObject) { @@ -103471,14 +105355,17 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#enable * @since 3.0.0 * - * @param {[type]} gameObject - [description] - * @param {[type]} shape - [description] - * @param {[type]} callback - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {object} shape - [description] + * @param {function} callback - [description] + * @param {boolean} [dropZone=false] - [description] * - * @return {[type]} [description] + * @return {Phaser.Input.InputPlugin} This Input Plugin. */ - enable: function (gameObject, shape, callback) + enable: function (gameObject, shape, callback, dropZone) { + if (dropZone === undefined) { dropZone = false; } + if (gameObject.input) { // If it is already has an InteractiveObject then just enable it and return @@ -103489,6 +105376,8 @@ var InputPlugin = new Class({ // Create an InteractiveObject and enable it this.setHitArea(gameObject, shape, callback); } + + gameObject.input.dropZone = dropZone; return this; }, @@ -103499,9 +105388,9 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#hitTestPointer * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * - * @return {[type]} [description] + * @return {array} [description] */ hitTestPointer: function (pointer) { @@ -103513,7 +105402,20 @@ var InputPlugin = new Class({ // Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'output' array. // All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well. - return this.manager.hitTest(pointer.x, pointer.y, this._list, camera); + var over = this.manager.hitTest(pointer.x, pointer.y, this._list, camera); + + // Filter out the drop zones + for (var i = 0; i < over.length; i++) + { + var obj = over[i]; + + if (obj.input.dropZone) + { + this._tempZones.push(obj); + } + } + + return over; } else { @@ -103527,7 +105429,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processDownEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -103566,10 +105468,10 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processDragEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] - * @param {[type]} time - [description] + * @param {number} pointer - [description] + * @param {number} time - [description] * - * @return {[type]} [description] + * @return {integer} [description] */ processDragEvents: function (pointer, time) { @@ -103580,7 +105482,6 @@ var InputPlugin = new Class({ } var i; - var c; var gameObject; var list; var input; @@ -103624,7 +105525,7 @@ var InputPlugin = new Class({ { pointer.dragState = 0; - return; + return 0; } else if (draglist.length > 1) { @@ -103695,22 +105596,13 @@ var InputPlugin = new Class({ pointer.dragState = 4; - return; + return 1; } // 4 = Pointer actively dragging the draglist and has moved if (pointer.dragState === 4 && pointer.justMoved) { - // Let's filter out currentlyOver for dropZones only - var dropZones = []; - - for (c = 0; c < currentlyOver.length; c++) - { - if (currentlyOver[c].input.dropZone) - { - dropZones.push(currentlyOver[c]); - } - } + var dropZones = this._tempZones; list = this._drag[pointer.id]; @@ -103836,7 +105728,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processMoveEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -103879,7 +105771,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processOverOutEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -103893,6 +105785,7 @@ var InputPlugin = new Class({ var justOver = []; var stillOver = []; var previouslyOver = this._over[pointer.id]; + var currentlyDragging = this._drag[pointer.id]; // Go through all objects the pointer was previously over, and see if it still is. // Splits the previouslyOver array into two parts: justOut and stillOver @@ -103901,7 +105794,7 @@ var InputPlugin = new Class({ { gameObject = previouslyOver[i]; - if (currentlyOver.indexOf(gameObject) === -1) + if (currentlyOver.indexOf(gameObject) === -1 && currentlyDragging.indexOf(gameObject) === -1) { // Not in the currentlyOver array, so must be outside of this object now justOut.push(gameObject); @@ -103994,7 +105887,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processUpEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] */ processUpEvents: function (pointer) { @@ -104017,6 +105910,8 @@ var InputPlugin = new Class({ this.emit('gameobjectup', pointer, gameObject); } + + return currentlyOver.length; }, /** @@ -104498,10 +106393,8 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#update * @since 3.0.0 * - * @param {[type]} time - [description] - * @param {[type]} delta - [description] - * - * @return {[type]} [description] + * @param {number} time - [description] + * @param {number} delta - [description] */ update: function (time, delta) { @@ -104535,14 +106428,27 @@ var InputPlugin = new Class({ return; } + // Always reset this array + this._tempZones = []; + + // _temp contains a hit tested and camera culled list of IO objects this._temp = this.hitTestPointer(pointer); this.sortGameObjects(this._temp); + this.sortGameObjects(this._tempZones); - if (this.topOnly && this._temp.length) + if (this.topOnly) { // Only the top-most one counts now, so safely ignore the rest - this._temp.splice(1); + if (this._temp.length) + { + this._temp.splice(1); + } + + if (this._tempZones.length) + { + this._tempZones.splice(1); + } } var total = this.processDragEvents(pointer, time); @@ -104559,7 +106465,7 @@ var InputPlugin = new Class({ if (pointer.justUp) { - this.processUpEvents(pointer); + total += this.processUpEvents(pointer); } if (pointer.justMoved) @@ -104677,7 +106583,7 @@ module.exports = InputPlugin; /***/ }), -/* 766 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104692,23 +106598,23 @@ module.exports = InputPlugin; module.exports = { - KeyboardManager: __webpack_require__(244), + KeyboardManager: __webpack_require__(245), - Key: __webpack_require__(245), + Key: __webpack_require__(246), KeyCodes: __webpack_require__(128), - KeyCombo: __webpack_require__(246), + KeyCombo: __webpack_require__(247), - JustDown: __webpack_require__(767), - JustUp: __webpack_require__(768), - DownDuration: __webpack_require__(769), - UpDuration: __webpack_require__(770) + JustDown: __webpack_require__(770), + JustUp: __webpack_require__(771), + DownDuration: __webpack_require__(772), + UpDuration: __webpack_require__(773) }; /***/ }), -/* 767 */ +/* 770 */ /***/ (function(module, exports) { /** @@ -104747,7 +106653,7 @@ module.exports = JustDown; /***/ }), -/* 768 */ +/* 771 */ /***/ (function(module, exports) { /** @@ -104786,7 +106692,7 @@ module.exports = JustUp; /***/ }), -/* 769 */ +/* 772 */ /***/ (function(module, exports) { /** @@ -104818,7 +106724,7 @@ module.exports = DownDuration; /***/ }), -/* 770 */ +/* 773 */ /***/ (function(module, exports) { /** @@ -104850,7 +106756,7 @@ module.exports = UpDuration; /***/ }), -/* 771 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104866,14 +106772,14 @@ module.exports = UpDuration; /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(247) + MouseManager: __webpack_require__(248) }; /* eslint-enable */ /***/ }), -/* 772 */ +/* 775 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104889,14 +106795,14 @@ module.exports = { /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(249) + TouchManager: __webpack_require__(250) }; /* eslint-enable */ /***/ }), -/* 773 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104911,21 +106817,21 @@ module.exports = { module.exports = { - FileTypes: __webpack_require__(774), + FileTypes: __webpack_require__(777), File: __webpack_require__(18), FileTypesManager: __webpack_require__(7), - GetURL: __webpack_require__(149), - LoaderPlugin: __webpack_require__(790), - MergeXHRSettings: __webpack_require__(150), - XHRLoader: __webpack_require__(314), + GetURL: __webpack_require__(148), + LoaderPlugin: __webpack_require__(793), + MergeXHRSettings: __webpack_require__(149), + XHRLoader: __webpack_require__(316), XHRSettings: __webpack_require__(90) }; /***/ }), -/* 774 */ +/* 777 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104963,33 +106869,33 @@ module.exports = { module.exports = { - AnimationJSONFile: __webpack_require__(775), - AtlasJSONFile: __webpack_require__(776), - AudioFile: __webpack_require__(315), - AudioSprite: __webpack_require__(777), - BinaryFile: __webpack_require__(778), - BitmapFontFile: __webpack_require__(779), - GLSLFile: __webpack_require__(780), - HTML5AudioFile: __webpack_require__(316), - HTMLFile: __webpack_require__(781), - ImageFile: __webpack_require__(57), - JSONFile: __webpack_require__(56), - MultiAtlas: __webpack_require__(782), - PluginFile: __webpack_require__(783), - ScriptFile: __webpack_require__(784), - SpriteSheetFile: __webpack_require__(785), - SVGFile: __webpack_require__(786), - TextFile: __webpack_require__(319), - TilemapCSVFile: __webpack_require__(787), - TilemapJSONFile: __webpack_require__(788), - UnityAtlasFile: __webpack_require__(789), - XMLFile: __webpack_require__(317) + AnimationJSONFile: __webpack_require__(778), + AtlasJSONFile: __webpack_require__(779), + AudioFile: __webpack_require__(317), + AudioSprite: __webpack_require__(780), + BinaryFile: __webpack_require__(781), + BitmapFontFile: __webpack_require__(782), + GLSLFile: __webpack_require__(783), + HTML5AudioFile: __webpack_require__(318), + HTMLFile: __webpack_require__(784), + ImageFile: __webpack_require__(58), + JSONFile: __webpack_require__(57), + MultiAtlas: __webpack_require__(785), + PluginFile: __webpack_require__(786), + ScriptFile: __webpack_require__(787), + SpriteSheetFile: __webpack_require__(788), + SVGFile: __webpack_require__(789), + TextFile: __webpack_require__(321), + TilemapCSVFile: __webpack_require__(790), + TilemapJSONFile: __webpack_require__(791), + UnityAtlasFile: __webpack_require__(792), + XMLFile: __webpack_require__(319) }; /***/ }), -/* 775 */ +/* 778 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104999,7 +106905,7 @@ module.exports = { */ var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(57); /** * An Animation JSON File. @@ -105071,7 +106977,7 @@ module.exports = AnimationJSONFile; /***/ }), -/* 776 */ +/* 779 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105081,8 +106987,8 @@ module.exports = AnimationJSONFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var JSONFile = __webpack_require__(56); +var ImageFile = __webpack_require__(58); +var JSONFile = __webpack_require__(57); /** * An Atlas JSON File. @@ -105149,7 +107055,7 @@ module.exports = AtlasJSONFile; /***/ }), -/* 777 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105158,10 +107064,10 @@ module.exports = AtlasJSONFile; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AudioFile = __webpack_require__(315); +var AudioFile = __webpack_require__(317); var CONST = __webpack_require__(17); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(57); /** * Adds an Audio Sprite file to the current load queue. @@ -105223,7 +107129,7 @@ FileTypesManager.register('audioSprite', function (key, urls, json, config, audi /***/ }), -/* 778 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105329,7 +107235,7 @@ module.exports = BinaryFile; /***/ }), -/* 779 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105339,8 +107245,8 @@ module.exports = BinaryFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var XMLFile = __webpack_require__(317); +var ImageFile = __webpack_require__(58); +var XMLFile = __webpack_require__(319); /** * An Bitmap Font File. @@ -105407,7 +107313,7 @@ module.exports = BitmapFontFile; /***/ }), -/* 780 */ +/* 783 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105513,7 +107419,7 @@ module.exports = GLSLFile; /***/ }), -/* 781 */ +/* 784 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105677,7 +107583,7 @@ module.exports = HTMLFile; /***/ }), -/* 782 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105687,9 +107593,9 @@ module.exports = HTMLFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var JSONFile = __webpack_require__(56); -var NumberArray = __webpack_require__(318); +var ImageFile = __webpack_require__(58); +var JSONFile = __webpack_require__(57); +var NumberArray = __webpack_require__(320); /** * Adds a Multi File Texture Atlas to the current load queue. @@ -105766,7 +107672,7 @@ FileTypesManager.register('multiatlas', function (key, textureURLs, atlasURLs, t /***/ }), -/* 783 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105805,6 +107711,14 @@ var PluginFile = new Class({ function PluginFile (key, url, path, xhrSettings) { + // If the url variable refers to a class, add the plugin directly + if (typeof url === 'function') + { + this.key = key; + window[key] = url; + window[key].register(PluginManager); + } + var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); var fileConfig = { @@ -105882,7 +107796,7 @@ module.exports = PluginFile; /***/ }), -/* 784 */ +/* 787 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105994,7 +107908,7 @@ module.exports = ScriptFile; /***/ }), -/* 785 */ +/* 788 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106004,7 +107918,7 @@ module.exports = ScriptFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); +var ImageFile = __webpack_require__(58); /** * A Sprite Sheet File. @@ -106071,7 +107985,7 @@ module.exports = SpriteSheetFile; /***/ }), -/* 786 */ +/* 789 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106226,7 +108140,7 @@ module.exports = SVGFile; /***/ }), -/* 787 */ +/* 790 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106239,7 +108153,7 @@ var Class = __webpack_require__(0); var CONST = __webpack_require__(17); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); -var TILEMAP_FORMATS = __webpack_require__(20); +var TILEMAP_FORMATS = __webpack_require__(21); /** * @classdesc @@ -106333,7 +108247,7 @@ module.exports = TilemapCSVFile; /***/ }), -/* 788 */ +/* 791 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106343,8 +108257,8 @@ module.exports = TilemapCSVFile; */ var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); -var TILEMAP_FORMATS = __webpack_require__(20); +var JSONFile = __webpack_require__(57); +var TILEMAP_FORMATS = __webpack_require__(21); /** * A Tilemap File. @@ -106448,7 +108362,7 @@ module.exports = TilemapJSONFile; /***/ }), -/* 789 */ +/* 792 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106458,8 +108372,8 @@ module.exports = TilemapJSONFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var TextFile = __webpack_require__(319); +var ImageFile = __webpack_require__(58); +var TextFile = __webpack_require__(321); /** * An Atlas JSON File. @@ -106527,7 +108441,7 @@ module.exports = UnityAtlasFile; /***/ }), -/* 790 */ +/* 793 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106538,11 +108452,11 @@ module.exports = UnityAtlasFile; var Class = __webpack_require__(0); var CONST = __webpack_require__(17); -var CustomSet = __webpack_require__(61); +var CustomSet = __webpack_require__(62); var EventEmitter = __webpack_require__(14); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ParseXMLBitmapFont = __webpack_require__(268); +var ParseXMLBitmapFont = __webpack_require__(269); var PluginManager = __webpack_require__(12); var XHRSettings = __webpack_require__(90); @@ -107188,7 +109102,7 @@ var LoaderPlugin = new Class({ // Yup, add them to the Texture Manager // Is the data JSON Hash or JSON Array? - if (Array.isArray(data[0].frames)) + if (Array.isArray(data[0].textures) || Array.isArray(data[0].frames)) { textures.addAtlasJSONArray(key, images, data); } @@ -107509,7 +109423,7 @@ module.exports = LoaderPlugin; /***/ }), -/* 791 */ +/* 794 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107528,58 +109442,58 @@ var Extend = __webpack_require__(23); var PhaserMath = { // Collections of functions - Angle: __webpack_require__(792), - Distance: __webpack_require__(800), - Easing: __webpack_require__(803), - Fuzzy: __webpack_require__(804), - Interpolation: __webpack_require__(810), - Pow2: __webpack_require__(813), - Snap: __webpack_require__(815), + Angle: __webpack_require__(795), + Distance: __webpack_require__(803), + Easing: __webpack_require__(806), + Fuzzy: __webpack_require__(807), + Interpolation: __webpack_require__(813), + Pow2: __webpack_require__(816), + Snap: __webpack_require__(818), // Single functions - Average: __webpack_require__(819), - Bernstein: __webpack_require__(321), - Between: __webpack_require__(228), - CatmullRom: __webpack_require__(122), - CeilTo: __webpack_require__(820), - Clamp: __webpack_require__(60), + Average: __webpack_require__(822), + Bernstein: __webpack_require__(323), + Between: __webpack_require__(231), + CatmullRom: __webpack_require__(123), + CeilTo: __webpack_require__(823), + Clamp: __webpack_require__(61), DegToRad: __webpack_require__(35), - Difference: __webpack_require__(821), - Factorial: __webpack_require__(322), - FloatBetween: __webpack_require__(275), - FloorTo: __webpack_require__(822), - FromPercent: __webpack_require__(64), - GetSpeed: __webpack_require__(823), - IsEven: __webpack_require__(824), - IsEvenStrict: __webpack_require__(825), - Linear: __webpack_require__(227), - MaxAdd: __webpack_require__(826), - MinSub: __webpack_require__(827), - Percent: __webpack_require__(828), - RadToDeg: __webpack_require__(218), - RandomXY: __webpack_require__(829), - RandomXYZ: __webpack_require__(206), - RandomXYZW: __webpack_require__(207), - Rotate: __webpack_require__(323), - RotateAround: __webpack_require__(185), - RotateAroundDistance: __webpack_require__(112), - RoundAwayFromZero: __webpack_require__(324), - RoundTo: __webpack_require__(830), - SinCosTableGenerator: __webpack_require__(831), - SmootherStep: __webpack_require__(192), - SmoothStep: __webpack_require__(193), - TransformXY: __webpack_require__(250), - Within: __webpack_require__(832), + Difference: __webpack_require__(824), + Factorial: __webpack_require__(324), + FloatBetween: __webpack_require__(276), + FloorTo: __webpack_require__(825), + FromPercent: __webpack_require__(65), + GetSpeed: __webpack_require__(826), + IsEven: __webpack_require__(827), + IsEvenStrict: __webpack_require__(828), + Linear: __webpack_require__(230), + MaxAdd: __webpack_require__(829), + MinSub: __webpack_require__(830), + Percent: __webpack_require__(831), + RadToDeg: __webpack_require__(219), + RandomXY: __webpack_require__(832), + RandomXYZ: __webpack_require__(207), + RandomXYZW: __webpack_require__(208), + Rotate: __webpack_require__(325), + RotateAround: __webpack_require__(186), + RotateAroundDistance: __webpack_require__(113), + RoundAwayFromZero: __webpack_require__(326), + RoundTo: __webpack_require__(833), + SinCosTableGenerator: __webpack_require__(834), + SmootherStep: __webpack_require__(193), + SmoothStep: __webpack_require__(194), + TransformXY: __webpack_require__(251), + Within: __webpack_require__(835), Wrap: __webpack_require__(50), // Vector classes Vector2: __webpack_require__(6), Vector3: __webpack_require__(51), - Vector4: __webpack_require__(119), - Matrix3: __webpack_require__(210), - Matrix4: __webpack_require__(118), - Quaternion: __webpack_require__(209), - RotateVec3: __webpack_require__(208) + Vector4: __webpack_require__(120), + Matrix3: __webpack_require__(211), + Matrix4: __webpack_require__(119), + Quaternion: __webpack_require__(210), + RotateVec3: __webpack_require__(209) }; @@ -107593,7 +109507,7 @@ module.exports = PhaserMath; /***/ }), -/* 792 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107608,22 +109522,22 @@ module.exports = PhaserMath; module.exports = { - Between: __webpack_require__(793), - BetweenY: __webpack_require__(794), - BetweenPoints: __webpack_require__(795), - BetweenPointsY: __webpack_require__(796), - Reverse: __webpack_require__(797), - RotateTo: __webpack_require__(798), - ShortestBetween: __webpack_require__(799), - Normalize: __webpack_require__(320), - Wrap: __webpack_require__(162), - WrapDegrees: __webpack_require__(163) + Between: __webpack_require__(796), + BetweenY: __webpack_require__(797), + BetweenPoints: __webpack_require__(798), + BetweenPointsY: __webpack_require__(799), + Reverse: __webpack_require__(800), + RotateTo: __webpack_require__(801), + ShortestBetween: __webpack_require__(802), + Normalize: __webpack_require__(322), + Wrap: __webpack_require__(161), + WrapDegrees: __webpack_require__(162) }; /***/ }), -/* 793 */ +/* 796 */ /***/ (function(module, exports) { /** @@ -107654,7 +109568,7 @@ module.exports = Between; /***/ }), -/* 794 */ +/* 797 */ /***/ (function(module, exports) { /** @@ -107685,7 +109599,7 @@ module.exports = BetweenY; /***/ }), -/* 795 */ +/* 798 */ /***/ (function(module, exports) { /** @@ -107714,7 +109628,7 @@ module.exports = BetweenPoints; /***/ }), -/* 796 */ +/* 799 */ /***/ (function(module, exports) { /** @@ -107743,7 +109657,7 @@ module.exports = BetweenPointsY; /***/ }), -/* 797 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107752,7 +109666,7 @@ module.exports = BetweenPointsY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Normalize = __webpack_require__(320); +var Normalize = __webpack_require__(322); /** * [description] @@ -107773,7 +109687,7 @@ module.exports = Reverse; /***/ }), -/* 798 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107840,7 +109754,7 @@ module.exports = RotateTo; /***/ }), -/* 799 */ +/* 802 */ /***/ (function(module, exports) { /** @@ -107886,7 +109800,7 @@ module.exports = ShortestBetween; /***/ }), -/* 800 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107901,15 +109815,15 @@ module.exports = ShortestBetween; module.exports = { - Between: __webpack_require__(41), - Power: __webpack_require__(801), - Squared: __webpack_require__(802) + Between: __webpack_require__(42), + Power: __webpack_require__(804), + Squared: __webpack_require__(805) }; /***/ }), -/* 801 */ +/* 804 */ /***/ (function(module, exports) { /** @@ -107943,7 +109857,7 @@ module.exports = DistancePower; /***/ }), -/* 802 */ +/* 805 */ /***/ (function(module, exports) { /** @@ -107977,7 +109891,7 @@ module.exports = DistanceSquared; /***/ }), -/* 803 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107992,24 +109906,24 @@ module.exports = DistanceSquared; module.exports = { - Back: __webpack_require__(276), - Bounce: __webpack_require__(277), - Circular: __webpack_require__(278), - Cubic: __webpack_require__(279), - Elastic: __webpack_require__(280), - Expo: __webpack_require__(281), - Linear: __webpack_require__(282), - Quadratic: __webpack_require__(283), - Quartic: __webpack_require__(284), - Quintic: __webpack_require__(285), - Sine: __webpack_require__(286), - Stepped: __webpack_require__(287) + Back: __webpack_require__(277), + Bounce: __webpack_require__(278), + Circular: __webpack_require__(279), + Cubic: __webpack_require__(280), + Elastic: __webpack_require__(281), + Expo: __webpack_require__(282), + Linear: __webpack_require__(283), + Quadratic: __webpack_require__(284), + Quartic: __webpack_require__(285), + Quintic: __webpack_require__(286), + Sine: __webpack_require__(287), + Stepped: __webpack_require__(288) }; /***/ }), -/* 804 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108024,17 +109938,17 @@ module.exports = { module.exports = { - Ceil: __webpack_require__(805), - Equal: __webpack_require__(806), - Floor: __webpack_require__(807), - GreaterThan: __webpack_require__(808), - LessThan: __webpack_require__(809) + Ceil: __webpack_require__(808), + Equal: __webpack_require__(809), + Floor: __webpack_require__(810), + GreaterThan: __webpack_require__(811), + LessThan: __webpack_require__(812) }; /***/ }), -/* 805 */ +/* 808 */ /***/ (function(module, exports) { /** @@ -108065,7 +109979,7 @@ module.exports = Ceil; /***/ }), -/* 806 */ +/* 809 */ /***/ (function(module, exports) { /** @@ -108097,7 +110011,7 @@ module.exports = Equal; /***/ }), -/* 807 */ +/* 810 */ /***/ (function(module, exports) { /** @@ -108128,7 +110042,7 @@ module.exports = Floor; /***/ }), -/* 808 */ +/* 811 */ /***/ (function(module, exports) { /** @@ -108160,7 +110074,7 @@ module.exports = GreaterThan; /***/ }), -/* 809 */ +/* 812 */ /***/ (function(module, exports) { /** @@ -108192,7 +110106,7 @@ module.exports = LessThan; /***/ }), -/* 810 */ +/* 813 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108206,17 +110120,16 @@ module.exports = LessThan; */ module.exports = { - - Bezier: __webpack_require__(811), - CatmullRom: __webpack_require__(812), - CubicBezier: __webpack_require__(216), - Linear: __webpack_require__(226) - + Bezier: __webpack_require__(814), + CatmullRom: __webpack_require__(815), + CubicBezier: __webpack_require__(217), + Linear: __webpack_require__(229), + QuadraticBezier: __webpack_require__(222) }; /***/ }), -/* 811 */ +/* 814 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108225,7 +110138,7 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bernstein = __webpack_require__(321); +var Bernstein = __webpack_require__(323); /** * [description] @@ -108255,7 +110168,7 @@ module.exports = BezierInterpolation; /***/ }), -/* 812 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108264,7 +110177,7 @@ module.exports = BezierInterpolation; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CatmullRom = __webpack_require__(122); +var CatmullRom = __webpack_require__(123); /** * [description] @@ -108312,7 +110225,7 @@ module.exports = CatmullRomInterpolation; /***/ }), -/* 813 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108327,15 +110240,15 @@ module.exports = CatmullRomInterpolation; module.exports = { - GetNext: __webpack_require__(290), - IsSize: __webpack_require__(125), - IsValue: __webpack_require__(814) + GetNext: __webpack_require__(291), + IsSize: __webpack_require__(126), + IsValue: __webpack_require__(817) }; /***/ }), -/* 814 */ +/* 817 */ /***/ (function(module, exports) { /** @@ -108363,7 +110276,7 @@ module.exports = IsValuePowerOfTwo; /***/ }), -/* 815 */ +/* 818 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108378,15 +110291,15 @@ module.exports = IsValuePowerOfTwo; module.exports = { - Ceil: __webpack_require__(816), - Floor: __webpack_require__(817), - To: __webpack_require__(818) + Ceil: __webpack_require__(819), + Floor: __webpack_require__(820), + To: __webpack_require__(821) }; /***/ }), -/* 816 */ +/* 819 */ /***/ (function(module, exports) { /** @@ -108426,7 +110339,7 @@ module.exports = SnapCeil; /***/ }), -/* 817 */ +/* 820 */ /***/ (function(module, exports) { /** @@ -108466,7 +110379,7 @@ module.exports = SnapFloor; /***/ }), -/* 818 */ +/* 821 */ /***/ (function(module, exports) { /** @@ -108506,7 +110419,7 @@ module.exports = SnapTo; /***/ }), -/* 819 */ +/* 822 */ /***/ (function(module, exports) { /** @@ -108541,7 +110454,7 @@ module.exports = Average; /***/ }), -/* 820 */ +/* 823 */ /***/ (function(module, exports) { /** @@ -108576,7 +110489,7 @@ module.exports = CeilTo; /***/ }), -/* 821 */ +/* 824 */ /***/ (function(module, exports) { /** @@ -108605,7 +110518,7 @@ module.exports = Difference; /***/ }), -/* 822 */ +/* 825 */ /***/ (function(module, exports) { /** @@ -108640,7 +110553,7 @@ module.exports = FloorTo; /***/ }), -/* 823 */ +/* 826 */ /***/ (function(module, exports) { /** @@ -108669,7 +110582,7 @@ module.exports = GetSpeed; /***/ }), -/* 824 */ +/* 827 */ /***/ (function(module, exports) { /** @@ -108700,7 +110613,7 @@ module.exports = IsEven; /***/ }), -/* 825 */ +/* 828 */ /***/ (function(module, exports) { /** @@ -108729,7 +110642,7 @@ module.exports = IsEvenStrict; /***/ }), -/* 826 */ +/* 829 */ /***/ (function(module, exports) { /** @@ -108759,7 +110672,7 @@ module.exports = MaxAdd; /***/ }), -/* 827 */ +/* 830 */ /***/ (function(module, exports) { /** @@ -108789,7 +110702,7 @@ module.exports = MinSub; /***/ }), -/* 828 */ +/* 831 */ /***/ (function(module, exports) { /** @@ -108848,7 +110761,7 @@ module.exports = Percent; /***/ }), -/* 829 */ +/* 832 */ /***/ (function(module, exports) { /** @@ -108884,7 +110797,7 @@ module.exports = RandomXY; /***/ }), -/* 830 */ +/* 833 */ /***/ (function(module, exports) { /** @@ -108919,7 +110832,7 @@ module.exports = RoundTo; /***/ }), -/* 831 */ +/* 834 */ /***/ (function(module, exports) { /** @@ -108973,7 +110886,7 @@ module.exports = SinCosTableGenerator; /***/ }), -/* 832 */ +/* 835 */ /***/ (function(module, exports) { /** @@ -109003,7 +110916,7 @@ module.exports = Within; /***/ }), -/* 833 */ +/* 836 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109018,22 +110931,22 @@ module.exports = Within; module.exports = { - ArcadePhysics: __webpack_require__(834), - Body: __webpack_require__(331), - Collider: __webpack_require__(332), - Factory: __webpack_require__(325), - Group: __webpack_require__(328), - Image: __webpack_require__(326), + ArcadePhysics: __webpack_require__(837), + Body: __webpack_require__(333), + Collider: __webpack_require__(334), + Factory: __webpack_require__(327), + Group: __webpack_require__(330), + Image: __webpack_require__(328), Sprite: __webpack_require__(91), - StaticBody: __webpack_require__(339), - StaticGroup: __webpack_require__(329), - World: __webpack_require__(330) + StaticBody: __webpack_require__(341), + StaticGroup: __webpack_require__(331), + World: __webpack_require__(332) }; /***/ }), -/* 834 */ +/* 837 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109043,12 +110956,12 @@ module.exports = { */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(325); +var Factory = __webpack_require__(327); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(103); +var Merge = __webpack_require__(104); var PluginManager = __webpack_require__(12); -var World = __webpack_require__(330); -var DistanceBetween = __webpack_require__(41); +var World = __webpack_require__(332); +var DistanceBetween = __webpack_require__(42); var DegToRad = __webpack_require__(35); // All methods in this class are available under `this.physics` in a Scene. @@ -109504,7 +111417,7 @@ module.exports = ArcadePhysics; /***/ }), -/* 835 */ +/* 838 */ /***/ (function(module, exports) { /** @@ -109579,7 +111492,7 @@ module.exports = Acceleration; /***/ }), -/* 836 */ +/* 839 */ /***/ (function(module, exports) { /** @@ -109653,7 +111566,7 @@ module.exports = Angular; /***/ }), -/* 837 */ +/* 840 */ /***/ (function(module, exports) { /** @@ -109745,7 +111658,7 @@ module.exports = Bounce; /***/ }), -/* 838 */ +/* 841 */ /***/ (function(module, exports) { /** @@ -109869,7 +111782,7 @@ module.exports = Debug; /***/ }), -/* 839 */ +/* 842 */ /***/ (function(module, exports) { /** @@ -109944,7 +111857,7 @@ module.exports = Drag; /***/ }), -/* 840 */ +/* 843 */ /***/ (function(module, exports) { /** @@ -110054,7 +111967,7 @@ module.exports = Enable; /***/ }), -/* 841 */ +/* 844 */ /***/ (function(module, exports) { /** @@ -110129,7 +112042,7 @@ module.exports = Friction; /***/ }), -/* 842 */ +/* 845 */ /***/ (function(module, exports) { /** @@ -110204,7 +112117,7 @@ module.exports = Gravity; /***/ }), -/* 843 */ +/* 846 */ /***/ (function(module, exports) { /** @@ -110246,7 +112159,7 @@ module.exports = Immovable; /***/ }), -/* 844 */ +/* 847 */ /***/ (function(module, exports) { /** @@ -110286,7 +112199,7 @@ module.exports = Mass; /***/ }), -/* 845 */ +/* 848 */ /***/ (function(module, exports) { /** @@ -110365,7 +112278,7 @@ module.exports = Size; /***/ }), -/* 846 */ +/* 849 */ /***/ (function(module, exports) { /** @@ -110460,7 +112373,7 @@ module.exports = Velocity; /***/ }), -/* 847 */ +/* 850 */ /***/ (function(module, exports) { /** @@ -110501,7 +112414,7 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 848 */ +/* 851 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110510,9 +112423,9 @@ module.exports = ProcessTileCallbacks; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileCheckX = __webpack_require__(849); -var TileCheckY = __webpack_require__(851); -var TileIntersectsBody = __webpack_require__(338); +var TileCheckX = __webpack_require__(852); +var TileCheckY = __webpack_require__(854); +var TileIntersectsBody = __webpack_require__(340); /** * The core separation function to separate a physics body and a tile. @@ -110614,7 +112527,7 @@ module.exports = SeparateTile; /***/ }), -/* 849 */ +/* 852 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110623,7 +112536,7 @@ module.exports = SeparateTile; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(850); +var ProcessTileSeparationX = __webpack_require__(853); /** * Check the body against the given tile on the X axis. @@ -110689,7 +112602,7 @@ module.exports = TileCheckX; /***/ }), -/* 850 */ +/* 853 */ /***/ (function(module, exports) { /** @@ -110734,7 +112647,7 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 851 */ +/* 854 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110743,7 +112656,7 @@ module.exports = ProcessTileSeparationX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(852); +var ProcessTileSeparationY = __webpack_require__(855); /** * Check the body against the given tile on the Y axis. @@ -110809,7 +112722,7 @@ module.exports = TileCheckY; /***/ }), -/* 852 */ +/* 855 */ /***/ (function(module, exports) { /** @@ -110854,7 +112767,7 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 853 */ +/* 856 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110863,7 +112776,7 @@ module.exports = ProcessTileSeparationY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapX = __webpack_require__(333); +var GetOverlapX = __webpack_require__(335); /** * [description] @@ -110941,7 +112854,7 @@ module.exports = SeparateX; /***/ }), -/* 854 */ +/* 857 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110950,7 +112863,7 @@ module.exports = SeparateX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapY = __webpack_require__(334); +var GetOverlapY = __webpack_require__(336); /** * [description] @@ -111028,16 +112941,16 @@ module.exports = SeparateY; /***/ }), -/* 855 */, -/* 856 */, -/* 857 */, /* 858 */, /* 859 */, /* 860 */, /* 861 */, /* 862 */, /* 863 */, -/* 864 */ +/* 864 */, +/* 865 */, +/* 866 */, +/* 867 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111052,16 +112965,16 @@ module.exports = SeparateY; module.exports = { - SceneManager: __webpack_require__(251), - ScenePlugin: __webpack_require__(865), - Settings: __webpack_require__(254), + SceneManager: __webpack_require__(252), + ScenePlugin: __webpack_require__(868), + Settings: __webpack_require__(255), Systems: __webpack_require__(129) }; /***/ }), -/* 865 */ +/* 868 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111224,7 +113137,7 @@ var ScenePlugin = new Class({ { if (this.settings.status !== CONST.RUNNING) { - this.manager.queueOp('start', key); + this.manager.queueOp('start', key, data); } else { @@ -111443,25 +113356,102 @@ var ScenePlugin = new Class({ }, /** - * [description] + * Swaps the position of two scenes in the Scenes list. + * This controls the order in which they are rendered and updated. * * @method Phaser.Scenes.ScenePlugin#swapPosition - * @since 3.0.0 + * @since 3.2.0 * - * @param {string} key - [description] + * @param {string} keyA - The first Scene to swap. + * @param {string} [keyB] - The second Scene to swap. If none is given it defaults to this Scene. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ - swapPosition: function (key) + swapPosition: function (keyA, keyB) { - if (key && key !== this.key) + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) + { + this.manager.swapPosition(keyA, keyB); + } + + return this; + }, + + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly above Scene A. + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveAbove + * @since 3.2.0 + * + * @param {string} keyA - The Scene that Scene B will be moved to be above. + * @param {string} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. + */ + moveAbove: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) + { + this.manager.moveAbove(keyA, keyB); + } + + return this; + }, + + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly below Scene A. + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveBelow + * @since 3.2.0 + * + * @param {string} keyA - The Scene that Scene B will be moved to be below. + * @param {string} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. + */ + moveBelow: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) { - this.manager.swapPosition(this.key, key); + this.manager.moveBelow(keyA, keyB); } return this; }, + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it wil + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.ScenePlugin#remove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} scene - The Scene to be removed. + * + * @return {Phaser.Scenes.SceneManager} This SceneManager. + */ + remove: function (key) + { + if (key === undefined) { key = this.key; } + + this.manager.remove(key); + + return this; + }, + /** * [description] * @@ -111583,7 +113573,7 @@ module.exports = ScenePlugin; /***/ }), -/* 866 */ +/* 869 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111625,25 +113615,25 @@ module.exports = ScenePlugin; module.exports = { - SoundManagerCreator: __webpack_require__(255), + SoundManagerCreator: __webpack_require__(256), BaseSound: __webpack_require__(85), BaseSoundManager: __webpack_require__(84), - WebAudioSound: __webpack_require__(261), - WebAudioSoundManager: __webpack_require__(260), + WebAudioSound: __webpack_require__(262), + WebAudioSoundManager: __webpack_require__(261), - HTML5AudioSound: __webpack_require__(257), - HTML5AudioSoundManager: __webpack_require__(256), + HTML5AudioSound: __webpack_require__(258), + HTML5AudioSoundManager: __webpack_require__(257), - NoAudioSound: __webpack_require__(259), - NoAudioSoundManager: __webpack_require__(258) + NoAudioSound: __webpack_require__(260), + NoAudioSoundManager: __webpack_require__(259) }; /***/ }), -/* 867 */ +/* 870 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111659,16 +113649,16 @@ module.exports = { module.exports = { List: __webpack_require__(86), - Map: __webpack_require__(113), - ProcessQueue: __webpack_require__(335), - RTree: __webpack_require__(336), - Set: __webpack_require__(61) + Map: __webpack_require__(114), + ProcessQueue: __webpack_require__(337), + RTree: __webpack_require__(338), + Set: __webpack_require__(62) }; /***/ }), -/* 868 */ +/* 871 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111683,19 +113673,19 @@ module.exports = { module.exports = { - Parsers: __webpack_require__(263), + Parsers: __webpack_require__(264), - FilterMode: __webpack_require__(869), + FilterMode: __webpack_require__(872), Frame: __webpack_require__(130), - Texture: __webpack_require__(264), - TextureManager: __webpack_require__(262), - TextureSource: __webpack_require__(265) + Texture: __webpack_require__(265), + TextureManager: __webpack_require__(263), + TextureSource: __webpack_require__(266) }; /***/ }), -/* 869 */ +/* 872 */ /***/ (function(module, exports) { /** @@ -111734,7 +113724,7 @@ module.exports = CONST; /***/ }), -/* 870 */ +/* 873 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111750,29 +113740,29 @@ module.exports = CONST; module.exports = { Components: __webpack_require__(96), - Parsers: __webpack_require__(900), + Parsers: __webpack_require__(903), - Formats: __webpack_require__(20), - ImageCollection: __webpack_require__(350), - ParseToTilemap: __webpack_require__(156), + Formats: __webpack_require__(21), + ImageCollection: __webpack_require__(352), + ParseToTilemap: __webpack_require__(155), Tile: __webpack_require__(44), - Tilemap: __webpack_require__(354), - TilemapCreator: __webpack_require__(917), - TilemapFactory: __webpack_require__(918), + Tilemap: __webpack_require__(356), + TilemapCreator: __webpack_require__(920), + TilemapFactory: __webpack_require__(921), Tileset: __webpack_require__(100), LayerData: __webpack_require__(75), MapData: __webpack_require__(76), - ObjectLayer: __webpack_require__(352), + ObjectLayer: __webpack_require__(354), - DynamicTilemapLayer: __webpack_require__(355), - StaticTilemapLayer: __webpack_require__(356) + DynamicTilemapLayer: __webpack_require__(357), + StaticTilemapLayer: __webpack_require__(358) }; /***/ }), -/* 871 */ +/* 874 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111837,7 +113827,7 @@ module.exports = Copy; /***/ }), -/* 872 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111849,7 +113839,7 @@ module.exports = Copy; var TileToWorldX = __webpack_require__(98); var TileToWorldY = __webpack_require__(99); var GetTilesWithin = __webpack_require__(15); -var ReplaceByIndex = __webpack_require__(343); +var ReplaceByIndex = __webpack_require__(345); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -111924,7 +113914,7 @@ module.exports = CreateFromTiles; /***/ }), -/* 873 */ +/* 876 */ /***/ (function(module, exports) { /** @@ -111992,7 +113982,7 @@ module.exports = CullTiles; /***/ }), -/* 874 */ +/* 877 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112046,7 +114036,7 @@ module.exports = Fill; /***/ }), -/* 875 */ +/* 878 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112095,7 +114085,7 @@ module.exports = FilterTiles; /***/ }), -/* 876 */ +/* 879 */ /***/ (function(module, exports) { /** @@ -112182,7 +114172,7 @@ module.exports = FindByIndex; /***/ }), -/* 877 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112229,7 +114219,7 @@ module.exports = FindTile; /***/ }), -/* 878 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112273,7 +114263,7 @@ module.exports = ForEachTile; /***/ }), -/* 879 */ +/* 882 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112314,7 +114304,7 @@ module.exports = GetTileAtWorldXY; /***/ }), -/* 880 */ +/* 883 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112323,9 +114313,9 @@ module.exports = GetTileAtWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Geom = __webpack_require__(293); +var Geom = __webpack_require__(295); var GetTilesWithin = __webpack_require__(15); -var Intersects = __webpack_require__(294); +var Intersects = __webpack_require__(296); var NOOP = __webpack_require__(3); var TileToWorldX = __webpack_require__(98); var TileToWorldY = __webpack_require__(99); @@ -112413,7 +114403,7 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 881 */ +/* 884 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112465,7 +114455,7 @@ module.exports = GetTilesWithinWorldXY; /***/ }), -/* 882 */ +/* 885 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112474,7 +114464,7 @@ module.exports = GetTilesWithinWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasTileAt = __webpack_require__(344); +var HasTileAt = __webpack_require__(346); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -112504,7 +114494,7 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 883 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112513,7 +114503,7 @@ module.exports = HasTileAtWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PutTileAt = __webpack_require__(153); +var PutTileAt = __webpack_require__(152); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -112546,7 +114536,7 @@ module.exports = PutTileAtWorldXY; /***/ }), -/* 884 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112556,7 +114546,7 @@ module.exports = PutTileAtWorldXY; */ var CalculateFacesWithin = __webpack_require__(34); -var PutTileAt = __webpack_require__(153); +var PutTileAt = __webpack_require__(152); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -112610,7 +114600,7 @@ module.exports = PutTilesAt; /***/ }), -/* 885 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112667,7 +114657,7 @@ module.exports = Randomize; /***/ }), -/* 886 */ +/* 889 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112676,7 +114666,7 @@ module.exports = Randomize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RemoveTileAt = __webpack_require__(345); +var RemoveTileAt = __webpack_require__(347); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -112709,7 +114699,7 @@ module.exports = RemoveTileAtWorldXY; /***/ }), -/* 887 */ +/* 890 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112719,7 +114709,7 @@ module.exports = RemoveTileAtWorldXY; */ var GetTilesWithin = __webpack_require__(15); -var Color = __webpack_require__(222); +var Color = __webpack_require__(225); /** * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to @@ -112794,7 +114784,7 @@ module.exports = RenderDebug; /***/ }), -/* 888 */ +/* 891 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112805,7 +114795,7 @@ module.exports = RenderDebug; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on the given tile or tiles within a layer by index. You can pass in either a @@ -112855,7 +114845,7 @@ module.exports = SetCollision; /***/ }), -/* 889 */ +/* 892 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112866,7 +114856,7 @@ module.exports = SetCollision; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on a range of tiles in a layer whose index is between the specified `start` and @@ -112921,7 +114911,7 @@ module.exports = SetCollisionBetween; /***/ }), -/* 890 */ +/* 893 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112932,7 +114922,7 @@ module.exports = SetCollisionBetween; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on all tiles in the given layer, except for tiles that have an index specified in @@ -112976,7 +114966,7 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 891 */ +/* 894 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113050,7 +115040,7 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 892 */ +/* 895 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113108,7 +115098,7 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 893 */ +/* 896 */ /***/ (function(module, exports) { /** @@ -113155,7 +115145,7 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 894 */ +/* 897 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113197,7 +115187,7 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 895 */ +/* 898 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113241,7 +115231,7 @@ module.exports = Shuffle; /***/ }), -/* 896 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113291,7 +115281,7 @@ module.exports = SwapByIndex; /***/ }), -/* 897 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113334,7 +115324,7 @@ module.exports = TileToWorldXY; /***/ }), -/* 898 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113413,7 +115403,7 @@ module.exports = WeightedRandomize; /***/ }), -/* 899 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113458,7 +115448,7 @@ module.exports = WorldToTileXY; /***/ }), -/* 900 */ +/* 903 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113473,18 +115463,18 @@ module.exports = WorldToTileXY; module.exports = { - Parse: __webpack_require__(346), - Parse2DArray: __webpack_require__(155), - ParseCSV: __webpack_require__(347), + Parse: __webpack_require__(348), + Parse2DArray: __webpack_require__(154), + ParseCSV: __webpack_require__(349), - Impact: __webpack_require__(353), - Tiled: __webpack_require__(348) + Impact: __webpack_require__(355), + Tiled: __webpack_require__(350) }; /***/ }), -/* 901 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113493,10 +115483,10 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Base64Decode = __webpack_require__(902); +var Base64Decode = __webpack_require__(905); var GetFastValue = __webpack_require__(2); var LayerData = __webpack_require__(75); -var ParseGID = __webpack_require__(349); +var ParseGID = __webpack_require__(351); var Tile = __webpack_require__(44); /** @@ -113610,7 +115600,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 902 */ +/* 905 */ /***/ (function(module, exports) { /** @@ -113653,7 +115643,7 @@ module.exports = Base64Decode; /***/ }), -/* 903 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113705,7 +115695,7 @@ module.exports = ParseImageLayers; /***/ }), -/* 904 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113715,8 +115705,8 @@ module.exports = ParseImageLayers; */ var Tileset = __webpack_require__(100); -var ImageCollection = __webpack_require__(350); -var ParseObject = __webpack_require__(351); +var ImageCollection = __webpack_require__(352); +var ParseObject = __webpack_require__(353); /** * Tilesets & Image Collections @@ -113810,7 +115800,7 @@ module.exports = ParseTilesets; /***/ }), -/* 905 */ +/* 908 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113853,7 +115843,7 @@ module.exports = Pick; /***/ }), -/* 906 */ +/* 909 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113863,8 +115853,8 @@ module.exports = Pick; */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(351); -var ObjectLayer = __webpack_require__(352); +var ParseObject = __webpack_require__(353); +var ObjectLayer = __webpack_require__(354); /** * [description] @@ -113912,7 +115902,7 @@ module.exports = ParseObjectLayers; /***/ }), -/* 907 */ +/* 910 */ /***/ (function(module, exports) { /** @@ -113985,7 +115975,7 @@ module.exports = BuildTilesetIndex; /***/ }), -/* 908 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114058,7 +116048,7 @@ module.exports = AssignTileProperties; /***/ }), -/* 909 */ +/* 912 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114142,7 +116132,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 910 */ +/* 913 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114193,7 +116183,7 @@ module.exports = ParseTilesets; /***/ }), -/* 911 */ +/* 914 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114207,12 +116197,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(912); + renderWebGL = __webpack_require__(915); } if (true) { - renderCanvas = __webpack_require__(913); + renderCanvas = __webpack_require__(916); } module.exports = { @@ -114224,7 +116214,7 @@ module.exports = { /***/ }), -/* 912 */ +/* 915 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114265,7 +116255,7 @@ module.exports = DynamicTilemapLayerWebGLRenderer; /***/ }), -/* 913 */ +/* 916 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114357,7 +116347,7 @@ module.exports = DynamicTilemapLayerCanvasRenderer; /***/ }), -/* 914 */ +/* 917 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114371,12 +116361,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(915); + renderWebGL = __webpack_require__(918); } if (true) { - renderCanvas = __webpack_require__(916); + renderCanvas = __webpack_require__(919); } module.exports = { @@ -114388,7 +116378,7 @@ module.exports = { /***/ }), -/* 915 */ +/* 918 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114429,7 +116419,7 @@ module.exports = StaticTilemapLayerWebGLRenderer; /***/ }), -/* 916 */ +/* 919 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114502,7 +116492,7 @@ module.exports = StaticTilemapLayerCanvasRenderer; /***/ }), -/* 917 */ +/* 920 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114512,7 +116502,7 @@ module.exports = StaticTilemapLayerCanvasRenderer; */ var GameObjectCreator = __webpack_require__(13); -var ParseToTilemap = __webpack_require__(156); +var ParseToTilemap = __webpack_require__(155); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -114562,7 +116552,7 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 918 */ +/* 921 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114572,7 +116562,7 @@ GameObjectCreator.register('tilemap', function (config) */ var GameObjectFactory = __webpack_require__(9); -var ParseToTilemap = __webpack_require__(156); +var ParseToTilemap = __webpack_require__(155); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -114628,7 +116618,7 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 919 */ +/* 922 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114643,14 +116633,14 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt module.exports = { - Clock: __webpack_require__(920), - TimerEvent: __webpack_require__(357) + Clock: __webpack_require__(923), + TimerEvent: __webpack_require__(359) }; /***/ }), -/* 920 */ +/* 923 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114661,7 +116651,7 @@ module.exports = { var Class = __webpack_require__(0); var PluginManager = __webpack_require__(12); -var TimerEvent = __webpack_require__(357); +var TimerEvent = __webpack_require__(359); /** * @classdesc @@ -115018,7 +117008,7 @@ module.exports = Clock; /***/ }), -/* 921 */ +/* 924 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115033,18 +117023,18 @@ module.exports = Clock; module.exports = { - Builders: __webpack_require__(922), + Builders: __webpack_require__(925), - TweenManager: __webpack_require__(924), - Tween: __webpack_require__(160), - TweenData: __webpack_require__(161), - Timeline: __webpack_require__(362) + TweenManager: __webpack_require__(927), + Tween: __webpack_require__(159), + TweenData: __webpack_require__(160), + Timeline: __webpack_require__(364) }; /***/ }), -/* 922 */ +/* 925 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115062,19 +117052,19 @@ module.exports = { GetBoolean: __webpack_require__(73), GetEaseFunction: __webpack_require__(71), GetNewValue: __webpack_require__(101), - GetProps: __webpack_require__(358), - GetTargets: __webpack_require__(157), - GetTweens: __webpack_require__(359), - GetValueOp: __webpack_require__(158), - NumberTweenBuilder: __webpack_require__(360), - TimelineBuilder: __webpack_require__(361), + GetProps: __webpack_require__(360), + GetTargets: __webpack_require__(156), + GetTweens: __webpack_require__(361), + GetValueOp: __webpack_require__(157), + NumberTweenBuilder: __webpack_require__(362), + TimelineBuilder: __webpack_require__(363), TweenBuilder: __webpack_require__(102) }; /***/ }), -/* 923 */ +/* 926 */ /***/ (function(module, exports) { /** @@ -115146,7 +117136,7 @@ module.exports = [ /***/ }), -/* 924 */ +/* 927 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115156,9 +117146,9 @@ module.exports = [ */ var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(360); +var NumberTweenBuilder = __webpack_require__(362); var PluginManager = __webpack_require__(12); -var TimelineBuilder = __webpack_require__(361); +var TimelineBuilder = __webpack_require__(363); var TWEEN_CONST = __webpack_require__(87); var TweenBuilder = __webpack_require__(102); @@ -115800,7 +117790,7 @@ module.exports = TweenManager; /***/ }), -/* 925 */ +/* 928 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115815,15 +117805,15 @@ module.exports = TweenManager; module.exports = { - Array: __webpack_require__(926), - Objects: __webpack_require__(930), - String: __webpack_require__(934) + Array: __webpack_require__(929), + Objects: __webpack_require__(933), + String: __webpack_require__(937) }; /***/ }), -/* 926 */ +/* 929 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115838,23 +117828,23 @@ module.exports = { module.exports = { - FindClosestInSorted: __webpack_require__(927), + FindClosestInSorted: __webpack_require__(930), GetRandomElement: __webpack_require__(138), - NumberArray: __webpack_require__(318), - NumberArrayStep: __webpack_require__(928), - QuickSelect: __webpack_require__(337), - Range: __webpack_require__(274), - RemoveRandomElement: __webpack_require__(929), - RotateLeft: __webpack_require__(189), - RotateRight: __webpack_require__(190), + NumberArray: __webpack_require__(320), + NumberArrayStep: __webpack_require__(931), + QuickSelect: __webpack_require__(339), + Range: __webpack_require__(275), + RemoveRandomElement: __webpack_require__(932), + RotateLeft: __webpack_require__(190), + RotateRight: __webpack_require__(191), Shuffle: __webpack_require__(80), - SpliceOne: __webpack_require__(363) + SpliceOne: __webpack_require__(365) }; /***/ }), -/* 927 */ +/* 930 */ /***/ (function(module, exports) { /** @@ -115902,7 +117892,7 @@ module.exports = FindClosestInSorted; /***/ }), -/* 928 */ +/* 931 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115911,7 +117901,7 @@ module.exports = FindClosestInSorted; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RoundAwayFromZero = __webpack_require__(324); +var RoundAwayFromZero = __webpack_require__(326); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -115979,7 +117969,7 @@ module.exports = NumberArrayStep; /***/ }), -/* 929 */ +/* 932 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115988,7 +117978,7 @@ module.exports = NumberArrayStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(363); +var SpliceOne = __webpack_require__(365); /** * Removes a random object from the given array and returns it. @@ -116017,7 +118007,7 @@ module.exports = RemoveRandomElement; /***/ }), -/* 930 */ +/* 933 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116032,24 +118022,24 @@ module.exports = RemoveRandomElement; module.exports = { - Clone: __webpack_require__(52), + Clone: __webpack_require__(53), Extend: __webpack_require__(23), GetAdvancedValue: __webpack_require__(10), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(931), + GetMinMaxValue: __webpack_require__(934), GetValue: __webpack_require__(4), - HasAll: __webpack_require__(932), - HasAny: __webpack_require__(288), + HasAll: __webpack_require__(935), + HasAny: __webpack_require__(289), HasValue: __webpack_require__(72), - IsPlainObject: __webpack_require__(167), - Merge: __webpack_require__(103), - MergeRight: __webpack_require__(933) + IsPlainObject: __webpack_require__(168), + Merge: __webpack_require__(104), + MergeRight: __webpack_require__(936) }; /***/ }), -/* 931 */ +/* 934 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116059,7 +118049,7 @@ module.exports = { */ var GetValue = __webpack_require__(4); -var Clamp = __webpack_require__(60); +var Clamp = __webpack_require__(61); /** * [description] @@ -116088,7 +118078,7 @@ module.exports = GetMinMaxValue; /***/ }), -/* 932 */ +/* 935 */ /***/ (function(module, exports) { /** @@ -116125,7 +118115,7 @@ module.exports = HasAll; /***/ }), -/* 933 */ +/* 936 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116134,7 +118124,7 @@ module.exports = HasAll; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Creates a new Object using all values from obj1. @@ -116168,7 +118158,7 @@ module.exports = MergeRight; /***/ }), -/* 934 */ +/* 937 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116183,16 +118173,16 @@ module.exports = MergeRight; module.exports = { - Format: __webpack_require__(935), - Pad: __webpack_require__(197), - Reverse: __webpack_require__(936), - UppercaseFirst: __webpack_require__(253) + Format: __webpack_require__(938), + Pad: __webpack_require__(198), + Reverse: __webpack_require__(939), + UppercaseFirst: __webpack_require__(254) }; /***/ }), -/* 935 */ +/* 938 */ /***/ (function(module, exports) { /** @@ -116229,7 +118219,7 @@ module.exports = Format; /***/ }), -/* 936 */ +/* 939 */ /***/ (function(module, exports) { /** @@ -116258,9 +118248,6 @@ module.exports = ReverseString; /***/ }), -/* 937 */, -/* 938 */, -/* 939 */, /* 940 */, /* 941 */, /* 942 */, @@ -116318,7 +118305,15 @@ module.exports = ReverseString; /* 994 */, /* 995 */, /* 996 */, -/* 997 */ +/* 997 */, +/* 998 */, +/* 999 */, +/* 1000 */, +/* 1001 */, +/* 1002 */, +/* 1003 */, +/* 1004 */, +/* 1005 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** @@ -116327,7 +118322,7 @@ module.exports = ReverseString; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -__webpack_require__(366); +__webpack_require__(377); var CONST = __webpack_require__(22); var Extend = __webpack_require__(23); @@ -116338,35 +118333,35 @@ var Extend = __webpack_require__(23); var Phaser = { - Actions: __webpack_require__(168), - Animation: __webpack_require__(438), - Cache: __webpack_require__(439), - Cameras: __webpack_require__(440), + Actions: __webpack_require__(169), + Animation: __webpack_require__(449), + Cache: __webpack_require__(450), + Cameras: __webpack_require__(451), Class: __webpack_require__(0), - Create: __webpack_require__(451), - Curves: __webpack_require__(457), - Data: __webpack_require__(460), - Display: __webpack_require__(462), - DOM: __webpack_require__(495), - EventEmitter: __webpack_require__(497), - Game: __webpack_require__(498), - GameObjects: __webpack_require__(543), - Geom: __webpack_require__(293), - Input: __webpack_require__(759), - Loader: __webpack_require__(773), - Math: __webpack_require__(791), + Create: __webpack_require__(462), + Curves: __webpack_require__(468), + Data: __webpack_require__(471), + Display: __webpack_require__(473), + DOM: __webpack_require__(506), + EventEmitter: __webpack_require__(508), + Game: __webpack_require__(509), + GameObjects: __webpack_require__(545), + Geom: __webpack_require__(295), + Input: __webpack_require__(762), + Loader: __webpack_require__(776), + Math: __webpack_require__(794), Physics: { - Arcade: __webpack_require__(833) + Arcade: __webpack_require__(836) }, - Scene: __webpack_require__(252), - Scenes: __webpack_require__(864), - Sound: __webpack_require__(866), - Structs: __webpack_require__(867), - Textures: __webpack_require__(868), - Tilemaps: __webpack_require__(870), - Time: __webpack_require__(919), - Tweens: __webpack_require__(921), - Utils: __webpack_require__(925) + Scene: __webpack_require__(253), + Scenes: __webpack_require__(867), + Sound: __webpack_require__(869), + Structs: __webpack_require__(870), + Textures: __webpack_require__(871), + Tilemaps: __webpack_require__(873), + Time: __webpack_require__(922), + Tweens: __webpack_require__(924), + Utils: __webpack_require__(928) }; @@ -116386,7 +118381,7 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(167))) /***/ }) /******/ ]); diff --git a/dist/phaser-arcade-physics.min.js b/dist/phaser-arcade-physics.min.js index 5fedfc630d..0396b882d0 100644 --- a/dist/phaser-arcade-physics.min.js +++ b/dist/phaser-arcade-physics.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Phaser",[],e):"object"==typeof exports?exports.Phaser=e():t.Phaser=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=997)}([function(t,e){function i(t,e,i,n){for(var r in e)if(e.hasOwnProperty(r)){var o=(l=e,c=r,f=void 0,p=void 0,p=(d=i)?l[c]:Object.getOwnPropertyDescriptor(l,c),!d&&p.value&&"object"==typeof p.value&&(p=p.value),!!(p&&(f=p,f.get&&"function"==typeof f.get||f.set&&"function"==typeof f.set))&&(void 0===p.enumerable&&(p.enumerable=!0),void 0===p.configurable&&(p.configurable=!0),p));if(!1!==o){if(a=(n||t).prototype,h=r,u=void 0,(u=Object.getOwnPropertyDescriptor(a,h))&&(u.value&&"object"==typeof u.value&&(u=u.value),!1===u.configurable)){if(s.ignoreFinals)continue;throw new Error("cannot override final property '"+r+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,r,o)}else t.prototype[r]=e[r]}var a,h,u,l,c,d,f,p}function n(t,e){if(e){Array.isArray(e)||(e=[e]);for(var n=0;n0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},transformMat3:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},transformMat4:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[4]*i+n[12],this.y=n[1]*e+n[5]*i+n[13],this},reset:function(){return this.x=0,this.y=0,this}});n.ZERO=new n,t.exports=n},function(t,e){var i={},n={install:function(t){for(var e in i)t[e]=i[e]},register:function(t,e){i[t]=e},destroy:function(){i={}}};t.exports=n},function(t,e,i){var n=i(0),s=i(33),r=i(106),o=i(184),a=i(107),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(){return{x1:this.x,y1:this.y,x2:this.right,y2:this.y}},getLineB:function(){return{x1:this.right,y1:this.y,x2:this.right,y2:this.bottom}},getLineC:function(){return{x1:this.right,y1:this.bottom,x2:this.x,y2:this.bottom}},getLineD:function(){return{x1:this.x,y1:this.bottom,x2:this.x,y2:this.y}},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.displayList,this.updateList},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList;var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){},destroy:function(){this.scene=null,this.displayList=null,this.updateList=null}});r.register=function(t,e){r.prototype.hasOwnProperty(t)||(r.prototype[t]=e)},s.register("GameObjectFactory",r,"add"),t.exports=r},function(t,e,i){var n=i(16),s=i(4);t.exports=function(t,e,i){var r=s(t,e,null);if(null===r)return i;if(Array.isArray(r))return n.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return n.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return n.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},function(t,e,i){t.exports={Alpha:i(381),Animation:i(364),BlendMode:i(382),ComputedSize:i(383),Depth:i(384),Flip:i(385),GetBounds:i(386),MatrixStack:i(387),Origin:i(388),Pipeline:i(186),ScaleMode:i(389),ScrollFactor:i(390),Size:i(391),Texture:i(392),Tint:i(393),ToJSON:i(394),Transform:i(395),TransformMatrix:i(187),Visible:i(396)}},function(t,e,i){var n={},s=new(i(0))({initialize:function(t){this.game=t,t.events.once("boot",this.boot,this)},boot:function(){this.game.events.once("destroy",this.destroy,this)},installGlobal:function(t,e){for(var i=t.game,n=t.scene,s=t.settings.map,r=0;ro.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var l=[],c=e;c0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},function(t,e,i){var n=i(97),s=i(15);t.exports=function(t,e,i,r,o){for(var a=null,h=null,u=null,l=null,c=s(t,e,i,r,null,o),d=0;d>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return this.getLeft(t)+this.width/2},getCenterY:function(t){return this.getTop(t)+this.height/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){(void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){(void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight-(this.height-this.baseHeight),this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.tilemapLayer;return t?t.tileset:null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e){t.exports={SKIP_CHECK:-1,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}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z;return this.x=i*o-n*r,this.y=n*s-e*o,this.z=e*r-i*s,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this},transformMat3:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=e*s[0]+i*s[3]+n*s[6],this.y=e*s[1]+i*s[4]+n*s[7],this.z=e*s[2]+i*s[5]+n*s[8],this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=e*s[0]+i*s[4]+n*s[8]+s[12],o=e*s[1]+i*s[5]+n*s[9]+s[13],a=e*s[2]+i*s[6]+n*s[10]+s[14],h=e*s[3]+i*s[7]+n*s[11]+s[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,u=a*i+o*e-s*n,l=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+u*-o-l*-r,this.y=u*a+c*-r+l*-s-h*-o,this.z=l*a+c*-o+h*-r-u*-s,this},project:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=s[0],o=s[1],a=s[2],h=s[3],u=s[4],l=s[5],c=s[6],d=s[7],f=s[8],p=s[9],g=s[10],v=s[11],y=s[12],m=s[13],x=s[14],w=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*u+n*f+y)*w,this.y=(e*o+i*l+n*p+m)*w,this.z=(e*a+i*c+n*g+x)*w,this},unproject:function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,o=this.x-i,a=r-this.y-1-n,h=this.z;return this.x=2*o/s-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});t.exports=n},function(t,e){t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},function(t,e){t.exports=function(t,e,i){var n=t.x3-t.x1,s=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,u=n*n+s*s,l=n*r+s*o,c=n*a+s*h,d=r*r+o*o,f=r*a+o*h,p=u*d-l*l,g=0===p?0:1/p,v=(d*c-l*f)*g,y=(u*f-l*c)*g;return v>=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},function(t,e,i){var n=i(0),s=i(53),r=i(308),o=i(309),a=i(111),h=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r,this},getLineA:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2}},getLineB:function(){return{x1:this.x2,y1:this.y2,x2:this.x3,y2:this.y3}},getLineC:function(){return{x1:this.x3,y1:this.y3,x2:this.x1,y2:this.y1}},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=h},function(t,e,i){var n=i(0),s=i(17),r=i(18),o=i(7),a=i(2),h=new n({Extends:r,initialize:function(t,e,i,n){var o="string"==typeof t?t:a(t,"key",""),h={type:"json",extension:a(t,"extension","json"),responseType:"text",key:o,url:a(t,"file",e),path:i,xhrSettings:a(t,"xhr",n)};r.call(this,h),"object"==typeof h.url&&(this.data=h.url,this.state=s.FILE_POPULATED)},onProcess:function(t){this.state=s.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText),this.onComplete(),t(this)}});o.register("json",function(t,e,i){if(Array.isArray(t))for(var n=0;n-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new n;return t.entries.forEach(function(t){e.set(t)}),this.entries.forEach(function(t){e.set(t)}),e},intersect:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)&&e.set(i)}),e},difference:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)||e.set(i)}),e},size:{get:function(){return this.entries.length},set:function(t){return this.entries.length=t}}});t.exports=n},function(t,e){t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(0),s=i(32),r=i(181),o=i(182),a=i(105),h=new n({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=h},function(t,e,i){var n=i(60);t.exports=function(t,e,i){return(i-e)*(t=n(t,0,1))}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e,i){var n=i(0),s=i(121),r=i(8),o=i(6),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var n=Math.max(1,Math.round(i/e));return s(this.getSpacedPoints(n),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],n=this.getPoint(0,this._tmpVec2A),s=0;i.push(0);for(var r=1;r<=t;r++)s+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(n),i.push(s),n.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++){var n=this.getUtoTmapping(i/t,null,t);e.push(this.getPoint(n))}return e},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=t-1e-4,n=t+1e-4;return i<0&&(i=0),n>1&&(n=1),this.getPoint(i,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var n,s=this.getLengths(i),r=0,o=s.length;n=e?Math.min(e,s[o-1]):t*s[o-1];for(var a,h=0,u=o-1;h<=u;)if((a=s[r=Math.floor(h+(u-h)/2)]-n)<0)h=r+1;else{if(!(a>0)){u=r;break}u=r-1}if(s[r=u]===n)return r/(o-1);var l=s[r];return(r+(n-l)/(s[r+1]-l))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},function(t,e,i){(function(e){var i={android:!1,chromeOS:!1,cocoonJS:!1,cocoonJSApp:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){var t=navigator.userAgent;/Windows/.test(t)?i.windows=!0:/Mac OS/.test(t)?i.macOS=!0:/Linux/.test(t)?i.linux=!0:/Android/.test(t)?i.android=!0:/iP[ao]d|iPhone/i.test(t)?(i.iOS=!0,navigator.appVersion.match(/OS (\d+)/),i.iOSVersion=parseInt(RegExp.$1,10)):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?i.kindle=!0:/CrOS/.test(t)&&(i.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(i.android=!1,i.iOS=!1,i.macOS=!1,i.windows=!0,i.windowsPhone=!0);var n=/Silk/.test(t);if((i.windows||i.macOS||i.linux&&!n||i.chromeOS)&&(i.desktop=!0),(i.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(i.desktop=!1),navigator.standalone&&(i.webApp=!0),void 0!==window.cordova&&(i.cordova=!0),void 0!==e&&void 0!==e.versions.node&&(i.node=!0),i.node&&"object"==typeof e.versions&&(i.nodeWebkit=!!e.versions["node-webkit"],i.electron=!!e.versions.electron),navigator.isCocoonJS){i.cocoonJS=!0;try{i.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){i.cocoonJSApp=!1}}return void 0!==window.ejecta&&(i.ejecta=!0),/Crosswalk/.test(t)&&(i.crosswalk=!0),i.iPhone=-1!==t.toLowerCase().indexOf("iphone"),i.iPad=-1!==t.toLowerCase().indexOf("ipad"),i.pixelRatio=window.devicePixelRatio||1,i}()}).call(e,i(496))},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var n=i(168),s=i(0),r=i(2),o=i(4),a=i(274),h=i(61),u=i(37),l=new s({initialize:function(t,e,i){void 0!==i||Array.isArray(e)||"object"!=typeof e||(i=e,e=null),this.scene=t,this.children=new h(e),this.isParent=!0,this.classType=r(i,"classType",u),this.active=r(i,"active",!0),this.maxSize=r(i,"maxSize",-1),this.defaultKey=r(i,"defaultKey",null),this.defaultFrame=r(i,"defaultFrame",null),this.runChildUpdate=r(i,"runChildUpdate",!1),this.createCallback=r(i,"createCallback",null),this.removeCallback=r(i,"removeCallback",null),this.createMultipleCallback=r(i,"createMultipleCallback",null),i&&this.createMultiple(i)},create:function(t,e,i,n,s){if(void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),this.isFull())return null;var r=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(r),r.preUpdate&&this.scene.sys.updateList.add(r),r.visible=s,this.add(r),r},createMultiple:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i=0&&t=0&&e0){this.blockSet=!1;var i=this;if(this.events.emit("changedata",this.parent,t,e,function(e){i.blockSet=!0,i.list[t]=e,i.events.emit("setdata",i.parent,t,e)}),this.blockSet)return this}return this.list[t]=e,this.events.emit("setdata",this.parent,t,e),this},each:function(t,e){for(var i=[this.parent,null,void 0],n=1;n0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e,i){var n=i(0),s=i(1),r=i(37),o=i(6),a=i(119),h=new n({Extends:s,initialize:function(t,e,i,n,h,u){s.call(this,t,"Sprite3D"),this.gameObject=new r(t,0,0,h,u),this.position=new a(e,i,n),this.size=new o(this.gameObject.width,this.gameObject.height),this.scale=new o(1,1),this.adjustScaleX=!0,this.adjustScaleY=!0,this._visible=!0},project:function(t){var e=this.position,i=this.gameObject;t.project(e,i),t.getPointSize(e,this.size,this.scale),this.scale.x<=0||this.scale.y<=0?i.setVisible(!1):(i.visible||i.setVisible(!0),this.adjustScaleX&&(i.scaleX=this.scale.x),this.adjustScaleY&&(i.scaleY=this.scale.y),i.setDepth(-1*i.z))},setVisible:function(t){return this.visible=t,this},visible:{get:function(){return this._visible},set:function(t){this._visible=t,this.gameObject.visible=t}},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},z:{get:function(){return this.position.z},set:function(t){this.position.z=t}}});t.exports=h},function(t,e,i){var n,s=i(67),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0};t.exports=(n=navigator.userAgent,/Edge\/\d+/.test(n)?r.edge=!0:/Chrome\/(\d+)/.test(n)&&!s.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10)):/Firefox\D+(\d+)/.test(n)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(n)&&s.iOS?r.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(n)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Opera/.test(n)?r.opera=!0:/Safari/.test(n)&&!s.windowsPhone?r.safari=!0:/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(n)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(n)&&(r.silk=!0),r)},function(t,e){t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},function(t,e,i){var n=i(0),s=i(14),r=i(3),o=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.once("destroy",this.destroy,this),this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.locked&&this.unlock()},add:r,addAudioSprite:function(t,e){var i=this.add(t,e);i.spritemap=this.game.cache.json.get(t).spritemap;for(var n in i.spritemap)if(i.spritemap.hasOwnProperty(n)){var s=i.spritemap[n];i.addMarker({name:n,start:s.start,duration:s.end-s.start,config:e})}return i},play:function(t,e){var i=this.add(t);return i.once("ended",i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var n=this.addAudioSprite(t);return n.once("ended",n.destroy,n),n.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var n=this.sounds[i];n.key===t&&(n.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound(function(t){t.pause()}),this.emit("pauseall",this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit("resumeall",this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit("stopall",this)},unlock:r,onBlur:r,onFocus:r,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit("unlocked",this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach(function(i){i.update(t,e)})},destroy:function(){this.removeAllListeners(),this.forEachActiveSound(function(t){t.destroy()}),this.sounds.length=0,this.sounds=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach(function(n,s){n.pendingRemove||t.call(e||i,n,s,i.sounds)})},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("rate",this,t)}},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("detune",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(14),r=i(23),o=i(3),a=new n({Extends:s,initialize:function(t,e,i){s.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={delay:0},this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.config=r(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(console.error("addMarker - Marker with name '"+t.name+"' already exists for sound '"+this.key+"'!"),!1):(t=r(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0}},t),this.markers[t.name]=t,!0))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(this.markers[t.name]=r(!0,this.markers[t.name],t),!0):(console.error("updateMarker - Marker with name '"+t.name+"' does not exist for sound '"+this.key+"'!"),!1))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return console.error("Sound marker name has to be a string!"),!1;if(t){if(!this.markers[t])return console.error("No marker with name '"+t+"' found for sound '"+this.key+"'!"),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=r(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!0,!0)},resume:function(){return!(!this.isPaused||this.isPlaying)&&(this.isPlaying=!0,this.isPaused=!1,!0)},stop:function(){return!(!this.isPaused&&!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),!0)},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:o,destroy:function(){this.pendingRemove||(this.pendingRemove=!0,this.manager=null,this.key="",this.removeAllListeners(),this.isPlaying=!1,this.isPaused=!1,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)},setRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e}});Object.defineProperty(a.prototype,"rate",{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.setRate(),this.emit("rate",this,t)}}),Object.defineProperty(a.prototype,"detune",{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.setRate(),this.emit("detune",this,t)}}),t.exports=a},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.list=[],this.position=0},add:function(t){return-1===this.getIndex(t)&&this.list.push(t),t},addAt:function(t,e){return void 0===e&&(e=0),0===this.list.length?this.add(t):(e>=0&&e<=this.list.length&&-1===this.getIndex(t)&&this.list.splice(e,0,t),t)},addMultiple:function(t){if(Array.isArray(t))for(var e=0;en?1:0},getByKey:function(t,e){for(var i=0;ithis.list.length)return null;var i=t+Math.floor(Math.random()*e);return this.list[i]},getFirst:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.list.length);for(var s=i;s=this.list.length)throw new Error("List.moveTo: The supplied index is out of bounds");return this.list.splice(i,1),this.list.splice(e,0,t),t},remove:function(t){var e=this.list.indexOf(t);return-1!==e&&this.list.splice(e,1),t},removeAt:function(t){var e=this.list[t];return e&&this.children.splice(t,1),e},removeBetween:function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.list.length);var i=e-t;if(i>0&&i<=e)return this.list.splice(t,i);if(0===i&&0===this.list.length)return[];throw new Error("List.removeBetween: Range Error, numeric values are outside the acceptable range")},removeAll:function(){for(var t=this.list.length;t--;)this.remove(this.list[t]);return this},bringToTop:function(t){return this.getIndex(t)0&&(this.remove(t),this.addAt(t,0)),t},moveUp:function(t){var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getAt(e-1);i&&this.swap(t,i)}return t},reverse:function(){return this.list.reverse(),this},shuffle:function(){for(var t=this.list.length-1;t>0;t--){var e=Math.floor(Math.random()*(t+1)),i=this.list[t];this.list[t]=this.list[e],this.list[e]=i}return this},replace:function(t,e){var i=this.getIndex(t);if(-1!==i)return this.remove(t),this.addAt(e,i),t},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e){for(var i=0;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=n},function(t,e){t.exports={CREATED:0,INIT:1,DELAY:2,OFFSET_DELAY:3,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING_ADD:20,PAUSED:21,LOOP_DELAY:22,ACTIVE:23,COMPLETE_DELAY:24,PENDING_REMOVE:25,REMOVED:26}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(655),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Size,s.Texture,s.Transform,s.Visible,s.ScrollFactor,o],initialize:function(t,e,i,n,s,o,a,h,u){if(r.call(this,t,"Mesh"),this.setTexture(h,u),this.setPosition(e,i),this.setSizeToFrame(),this.setOrigin(),this.initPipeline("TextureTintPipeline"),n.length!==s.length)throw new Error("Mesh Vertex count must match UV count");var l,c=n.length/2|0;if(o.length>0&&o.length0&&a.length=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e){t.exports=function(t,e,i,n,s){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),{responseType:t,async:e,user:i,password:n,timeout:s,header:void 0,headerValue:void 0,overrideMimeType:void 0}}},function(t,e,i){var n=i(0),s=i(327),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},,,,,function(t,e,i){t.exports={CalculateFacesAt:i(152),CalculateFacesWithin:i(34),Copy:i(871),CreateFromTiles:i(872),CullTiles:i(873),Fill:i(874),FilterTiles:i(875),FindByIndex:i(876),FindTile:i(877),ForEachTile:i(878),GetTileAt:i(97),GetTileAtWorldXY:i(879),GetTilesWithin:i(15),GetTilesWithinShape:i(880),GetTilesWithinWorldXY:i(881),HasTileAt:i(344),HasTileAtWorldXY:i(882),IsInLayerBounds:i(74),PutTileAt:i(153),PutTileAtWorldXY:i(883),PutTilesAt:i(884),Randomize:i(885),RemoveTileAt:i(345),RemoveTileAtWorldXY:i(886),RenderDebug:i(887),ReplaceByIndex:i(343),SetCollision:i(888),SetCollisionBetween:i(889),SetCollisionByExclusion:i(890),SetCollisionByProperty:i(891),SetCollisionFromCollisionGroup:i(892),SetTileIndexCallback:i(893),SetTileLocationCallback:i(894),Shuffle:i(895),SwapByIndex:i(896),TileToWorldX:i(98),TileToWorldXY:i(897),TileToWorldY:i(99),WeightedRandomize:i(898),WorldToTileX:i(39),WorldToTileXY:i(899),WorldToTileY:i(40)}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),n(t,e,s)){var r=s.data[e][t];return null===r?null:-1===r.index?i?r:null:r}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o,a){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o={}),void 0===a&&(a={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=n,this.tileMargin=s,this.tileSpacing=r,this.tileProperties=o,this.tileData=a,this.image=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&t1?2-s:s,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},function(t,e,i){var n=i(78),s=i(5);t.exports=function(t,e,i){if(void 0===i&&(i=new s),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=n(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},function(t,e,i){var n=i(65),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=n(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,u=t.y2,l=0;l=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(s*a+o*h),e}},function(t,e){t.exports=function(t,e,i,n,s){var r=n+Math.atan2(t.y-i,t.x-e);return t.x=e+s*Math.cos(r),t.y=i+s*Math.sin(r),t}},function(t,e,i){var n=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e-y||T>-m||b-y||S>-m||A-y||T>-m||b-y||S>-m||A-v&&S*n+C*r+h>-y&&(S+v)*i+(C+y)*s+a0?this:(this._fadeRed=e,this._fadeGreen=i,this._fadeBlue=n,t<=0&&(t=Number.MIN_VALUE),this._fadeDuration=t,this._fadeAlpha=Number.MIN_VALUE,this)},flash:function(t,e,i,n,s){return!s&&this._flashAlpha>0?this:(void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),this._flashRed=e,this._flashGreen=i,this._flashBlue=n,t<=0&&(t=Number.MIN_VALUE),this._flashDuration=t,this._flashAlpha=1,this)},getWorldPoint:function(t,e,i){void 0===i&&(i=new h);var n=this.matrix.matrix,s=n[0],r=n[1],o=n[2],a=n[3],u=n[4],l=n[5],c=s*a-r*o;if(!c)return i.x=t,i.y=e,i;var d=a*(c=1/c),f=-r*c,p=-o*c,g=s*c,v=(o*l-a*u)*c,y=(r*u-s*l)*c,m=Math.cos(this.rotation),x=Math.sin(this.rotation),w=this.zoom,b=this.scrollX,T=this.scrollY,A=t+(b*m-T*x)*w,S=e+(b*x+T*m)*w;return i.x=A*d+S*p+v,i.y=A*f+S*g+y,i},ignore:function(t){if(t instanceof Array)for(var e=0;el&&(this.scrollX=l),this.scrollYc&&(this.scrollY=c)}this.roundPixels&&(this.scrollX=Math.round(this.scrollX),this.scrollY=Math.round(this.scrollY)),r.loadIdentity(),r.scale(e,e),r.translate(this.x+o,this.y+a),r.rotate(this.rotation),r.scale(s,s),r.translate(-o,-a),r.translate(this._shakeOffsetX,this._shakeOffsetY)},removeBounds:function(){return this.useBounds=!1,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=s(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=a(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n){return this._bounds.setTo(t,e,i,n),this.useBounds=!0,this},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t){return this.scene=t,this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setZoom:function(t){return void 0===t&&(t=1),this.zoom=t,this},shake:function(t,e,i){return void 0===e&&(e=.05),i||0===this._shakeOffsetX&&0===this._shakeOffsetY?(this._shakeDuration=t,this._shakeIntensity=e,this._shakeOffsetX=0,this._shakeOffsetY=0,this):this},startFollow:function(t,e){return this._follow=t,void 0!==e&&(this.roundPixels=e),this},stopFollow:function(){return this._follow=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},resetFX:function(){return this._flashAlpha=0,this._fadeAlpha=0,this._shakeOffsetX=0,this._shakeOffsetY=0,this._shakeDuration=0,this},update:function(t,e){if(this._flashAlpha>0&&(this._flashAlpha-=e/this._flashDuration,this._flashAlpha<0&&(this._flashAlpha=0)),this._fadeAlpha>0&&this._fadeAlpha<1&&(this._fadeAlpha+=e/this._fadeDuration,this._fadeAlpha>=1&&(this._fadeAlpha=1)),this._shakeDuration>0){var i=this._shakeIntensity;this._shakeDuration-=e,this._shakeDuration<=0?(this._shakeOffsetX=0,this._shakeOffsetY=0):(this._shakeOffsetX=(Math.random()*i*this.width*2-i*this.width)*this.zoom,this._shakeOffsetY=(Math.random()*i*this.height*2-i*this.height)*this.zoom,this.roundPixels&&(this._shakeOffsetX|=0,this._shakeOffsetY|=0))}},destroy:function(){this._bounds=void 0,this.matrix=void 0,this.culledObjects=[],this.scene=void 0}});t.exports=u},function(t,e,i){var n=i(200),s=i(202),r=i(204),o=i(205);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):n(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var n=i(0),s=i(118),r=i(206),o=i(207),a=i(208),h=i(61),u=i(81),l=i(6),c=i(51),d=i(119),f=new c,p=new d,g=new c,v=new c,y=new s,m=new n({initialize:function(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,this.name="",this.direction=new c(0,0,-1),this.up=new c(0,1,0),this.position=new c,this.pixelScale=128,this.projection=new s,this.view=new s,this.combined=new s,this.invProjectionView=new s,this.near=1,this.far=100,this.ray={origin:new c,direction:new c},this.viewportWidth=0,this.viewportHeight=0,this.billboardMatrixDirty=!0,this.children=new h},setPosition:function(t,e,i){return this.position.set(t,e,i),this.update()},setScene:function(t){return this.scene=t,this},setPixelScale:function(t){return this.pixelScale=t,this.update()},add:function(t){return this.children.set(t),this.updateChildren(),t},remove:function(t){return this.displayList.remove(t.gameObject),this.updateList.remove(t.gameObject),this.children.delete(t),this},clear:function(){for(var t=this.getChildren(),e=0;e0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return Math.sqrt(e*e+i*i+n*n+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return e*e+i*i+n*n+s*s},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,u=a*i+o*e-s*n,l=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+u*-o-l*-r,this.y=u*a+c*-r+l*-s-h*-o,this.z=l*a+c*-o+h*-r-u*-s,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});n.prototype.sub=n.prototype.subtract,n.prototype.mul=n.prototype.multiply,n.prototype.div=n.prototype.divide,n.prototype.dist=n.prototype.distance,n.prototype.distSq=n.prototype.distanceSq,n.prototype.len=n.prototype.length,n.prototype.lenSq=n.prototype.lengthSq,t.exports=n},function(t,e){var i,n="";t.exports={disable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!1),t},enable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!0),t},getPrefix:i=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n=i(0),s=i(42),r=new n({initialize:function(t){this.name="WebGLPipeline",this.game=t.game,this.view=t.game.canvas,this.resolution=t.game.config.resolution,this.width=t.game.config.width*this.resolution,this.height=t.game.config.height*this.resolution,this.gl=t.gl,this.vertexCount=0,this.vertexCapacity=t.vertexCapacity,this.renderer=t.renderer,this.vertexData=t.vertices?t.vertices:new ArrayBuffer(t.vertexCapacity*t.vertexSize),this.vertexBuffer=this.renderer.createVertexBuffer(t.vertices?t.vertices:this.vertexData.byteLength,this.gl.STREAM_DRAW),this.program=this.renderer.createProgram(t.vertShader,t.fragShader),this.attributes=t.attributes,this.vertexSize=t.vertexSize,this.topology=t.topology,this.bytes=new Uint8Array(this.vertexData),this.vertexComponentCount=s.getComponentCount(t.attributes,this.gl),this.flushLocked=!1},shouldFlush:function(){return this.vertexCount>=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this},bind:function(){var t=this.gl,e=this.vertexBuffer,i=this.attributes,n=this.program,s=this.renderer,r=this.vertexSize;s.setProgram(n),s.setVertexBuffer(e);for(var o=0;o=0?(t.enableVertexAttribArray(h),t.vertexAttribPointer(h,a.size,a.type,a.normalized,r,a.offset)):t.disableVertexAttribArray(h)}return this},onBind:function(){return this},onPreRender:function(){return this},onRender:function(){return this},onPostRender:function(){return this},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t=this.gl,e=this.vertexCount,i=this.topology,n=this.vertexSize;if(0!==e)return t.bufferSubData(t.ARRAY_BUFFER,0,this.bytes.subarray(0,e*n)),t.drawArrays(i,0,e),this.vertexCount=0,this.flushLocked=!1,this;this.flushLocked=!1},destroy:function(){var t=this.gl;return t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),delete this.program,delete this.vertexBuffer,delete this.gl,this}});t.exports=r},function(t,e){t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,LINE_FX_TO:12,MOVE_FX_TO:13,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18}},function(t,e){t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221}},function(t,e,i){var n=i(0),s=i(83),r=i(529),o=i(530),a=i(233),h=i(254),u=new n({initialize:function(t,e){this.scene=t,this.game,this.config=e,this.settings=h.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList},init:function(t){this.settings.status=s.INIT,this.game=t,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.installGlobal(this,a.Global),e.installLocal(this,a.CoreScene),e.installLocal(this,o(this)),e.installLocal(this,r(this)),this.events.emit("boot",this),this.settings.isBooted=!0},install:function(t){Array.isArray(t)||(t=[t]),this.plugins.installLocal(this,t)},step:function(t,e){this.events.emit("preupdate",t,e),this.events.emit("update",t,e),this.scene.update.call(this.scene,t,e),this.events.emit("postupdate",t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.cameras.render(t,e),this.events.emit("render",t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(){return this.settings.active&&(this.settings.status=s.PAUSED,this.settings.active=!1,this.events.emit("pause",this)),this},resume:function(){return this.settings.active||(this.settings.status=s.RUNNING,this.settings.active=!0,this.events.emit("resume",this)),this},sleep:function(){return this.settings.status=s.SLEEPING,this.settings.active=!1,this.settings.visible=!1,this.events.emit("sleep",this),this},wake:function(){return this.settings.status=s.RUNNING,this.settings.active=!0,this.settings.visible=!0,this.events.emit("wake",this),this},isSleeping:function(){return this.settings.status===s.SLEEPING},isActive:function(){return this.settings.status===s.RUNNING},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t){return t?this.resume():this.pause()},start:function(t){this.settings.status=s.START,this.settings.data=t,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this)},shutdown:function(){this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this)}});t.exports=u},function(t,e,i){var n=i(0),s=i(23),r=new n({initialize:function(t,e,i,n,s,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX=n,this.cutY=s,this.cutWidth=r,this.cutHeight=o,this.x=0,this.y=0,this.width=r,this.height=o,this.halfWidth=Math.floor(.5*r),this.halfHeight=Math.floor(.5*o),this.centerX=Math.floor(r/2),this.centerY=Math.floor(o/2),this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.data={cut:{x:n,y:s,w:r,h:o,r:n+r,b:s+o},trim:!1,sourceSize:{w:r,h:o},spriteSourceSize:{x:0,y:0,w:r,h:o},uvs:{x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},radius:.5*Math.sqrt(r*r+o*o),drawImage:{sx:n,sy:s,sWidth:r,sHeight:o,dWidth:r,dHeight:o}},this.updateUVs()},setTrim:function(t,e,i,n,s,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=n,a.w=s,a.h=r,this.x=i,this.y=n,this.width=s,this.height=r,this.halfWidth=.5*s,this.halfHeight=.5*r,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.updateUVs()},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.sWidth=i,s.sHeight=n,s.dWidth=i,s.dHeight=n;var r=this.source.width,o=this.source.height,a=this.data.uvs;return a.x0=t/r,a.y0=e/o,a.x1=t/r,a.y1=(e+n)/o,a.x2=(t+i)/r,a.y2=(e+n)/o,a.x3=(t+i)/r,a.y3=e/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height,i=this.data.uvs;return i.x3=(this.cutX+this.cutHeight)/t,i.y3=(this.cutY+this.cutWidth)/e,i.x2=this.cutX/t,i.y2=(this.cutY+this.cutWidth)/e,i.x1=this.cutX/t,i.y1=this.cutY/e,i.x0=(this.cutX+this.cutHeight)/t,i.y0=this.cutY/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},uvs:{get:function(){return this.data.uvs}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(267),a=i(546),h=i(547),u=i(548),l=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.ScaleMode,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,u],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"BitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds()},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return Array.isArray(t)&&(t=t.join("\n")),this.text=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});l.ParseRetroFont=h,l.ParseFromAtlas=a,t.exports=l},function(t,e,i){var n=i(551),s=i(554),r=i(0),o=i(11),a=i(130),h=i(1),u=i(86),l=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,n],initialize:function(t,e,i,n,s){h.call(this,t,"Blitter"),this.setTexture(n,s),this.setPosition(e,i),this.initPipeline("TextureTintPipeline"),this.children=new u,this.renderList=[],this.dirty=!1},create:function(t,e,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new s(this,t,e,i,n);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,n){for(var s=this.createMultiple(e,i,n),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0}});t.exports=l},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(267),a=i(555),h=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"DynamicBitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds(),this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return Array.isArray(t)&&(t=t.join("\n")),this.text=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});t.exports=h},function(t,e,i){var n=i(114),s=i(0),r=i(127),o=i(11),a=i(269),h=i(1),u=i(4),l=i(16),c=i(567),d=new s({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.Transform,o.Visible,o.ScrollFactor,c],initialize:function(t,e){var i=u(e,"x",0),n=u(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,n),this.initPipeline("FlatTintPipeline"),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.setDefaultStyles(e)},setDefaultStyles:function(t){return u(t,"lineStyle",null)&&(this.defaultStrokeWidth=u(t,"lineStyle.width",1),this.defaultStrokeColor=u(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=u(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),u(t,"fillStyle",null)&&(this.defaultFillColor=u(t,"fillStyle.color",16777215),this.defaultFillAlpha=u(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,l.PI2),this.closePath(),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,l.PI2),this.closePath(),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,n){return this.commandBuffer.push(r.FILL_RECT,t,e,i,n),this},strokeRect:function(t,e,i,n){var s=this._lineWidth/2,r=t-s,o=t+s;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+n),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+n),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(r,e+n),this.lineTo(o+i,e+n),this.strokePath(),this.closePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,n,s,o),this},strokeTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,n,s,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,n){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,n),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},lineFxTo:function(t,e,i,n){return this.commandBuffer.push(r.LINE_FX_TO,t,e,i,n,1),this},moveFxTo:function(t,e,i,n){return this.commandBuffer.push(r.MOVE_FX_TO,t,e,i,n,1),this},strokePoints:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var n,s,r=this.scene.sys;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),d.TargetCamera.setViewport(0,0,e,i),d.TargetCamera.scrollX=this.x,d.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var o=(n=r.textures.get(t)).getSourceImage();o instanceof HTMLCanvasElement&&(s=o.getContext("2d"))}else s=(n=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d");else t instanceof HTMLCanvasElement&&(s=t.getContext("2d"));return s&&(this.renderCanvas(r.game.renderer,this,0,d.TargetCamera,s),r.game.renderer.gl&&n&&(n.source[0].glTexture=r.game.renderer.canvasToTexture(s.canvas,n.source[0].glTexture,!0,0))),this}});d.TargetCamera=new n(0,0,0,0),t.exports=d},function(t,e,i){var n=i(0),s=i(68),r=i(270),o=i(271),a=i(109),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(5);t.exports=function(t,e,i){void 0===i&&(i=new n);var s=t.width/2,r=t.height/2;return i.x=t.x+s*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(572),a=i(86),h=i(573),u=i(612),l=new n({Extends:r,Mixins:[s.Depth,s.Visible,s.Pipeline,u],initialize:function(t,e,i,n){if(r.call(this,t,"ParticleEmitterManager"),this.blendMode=-1,this.timeScale=1,this.texture=null,this.frame=null,this.frameNames=[],null===i||"object"!=typeof i&&!Array.isArray(i)||(n=i,i=null),this.setTexture(e,i),this.initPipeline("TextureTintPipeline"),this.emitters=new a(this),this.wells=new a(this),n){Array.isArray(n)||(n=[n]);for(var s=0;s0?e.defaultFrame=i[0]:e.defaultFrame=this.defaultFrame,this},addEmitter:function(t){return this.emitters.add(t)},createEmitter:function(t){return this.addEmitter(new h(this,t))},addGravityWell:function(t){return this.wells.add(t)},createGravityWell:function(t){return this.addGravityWell(new o(t))},emitParticle:function(t,e,i){for(var n=this.emitters.list,s=0;su){if(0===c){for(var g=f;g.length&&(g=g.slice(0,-1),!((p=e.measureText(g).width)<=u)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var v=d.substr(g.length);l[c]=v,h+=g}var y=l[c].length?c:c+1,m=l.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=m+" "+(s[o+1]||""),r=s.length;break}h+=f,u-=p}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var n="",s=t.split(this.splitRegExp),r=0;ro?(h>0&&(n+="\n"),n+=a[h]+" ",o=i-u):(o-=l,n+=a[h]+" ")}r0&&(a+=l.lineSpacing*p),i.rtl?o=d-o:"right"===i.align?o+=l.width-l.lineWidths[p]:"center"===i.align&&(o+=(l.width-l.lineWidths[p])/2),this.autoRound&&(o=Math.round(o),a=Math.round(a)),i.strokeThickness&&(this.style.syncShadow(e,i.shadowStroke),e.strokeText(u[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(u[p],o,a));return e.restore(),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this.text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t},preDestroy:function(){this.style.rtl&&l(this.canvas),s.remove(this.canvas)}});t.exports=f},function(t,e,i){var n=i(21),s=i(0),r=i(11),o=i(1),a=i(290),h=i(625),u=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Origin,r.Pipeline,r.ScaleMode,r.ScrollFactor,r.Size,r.Texture,r.Tint,r.Transform,r.Visible,h],initialize:function(t,e,i,s,r,h,u){var l=t.sys.game.renderer;o.call(this,t,"TileSprite"),this.tilePositionX=0,this.tilePositionY=0,this.dirty=!0,this.tileTexture=null,this.renderer=l,this.setTexture(h,u),this.setPosition(e,i),this.setSize(s,r),this.setOriginFromFrame(),this.initPipeline("TextureTintPipeline"),this.potWidth=a(this.frame.width),this.potHeight=a(this.frame.height),this.canvasPattern=null,this.canvasBuffer=n.create2D(null,this.potWidth,this.potHeight),this.canvasBufferCtx=this.canvasBuffer.getContext("2d"),this.updateTileTexture(),t.sys.game.renderer.onContextRestored(function(t){var e=t.gl;this.tileTexture=null,this.dirty=!0,this.tileTexture=t.createTexture2D(0,e.LINEAR,e.LINEAR,e.REPEAT,e.REPEAT,e.RGBA,this.canvasBuffer,this.potWidth,this.potHeight)},this)},updateTileTexture:function(){this.dirty&&(this.canvasBufferCtx.drawImage(this.frame.source.image,this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight,0,0,this.potWidth,this.potHeight),this.renderer.gl?this.tileTexture=this.renderer.canvasToTexture(this.canvasBuffer,this.tileTexture,null===this.tileTexture,this.scaleMode):this.canvasPattern=this.canvasBufferCtx.createPattern(this.canvasBuffer,"repeat"),this.dirty=!1)},destroy:function(){this.renderer&&this.renderer.deleteTexture(this.tileTexture),n.remove(this.canvasBuffer),this.canvasPattern=null,this.canvasBufferCtx=null,this.canvasBuffer=null,this.renderer=null,this.visible=!1}});t.exports=u},function(t,e,i){var n=i(10);t.exports=function(t,e){var i=n(e,"anims",null);if(null===i)return t;if("string"==typeof i)t.anims.play(i);else if("object"==typeof i){var s=t.anims,r=n(i,"key",void 0),o=n(i,"startFrame",void 0),a=n(i,"delay",0),h=n(i,"repeat",0),u=n(i,"repeatDelay",0),l=n(i,"yoyo",!1),c=n(i,"play",!1),d=n(i,"delayedPlay",0);s.delay(a),s.repeat(h),s.repeatDelay(u),s.yoyo(l),c?s.play(r,o):d>0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(0),s=i(88),r=new n({Extends:s,initialize:function(t,e,i,n,r){s.call(this,t,e,i,[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,1,1,1,0],[16777215,16777215,16777215,16777215,16777215,16777215],[1,1,1,1,1,1],n,r),this.resetPosition()},topLeftX:{get:function(){return this.x+this.vertices[0]},set:function(t){this.vertices[0]=t-this.x,this.vertices[6]=t-this.x}},topLeftY:{get:function(){return this.y+this.vertices[1]},set:function(t){this.vertices[1]=t-this.y,this.vertices[7]=t-this.y}},topRightX:{get:function(){return this.x+this.vertices[10]},set:function(t){this.vertices[10]=t-this.x}},topRightY:{get:function(){return this.y+this.vertices[11]},set:function(t){this.vertices[11]=t-this.y}},bottomLeftX:{get:function(){return this.x+this.vertices[2]},set:function(t){this.vertices[2]=t-this.x}},bottomLeftY:{get:function(){return this.y+this.vertices[3]},set:function(t){this.vertices[3]=t-this.y}},bottomRightX:{get:function(){return this.x+this.vertices[4]},set:function(t){this.vertices[4]=t-this.x,this.vertices[8]=t-this.x}},bottomRightY:{get:function(){return this.y+this.vertices[5]},set:function(t){this.vertices[5]=t-this.y,this.vertices[9]=t-this.y}},topLeftAlpha:{get:function(){return this.alphas[0]},set:function(t){this.alphas[0]=t,this.alphas[3]=t}},topRightAlpha:{get:function(){return this.alphas[5]},set:function(t){this.alphas[5]=t}},bottomLeftAlpha:{get:function(){return this.alphas[1]},set:function(t){this.alphas[1]=t}},bottomRightAlpha:{get:function(){return this.alphas[2]},set:function(t){this.alphas[2]=t,this.alphas[4]=t}},topLeftColor:{get:function(){return this.colors[0]},set:function(t){this.colors[0]=t,this.colors[3]=t}},topRightColor:{get:function(){return this.colors[5]},set:function(t){this.colors[5]=t}},bottomLeftColor:{get:function(){return this.colors[1]},set:function(t){this.colors[1]=t}},bottomRightColor:{get:function(){return this.colors[2]},set:function(t){this.colors[2]=t,this.colors[4]=t}},setTopLeft:function(t,e){return this.topLeftX=t,this.topLeftY=e,this},setTopRight:function(t,e){return this.topRightX=t,this.topRightY=e,this},setBottomLeft:function(t,e){return this.bottomLeftX=t,this.bottomLeftY=e,this},setBottomRight:function(t,e){return this.bottomRightX=t,this.bottomRightY=e,this},resetPosition:function(){var t=this.x,e=this.y,i=Math.floor(this.width/2),n=Math.floor(this.height/2);return this.setTopLeft(t-i,e-n),this.setTopRight(t+i,e-n),this.setBottomLeft(t-i,e+n),this.setBottomRight(t+i,e+n),this},resetAlpha:function(){var t=this.alphas;return t[0]=1,t[1]=1,t[2]=1,t[3]=1,t[4]=1,t[5]=1,this},resetColors:function(){var t=this.colors;return t[0]=16777215,t[1]=16777215,t[2]=16777215,t[3]=16777215,t[4]=16777215,t[5]=16777215,this},reset:function(){return this.resetPosition(),this.resetAlpha(),this.resetColors()}});t.exports=r},function(t,e){t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=[]);for(var s,r,o,a,h,u,l=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=l*l+c*c,g=l*d+c*f,v=d*d+f*f,y=p*v-g*g,m=0===y?0:1/y,x=t.x1,w=t.y1,b=0;b=0&&r>=0&&s+r<1&&(n.push({x:e[b].x,y:e[b].y}),i)));b++);return n}},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*s-a*r+e,t.y1=o*r+a*s+i,o=t.x2-e,a=t.y2-i,t.x2=o*s-a*r+e,t.y2=o*r+a*s+i,t}},function(t,e){t.exports=function(t,e,i){for(var n=!1,s=-1,r=t.points.length-1;++s0&&(n.totalDuration+=n.t2*n.repeat),n.totalDuration>t&&(t=n.totalDuration)}this.duration=t,this.loopCounter=-1===this.loop?999999999999:this.loop,this.loopCounter>0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){for(var t=this.data,e=this.totalTargets,i=0;i0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&(t.params[1]=this.targets,t.func.apply(t.scope,t.params)),this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},pause:function(){if(this.state!==o.PAUSED)return this.paused=!0,this._pausedState=this.state,this.state=o.PAUSED,this},play:function(t){if(this.state!==o.ACTIVE){this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?(e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.ACTIVE):(this.countdown=this.calculatedOffset,this.state=o.OFFSET_DELAY)):this.paused?(this.paused=!1,this.parent.makeActive(this)):(this.resetTweenData(t),this.state=o.ACTIVE,e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)))}},resetTweenData:function(t){for(var e=this.data,i=0;i0?(n.elapsed=n.delay,n.state=o.DELAY):n.state=o.PENDING_RENDER}},resume:function(){return this.state===o.PAUSED&&(this.paused=!1,this.state=this._pausedState),this},seek:function(t){for(var e=this.data,i=0;i=s.totalDuration?(r=1,o=s.duration):n>s.delay&&n<=s.t1?(r=(n=Math.max(0,n-s.delay))/s.t1,o=s.duration*r):n>s.t1&&ns.repeatDelay&&(r=n/s.t1,o=s.duration*r)),s.progress=r,s.elapsed=o;var a=s.ease(s.progress);s.current=s.start+(s.end-s.start)*a,s.target[s.key]=s.current}},setCallback:function(t,e,i,n){return this.callbacks[t]={func:e,scope:n,params:i},this},stop:function(t){void 0!==t&&this.seek(t),this.state=o.PENDING_REMOVE},update:function(t,e){if(this.state===o.PAUSED)return!1;switch(this.useFrames&&(e=1*this.parent.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var i=!1,n=0;n0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var s=t.callbacks.onRepeat;return s&&(s.params[1]=e.target,s.func.apply(s.scope,s.params)),e.start=e.getStartValue(e.target,e.key,e.start),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},setStateFromStart:function(t,e,i){if(e.repeatCounter>0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var n=t.callbacks.onRepeat;return n&&(n.params[1]=e.target,n.func.apply(n.scope,n.params)),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},updateTweenData:function(t,e,i){switch(e.state){case o.PLAYING_FORWARD:case o.PLAYING_BACKWARD:if(!e.target){e.state=o.COMPLETE;break}var n=e.elapsed,s=e.duration,r=0;(n+=i)>s&&(r=n-s,n=s);var a,h=e.state===o.PLAYING_FORWARD,u=n/s;a=h?e.ease(u):e.ease(1-u),e.current=e.start+(e.end-e.start)*a,e.target[e.key]=e.current,e.elapsed=n,e.progress=u;var l=t.callbacks.onUpdate;l&&(l.params[1]=e.target,l.func.apply(l.scope,l.params)),1===u&&(h?e.hold>0?(e.elapsed=e.hold-r,e.state=o.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,r):e.state=this.setStateFromStart(t,e,r));break;case o.DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PENDING_RENDER);break;case o.REPEAT_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PLAYING_FORWARD);break;case o.HOLD_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case o.PENDING_RENDER:e.target?(e.start=e.getStartValue(e.target,e.key,e.target[e.key]),e.end=e.getEndValue(e.target,e.key,e.start),e.current=e.start,e.target[e.key]=e.start,e.state=o.PLAYING_FORWARD):e.state=o.COMPLETE}return e.state!==o.COMPLETE}});a.TYPES=["onComplete","onLoop","onRepeat","onStart","onUpdate","onYoyo"],r.register("tween",function(t){return this.scene.sys.tweens.add(t)}),s.register("tween",function(t){return this.scene.sys.tweens.create(t)}),t.exports=a},function(t,e){t.exports=function(t,e,i,n,s,r,o,a,h,u,l,c,d){return{target:t,key:e,getEndValue:i,getStartValue:n,ease:s,duration:0,totalDuration:0,delay:0,yoyo:a,hold:0,repeat:0,repeatDelay:0,flipX:c,flipY:d,progress:0,elapsed:0,repeatCounter:0,start:0,current:0,end:0,t1:0,t2:0,gen:{delay:r,duration:o,hold:h,repeat:u,repeatDelay:l},state:0}}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-180,180)}},,,function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){t.exports=function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0}},function(t,e,i){t.exports={Angle:i(376),Call:i(377),GetFirst:i(378),GridAlign:i(379),IncAlpha:i(397),IncX:i(398),IncXY:i(399),IncY:i(400),PlaceOnCircle:i(401),PlaceOnEllipse:i(402),PlaceOnLine:i(403),PlaceOnRectangle:i(404),PlaceOnTriangle:i(405),PlayAnimation:i(406),RandomCircle:i(407),RandomEllipse:i(408),RandomLine:i(409),RandomRectangle:i(410),RandomTriangle:i(411),Rotate:i(412),RotateAround:i(413),RotateAroundDistance:i(414),ScaleX:i(415),ScaleXY:i(416),ScaleY:i(417),SetAlpha:i(418),SetBlendMode:i(419),SetDepth:i(420),SetHitArea:i(421),SetOrigin:i(422),SetRotation:i(423),SetScale:i(424),SetScaleX:i(425),SetScaleY:i(426),SetTint:i(427),SetVisible:i(428),SetX:i(429),SetXY:i(430),SetY:i(431),ShiftPosition:i(432),Shuffle:i(433),SmootherStep:i(434),SmoothStep:i(435),Spread:i(436),ToggleVisible:i(437)}},function(t,e,i){var n=i(170),s=[];s[n.BOTTOM_CENTER]=i(171),s[n.BOTTOM_LEFT]=i(172),s[n.BOTTOM_RIGHT]=i(173),s[n.CENTER]=i(174),s[n.LEFT_CENTER]=i(176),s[n.RIGHT_CENTER]=i(177),s[n.TOP_CENTER]=i(178),s[n.TOP_LEFT]=i(179),s[n.TOP_RIGHT]=i(180);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e){t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},function(t,e,i){var n=i(24),s=i(46),r=i(25),o=i(47);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(26),r=i(25),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(28),r=i(25),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(175),s=i(46),r=i(49);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),n(t,s(e)+i,r(e)+o),t}},function(t,e,i){var n=i(47),s=i(48);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(49),s=i(26),r=i(48),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(49),s=i(28),r=i(48),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(46),s=i(30),r=i(47),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(26),s=i(30),r=i(27),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)-a),t}},function(t,e,i){var n=i(28),s=i(30),r=i(29),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(104),s=i(64),r=i(16),o=i(5);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=s(e,0,r.PI2);return n(t,a,i)}},function(t,e,i){var n=i(183),s=i(104),r=i(64),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;n-h&&(c-=h,n+=u),f0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var n=this.frames.slice(0,t),s=this.frames.slice(t);this.frames=n.concat(i,s)}this.updateFrameSequence()}return this},checkFrame:function(t){return t0){o.isLast=!0,o.nextFrame=u[0],u[0].prevFrame=o;var v=1/(u.length-1);for(a=0;a=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,t._timeScale=1,t.frameRate=this.frameRate,t.duration=this.duration,t.msPerFrame=this.msPerFrame,t.skipMissedFrames=this.skipMissedFrames,t._delay=this.delay,t._repeat=this.repeat,t._repeatDelay=this.repeatDelay,t._yoyo=this.yoyo,t._callbackArgs[1]=this,t._updateParams=t._callbackArgs.concat(this.onUpdateParams)),t.updateFrame(this.frames[e])},nextFrame:function(t){var e=t.currentFrame;e.isLast?this.yoyo?(t.forward=!1,t.updateFrame(e.prevFrame),this.getNextTick(t)):t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.nextFrame),this.getNextTick(t))},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.prevFrame),this.getNextTick(t))},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=1e3*t._repeatDelay):(t.repeatCounter--,t.forward=!0,t.updateFrame(t.currentFrame.nextFrame),this.getNextTick(t),t.pendingRepeat=!1,this.onRepeat&&this.onRepeat.apply(this.callbackScope,t._callbackArgs.concat(this.onRepeatParams)))},setFrame:function(t){t.forward?this.nextFrame(t):this.previousFrame(t)},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showOnStart:this.showOnStart,hideOnComplete:this.hideOnComplete};return this.frames.forEach(function(e){t.frames.push(e.toJSON())}),t},updateFrameSequence:function(){for(var t=this.frames.length,e=1/(t-1),i=0;i1&&(n.prevFrame=this.frames[i-1],n.nextFrame=this.frames[i+1])}return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){}});t.exports=o},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.onUpdate=null},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0,this.onUpdate=void 0}});t.exports=n},function(t,e,i){var n=i(194),s=i(0),r=i(113),o=i(14),a=i(4),h=i(197),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.paused=!1,this.name="AnimationManager",t.events.once("boot",this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once("destroy",this.destroy,this)},add:function(t,e){if(!this.anims.has(t))return e.key=t,this.anims.set(t,e),this.emit("add",t,e),this;console.warn("Animation with key",t,"already exists")},create:function(t){var e=t.key;if(e&&!this.anims.has(e)){var i=new n(this,e,t);return this.anims.set(e,i),this.emit("add",e,i),i}console.warn("Invalid Animation Key, or Key already in use: "+e)},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var n=0;n=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(0),s=i(113),r=i(14),o=new n({initialize:function(){this.entries=new s,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit("add",this,t,e),this},has:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit("remove",this,t,e.data)),this},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=o},function(t,e,i){var n=i(198),s=new(i(0))({initialize:function(t){this.game=t,this.binary=new n,this.bitmapFont=new n,this.json=new n,this.physics=new n,this.shader=new n,this.audio=new n,this.text=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once("destroy",this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new n),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","text","obj","tilemap","xml"],e=0;e16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(36);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var n=i(36);t.exports=function(t){var e=new n,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var s=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(s,r,o,255*a)}return e}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,n=2*Math.random()-1,s=Math.sqrt(1-n*n)*e;return t.x=Math.cos(i)*s,t.y=Math.sin(i)*s,t.z=n*e,t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},function(t,e,i){var n=i(51),s=i(118),r=i(209),o=new s,a=new r,h=new n;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},function(t,e,i){var n=i(0),s=i(51),r=i(210),o=new Int8Array([1,2,0]),a=new Float32Array([0,0,0]),h=new s(1,0,0),u=new s(0,1,0),l=new s,c=new r,d=new n({initialize:function(t,e,i,n){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},set:function(t,e,i,n){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(l.copy(h).cross(t).length()<1e-6&&l.copy(u).cross(t),l.normalize(),this.setAxisAngle(l,Math.PI)):i>.999999?(this.x=0,this.y=0,this.z=0,this.w=1,this):(l.copy(t).cross(e),this.x=l.x,this.y=l.y,this.z=l.z,this.w=1+i,this.normalize())},setAxes:function(t,e,i){var n=c.val;return n[0]=e.x,n[3]=e.y,n[6]=e.z,n[1]=i.x,n[4]=i.y,n[7]=i.z,n[2]=-t.x,n[5]=-t.y,n[8]=-t.z,this.fromMat3(c).normalize()},identity:function(){return this.x=0,this.y=0,this.z=0,this.w=1,this},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=Math.cos(e),this},multiply:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.x=e*h+s*r+i*a-n*o,this.y=i*h+s*o+n*r-e*a,this.z=n*h+s*a+e*o-i*r,this.w=s*h-e*r-i*o-n*a,this},slerp:function(t,e){var i=this.x,n=this.y,s=this.z,r=this.w,o=t.x,a=t.y,h=t.z,u=t.w,l=i*o+n*a+s*h+r*u;l<0&&(l=-l,o=-o,a=-a,h=-h,u=-u);var c=1-e,d=e;if(1-l>1e-6){var f=Math.acos(l),p=Math.sin(f);c=Math.sin((1-e)*f)/p,d=Math.sin(e*f)/p}return this.x=c*i+d*o,this.y=c*n+d*a,this.z=c*s+d*h,this.w=c*r+d*u,this},invert:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n,r=s?1/s:0;return this.x=-t*r,this.y=-e*r,this.z=-i*r,this.w=n*r,this},conjugate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+s*r,this.y=i*o+n*r,this.z=n*o-i*r,this.w=s*o-e*r,this},rotateY:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o-n*r,this.y=i*o+s*r,this.z=n*o+e*r,this.w=s*o-i*r,this},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+i*r,this.y=i*o-e*r,this.z=n*o+s*r,this.w=s*o-n*r,this},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(Math.abs(1-t*t-e*e-i*i)),this},fromMat3:function(t){var e,i=t.val,n=i[0]+i[4]+i[8];if(n>0)e=Math.sqrt(n+1),this.w=.5*e,e=.5/e,this.x=(i[7]-i[5])*e,this.y=(i[2]-i[6])*e,this.z=(i[3]-i[1])*e;else{var s=0;i[4]>i[0]&&(s=1),i[8]>i[3*s+s]&&(s=2);var r=o[s],h=o[r];e=Math.sqrt(i[3*s+s]-i[3*r+r]-i[3*h+h]+1),a[s]=.5*e,e=.5/e,a[r]=(i[3*r+s]+i[3*s+r])*e,a[h]=(i[3*h+s]+i[3*s+h])*e,this.x=a[0],this.y=a[1],this.z=a[2],this.w=(i[3*h+r]-i[3*r+h])*e}return this}});t.exports=d},function(t,e,i){var n=new(i(0))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new n(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=n,this},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8],l=u*r-o*h,c=-u*s+o*a,d=h*s-r*a,f=e*l+i*c+n*d;return f?(f=1/f,t[0]=l*f,t[1]=(-u*i+n*h)*f,t[2]=(o*i-n*r)*f,t[3]=c*f,t[4]=(u*e-n*a)*f,t[5]=(-o*e+n*s)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*s)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8];return t[0]=r*u-o*h,t[1]=n*h-i*u,t[2]=i*o-n*r,t[3]=o*a-s*u,t[4]=e*u-n*a,t[5]=n*s-e*o,t[6]=s*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*s,this},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8];return e*(u*r-o*h)+i*(-u*s+o*a)+n*(h*s-r*a)},multiply:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=e[6],u=e[7],l=e[8],c=t.val,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=c[6],x=c[7],w=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*n+f*o+p*u,e[2]=d*s+f*a+p*l,e[3]=g*i+v*r+y*h,e[4]=g*n+v*o+y*u,e[5]=g*s+v*a+y*l,e[6]=m*i+x*r+w*h,e[7]=m*n+x*o+w*u,e[8]=m*s+x*a+w*l,this},translate:function(t){var e=this.val,i=t.x,n=t.y;return e[6]=i*e[0]+n*e[3]+e[6],e[7]=i*e[1]+n*e[4]+e[7],e[8]=i*e[2]+n*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),u=Math.cos(t);return e[0]=u*i+h*r,e[1]=u*n+h*o,e[2]=u*s+h*a,e[3]=u*r-h*i,e[4]=u*o-h*n,e[5]=u*a-h*s,this},scale:function(t){var e=this.val,i=t.x,n=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=n*e[3],e[4]=n*e[4],e[5]=n*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,o=i+i,a=n+n,h=e*r,u=e*o,l=e*a,c=i*o,d=i*a,f=n*a,p=s*r,g=s*o,v=s*a,y=this.val;return y[0]=1-(c+f),y[3]=u+v,y[6]=l-g,y[1]=u-v,y[4]=1-(h+f),y[7]=d+p,y[2]=l+g,y[5]=d-p,y[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],h=e[5],u=e[6],l=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],v=e[13],y=e[14],m=e[15],x=n*h-s*a,w=n*u-r*a,b=n*l-o*a,T=s*u-r*h,A=s*l-o*h,S=r*l-o*u,C=c*v-d*g,M=c*y-f*g,E=c*m-p*g,_=d*y-f*v,L=d*m-p*v,P=f*m-p*y,F=x*P-w*L+b*_+T*E-A*M+S*C;return F?(F=1/F,i[0]=(h*P-u*L+l*_)*F,i[1]=(u*E-a*P-l*M)*F,i[2]=(a*L-h*E+l*C)*F,i[3]=(r*L-s*P-o*_)*F,i[4]=(n*P-r*E+o*M)*F,i[5]=(s*E-n*L-o*C)*F,i[6]=(v*S-y*A+m*T)*F,i[7]=(y*b-g*S-m*w)*F,i[8]=(g*A-v*b+m*x)*F,this):null}});t.exports=n},function(t,e,i){var n=i(117),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),n.call(this,t),this.viewportWidth=e,this.viewportHeight=i,this._zoom=1,this.near=0,this.update()},setToOrtho:function(t,e,i){void 0===e&&(e=this.viewportWidth),void 0===i&&(i=this.viewportHeight);var n=this.zoom;return this.up.set(0,t?-1:1,0),this.direction.set(0,0,t?1:-1),this.position.set(n*e/2,n*i/2,0),this.viewportWidth=e,this.viewportHeight=i,this.update()},update:function(){var t=this.viewportWidth,e=this.viewportHeight,i=Math.abs(this.near),n=Math.abs(this.far),s=this.zoom;return 0===t||0===e?this:(this.projection.ortho(s*-t/2,s*t/2,s*-e/2,s*e/2,i,n),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this)},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.update()}}});t.exports=o},function(t,e,i){var n=i(117),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e=80),void 0===i&&(i=0),void 0===s&&(s=0),n.call(this,t),this.viewportWidth=i,this.viewportHeight=s,this.fieldOfView=e*Math.PI/180,this.update()},setFOV:function(t){return this.fieldOfView=t*Math.PI/180,this},update:function(){var t=this.viewportWidth/this.viewportHeight;return this.projection.perspective(this.fieldOfView,t,Math.abs(this.near),Math.abs(this.far)),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this}});t.exports=o},function(t,e,i){var n=i(214),s=i(21),r=i(4);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",n),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),u=r(t,"resizeCanvas",!0),l=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=s.create2D(this,f,p),u=!1,l=!1),u&&(i.width=f,i.height=p);var g=i.getContext("2d");l&&g.clearRect(0,0,f,p),c&&c(i,g);for(var v=0;vi;)n-=i;ni.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(n(a,h.x,u.x,l.x,c.x),n(a,h.y,u.y,l.y,c.y))},toJSON:function(){for(var t=[],e=0;e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}}).call(e,i(486)(t))},function(t,e,i){var n=i(116);t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var s=Math.floor(6*t),r=6*t-s,o=Math.floor(i*(1-e)*255),a=Math.floor(i*(1-r*e)*255),h=Math.floor(i*(1-(1-r)*e)*255),u={r:i=Math.floor(i*=255),g:i,b:i,color:0},l=s%6;return 0===l?(u.g=h,u.b=o):1===l?(u.r=a,u.b=o):2===l?(u.r=o,u.b=h):3===l?(u.r=o,u.g=a):4===l?(u.r=h,u.g=o):5===l&&(u.g=o,u.b=a),u.color=n(u.r,u.g,u.b),u}},function(t,e,i){var n=i(227);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return e<0?n(t[0],t[1],s):e>1?n(t[i],t[i-1],i-s):n(t[r],t[r+1>i?i:r+1],s-r)}},function(t,e){t.exports=function(t,e,i){return(e-t)*i+t}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e,i){var n=i(67);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?n.cordova&&!n.cocoonJS?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},function(t,e){t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},function(t,e){t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0;var t=this;this.step=function e(i){t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.requestAnimationFrame(e)},this.stepTimeout=function e(){var i=Date.now(),n=Math.max(16+t.lastTime-i,0);t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.setTimeout(e,n)}},start:function(t,e){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e){t.exports={Global:["anims","cache","registry","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["CameraManager3D","Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},function(t,e,i){var n,s,r,o=i(21),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create(t,6,1).getContext("2d");if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,u,l,f,g,v=e&&e.length,y=v?e[0]*i:t.length,m=s(t,0,y,i,!0),x=[];if(!m)return x;if(v&&(m=function(t,e,i,n){var o,a,h,u,l,f=[];for(o=0,a=e.length;o80*i){n=h=t[0],a=u=t[1];for(var w=i;wh&&(h=l),f>u&&(u=f);g=Math.max(h-n,u-a)}return o(m,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===S(t,e,i,n)>0)for(r=e;r=e;r-=n)o=b(r,t[r],t[r+1],o);return o&&y(o,o.next)&&(T(o),o=o.next),o}function r(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!y(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(T(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,s,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,h,u=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,u*=2}while(o>1)}(s)}(t,n,s,c);for(var p,g,v=t;t.prev!==t.next;)if(p=t.prev,g=t.next,c?h(t,n,s,c):a(t))e.push(p.i/i),e.push(t.i/i),e.push(g.i/i),T(t),t=g.next,v=g.next;else if((t=g)===v){d?1===d?o(t=u(t,e,i),e,i,n,s,c,2):2===d&&l(t,e,i,n,s,c):o(r(t),e,i,n,s,c,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(v(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&v(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function h(t,e,i,n){var s=t.prev,r=t,o=t.next;if(v(s,r,o)>=0)return!1;for(var a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(a,h,e,i,n),d=f(u,l,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function u(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!y(s,r)&&m(s,n,n.next,r)&&x(s,r)&&x(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),T(n),T(n.next),n=t=r),n=n.next}while(n!==t);return n}function l(t,e,i,n,s,a){var h,u,l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&(u=c,(h=l).next.i!==u.i&&h.prev.i!==u.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&m(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(h,u)&&x(h,u)&&x(u,h)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(h,u))){var d=w(l,c);return l=r(l,l.next),d=r(d,d.next),o(l,e,i,n,s,a),void o(d,e,i,n,s,a)}c=c.next}l=l.next}while(l!==t)}function c(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&a>o){if(o=a,a===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=l&&s!==n.x&&g(ri.x)&&x(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=w(e,t);r(i,i.next)}}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0}function v(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function m(t,e,i,n){return!!(y(t,e)&&y(i,n)||y(t,n)&&y(i,e))||v(t,e,i)>0!=v(t,e,n)>0&&v(i,n,t)>0!=v(i,n,e)>0}function x(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function w(t,e){var i=new A(t.i,t.x,t.y),n=new A(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function b(t,e,i,n){var s=new A(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function T(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},function(t,e){var i={modelMatrixDirty:!1,viewMatrixDirty:!1,projectionMatrixDirty:!1,modelMatrix:null,viewMatrix:null,projectionMatrix:null,mvpInit:function(){return this.modelMatrixDirty=!0,this.viewMatrixDirty=!0,this.projectionMatrixDirty=!0,this.modelMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},mvpUpdate:function(){var t=this.program;return this.modelMatrixDirty&&(this.renderer.setMatrix4(t,"uModelMatrix",!1,this.modelMatrix),this.modelMatrixDirty=!1),this.viewMatrixDirty&&(this.renderer.setMatrix4(t,"uViewMatrix",!1,this.viewMatrix),this.viewMatrixDirty=!1),this.projectionMatrixDirty&&(this.renderer.setMatrix4(t,"uProjectionMatrix",!1,this.projectionMatrix),this.projectionMatrixDirty=!1),this},modelIdentity:function(){var t=this.modelMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.modelMatrixDirty=!0,this},modelScale:function(t,e,i){var n=this.modelMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.modelMatrixDirty=!0,this},modelTranslate:function(t,e,i){var n=this.modelMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.modelMatrixDirty=!0,this},modelRotateX:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],u=e[9],l=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+u*i,e[6]=o*n+l*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=u*n-r*i,e[10]=l*n-o*i,e[11]=c*n-a*i,this.modelMatrixDirty=!0,this},modelRotateY:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],u=e[9],l=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-u*i,e[2]=o*n-l*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+u*n,e[10]=o*i+l*n,e[11]=a*i+c*n,this.modelMatrixDirty=!0,this},modelRotateZ:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],u=e[5],l=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+u*i,e[2]=o*n+l*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=u*n-r*i,e[6]=l*n-o*i,e[7]=c*n-a*i,this.modelMatrixDirty=!0,this},viewIdentity:function(){var t=this.viewMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.viewMatrixDirty=!0,this},viewScale:function(t,e,i){var n=this.viewMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.viewMatrixDirty=!0,this},viewTranslate:function(t,e,i){var n=this.viewMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.viewMatrixDirty=!0,this},viewRotateX:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],u=e[9],l=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+u*i,e[6]=o*n+l*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=u*n-r*i,e[10]=l*n-o*i,e[11]=c*n-a*i,this.viewMatrixDirty=!0,this},viewRotateY:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],u=e[9],l=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-u*i,e[2]=o*n-l*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+u*n,e[10]=o*i+l*n,e[11]=a*i+c*n,this.viewMatrixDirty=!0,this},viewRotateZ:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],u=e[5],l=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+u*i,e[2]=o*n+l*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=u*n-r*i,e[6]=l*n-o*i,e[7]=c*n-a*i,this.viewMatrixDirty=!0,this},viewLoad2D:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=0,e[4]=t[2],e[5]=t[3],e[6]=0,e[7]=0,e[8]=t[4],e[9]=t[5],e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this.viewMatrixDirty=!0,this},viewLoad:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this.viewMatrixDirty=!0,this},projIdentity:function(){var t=this.projectionMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.projectionMatrixDirty=!0,this},projOrtho:function(t,e,i,n,s,r){var o=this.projectionMatrix,a=1/(t-e),h=1/(i-n),u=1/(s-r);return o[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*h,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*u,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*h,o[14]=(r+s)*u,o[15]=1,this.projectionMatrixDirty=!0,this},projPersp:function(t,e,i,n){var s=this.projectionMatrix,r=1/Math.tan(t/2),o=1/(i-n);return s[0]=r/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*n*i*o,s[15]=0,this.projectionMatrixDirty=!0,this}};t.exports=i},function(t,e,i){var n=i(0),s=i(514),r=i(238),o=new n({Extends:r,initialize:function(t,e,i){r.call(this,t,e,i,s.replace("%LIGHT_COUNT%",10..toString()))},onBind:function(){r.prototype.onBind.call(this);var t=this.renderer,e=this.program;return this.mvpUpdate(),t.setInt1(e,"uNormSampler",1),t.setFloat2(e,"uResolution",this.width,this.height),this},onRender:function(t,e){var i=t.lights;if(i.culledLights.length=0,i.lights.length<=0||!i.active)return this;var n,s=this.renderer,r=this.program,o=t.lights.cull(e),a=Math.min(o.length,10),h=e.matrix,u={x:0,y:0},l=s.height;for(n=0;n<10;++n)s.setFloat1(r,"uLights["+n+"].radius",0);if(a<=0)return this;for(s.setFloat4(r,"uCamera",e.x,e.y,e.rotation,e.zoom),s.setFloat3(r,"uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),n=0;n0?(n.textures[e-1]&&n.textures[e-1]!==t&&this.pushBatch(),i[i.length-1].textures[e-1]=t):(null!==n.texture&&n.texture!==t&&this.pushBatch(),i[i.length-1].texture=t),this},pushBatch:function(){var t={first:this.vertexCount,texture:null,textures:[]};this.batches.push(t)},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.renderer,r=this.vertexCount,o=this.topology,a=this.vertexSize,h=this.batches,u=0,l=null;if(0===h.length||0===r)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,r*a));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(s.setTexture2D(l.texture,0),n.drawArrays(o,l.first,u)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},onBind:function(){return h.prototype.onBind.call(this),this.mvpUpdate(),0===this.batches.length&&this.pushBatch(),this},resize:function(t,e,i){return h.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},drawStaticTilemapLayer:function(t){if(t.vertexCount>0){var e=this.vertexBuffer,i=this.gl,n=this.renderer,s=t.tileset.image.get();n.currentPipeline&&n.currentPipeline.vertexCount>0&&n.flush(),this.vertexBuffer=t.vertexBuffer,n.setPipeline(this),n.setTexture2D(s.source.glTexture,0),i.drawArrays(this.topology,0,t.vertexCount),this.vertexBuffer=e}this.viewIdentity(),this.modelIdentity()},drawEmitterManager:function(t,e){this.renderer.setPipeline(this);var i=t.emitters.list,n=i.length,s=this.vertexViewF32,r=this.vertexViewU32,o=this.renderer,a=this.maxQuads,h=e.scrollX,u=e.scrollY,l=e.matrix.matrix,c=l[0],d=l[1],f=l[2],p=l[3],g=l[4],v=l[5],y=Math.sin,m=Math.cos,x=this.vertexComponentCount,w=this.vertexCapacity,b=t.defaultFrame.source.glTexture;this.setTexture2D(b,0);for(var T=0;T=w&&(this.flush(),this.setTexture2D(b,0));for(var P=0;P=w&&(this.flush(),this.setTexture2D(b,0))}}}this.setTexture2D(b,0)},drawBlitter:function(t,e){this.renderer.setPipeline(this);for(var i=a.getTintAppendFloatAlpha,n=this.vertexViewF32,s=this.vertexViewU32,r=(this.renderer,t.getRenderList()),o=r.length,h=e.matrix.matrix,u=h[0],l=h[1],c=h[2],d=h[3],f=h[4],p=h[5],g=e.scrollX*t.scrollFactorX,v=e.scrollY*t.scrollFactorY,y=Math.ceil(o/this.maxQuads),m=0,x=t.x-g,w=t.y-v,b=0;b=this.vertexCapacity&&this.flush()}m+=T,o-=T,this.vertexCount>=this.vertexCapacity&&this.flush()}},batchSprite:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n=a.getTintAppendFloatAlpha,s=this.vertexViewF32,r=this.vertexViewU32,o=(this.renderer,e.matrix.matrix),h=t.frame,u=h.texture.source[h.sourceIndex].glTexture,l=!!u.isRenderTexture,c=t.flipX,d=t.flipY^l,f=h.uvs,p=h.width*(c?-1:1),g=h.height*(d?-1:1),v=-t.displayOriginX+h.x+h.width*(c?1:0),y=-t.displayOriginY+h.y+h.height*(d?1:0),m=v+p,x=y+g,w=t.x-e.scrollX*t.scrollFactorX,b=t.y-e.scrollY*t.scrollFactorY,T=t.scaleX,A=t.scaleY,S=-t.rotation,C=t._alphaTL,M=t._alphaTR,E=t._alphaBL,_=t._alphaBR,L=t._tintTL,P=t._tintTR,F=t._tintBL,k=t._tintBR,R=Math.sin(S),O=Math.cos(S),D=O*T,I=-R*T,B=R*A,Y=O*A,X=w,z=b,N=o[0],W=o[1],G=o[2],U=o[3],V=D*N+I*G,H=D*W+I*U,j=B*N+Y*G,q=B*W+Y*U,K=X*N+z*G+o[4],J=X*W+z*U+o[5],Z=v*V+y*j+K,Q=v*H+y*q+J,$=v*V+x*j+K,tt=v*H+x*q+J,et=m*V+x*j+K,it=m*H+x*q+J,nt=m*V+y*j+K,st=m*H+y*q+J,rt=n(L,C),ot=n(P,M),at=n(F,E),ht=n(k,_);this.setTexture2D(u,0),s[(i=this.vertexCount*this.vertexComponentCount)+0]=Z,s[i+1]=Q,s[i+2]=f.x0,s[i+3]=f.y0,r[i+4]=rt,s[i+5]=$,s[i+6]=tt,s[i+7]=f.x1,s[i+8]=f.y1,r[i+9]=at,s[i+10]=et,s[i+11]=it,s[i+12]=f.x2,s[i+13]=f.y2,r[i+14]=ht,s[i+15]=Z,s[i+16]=Q,s[i+17]=f.x0,s[i+18]=f.y0,r[i+19]=rt,s[i+20]=et,s[i+21]=it,s[i+22]=f.x2,s[i+23]=f.y2,r[i+24]=ht,s[i+25]=nt,s[i+26]=st,s[i+27]=f.x3,s[i+28]=f.y3,r[i+29]=ot,this.vertexCount+=6},batchMesh:function(t,e){var i=t.vertices,n=i.length,s=n/2|0;this.renderer.setPipeline(this),this.vertexCount+s>this.vertexCapacity&&this.flush();var r=a.getTintAppendFloatAlpha,o=t.uv,h=t.colors,u=t.alphas,l=this.vertexViewF32,c=this.vertexViewU32,d=(this.renderer,e.matrix.matrix),f=t.frame,p=t.texture.source[f.sourceIndex].glTexture,g=t.x-e.scrollX*t.scrollFactorX,v=t.y-e.scrollY*t.scrollFactorY,y=t.scaleX,m=t.scaleY,x=-t.rotation,w=Math.sin(x),b=Math.cos(x),T=b*y,A=-w*y,S=w*m,C=b*m,M=g,E=v,_=d[0],L=d[1],P=d[2],F=d[3],k=T*_+A*P,R=T*L+A*F,O=S*_+C*P,D=S*L+C*F,I=M*_+E*P+d[4],B=M*L+E*F+d[5],Y=0;this.setTexture2D(p,0),Y=this.vertexCount*this.vertexComponentCount;for(var X=0,z=0;Xthis.vertexCapacity&&this.flush();var i,n,s,r,o,h,u,l,c=t.text,d=c.length,f=a.getTintAppendFloatAlpha,p=this.vertexViewF32,g=this.vertexViewU32,v=(this.renderer,e.matrix.matrix),y=e.width+50,m=e.height+50,x=t.frame,w=t.texture.source[x.sourceIndex],b=e.scrollX*t.scrollFactorX,T=e.scrollY*t.scrollFactorY,A=t.fontData,S=A.lineHeight,C=t.fontSize/A.size,M=A.chars,E=t.alpha,_=f(t._tintTL,E),L=f(t._tintTR,E),P=f(t._tintBL,E),F=f(t._tintBR,E),k=t.x,R=t.y,O=x.cutX,D=x.cutY,I=w.width,B=w.height,Y=w.glTexture,X=0,z=0,N=0,W=0,G=null,U=0,V=0,H=0,j=0,q=0,K=0,J=0,Z=0,Q=0,$=0,tt=0,et=0,it=null,nt=0,st=k-b+x.x,rt=R-T+x.y,ot=-t.rotation,at=t.scaleX,ht=t.scaleY,ut=Math.sin(ot),lt=Math.cos(ot),ct=lt*at,dt=-ut*at,ft=ut*ht,pt=lt*ht,gt=st,vt=rt,yt=v[0],mt=v[1],xt=v[2],wt=v[3],bt=ct*yt+dt*xt,Tt=ct*mt+dt*wt,At=ft*yt+pt*xt,St=ft*mt+pt*wt,Ct=gt*yt+vt*xt+v[4],Mt=gt*mt+vt*wt+v[5],Et=0;this.setTexture2D(Y,0);for(var _t=0;_ty||n<-50||n>m)&&(s<-50||s>y||r<-50||r>m)&&(o<-50||o>y||h<-50||h>m)&&(u<-50||u>y||l<-50||l>m)||(this.vertexCount+6>this.vertexCapacity&&this.flush(),p[(Et=this.vertexCount*this.vertexComponentCount)+0]=i,p[Et+1]=n,p[Et+2]=Q,p[Et+3]=tt,g[Et+4]=_,p[Et+5]=s,p[Et+6]=r,p[Et+7]=Q,p[Et+8]=et,g[Et+9]=P,p[Et+10]=o,p[Et+11]=h,p[Et+12]=$,p[Et+13]=et,g[Et+14]=F,p[Et+15]=i,p[Et+16]=n,p[Et+17]=Q,p[Et+18]=tt,g[Et+19]=_,p[Et+20]=o,p[Et+21]=h,p[Et+22]=$,p[Et+23]=et,g[Et+24]=F,p[Et+25]=u,p[Et+26]=l,p[Et+27]=$,p[Et+28]=tt,g[Et+29]=L,this.vertexCount+=6))}}else X=0,N=0,z+=S,it=null},batchDynamicBitmapText:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n,s,r,o,h,u,l,c,d,f,p,g,v,y=t.displayCallback,m=t.text,x=m.length,w=a.getTintAppendFloatAlpha,b=this.vertexViewF32,T=this.vertexViewU32,A=this.renderer,S=e.matrix.matrix,C=t.frame,M=t.texture.source[C.sourceIndex],E=e.scrollX*t.scrollFactorX,_=e.scrollY*t.scrollFactorY,L=t.scrollX,P=t.scrollY,F=t.fontData,k=F.lineHeight,R=t.fontSize/F.size,O=F.chars,D=t.alpha,I=w(t._tintTL,D),B=w(t._tintTR,D),Y=w(t._tintBL,D),X=w(t._tintBR,D),z=t.x,N=t.y,W=C.cutX,G=C.cutY,U=M.width,V=M.height,H=M.glTexture,j=0,q=0,K=0,J=0,Z=null,Q=0,$=0,tt=0,et=0,it=0,nt=0,st=0,rt=0,ot=0,at=0,ht=0,ut=0,lt=null,ct=0,dt=z+C.x,ft=N+C.y,pt=-t.rotation,gt=t.scaleX,vt=t.scaleY,yt=Math.sin(pt),mt=Math.cos(pt),xt=mt*gt,wt=-yt*gt,bt=yt*vt,Tt=mt*vt,At=dt,St=ft,Ct=S[0],Mt=S[1],Et=S[2],_t=S[3],Lt=xt*Ct+wt*Et,Pt=xt*Mt+wt*_t,Ft=bt*Ct+Tt*Et,kt=bt*Mt+Tt*_t,Rt=At*Ct+St*Et+S[4],Ot=At*Mt+St*_t+S[5],Dt=t.cropWidth>0||t.cropHeight>0,It=0;this.setTexture2D(H,0),Dt&&A.pushScissor(t.x,t.y,t.cropWidth*t.scaleX,t.cropHeight*t.scaleY);for(var Bt=0;Btthis.vertexCapacity&&this.flush(),b[(It=this.vertexCount*this.vertexComponentCount)+0]=i,b[It+1]=n,b[It+2]=ot,b[It+3]=ht,T[It+4]=I,b[It+5]=s,b[It+6]=r,b[It+7]=ot,b[It+8]=ut,T[It+9]=Y,b[It+10]=o,b[It+11]=h,b[It+12]=at,b[It+13]=ut,T[It+14]=X,b[It+15]=i,b[It+16]=n,b[It+17]=ot,b[It+18]=ht,T[It+19]=I,b[It+20]=o,b[It+21]=h,b[It+22]=at,b[It+23]=ut,T[It+24]=X,b[It+25]=u,b[It+26]=l,b[It+27]=at,b[It+28]=ht,T[It+29]=B,this.vertexCount+=6}}}else j=0,K=0,q+=k,lt=null;Dt&&A.popScissor()},batchText:function(t,e){var i=a.getTintAppendFloatAlpha;this.batchTexture(t,t.canvasTexture,t.canvasTexture.width,t.canvasTexture.height,t.x,t.y,t.canvasTexture.width,t.canvasTexture.height,t.scaleX,t.scaleY,t.rotation,t.flipX,t.flipY,t.scrollFactorX,t.scrollFactorY,t.displayOriginX,t.displayOriginY,0,0,t.canvasTexture.width,t.canvasTexture.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),0,0,e)},batchDynamicTilemapLayer:function(t,e){for(var i=t.culledTiles,n=i.length,s=t.tileset.image.get().source.glTexture,r=t.tileset,o=t.scrollFactorX,h=t.scrollFactorY,u=t.alpha,l=t.x,c=t.y,d=t.scaleX,f=t.scaleY,p=a.getTintAppendFloatAlpha,g=0;gthis.vertexCapacity&&this.flush(),d^=e.isRenderTexture?1:0,l=-l;var _,L=this.vertexViewF32,P=this.vertexViewU32,F=(this.renderer,E.matrix.matrix),k=o*(c?1:0)-g,R=a*(d?1:0)-v,O=k+o*(c?-1:1),D=R+a*(d?-1:1),I=s-E.scrollX*f,B=r-E.scrollY*p,Y=Math.sin(l),X=Math.cos(l),z=X*h,N=-Y*h,W=Y*u,G=X*u,U=I,V=B,H=F[0],j=F[1],q=F[2],K=F[3],J=z*H+N*q,Z=z*j+N*K,Q=W*H+G*q,$=W*j+G*K,tt=U*H+V*q+F[4],et=U*j+V*K+F[5],it=k*J+R*Q+tt,nt=k*Z+R*$+et,st=k*J+D*Q+tt,rt=k*Z+D*$+et,ot=O*J+D*Q+tt,at=O*Z+D*$+et,ht=O*J+R*Q+tt,ut=O*Z+R*$+et,lt=y/i+C,ct=m/n+M,dt=(y+x)/i+C,ft=(m+w)/n+M;this.setTexture2D(e,0),L[(_=this.vertexCount*this.vertexComponentCount)+0]=it,L[_+1]=nt,L[_+2]=lt,L[_+3]=ct,P[_+4]=b,L[_+5]=st,L[_+6]=rt,L[_+7]=lt,L[_+8]=ft,P[_+9]=T,L[_+10]=ot,L[_+11]=at,L[_+12]=dt,L[_+13]=ft,P[_+14]=A,L[_+15]=it,L[_+16]=nt,L[_+17]=lt,L[_+18]=ct,P[_+19]=b,L[_+20]=ot,L[_+21]=at,L[_+22]=dt,L[_+23]=ft,P[_+24]=A,L[_+25]=ht,L[_+26]=ut,L[_+27]=dt,L[_+28]=ct,P[_+29]=S,this.vertexCount+=6},drawTexture:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var h,u=this.vertexViewF32,l=this.vertexViewU32,c=(this.renderer,e),d=i,f=c+r,p=d+o,g=a[0],v=a[1],y=a[2],m=a[3],x=a[4],w=a[5],b=c*g+d*y+x,T=c*v+d*m+w,A=c*g+p*y+x,S=c*v+p*m+w,C=f*g+p*y+x,M=f*v+p*m+w,E=f*g+d*y+x,_=f*v+d*m+w,L=t.width,P=t.height,F=n/L,k=s/P,R=(n+r)/L,O=(s+o)/P,D=4294967295;this.setTexture2D(t,0),u[(h=this.vertexCount*this.vertexComponentCount)+0]=b,u[h+1]=T,u[h+2]=F,u[h+3]=k,l[h+4]=D,u[h+5]=A,u[h+6]=S,u[h+7]=F,u[h+8]=O,l[h+9]=D,u[h+10]=C,u[h+11]=M,u[h+12]=R,u[h+13]=O,l[h+14]=D,u[h+15]=b,u[h+16]=T,u[h+17]=F,u[h+18]=k,l[h+19]=D,u[h+20]=C,u[h+21]=M,u[h+22]=R,u[h+23]=O,l[h+24]=D,u[h+25]=E,u[h+26]=_,u[h+27]=R,u[h+28]=k,l[h+29]=D,this.vertexCount+=6,this.flush()},batchGraphics:function(){}});t.exports=u},function(t,e,i){var n=i(0),s=i(14),r=i(240),o=i(244),a=i(247),h=i(248),u=i(8),l=i(249),c=i(250),d=new n({initialize:function(t,e){this.game=t,this.canvas,this.config=e,this.enabled=!0,this.events=new s,this.queue=[],this.keyboard=new o(this),this.mouse=new a(this),this.touch=new l(this),this.gamepad=new r(this),this.activePointer=new h(this,0),this.scale={x:1,y:1},this.globalTopOnly=!0,this.ignoreEvents=!1,this.bounds=new u,this._tempPoint={x:0,y:0},this._tempHitTest=[],t.events.once("boot",this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.updateBounds(),this.keyboard.boot(),this.mouse.boot(),this.touch.boot(),this.gamepad.boot(),this.game.events.once("destroy",this.destroy,this)},updateBounds:function(){var t=this.canvas.getBoundingClientRect(),e=this.bounds;e.left=t.left+window.pageXOffset,e.top=t.top+window.pageYOffset,e.width=t.width,e.height=t.height},update:function(t){this.keyboard.update(),this.gamepad.update(),this.ignoreEvents=!1;var e=this.queue.length,i=this.activePointer;if(i.reset(),this.enabled&&0!==e){this.updateBounds(),this.scale.x=this.game.config.width/this.bounds.width,this.scale.y=this.game.config.height/this.bounds.height;for(var n=this.queue.splice(0,e),s=0;s=n.x&&e>=n.y&&t<=n.x+o&&e<=n.y+a))return s;n.getWorldPoint(t,e,r);for(var h=n.cull(i),u={x:0,y:0},l=0;l0?1:-1)}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=0,this.pressed=!1},update:function(t){this.value=t.value,this.value>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",this.pad,this,this.value,t)):this.pressed&&(this.pressed=!1,this.events.emit("up",this.pad,this,this.value,t))}});t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(245),o=i(128),a=i(246),h=i(526),u=i(527),l=i(528),c=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.enabled=!1,this.target,this.keys=[],this.combos=[],this.captures=[],this.queue=[],this.handler},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.enabled&&this.startListeners()},startListeners:function(){var t=this.queue,e=this.captures,i=function(i){i.defaultPrevented||(t.push(i),e[i.keyCode]&&i.preventDefault())};this.handler=i,this.target.addEventListener("keydown",i,!1),this.target.addEventListener("keyup",i,!1)},stopListeners:function(){this.target.removeEventListener("keydown",this.handler),this.target.removeEventListener("keyup",this.handler)},createCursorKeys:function(){return this.addKeys({up:o.UP,down:o.DOWN,left:o.LEFT,right:o.RIGHT,space:o.SPACE,shift:o.SHIFT})},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},addKey:function(t){var e=this.keys;return e[t]||(e[t]=new r(t),this.captures[t]=!0),e[t]},removeKey:function(t){this.keys[t]&&(this.keys[t]=void 0,this.captures[t]=!1)},addKeyCapture:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e=0;i--){var n=this.scenes[i].sys;n.settings.status===s.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this._processing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,n=this.getScene(t),s=this.getAt(i);this.scenes[e]=s,this.scenes[i]=n}}return this},moveUp:function(t){if(this._processing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=0;t--){this.scenes[t].sys.destroy()}this.scenes=[],this._pending=[],this._start=[],this._queue=[],this.game=null}});t.exports=u},function(t,e,i){var n=i(0),s=i(129),r=new n({initialize:function(t){this.sys=new s(this,t)},update:function(){}});t.exports=r},function(t,e){t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},function(t,e,i){var n=i(83),s=i(4),r=i(531),o={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:n.PENDING,key:s(t,"key",""),active:s(t,"active",!1),visible:s(t,"visible",!0),isBooted:!1,data:{},files:s(t,"files",!1),cameras:s(t,"cameras",null),map:s(t,"map",r),physics:s(t,"physics",{}),loader:s(t,"loader",{}),plugins:s(t,"plugins",!1)}}};t.exports=o},function(t,e,i){var n=i(256),s=i(258),r=i(260),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e&&e.noAudio||!i.webAudio&&!i.audioData?new s(t):!i.webAudio||e&&e.disableWebAudio?new n(t):new r(t)}};t.exports=o},function(t,e,i){var n=i(0),s=i(84),r=i(257),o=new n({Extends:s,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,s.call(this,t)},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=!1,i=function(){e=!0},n=function(){if(e)e=!1;else{document.body.removeEventListener("touchmove",i),document.body.removeEventListener("touchend",n);var s=[];t.game.cache.audio.entries.each(function(t,e){for(var i=0;i0)&&(!!s.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit("pause",this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!s.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit("stop",this),!0))},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s=n)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit("ended",this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},setMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},setVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},setRate:function(){s.prototype.setRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)}});Object.defineProperty(r.prototype,"mute",{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.setMute(),this.emit("mute",this,t))}}),Object.defineProperty(r.prototype,"volume",{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.setVolume(),this.emit("volume",this,t))}}),Object.defineProperty(r.prototype,"rate",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"rate").get.call(this)},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||Object.getOwnPropertyDescriptor(s.prototype,"rate").set.call(this,t)}}),Object.defineProperty(r.prototype,"detune",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"detune").get.call(this)},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||Object.getOwnPropertyDescriptor(s.prototype,"detune").set.call(this,t)}}),Object.defineProperty(r.prototype,"seek",{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit("seek",this,t))}}),Object.defineProperty(r.prototype,"loop",{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit("loop",this,t))}}),t.exports=r},function(t,e,i){var n=i(84),s=i(0),r=i(14),o=i(259),a=i(3),h=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return n.prototype.remove.call(this,t)},removeByKey:function(t){return n.prototype.removeByKey.call(this,t)},pauseAll:a,resumeAll:a,stopAll:a,update:a,destroy:function(){n.prototype.destroy.call(this)},forEachActiveSound:function(t,e){n.prototype.forEachActiveSound.call(this,t,e)}});t.exports=h},function(t,e,i){var n=i(85),s=i(0),r=i(14),o=i(23),a=new s({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!1},updateMarker:function(t){return!1},removeMarker:function(t){return null},play:function(t,e){return!1},pause:function(){return!1},resume:function(){return!1},stop:function(){return!1},destroy:function(){this.manager.remove(this),n.prototype.destroy.call(this)}});t.exports=a},function(t,e,i){var n=i(0),s=i(84),r=i(261),o=new n({Extends:s,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&"ontouchstart"in window,s.call(this,t)},createAudioContext:function(t){var e=t.config.audio;return e&&e.context?(e.context.resume(),e.context):new AudioContext},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=function(){t.context.resume().then(function(){document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),t.unlocked=!0})};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("touchend",e,!1)},onBlur:function(){this.context.suspend()},onFocus:function(){this.context.resume()},destroy:function(){this.destination=null,this.masterVolumeNode.disconnect(),this.masterVolumeNode=null,this.masterMuteNode.disconnect(),this.masterMuteNode=null,this.game.config.audio&&this.game.config.audio.context?this.context.suspend():this.context.close(),this.context=null,s.prototype.destroy.call(this)}});Object.defineProperty(o.prototype,"mute",{get:function(){return 0===this.masterMuteNode.gain.value},set:function(t){this.masterMuteNode.gain.setValueAtTime(t?0:1,0),this.emit("mute",this,t)}}),Object.defineProperty(o.prototype,"volume",{get:function(){return this.masterVolumeNode.gain.value},set:function(t){this.masterVolumeNode.gain.setValueAtTime(t,0),this.emit("volume",this,t)}}),t.exports=o},function(t,e,i){var n=i(0),s=i(85),r=new n({Extends:s,initialize:function(t,e,i){void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),this.audioBuffer?(this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)):console.error("No audio loaded in cache with key: '"+e+"'!")},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit("play",this),!0)},pause:function(){return!(this.manager.context.currentTime=0&&t<=o.width&&e>=0&&e<=o.height){t+=s.cutX,e+=s.cutY;var a=this._tempContext;a.clearRect(0,0,1,1),a.drawImage(o,t,e,1,1,0,0,1,1);var h=a.getImageData(0,0,1,1);return new r(h.data[0],h.data[1],h.data[2],h.data[3])}}return null},setTexture:function(t,e,i){return this.list[e]&&(t.texture=this.list[e],t.frame=t.texture.get(i)),t},each:function(t,e){for(var i=[null],n=1;nu&&(r=u),o>u&&(o=u),a=s,h=r;;)if(ay&&(s=y),r>m&&(r=m);var A=y+g-s,S=m+v-r;o0&&e.cameraFilter&r._id)){var h=r.scrollX*e.scrollFactorX,u=r.scrollY*e.scrollFactorY,l=e.x,c=e.y,d=e.scaleX,f=e.scaleY,p=e.rotation,g=e.commandBuffer,v=o||t.currentContext,y=1,m=1,x=0,w=0,b=1,T=0,A=0,S=0;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,v.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,v.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),v.save(),v.translate(l-h,c-u),v.rotate(p),v.scale(d,f),v.fillStyle="#fff",v.globalAlpha=e.alpha;for(var C=0,M=g.length;C>>16,A=(65280&x)>>>8,S=255&x,v.strokeStyle="rgba("+T+","+A+","+S+","+y+")",v.lineWidth=b,C+=3;break;case n.FILL_STYLE:w=g[C+1],m=g[C+2],T=(16711680&w)>>>16,A=(65280&w)>>>8,S=255&w,v.fillStyle="rgba("+T+","+A+","+S+","+m+")",C+=2;break;case n.BEGIN_PATH:v.beginPath();break;case n.CLOSE_PATH:v.closePath();break;case n.FILL_PATH:a||v.fill();break;case n.STROKE_PATH:a||v.stroke();break;case n.FILL_RECT:a?v.rect(g[C+1],g[C+2],g[C+3],g[C+4]):v.fillRect(g[C+1],g[C+2],g[C+3],g[C+4]),C+=4;break;case n.FILL_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.fill(),C+=6;break;case n.STROKE_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.stroke(),C+=6;break;case n.LINE_TO:v.lineTo(g[C+1],g[C+2]),C+=2;break;case n.MOVE_TO:v.moveTo(g[C+1],g[C+2]),C+=2;break;case n.LINE_FX_TO:v.lineTo(g[C+1],g[C+2]),C+=5;break;case n.MOVE_FX_TO:v.moveTo(g[C+1],g[C+2]),C+=5;break;case n.SAVE:v.save();break;case n.RESTORE:v.restore();break;case n.TRANSLATE:v.translate(g[C+1],g[C+2]),C+=2;break;case n.SCALE:v.scale(g[C+1],g[C+2]),C+=2;break;case n.ROTATE:v.rotate(g[C+1]),C+=1}v.restore()}}},function(t,e,i){var n=i(4),s=i(80),r=function(t,e,i){for(var n=[],s=0;s0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],r):h=new s(t,e,i,a[0],a[1],a[2],r),this.lights.push(h),h},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&(this.lightPool.push(t),this.lights.splice(e,1)),this},shutdown:function(){for(;this.lights.length>0;)this.lightPool.push(this.lights.pop());this.ambientColor={r:.1,g:.1,b:.1},this.culledLights.length=0,this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=a},function(t,e,i){t.exports={Circle:i(663),Ellipse:i(269),Intersects:i(294),Line:i(683),Point:i(701),Polygon:i(715),Rectangle:i(306),Triangle:i(744)}},function(t,e,i){t.exports={CircleToCircle:i(673),CircleToRectangle:i(674),GetRectangleIntersection:i(675),LineToCircle:i(296),LineToLine:i(89),LineToRectangle:i(676),PointToLine:i(297),PointToLineSegment:i(677),RectangleToRectangle:i(295),RectangleToTriangle:i(678),RectangleToValues:i(679),TriangleToCircle:i(680),TriangleToLine:i(681),TriangleToTriangle:i(682)}},function(t,e){t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},function(t,e,i){var n=i(32),s=new(i(5));t.exports=function(t,e,i){if(void 0===i&&(i=s),n(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(n(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,u=r*r+o*o,l=r,c=o;if(u>0){var d=(a*r+h*o)/u;l*=d,c*=d}return i.x=t.x1+l,i.y=t.y1+c,l*l+c*c<=u&&l*r+c*o>=0&&n(e,i.x,i.y)}},function(t,e){t.exports=function(t,e){return(t.x-e.x1)*(e.y2-e.y1)==(e.x2-e.x1)*(t.y-e.y1)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},function(t,e,i){var n=i(0),s=i(301),r=i(108),o=i(110),a=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return o(this,t)},setTo:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this},getPointA:function(){return{x:this.x1,y:this.y1}},getPointB:function(){return{x:this.x2,y:this.y2}},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=a},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},function(t,e,i){var n=i(16),s=i(50),r=i(54);t.exports=function(t){var e=r(t)-n.TAU;return s(e,-Math.PI,Math.PI)}},function(t,e){t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},function(t,e){t.exports=function(t){return t.x*t.x+t.y*t.y}},function(t,e,i){var n=i(0),s=i(146),r=new n({initialize:function(t){this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return s(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],!Array.isArray(t))return this;for(var e,i=Number.MAX_VALUE,n=0;n=1)return i.x=r.x1,i.y=r.y1,i;var h=s(r),u=s(o),l=s(a),c=(h+u+l)*e,d=0;return ch+u?(d=(c-=h+u)/l,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/u,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},function(t,e,i){var n=i(65),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),u=n(o),l=n(a),c=n(h),d=u+l+c;e||(e=d/i);for(var f=0;fu+l?(g=(p-=u+l)/c,v.x=h.x1+(h.x2-h.x1)*g,v.y=h.y1+(h.y2-h.y1)*g):(g=(p-=u)/l,v.x=a.x1+(a.x2-a.x1)*g,v.y=a.y1+(a.y2-a.y1)*g),r.push(v)}return r}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},function(t,e,i){var n=i(5);function s(t,e,i,n){var s=t-i,r=e-n,o=s*s+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,u=t.y3,l=s(h,u,o,a),c=s(i,r,h,u),d=s(o,a,i,r),f=l+c+d;return e.x=(i*l+o*c+h*d)/f,e.y=(r*l+a*c+u*d)/f,e}},function(t,e){t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragX:0,dragY:0}}},function(t,e,i){var n=i(150);t.exports=function(t,e){var i=n(e,t.xhrSettings),s=new XMLHttpRequest;return s.open("GET",t.src,i.async,i.user,i.password),s.responseType=t.xhrSettings.responseType,s.timeout=i.timeout,i.header&&i.headerValue&&s.setRequestHeader(i.header,i.headerValue),i.overrideMimeType&&s.overrideMimeType(i.overrideMimeType),s.onload=t.onLoad.bind(t),s.onerror=t.onError.bind(t),s.onprogress=t.onProgress.bind(t),s.send(),s}},function(t,e,i){var n=i(0),s=i(22),r=i(18),o=i(7),a=i(2),h=i(316),u=new n({Extends:r,initialize:function(t,e,i,n,s){this.context=s;var o={type:"audio",extension:a(e,"type",""),responseType:"arraybuffer",key:t,url:a(e,"uri",e),path:i,xhrSettings:n};r.call(this,o)},onProcess:function(t){this.state=s.FILE_PROCESSING;var e=this;this.context.decodeAudioData(this.xhrLoader.response,function(i){e.data=i,e.onComplete(),t(e)},function(i){console.error("Error with decoding audio data for '"+this.key+"':",i.message),e.state=s.FILE_ERRORED,t(e)}),this.context=null}});u.create=function(t,e,i,n,s){var r=t.systems.game,o=r.config.audio,a=r.device.audio;if(o&&o.noAudio||!a.webAudio&&!a.audioData)return null;var l=u.findAudioURL(r,i);return l?!a.webAudio||o&&o.disableWebAudio?new h(e,l,t.path,n,r.sound.locked):new u(e,l,t.path,s,r.sound.context):null},o.register("audio",function(t,e,i,n){var s=u.create(this,t,e,i,n);return s&&this.addFile(s),this}),u.findAudioURL=function(t,e){e.constructor!==Array&&(e=[e]);for(var i=0;i=0?t:t+2*Math.PI}},function(t,e,i){var n=i(322);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e){t.exports=function(t,e){var i=t.x,n=t.y;return t.x=i*Math.cos(e)-n*Math.sin(e),t.y=i*Math.sin(e)+n*Math.cos(e),t}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e,i){var n=i(326),s=i(91),r=i(0),o=i(58),a=i(328),h=i(329),u=new r({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,n,s){return this.world.addCollider(t,e,i,n,s)},overlap:function(t,e,i,n,s){return this.world.addOverlap(t,e,i,n,s)},existing:function(t,e){var i=e?o.STATIC_BODY:o.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},image:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticSprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},sprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new a(this.world,this.world.scene,t,e))}});t.exports=u},function(t,e,i){var n=i(0),s=i(327),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){t.exports={Acceleration:i(835),Angular:i(836),Bounce:i(837),Debug:i(838),Drag:i(839),Enable:i(840),Friction:i(841),Gravity:i(842),Immovable:i(843),Mass:i(844),Size:i(845),Velocity:i(846)}},function(t,e,i){var n=i(91),s=i(0),r=i(58),o=i(2),a=i(69),h=new s({Extends:a,initialize:function(t,e,i,s){void 0!==s||Array.isArray(i)||"object"!=typeof i?void 0===s&&(s={}):(s=i,i=null),this.world=t,s.createCallback=this.createCallback,s.removeCallback=this.removeCallback,s.classType=o(s,"classType",n),this.physicsType=r.DYNAMIC_BODY,this.defaults={setCollideWorldBounds:o(s,"collideWorldBounds",!1),setAccelerationX:o(s,"accelerationX",0),setAccelerationY:o(s,"accelerationY",0),setBounceX:o(s,"bounceX",0),setBounceY:o(s,"bounceY",0),setDragX:o(s,"dragX",0),setDragY:o(s,"dragY",0),setGravityX:o(s,"gravityX",0),setGravityY:o(s,"gravityY",0),setFrictionX:o(s,"frictionX",0),setFrictionY:o(s,"frictionY",0),setVelocityX:o(s,"velocityX",0),setVelocityY:o(s,"velocityY",0),setAngularVelocity:o(s,"angularVelocity",0),setAngularAcceleration:o(s,"angularAcceleration",0),setAngularDrag:o(s,"angularDrag",0),setMass:o(s,"mass",1),setImmovable:o(s,"immovable",!1)},a.call(this,e,i,s)},createCallback:function(t){t.body||this.world.enableBody(t,r.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallback:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var n=this.getChildren(),s=0;s0){var u=this.tree,l=this.staticTree;for(o=(r=s.entries).length,t=0;t0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},separate:function(t,e,i,n,s){if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return!1;if(i&&!1===i.call(n,t.gameObject,e.gameObject))return!1;if(t.isCircle&&e.isCircle)return this.separateCircle(t,e,s);if(t.isCircle!==e.isCircle){var r=t.isCircle?e:t,o=t.isCircle?t:e,a={x:r.x,y:r.y,right:r.right,bottom:r.bottom},h=o.center;if((h.ya.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var u=!1,l=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)u.right&&(a=h(d.x,d.y,u.right,u.y)-d.radius):d.y>u.bottom&&(d.xu.right&&(a=h(d.x,d.y,u.right,u.bottom)-d.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-h(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap||e.onOverlap)&&this.emit("overlap",t.gameObject,e.gameObject,t,e),0!==a;var f=t.velocity.x,p=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=f*Math.cos(o)+p*Math.sin(o),w=f*Math.sin(o)-p*Math.cos(o),b=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),A=((g-m)*x+2*m*b)/(g+m),S=(2*g*x+(m-g)*b)/(g+m);return t.immovable||(t.velocity.x=(A*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+A*Math.sin(o))*t.bounce.y,f=t.velocity.x,p=t.velocity.y),e.immovable||(e.velocity.x=(S*Math.cos(o)-T*Math.sin(o))*e.bounce.x,e.velocity.y=(T*Math.cos(o)+S*Math.sin(o))*e.bounce.y,v=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>f?t.velocity.x*=-1:v<0&&!e.immovable&&f0&&!t.immovable&&y>p?t.velocity.y*=-1:y<0&&!e.immovable&&pMath.PI/2&&(f<0&&!t.immovable&&v0&&!e.immovable&&f>v?e.velocity.x*=-1:p<0&&!t.immovable&&y0&&!e.immovable&&f>y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.delta-a*Math.cos(o),t.y+=t.velocity.y*this.delta-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.delta+a*Math.cos(o),e.y+=e.velocity.y*this.delta+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),!0},intersects:function(t,e){return t!==e&&(t.isCircle?e.isCircle?h(t.center.x,t.center.y,e.center.x,e.center.y)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):e.isCircle?this.circleBodyIntersects(e,t):!(t.right<=e.position.x)&&(!(t.bottom<=e.position.y)&&(!(t.position.x>=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=s(t.center.x,e.left,e.right),n=s(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o,a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;o0},collideHandler:function(t,e,i,n,s,r){if(void 0===e&&t.isParent)return this.collideGroupVsSelf(t,i,n,s,r);if(!t||!e)return!1;if(t.body){if(e.body)return this.collideSpriteVsSprite(t,e,i,n,s,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,n,s,r)}else if(t.isParent){if(e.body)return this.collideSpriteVsGroup(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,n,s,r)}else if(t.isTilemap){if(e.body)return this.collideSpriteVsTilemapLayer(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,n,s,r)}},collideSpriteVsSprite:function(t,e,i,n,s,r){return!(!t.body||!e.body)&&(this.separate(t.body,e.body,n,s,r)&&(i&&i.call(s,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,n,s,r){var o=t.body;if(0!==e.length&&o){var h=this.treeMinMax;h.minX=o.left,h.minY=o.top,h.maxX=o.right,h.maxY=o.bottom;var u=e.physicsType===a.DYNAMIC_BODY?this.tree.search(h):this.staticTree.search(h);if(0!==u.length)for(var l=e.getChildren(),c=0;cc.baseTileWidth){var d=(c.tileWidth-c.baseTileWidth)*e.scaleX;a-=d,u+=d}c.tileHeight>c.baseTileHeight&&(l+=(c.tileHeight-c.baseTileHeight)*e.scaleY);var f,g=e.getTilesWithinWorldXY(a,h,u,l);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},m=0;m0&&(this.facing=r.FACING_RIGHT),this.deltaY()<0?this.facing=r.FACING_UP:this.deltaY()>0&&(this.facing=r.FACING_DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.gameObject.x+=this._dx,this.gameObject.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.world.bounds,i=this.world.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){if(void 0===i&&(i=!0),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&this.gameObject.getCenter){var n=this.gameObject,s=n.displayWidth/2,r=n.displayHeight/2;this.offset.set(s-this.halfWidth,r-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i.setPosition(t,e),i.getTopLeft(this.position),this.prev.copy(this.position),this.rotation=i.angle,this.preRotation=i.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):a(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.radius):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.velocity.x/2,n+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t){return this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this},setVelocityX:function(t){return this.velocity.x=t,this},setVelocityY:function(t){return this.velocity.y=t,this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return this.immovable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=u},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=n,this.collideCallback=s,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(s=t.right-e.x)>r&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()r&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?s=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=s,e.overlapX=s,s}},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(s=t.bottom-e.y)>r&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()r&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?s=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=s,e.overlapY=s,s}},function(t,e,i){var n=new(i(0))({initialize:function(){this._pending=[],this._active=[],this._destroy=[],this._toProcess=0},add:function(t){return this._pending.push(t),this._toProcess++,this},remove:function(t){return this._destroy.push(t),this._toProcess++,this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,n=this._active;for(t=0;t=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,s,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=s||(o=e+Math.ceil((i-e)/s/2)*s,n(t,o,e,i,r),a.push(e,o,o,i))}s.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!p(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),a=g(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,s,r,o,h,u,l,d,f,p,g,v,y,m;for(u=l=1/0,n=e;n<=i-e;n++)s=a(t,0,n,this.toBBox),r=a(t,n,i,this.toBBox),f=s,p=r,void 0,void 0,void 0,void 0,g=Math.max(f.minX,p.minX),v=Math.max(f.minY,p.minY),y=Math.min(f.maxX,p.maxX),m=Math.min(f.maxY,p.maxY),o=Math.max(0,y-g)*Math.max(0,m-v),h=c(s)+c(r),o=e;s--)r=t.children[s],h(l,t.leaf?o(r):r),c+=d(l);return c},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},t.exports=s},function(t,e){var i=function(t,e,r,o,a){for(r=r||0,o=o||t.length-1,a=a||s;o>r;){if(o-r>600){var h=o-r+1,u=e-r+1,l=Math.log(h),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(h-c)/h)*(u-h/2<0?-1:1),f=Math.max(r,Math.floor(e-u*c/h+d)),p=Math.min(o,Math.floor(e+(h-u)*c/h+d));i(t,e,f,p,a)}var g=t[e],v=r,y=o;for(n(t,r,e),a(t[o],g)>0&&n(t,r,o);v0;)y--}0===a(t[r],g)?n(t,r,y):n(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};function n(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function s(t,e){return te?1:0}t.exports=i},function(t,e){t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},function(t,e,i){var n=i(32),s=i(0),r=i(58),o=i(33),a=i(6),h=new s({initialize:function(t,e){this.world=t,this.gameObject=e,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new a,this.position=new a(e.x-e.displayOriginX,e.y-e.displayOriginY),this.width=e.displayWidth,this.height=e.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new a(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=a.ZERO,this.allowGravity=!1,this.gravity=a.ZERO,this.bounce=a.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=r.STATIC_BODY},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){return void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),this.offset.set(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):o(this,t,e)},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=h},,,,function(t,e,i){var n=i(15);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),u=0;u-1}return!1}},function(t,e,i){var n=i(44),s=i(74),r=i(152);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!1),void 0===o&&(o=!0),!s(t,e,a))return null;var h=a.data[e][t];return null===h?null:(a.data[e][t]=i?null:new n(a,-1,t,e,h.width,h.height),o&&h&&h.collides&&r(t,e,a),h)}},function(t,e,i){var n=i(20),s=i(155),r=i(347),o=i(348),a=i(353);t.exports=function(t,e,i,h,u,l){var c;switch(e){case n.ARRAY_2D:c=s(t,i,h,u,l);break;case n.CSV:c=r(t,i,h,u,l);break;case n.TILED_JSON:c=o(t,i,l);break;case n.WELTMEISTER:c=a(t,i,l);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},function(t,e,i){var n=i(20),s=i(155);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map(function(t){return t.split(",")}),h=s(t,a,i,r,o);return h.format=n.CSV,h}},function(t,e,i){var n=i(20),s=i(76),r=i(901),o=i(903),a=i(904),h=i(906),u=i(907),l=i(908);t.exports=function(t,e,i){if("orthogonal"!==e.orientation)return console.warn("Only orthogonal map types are supported in this version of Phaser"),null;var c=new s({width:e.width,height:e.height,name:t,tileWidth:e.tilewidth,tileHeight:e.tileheight,orientation:e.orientation,format:n.TILED_JSON,version:e.version,properties:e.properties});c.layers=r(e,i),c.images=o(e);var d=a(e);return c.tilesets=d.tilesets,c.imageCollections=d.imageCollections,c.objects=h(e),c.tiles=u(c),l(c),c}},function(t,e){t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),n=Boolean(536870912&t);t&=536870911;var s=0,r=!1;return e&&i&&n?(s=Math.PI/2,r=!0):e&&i&&!n?(s=Math.PI,r=!1):e&&!i&&n?(s=Math.PI/2,r=!1):!e||i||n?!e&&i&&n?(s=3*Math.PI/2,r=!1):e||!i||n?e||i||!n?e||i||n||(s=0,r=!1):(s=3*Math.PI/2,r=!0):(s=Math.PI,r=!0):(s=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:n,rotation:s,flipped:r}}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&ta&&(a=e.layer[u].width),e.layer[u].height>h&&(h=e.layer[u].height);var l=new s({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:n.WELTMEISTER});return l.layers=r(e,i),l.tilesets=o(e),l}},function(t,e,i){var n=i(0),s=i(35),r=i(355),o=i(23),a=i(20),h=i(75),u=i(323),l=i(356),c=i(44),d=i(96),f=i(100),p=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0},addTilesetImage:function(t,e,i,n,s,r,o){if(void 0===t)return null;if(void 0!==e&&null!==e||(e=t),!this.scene.sys.textures.exists(e))return console.warn('Invalid image key given for tileset: "'+e+'"'),null;var h=this.scene.sys.textures.get(e),u=this.getTilesetIndex(t);if(null===u&&this.format===a.TILED_JSON)return console.warn('No data found in the JSON tilemap from Tiled matching the tileset name: "'+t+'"'),null;if(this.tilesets[u])return this.tilesets[u].setTileSize(i,n),this.tilesets[u].setSpacing(s,r),this.tilesets[u].setImage(h),this.tilesets[u];void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0);var l=new f(t,o,i,n,s,r);return l.setImage(h),this.tilesets.push(l),l},convertLayerToStatic:function(t){if(null===(t=this.getLayer(t)))return null;var e=t.tilemapLayer;if(!(e&&e instanceof r))return null;var i=new l(e.scene,e.tilemap,e.layerIndex,e.tileset,e.x,e.y);return this.scene.sys.displayList.add(i),e.destroy(),i},copy:function(t,e,i,n,s,r,o,a){return a=this.getLayer(a),this._isStaticCall(a,"copy")?this:(null!==a&&d.Copy(t,e,i,n,s,r,o,a),this)},createBlankDynamicLayer:function(t,e,i,n,s,o,a,u){if(void 0===a&&(a=e.tileWidth),void 0===u&&(u=e.tileHeight),void 0===s&&(s=this.width),void 0===o&&(o=this.height),void 0===i&&(i=0),void 0===n&&(n=0),null!==this.getLayerIndex(t))return console.warn("Cannot create blank layer: layer with matching name already exists "+t),null;for(var l,d=new h({name:t,tileWidth:a,tileHeight:u,width:s,height:o}),f=0;f0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},function(t,e,i){var n=i(923);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substr(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===n.indexOf(e)&&"_"!==e.substr(0,1)&&i.push({key:e,value:t[e]});return i}},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"tweens",null);return null===e?[]:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(159),s=i(10),r=i(73),o=i(71),a=i(101),h=i(4),u=i(158),l=i(160),c=i(161);t.exports=function(t,e,i){void 0===i&&(i=n);var d=h(e,"from",0),f=h(e,"to",1),p=[{value:d}],g=a(e,"delay",i.delay),v=a(e,"duration",i.duration),y=h(e,"easeParams",i.easeParams),m=o(h(e,"ease",i.ease),y),x=a(e,"hold",i.hold),w=a(e,"repeat",i.repeat),b=a(e,"repeatDelay",i.repeatDelay),T=r(e,"yoyo",i.yoyo),A=[],S=u("value",f),C=c(p[0],"value",S.getEnd,S.getStart,m,g,v,T,x,w,b,!1,!1);C.start=d,C.current=d,C.to=f,A.push(C);var M=new l(t,A,p);M.offset=s(e,"offset",null),M.completeDelay=s(e,"completeDelay",0),M.loop=Math.round(s(e,"loop",0)),M.loopDelay=Math.round(s(e,"loopDelay",0)),M.paused=r(e,"paused",!1),M.useFrames=r(e,"useFrames",!1);for(var E=h(e,"callbackScope",M),_=[M,null],L=l.TYPES,P=0;P0?Math.floor(v/p.length):h(e,"duration",g.duration),g.delay=h(e,"delay",g.delay),g.easeParams=c(e,"easeParams",g.easeParams),g.ease=a(c(e,"ease",g.ease),g.easeParams),g.hold=h(e,"hold",g.hold),g.repeat=h(e,"repeat",g.repeat),g.repeatDelay=h(e,"repeatDelay",g.repeatDelay),g.yoyo=o(e,"yoyo",g.yoyo),g.flipX=o(e,"flipX",g.flipX),g.flipY=o(e,"flipY",g.flipY);for(var y=0;y0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=o.PAUSED,!1)},resetTweens:function(t){for(var e=0;e0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&t.func.apply(t.scope,t.params),this.emit("loop",this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit("complete",this),this.state=o.PENDING_REMOVE}},update:function(t,e){if(this.state!==o.PAUSED){var i=e;switch(this.useFrames&&(e=1*this.manager.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var n=this.totalData,s=0;s=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.nextTick&&this.currentAnim.setFrame(this))},updateFrame:function(t){var e=this.parent;if(this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;i.onUpdate&&i.onUpdate.apply(i.callbackScope,this._updateParams),t.onUpdate&&t.onUpdate(e,t)}},yoyo:function(t){return void 0===t?this._yoyo:(this._yoyo=t,this)},destroy:function(){}});t.exports=n},,function(t,e,i){i(367),i(368),i(369),i(370),i(371),i(372),i(373),i(374),i(375)},function(t,e){Array.prototype.forEach||(Array.prototype.forEach=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,t)for(var e=0;e=0&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e){t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}}},function(t,e){var i={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.scene.sys.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}};t.exports=i},function(t,e){t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},function(t,e,i){var n=i(8),s=i(185),r=i(6),o={getCenter:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,t},getTopLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getTopRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBounds:function(t){void 0===t&&(t=new n),this.getTopLeft(t);var e=t.x,i=t.y;this.getTopRight(t);var s=t.x,r=t.y;this.getBottomLeft(t);var o=t.x,a=t.y;this.getBottomRight(t);var h=t.x,u=t.y;return t.x=Math.min(e,s,o,h),t.y=Math.min(i,r,a,u),t.width=Math.max(e,s,o,h)-t.x,t.height=Math.max(i,r,a,u)-t.y,t}};t.exports=o},function(t,e){var i={matrixStack:null,currentMatrix:null,currentMatrixIndex:0,initMatrixStack:function(){return this.matrixStack=new Float32Array(6e3),this.currentMatrix=new Float32Array([1,0,0,1,0,0]),this.currentMatrixIndex=0,this},save:function(){if(this.currentMatrixIndex>=this.matrixStack.length)return this;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return this.currentMatrixIndex+=6,t[i+0]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=e[3],t[i+4]=e[4],t[i+5]=e[5],this},restore:function(){if(this.currentMatrixIndex<=0)return this;this.currentMatrixIndex-=6;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return e[0]=t[i+0],e[1]=t[i+1],e[2]=t[i+2],e[3]=t[i+3],e[4]=t[i+4],e[5]=t[i+5],this},loadIdentity:function(){return this.setTransform(1,0,0,1,0,0),this},transform:function(t,e,i,n,s,r){var o=this.currentMatrix,a=o[0],h=o[1],u=o[2],l=o[3],c=o[4],d=o[5];return o[0]=a*t+u*e,o[1]=h*t+l*e,o[2]=a*i+u*n,o[3]=h*i+l*n,o[4]=a*s+u*r+c,o[5]=h*s+l*r+d,this},setTransform:function(t,e,i,n,s,r){var o=this.currentMatrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},translate:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3],a=i[4],h=i[5];return i[4]=n*t+r*e+a,i[5]=s*t+o*e+h,this},scale:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3];return i[0]=n*t,i[1]=s*t,i[2]=r*e,i[3]=o*e,this},rotate:function(t){var e=this.currentMatrix,i=e[0],n=e[1],s=e[2],r=e[3],o=Math.sin(t),a=Math.cos(t);return e[0]=i*a+s*o,e[1]=n*a+r*o,e[2]=s*-o+s*a,e[3]=r*-o+r*a,this}};t.exports=i},function(t,e){var i={originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=Math.round(this.originX*this.width),this._displayOriginY=Math.round(this.originY*this.height),this}};t.exports=i},function(t,e,i){var n=i(62),s={_scaleMode:n.DEFAULT,scaleMode:{get:function(){return this._scaleMode},set:function(t){t!==n.LINEAR&&t!==n.NEAREST||(this._scaleMode=t)}},setScaleMode:function(t){return this.scaleMode=t,this}};t.exports=s},function(t,e){var i={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}};t.exports=i},function(t,e){var i={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.frame.realWidth},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return this.scaleY*this.frame.realHeight},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){return void 0===t&&(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=i},function(t,e){var i={texture:null,frame:null,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this.frame.customPivot&&this.setOrigin(this.frame.pivotX,this.frame.pivotY),this}};t.exports=i},function(t,e){var i=function(t){return(t>>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,n,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,n=t,s=t),this._tintTL=i(t),this._tintTR=i(e),this._tintBL=i(n),this._tintBR=i(s),this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t)}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t)}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t)}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t)}},tint:{set:function(t){this.setTint(t,t,t,t)}}};t.exports=n},function(t,e){t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,scaleMode:t.scaleMode,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},function(t,e,i){var n=i(16),s=i(162),r=i(163),o={_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4}},angle:{get:function(){return r(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=r(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=s(t)}},setPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this}};t.exports=o},function(t,e){var i={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}};t.exports=i},function(t,e){t.exports=function(t,e){for(var i=0;i0?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a1)if(0===s){var d=t.length-1;for(o=t[d].x,a=t[d].y,h=d-1;h>=0;h--)u=(c=t[h]).x,l=c.y,c.x=o,c.y=a,o=u,a=l;t[d].x=e,t[d].y=i}else{for(o=t[0].x,a=t[0].y,h=1;h0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.1&&(e.zoom=.1))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(114),CameraManager:i(445)}},function(t,e,i){var n=i(114),s=i(0),r=i(2),o=i(12),a=i(33),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.currentCameraId=1,this.cameras=[],this.cameraPool=[],t.sys.settings.cameras?this.fromJSON(t.sys.settings.cameras):this.add(),this.main=this.cameras[0],this.baseScale=1},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i,s,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===s&&(s=this.scene.sys.game.config.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=null;return this.cameraPool.length>0?(a=this.cameraPool.pop()).setViewport(t,e,i,s):a=new n(t,e,i,s),a.setName(o),a.setScene(this.scene),this.cameras.push(a),r&&(this.main=a),a._id=this.currentCameraId,this.currentCameraId=this.currentCameraId<<1,a},addExisting:function(t){var e=this.cameras.indexOf(t),i=this.cameraPool.indexOf(t);return e<0&&i>=0?(this.cameras.push(t),this.cameraPool.slice(i,1),t):null},fromJSON:function(t){Array.isArray(t)||(t=[t]);for(var e=this.scene.sys.game.config.width,i=this.scene.sys.game.config.height,n=0;n=0;i--){var n=e[i];if(n.inputEnabled&&a(n,t.x,t.y))return n}},remove:function(t){var e=this.cameras.indexOf(t);e>=0&&this.cameras.length>1&&(this.cameraPool.push(this.cameras[e]),this.cameras.splice(e,1),this.main===t&&(this.main=this.cameras[0]))},render:function(t,e,i){for(var n=this.cameras,s=this.baseScale,r=0,o=n.length;r0;)this.cameraPool.push(this.cameras.pop());return this.main=this.add(),this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(211),r=i(212),o=i(12),a=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.cameras=[],t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i){return this.addPerspectiveCamera(t,e,i)},addOrthographicCamera:function(t,e){var i=this.scene.sys.game.config;void 0===t&&(t=i.width),void 0===e&&(e=i.height);var n=new s(this.scene,t,e);return this.cameras.push(n),n},addPerspectiveCamera:function(t,e,i){var n=this.scene.sys.game.config;void 0===t&&(t=80),void 0===e&&(e=n.width),void 0===i&&(i=n.height);var s=new r(this.scene,t,e,i);return this.cameras.push(s),s},getCamera:function(t){return this.cameras.forEach(function(e){if(e.name===t)return e}),null},removeCamera:function(t){var e=this.cameras.indexOf(t);-1!==e&&this.cameras.splice(e,1)},removeAll:function(){for(;this.cameras.length>0;){this.cameras.pop().destroy()}return this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new c);for(var i=t*this.getLength(),n=this.getCurveLengths(),s=0;s=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},getRandomPoint:function(t){return void 0===t&&(t=new c),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new c),t.copy(this.startPoint)},lineTo:function(t,e){t instanceof c?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new l(t))},moveTo:function(t,e){return this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e,i){var n=i(36),s=i(224);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,u=2*i-h;r=s(u,h,t+1/3),o=s(u,h,t),a=s(u,h,t-1/3)}return(new n).setGLTo(r,o,a,1)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){var n=i(225);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n(s/359,t,e));return i}},function(t,e,i){var n=i(226),s=function(t,e,i,s,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var u=h/a;return{r:n(t,s,u),g:n(e,r,u),b:n(i,o,u)}};t.exports={RGBWithRGB:s,ColorWithRGB:function(t,e,i,n,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),s(t.r,t.g,t.b,e,i,n,r,o)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),s(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(228),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e){t.exports=function(t,e,i){t/=255,e/=255,i/=255;var n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n,o=0;return s!==n&&(s===t?o=(e-i)/r+(e1)for(var i=1;i0||n._flashAlpha>0)&&(s.globalCompositeOperation="source-over",s.fillStyle="rgb("+255*n._fadeRed+","+255*n._fadeGreen+","+255*n._fadeBlue+")",s.globalAlpha=n._fadeAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.fillStyle="rgb("+255*n._flashRed+","+255*n._flashGreen+","+255*n._flashBlue+")",s.globalAlpha=n._flashAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.globalAlpha=1),r&&s.restore()},postRender:function(){var t=this.gameContext;t.globalAlpha=1,t.globalCompositeOperation="source-over",this.currentAlpha=1,this.currentBlendMode=0,this.snapshotCallback&&(this.snapshotCallback(s(this.gameCanvas,this.snapshotType,this.snapshotEncoder)),this.snapshotCallback=null)},snapshot:function(t,e,i){this.snapshotCallback=t,this.snapshotType=e,this.snapshotEncoder=i},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e){t.exports=function(t,e,i){var n=this.currentContext,s=i.canvasData;n.drawImage(i.source.image,s.sx,s.sy,s.sWidth,s.sHeight,t,e,s.dWidth,s.dHeight)}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e="image/png"),void 0===i&&(i=.92);var n=t.toDataURL(e,i),s=new Image;return s.src=n,s}},function(t,e){t.exports=function(t,e){var i=this.currentContext,n=t.frame,s=n.canvasData;this.currentBlendMode!==t.blendMode&&(this.currentBlendMode=t.blendMode,i.globalCompositeOperation=this.blendModes[t.blendMode]),this.currentAlpha!==t.alpha&&(this.currentAlpha=t.alpha,i.globalAlpha=t.alpha),this.currentScaleMode!==t.scaleMode&&(this.currentScaleMode=t.scaleMode);var r=n.x,o=n.y,a=1,h=1;t.flipX?(a=-1,r-=s.dWidth-t.displayOriginX):r-=t.displayOriginX,t.flipY?(h=-1,o-=s.dHeight-t.displayOriginY):o-=t.displayOriginY,i.save(),i.translate(t.x-e.scrollX*t.scrollFactorX,t.y-e.scrollY*t.scrollFactorY),i.rotate(t.rotation),i.scale(t.scaleX,t.scaleY),i.scale(a,h),i.drawImage(n.source.image,s.sx,s.sy,s.sWidth,s.sHeight,r,o,s.dWidth,s.dHeight),i.restore()}},function(t,e,i){var n=i(45),s=i(234);t.exports=function(){var t=[],e=s.supportNewBlendModes;return t[n.NORMAL]="source-over",t[n.ADD]="lighter",t[n.MULTIPLY]=e?"multiply":"source-over",t[n.SCREEN]=e?"screen":"source-over",t[n.OVERLAY]=e?"overlay":"source-over",t[n.DARKEN]=e?"darken":"source-over",t[n.LIGHTEN]=e?"lighten":"source-over",t[n.COLOR_DODGE]=e?"color-dodge":"source-over",t[n.COLOR_BURN]=e?"color-burn":"source-over",t[n.HARD_LIGHT]=e?"hard-light":"source-over",t[n.SOFT_LIGHT]=e?"soft-light":"source-over",t[n.DIFFERENCE]=e?"difference":"source-over",t[n.EXCLUSION]=e?"exclusion":"source-over",t[n.HUE]=e?"hue":"source-over",t[n.SATURATION]=e?"saturation":"source-over",t[n.COLOR]=e?"color":"source-over",t[n.LUMINOSITY]=e?"luminosity":"source-over",t}},function(t,e,i){var n=i(0),s=i(22),r=i(125),o=i(42),a=i(507),h=i(508),u=i(511),l=i(237),c=i(238),d=new n({initialize:function(t){var e=this,i={alpha:t.config.transparent,depth:!1,antialias:t.config.antialias,premultipliedAlpha:t.config.transparent,stencil:!0,preserveDrawingBuffer:t.config.preserveDrawingBuffer,failIfMajorPerformanceCaveat:!1,powerPreference:t.config.powerPreference};this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,contextCreation:i,resolution:t.config.resolution,autoResize:t.config.autoResize},this.game=t,this.type=s.WEBGL,this.width=t.config.width,this.height=t.config.height,this.canvas=t.canvas,this.lostContextCallbacks=[],this.restoredContextCallbacks=[],this.blendModes=[],this.nativeTextures=[],this.contextLost=!1,this.pipelines=null,this.snapshotState={callback:null,type:null,encoder:null},this.currentActiveTextureUnit=0,this.currentTextures=new Array(16),this.currentFramebuffer=null,this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=new Uint32Array([0,0,this.width,this.height]),this.currentScissorIdx=0,this.scissorStack=new Uint32Array(4e3),this.canvas.addEventListener("webglcontextlost",function(t){e.contextLost=!0,t.preventDefault();for(var i=0;i=0&&n>=0;if(r[0]===t&&r[1]===e&&r[2]===i&&r[3]===n||this.flush(),r[0]=t,r[1]=e,r[2]=i,r[3]=n,this.currentScissorEnabled=o,!o)return s.enable(s.SCISSOR_TEST),s.scissor(t,s.drawingBufferHeight-e-n,i,n),this;s.disable(s.SCISSOR_TEST)},pushScissor:function(t,e,i,n){var s=this.scissorStack,r=this.currentScissorIdx,o=this.currentScissor;return s[r+0]=o[0],s[r+1]=o[1],s[r+2]=o[2],s[r+3]=o[3],this.currentScissorIdx+=4,this.setScissor(t,e,i,n),this},popScissor:function(){var t=this.scissorStack,e=this.currentScissorIdx-4,i=t[e+0],n=t[e+1],s=t[e+2],r=t[e+3];return this.currentScissorIdx=e,this.setScissor(i,n,s,r),this},setPipeline:function(t){return this.currentPipeline===t&&this.currentPipeline.vertexBuffer===this.currentVertexBuffer&&this.currentPipeline.program===this.currentProgram||(this.flush(),this.currentPipeline=t,this.currentPipeline.bind()),this.currentPipeline.onBind(),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==s.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t&&(this.flush(),e.enable(e.BLEND),e.blendEquation(i.equation),i.func.length>2?e.blendFuncSeparate(i.func[0],i.func[1],i.func[2],i.func[3]):e.blendFunc(i.func[0],i.func[1]),this.currentBlendMode=t),this},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>16&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setTexture2D:function(t,e){var i=this.gl;return t!==this.currentTextures[e]&&(this.flush(),this.currentActiveTextureUnit!==e&&(i.activeTexture(i.TEXTURE0+e),this.currentActiveTextureUnit=e),i.bindTexture(i.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t){var e=this.gl;return t!==this.currentFramebuffer&&(this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),this.currentFramebuffer=t),this},setProgram:function(t){var e=this.gl;return t!==this.currentProgram&&(this.flush(),e.useProgram(t),this.currentProgram=t),this},setVertexBuffer:function(t){var e=this.gl;return t!==this.currentVertexBuffer&&(this.flush(),e.bindBuffer(e.ARRAY_BUFFER,t),this.currentVertexBuffer=t),this},setIndexBuffer:function(t){var e=this.gl;return t!==this.currentIndexBuffer&&(this.flush(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.currentIndexBuffer=t),this},createTextureFromSource:function(t,e,i,n){var o=this.gl,a=o.NEAREST,h=o.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,r(e,i)&&(h=o.REPEAT),n===s.ScaleModes.LINEAR?a=o.LINEAR:(n===s.ScaleModes.NEAREST||this.config.pixelArt)&&(a=o.NEAREST),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,o.RGBA,t):this.createTexture2D(0,a,a,h,h,o.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,u){var l=this.gl,c=l.createTexture();return u=void 0===u||null===u||u,this.setTexture2D(c,0),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,s),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,n),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),null===o||void 0===o?l.texImage2D(l.TEXTURE_2D,t,r,a,h,0,r,l.UNSIGNED_BYTE,null):(l.texImage2D(l.TEXTURE_2D,t,r,r,l.UNSIGNED_BYTE,o),a=o.width,h=o.height),this.setTexture2D(null,0),c.isAlphaPremultiplied=u,c.isRenderTexture=!1,c.width=a,c.height=h,this.nativeTextures.push(c),c},createFramebuffer:function(t,e,i,n){var s,r=this.gl,o=r.createFramebuffer();if(this.setFramebuffer(o),n){var a=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,a),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)}if(i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),(s=r.checkFramebufferStatus(r.FRAMEBUFFER))!==r.FRAMEBUFFER_COMPLETE){throw new Error("Framebuffer incomplete. Framebuffer status: "+{36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"}[s])}return o.renderTexture=i,this.setFramebuffer(null),o},createProgram:function(t,e){var i=this.gl,n=i.createProgram(),s=i.createShader(i.VERTEX_SHADER),r=i.createShader(i.FRAGMENT_SHADER);if(i.shaderSource(s,t),i.shaderSource(r,e),i.compileShader(s),i.compileShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS))throw new Error("Failed to compile Vertex Shader:\n"+i.getShaderInfoLog(s));if(!i.getShaderParameter(r,i.COMPILE_STATUS))throw new Error("Failed to compile Fragment Shader:\n"+i.getShaderInfoLog(r));if(i.attachShader(n,s),i.attachShader(n,r),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS))throw new Error("Failed to link program:\n"+i.getProgramInfoLog(n));return n},createVertexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setVertexBuffer(n),i.bufferData(i.ARRAY_BUFFER,t,e),this.setVertexBuffer(null),n},createIndexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setIndexBuffer(n),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t,e),this.setIndexBuffer(null),n},deleteTexture:function(t){return this.gl.deleteTexture(t),this},deleteFramebuffer:function(t){return this.gl.deleteFramebuffer(t),this},deleteProgram:function(t){return this.gl.deleteProgram(t),this},deleteBuffer:function(t){return this.gl.deleteBuffer(t),this},preRenderCamera:function(t){var e=this.config.resolution;if(this.pushScissor(t.x*e,t.y*e,t.width*e,t.height*e),t.backgroundColor.alphaGL>0){var i=t.backgroundColor,n=this.pipelines.FlatTintPipeline;n.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(i.redGL,i.greenGL,i.blueGL,1),i.alphaGL,1,0,0,1,0,0,[1,0,0,1,0,0]),n.flush()}},postRenderCamera:function(t){if(t._fadeAlpha>0||t._flashAlpha>0){var e=this.pipelines.FlatTintPipeline;e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._fadeRed,t._fadeGreen,t._fadeBlue,1),t._fadeAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._flashRed,t._flashGreen,t._flashBlue,1),t._flashAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.flush()}this.popScissor()},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),this.config.clearBeforeRender&&t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT);for(var n in i)i[n].onPreRender()}},render:function(t,e,i,n){if(!this.contextLost){var r=e.list,o=r.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var u=0;uthis.vertexCapacity&&this.flush();this.renderer.config.resolution;var x=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount,T=r+a,A=o+h,S=m[0],C=m[1],M=m[2],E=m[3],_=d*S+f*M,L=d*C+f*E,P=p*S+g*M,F=p*C+g*E,k=v*S+y*M+m[4],R=v*C+y*E+m[5],O=r*_+o*P+k,D=r*L+o*F+R,I=r*_+A*P+k,B=r*L+A*F+R,Y=T*_+A*P+k,X=T*L+A*F+R,z=T*_+o*P+k,N=T*L+o*F+R,W=u.getTintAppendFloatAlphaAndSwap(l,c);x[b+0]=O,x[b+1]=D,w[b+2]=W,x[b+3]=I,x[b+4]=B,w[b+5]=W,x[b+6]=Y,x[b+7]=X,w[b+8]=W,x[b+9]=O,x[b+10]=D,w[b+11]=W,x[b+12]=Y,x[b+13]=X,w[b+14]=W,x[b+15]=z,x[b+16]=N,w[b+17]=W,this.vertexCount+=6},batchFillTriangle:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y,m,x,w){this.renderer.setPipeline(this),this.vertexCount+3>this.vertexCapacity&&this.flush();this.renderer.config.resolution;var b=this.vertexViewF32,T=this.vertexViewU32,A=this.vertexCount*this.vertexComponentCount,S=w[0],C=w[1],M=w[2],E=w[3],_=p*S+g*M,L=p*C+g*E,P=v*S+y*M,F=v*C+y*E,k=m*S+x*M+w[4],R=m*C+x*E+w[5],O=r*_+o*P+k,D=r*L+o*F+R,I=a*_+h*P+k,B=a*L+h*F+R,Y=l*_+c*P+k,X=l*L+c*F+R,z=u.getTintAppendFloatAlphaAndSwap(d,f);b[A+0]=O,b[A+1]=D,T[A+2]=z,b[A+3]=I,b[A+4]=B,T[A+5]=z,b[A+6]=Y,b[A+7]=X,T[A+8]=z,this.vertexCount+=3},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,y,m,x,w){var b=this.tempTriangle;b[0].x=r,b[0].y=o,b[0].width=c,b[0].rgb=d,b[0].alpha=f,b[1].x=a,b[1].y=h,b[1].width=c,b[1].rgb=d,b[1].alpha=f,b[2].x=u,b[2].y=l,b[2].width=c,b[2].rgb=d,b[2].alpha=f,b[3].x=r,b[3].y=o,b[3].width=c,b[3].rgb=d,b[3].alpha=f,this.batchStrokePath(t,e,i,n,s,b,c,d,f,p,g,v,y,m,x,!1,w)},batchFillPath:function(t,e,i,n,s,o,a,h,l,c,d,f,p,g,v){this.renderer.setPipeline(this);this.renderer.config.resolution;for(var y,m,x,w,b,T,A,S,C,M,E,_,L,P,F,k,R,O=o.length,D=this.polygonCache,I=this.vertexViewF32,B=this.vertexViewU32,Y=0,X=v[0],z=v[1],N=v[2],W=v[3],G=l*X+c*N,U=l*z+c*W,V=d*X+f*N,H=d*z+f*W,j=p*X+g*N+v[4],q=p*z+g*W+v[5],K=u.getTintAppendFloatAlphaAndSwap(a,h),J=0;Jthis.vertexCapacity&&this.flush(),Y=this.vertexCount*this.vertexComponentCount,_=(T=D[x+0])*G+(A=D[x+1])*V+j,L=T*U+A*H+q,P=(S=D[w+0])*G+(C=D[w+1])*V+j,F=S*U+C*H+q,k=(M=D[b+0])*G+(E=D[b+1])*V+j,R=M*U+E*H+q,I[Y+0]=_,I[Y+1]=L,B[Y+2]=K,I[Y+3]=P,I[Y+4]=F,B[Y+5]=K,I[Y+6]=k,I[Y+7]=R,B[Y+8]=K,this.vertexCount+=3;D.length=0},batchStrokePath:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y){var m,x;this.renderer.setPipeline(this);for(var w,b,T,A,S=r.length,C=this.polygonCache,M=this.vertexViewF32,E=this.vertexViewU32,_=u.getTintAppendFloatAlphaAndSwap,L=0;L+1this.vertexCapacity&&this.flush(),w=C[P-1]||C[F-1],b=C[P],M[(T=this.vertexCount*this.vertexComponentCount)+0]=w[6],M[T+1]=w[7],E[T+2]=_(w[8],h),M[T+3]=w[0],M[T+4]=w[1],E[T+5]=_(w[2],h),M[T+6]=b[9],M[T+7]=b[10],E[T+8]=_(b[11],h),M[T+9]=w[0],M[T+10]=w[1],E[T+11]=_(w[2],h),M[T+12]=w[6],M[T+13]=w[7],E[T+14]=_(w[8],h),M[T+15]=b[3],M[T+16]=b[4],E[T+17]=_(b[5],h),this.vertexCount+=6;C.length=0},batchLine:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y,m,x,w,b){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();this.renderer.config.resolution;var T=b[0],A=b[1],S=b[2],C=b[3],M=g*T+v*S,E=g*A+v*C,_=y*T+m*S,L=y*A+m*C,P=x*T+w*S+b[4],F=x*A+w*C+b[5],k=this.vertexViewF32,R=this.vertexViewU32,O=a-r,D=h-o,I=Math.sqrt(O*O+D*D),B=l*(h-o)/I,Y=l*(r-a)/I,X=c*(h-o)/I,z=c*(r-a)/I,N=a-X,W=h-z,G=r-B,U=o-Y,V=a+X,H=h+z,j=r+B,q=o+Y,K=N*M+W*_+P,J=N*E+W*L+F,Z=G*M+U*_+P,Q=G*E+U*L+F,$=V*M+H*_+P,tt=V*E+H*L+F,et=j*M+q*_+P,it=j*E+q*L+F,nt=u.getTintAppendFloatAlphaAndSwap,st=nt(d,p),rt=nt(f,p),ot=this.vertexCount*this.vertexComponentCount;return k[ot+0]=K,k[ot+1]=J,R[ot+2]=rt,k[ot+3]=Z,k[ot+4]=Q,R[ot+5]=st,k[ot+6]=$,k[ot+7]=tt,R[ot+8]=rt,k[ot+9]=Z,k[ot+10]=Q,R[ot+11]=st,k[ot+12]=et,k[ot+13]=it,R[ot+14]=st,k[ot+15]=$,k[ot+16]=tt,R[ot+17]=rt,this.vertexCount+=6,[K,J,f,Z,Q,d,$,tt,f,et,it,d]},batchGraphics:function(t,e){if(!(t.commandBuffer.length<=0)){this.renderer.setPipeline(this);var i,n,r=e.scrollX*t.scrollFactorX,o=e.scrollY*t.scrollFactorY,a=t.x-r,h=t.y-o,u=t.scaleX,l=t.scaleY,y=-t.rotation,m=t.commandBuffer,x=1,w=1,b=0,T=0,A=1,S=e.matrix.matrix,C=null,M=0,E=0,_=0,L=0,P=0,F=0,k=0,R=0,O=0,D=null,I=Math.sin,B=Math.cos,Y=I(y),X=B(y),z=X*u,N=-Y*u,W=Y*l,G=X*l,U=a,V=h,H=S[0],j=S[1],q=S[2],K=S[3],J=z*H+N*q,Z=z*j+N*K,Q=W*H+G*q,$=W*j+G*K,tt=U*H+V*q+S[4],et=U*j+V*K+S[5];v.length=0;for(var it=0,nt=m.length;it0){var st=C.points[0],rt=C.points[C.points.length-1];C.points.push(st),C=new d(rt.x,rt.y,rt.width,rt.rgb,rt.alpha),v.push(C)}break;case s.FILL_PATH:for(i=0,n=v.length;i=1)&&(r.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(r.mspointer=!0),navigator.getGamepads&&(r.gamepads=!0),n.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll")),r)},function(t,e,i){var n=i(82),s={audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(n.edge)s.dolby=!0;else if(n.safari&&n.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var i=parseInt(RegExp.$1,10),r=parseInt(RegExp.$2,10);(10===i&&r>=11||i>10)&&(s.dolby=!0)}}catch(t){}return s}()},function(t,e){var i={h264Video:!1,hlsVideo:!1,mp4Video:!1,oggVideo:!1,vp9Video:!1,webmVideo:!1};t.exports=function(){var t=document.createElement("video"),e=!!t.canPlayType;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(i.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.h264Video=!0,i.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(i.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(i.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.hlsVideo=!0))}catch(t){}return i}()},function(t,e){var i={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){var t,e=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],n=document.createElement("div");for(t=0;t0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(s=!0,i=n(t,e))}else s=!0,i=n(t,e);return!s&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},function(t,e){t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},function(t,e){t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},function(t,e,i){var n=i(128),s={};for(var r in n)s[n[r]]=r;t.exports=s},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.altKey=e.altKey,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.location=e.location,t.isDown=!0,t.isUp=!1,t.timeDown=e.timeStamp,t.duration=0,t.repeats++,t._justDown=!0,t._justUp=!1,t}},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.isDown=!1,t.isUp=!0,t.timeUp=e.timeStamp,t.duration=t.timeUp-t.timeDown,t.repeats=0,t._justDown=!1,t._justUp=!0,t}},function(t,e,i){var n=i(2),s=i(253);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=n(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(s(e+"Physics")),i)for(var o in i)o=s(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},function(t,e,i){var n=i(2);t.exports=function(t){var e=t.game.config.defaultPlugins,i=n(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},function(t,e){t.exports={game:"game",anims:"anims",cache:"cache",registry:"registry",sound:"sound",textures:"textures",events:"events",cameras:"cameras",cameras3d:"cameras3d",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e,i){var n=i(52);t.exports=function(t,e,i){if(i.frames||i.textures){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var r,o=Array.isArray(i.textures)?i.textures[0].frames:i.frames,a=0;ag||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,y=f,m=0,x=0,w=0;wr&&(m=b-r),T>o&&(x=T-o),t.add(w,e,i+v,s+y,h-m,u-x),(v+=h+p)+h>r&&(v=f,y+=u+p)}return t}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){var s=n(i,"frameWidth",null),r=n(i,"frameHeight",s);if(!s)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o,a=n(i,"startFrame",0),h=n(i,"endFrame",-1),u=n(i,"margin",0),l=n(i,"spacing",0),c=e.cutX,d=e.cutY,f=e.cutWidth,p=e.cutHeight,g=e.realWidth,v=e.realHeight,y=Math.floor((g-u+l)/(s+l)),m=Math.floor((v-u+l)/(r+l)),x=y*m,w=e.x,b=s-w,T=s-(g-f-w),A=e.y,S=r-A,C=r-(v-p-A);(a>x||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var M=u,E=u,_=0,L=e.sourceIndex,P=0;P0||!this.inFocus)&&(this._coolDown--,s=Math.min(s,this._target)),s>this._min&&(s=i[e],s=Math.min(s,this._min)),i[e]=s,this.deltaIndex++,this.deltaIndex>n&&(this.deltaIndex=0);for(var r=0,o=0;othis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var a=r/this._target;this.callback(t,r,a),this.lastTime=t},tick:function(){this.step(window.performance.now())},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running?this.sleep():t&&(this.startTime+=-this.lastTime+(this.lastTime=window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step(window.performance.now())},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e){t.exports=function(t){var e;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(e){document.hidden||"pause"===e.type?t.emit("hidden"):t.emit("visible")},!1),window.onblur=function(){t.emit("blur")},window.onfocus=function(){t.emit("focus")}}},function(t,e,i){var n={DisplayList:i(544),GameObjectCreator:i(13),GameObjectFactory:i(9),UpdateList:i(545),Components:i(11),BitmapText:i(131),Blitter:i(132),DynamicBitmapText:i(133),Graphics:i(134),Group:i(69),Image:i(70),Particles:i(137),PathFollower:i(289),RenderTexture:i(139),Sprite3D:i(81),Sprite:i(37),Text:i(140),TileSprite:i(141),Zone:i(77),Factories:{Blitter:i(628),DynamicBitmapText:i(629),Graphics:i(630),Group:i(631),Image:i(632),Particles:i(633),PathFollower:i(634),RenderTexture:i(635),Sprite3D:i(636),Sprite:i(637),StaticBitmapText:i(638),Text:i(639),TileSprite:i(640),Zone:i(641)},Creators:{Blitter:i(642),DynamicBitmapText:i(643),Graphics:i(644),Group:i(645),Image:i(646),Particles:i(647),RenderTexture:i(648),Sprite3D:i(649),Sprite:i(650),StaticBitmapText:i(651),Text:i(652),TileSprite:i(653),Zone:i(654)}};n.Mesh=i(88),n.Quad=i(143),n.Factories.Mesh=i(658),n.Factories.Quad=i(659),n.Creators.Mesh=i(660),n.Creators.Quad=i(661),n.Light=i(291),i(292),i(662),t.exports=n},function(t,e,i){var n=i(0),s=i(86),r=i(12),o=i(266),a=new n({Extends:s,initialize:function(t){s.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(o.inplace(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},sortGameObjects:function(t){return void 0===t&&(t=this.list),this.scene.sys.depthSort(),t.sort(this.sortIndexHandler.bind(this))},getTopGameObject:function(t){return this.sortGameObjects(t),t[t.length-1]}});r.register("DisplayList",a,"displayList"),t.exports=a},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this._list=[],this._pendingInsertion=[],this._pendingRemoval=[]},boot:function(){var t=this.systems.events;t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t){return-1===this._list.indexOf(t)&&-1===this._pendingInsertion.indexOf(t)&&this._pendingInsertion.push(t),t},preUpdate:function(){var t=this._pendingRemoval.length,e=this._pendingInsertion.length;if(0!==t||0!==e){var i,n;for(i=0;i-1&&this._list.splice(s,1)}this._list=this._list.concat(this._pendingInsertion.splice(0)),this._pendingRemoval.length=0,this._pendingInsertion.length=0}},update:function(t,e){for(var i=0;ia.length&&(f=a.length);for(var p=u,g=l,v={retroFont:!0,font:h,size:i,lineHeight:s,chars:{}},y=0,m=0;m?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",s.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",s.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",s.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",s.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",s.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",s.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",s.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",t.exports=s},function(t,e,i){var n=i(3),s=i(3);n=i(549),s=i(550),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text.length;n.RENDER_MASK!==e.renderFlags||0===r||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchBitmapText(this,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=s.scrollX*e.scrollFactorX,u=s.scrollY*e.scrollFactorY,l=e.fontData.chars,c=e.fontData.lineHeight,d=0,f=0,p=0,g=0,v=null,y=0,m=0,x=0,w=0,b=0,T=0,A=null,S=0,C=t.currentContext,M=e.frame.source.image,E=a.cutX,_=a.cutY,L=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,C.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,C.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),C.save(),C.translate(e.x-h+e.frame.x,e.y-u+e.frame.y),C.rotate(e.rotation),C.translate(-e.displayOriginX,-e.displayOriginY),C.scale(e.scaleX,e.scaleY);for(var P=0;P0&&e.cameraFilter&s._id||this.pipeline.drawBlitter(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=e.getRenderList();t.setBlendMode(e.blendMode);for(var o=t.gameContext,a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY,u=0;u0&&e.cameraFilter&s._id||this.pipeline.batchDynamicBitmapText(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.displayCallback,u=s.scrollX*e.scrollFactorX,l=s.scrollY*e.scrollFactorY,c=e.fontData.chars,d=e.fontData.lineHeight,f=0,p=0,g=0,v=0,y=null,m=0,x=0,w=0,b=0,T=0,A=0,S=null,C=0,M=t.currentContext,E=e.frame.source.image,_=a.cutX,L=a.cutY,P=0,F=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,M.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,M.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),M.save(),M.translate(e.x,e.y),M.rotate(e.rotation),M.translate(-e.displayOriginX,-e.displayOriginY),M.scale(e.scaleX,e.scaleY),e.cropWidth>0&&e.cropHeight>0&&(M.save(),M.beginPath(),M.rect(0,0,e.cropWidth,e.cropHeight),M.clip());for(var k=0;k0&&e.cropHeight>0&&M.restore(),M.restore()}}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(135);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(3),s=i(3);n=i(568),s=i(273),s=i(273),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchGraphics(this,s)}},function(t,e,i){var n=i(3),s=i(3);n=i(570),s=i(571),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t,e,i,n,r){if("object"==typeof t){var o=t;t=s(o,"x",0),e=s(o,"y",0),i=s(o,"power",0),n=s(o,"epsilon",100),r=s(o,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=50);this.x=t,this.y=e,this.active=!0,this._gravity=r,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i=this.x-t.x,n=this.y-t.y,s=i*i+n*n;if(0!==s){var r=Math.sqrt(s);s0&&this.getParticleCount()===this.maxParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,n=i.length,s=0;s0?n.pop():new this.particleClass(this)).fire(e,i),this.particleBringToTop?this.alive.push(r):this.alive.unshift(r),this.emitCallback&&this.emitCallback.call(this.emitCallbackScope,r,this),this.atLimit())break}return r}},preUpdate:function(t,e){var i=(e*=this.timeScale)/1e3;this.trackVisible&&(this.visible=this.follow.visible);for(var n=this.manager.getProcessors(),s=this.alive,r=s.length,o=0;o0){var l=s.splice(s.length-u,u),c=this.deathCallback,d=this.deathCallbackScope;if(c)for(var f=0;f0&&(this._counter-=e,this._counter<=0&&(this.emitParticle(),this._counter=this.frequency-Math.abs(this._counter))))},depthSortCallback:function(t,e){return t.y-e.y},indexSortCallback:function(t,e){return t.index-e.index}});t.exports=x},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=this.source.contains(t.x,t.y);return e&&this.killOnEnter||!e&&!this.killOnEnter}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===n&&(n=!1),void 0===s&&(s=!0),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=n,this.counter=-1,this.seamless=s,this._length=0,this._direction=0,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e,i){var n=i(0),s=i(275),r=i(71),o=i(2),a=i(50),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t=this.propertyValue,e=typeof t;if("number"===e)this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate;else if(Array.isArray(t))this.onEmit=this.randomStaticValueEmit;else if("function"===e)this.emitOnly?this.onEmit=t:this.onUpdate=t;else if("object"===e&&(this.has(t,"random")||this.hasBoth(t,"start","end")||this.hasBoth(t,"min","max"))){this.start=this.has(t,"start")?t.start:t.min,this.end=this.has(t,"end")?t.end:t.max;var i=this.hasBoth(t,"min","max")||this.has(t,"random");if(i){var n=t.random;Array.isArray(n)&&(this.start=n[0],this.end=n[1]),this.onEmit=this.randomRangedValueEmit}if(this.has(t,"steps"))this.steps=t.steps,this.counter=this.start,this.onEmit=this.steppedEmit;else{var s=this.has(t,"ease")?t.ease:"Linear";this.ease=r(s),i||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate}}else"object"===e&&this.hasEither(t,"onEmit","onUpdate")&&(this.has(t,"onEmit")&&(this.onEmit=t.onEmit),this.has(t,"onUpdate")&&(this.onUpdate=t.onUpdate));return this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(276),s=i(277),r=i(278),o=i(279),a=i(280),h=i(281),u=i(282),l=i(283),c=i(284),d=i(285),f=i(286),p=i(287);t.exports={Power0:u,Power1:l.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:u,Quad:l.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:n.Out,Bounce:s.Out,Stepped:p,"Quad.easeIn":l.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":n.In,"Bounce.easeIn":s.In,"Quad.easeOut":l.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":n.Out,"Bounce.easeOut":s.Out,"Quad.easeInOut":l.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":n.InOut,"Bounce.easeInOut":s.InOut}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},function(t,e){t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},function(t,e){t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},function(t,e){t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},function(t,e){t.exports=function(t){return Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},function(t,e){t.exports=function(t){return t*t*t}},function(t,e){t.exports=function(t){return--t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/i)+1}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*.5+1}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},function(t,e){t.exports=function(t){return 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},function(t,e){t.exports=function(t){return t}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return t*(2-t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},function(t,e){t.exports=function(t){return t*t*t*t}},function(t,e){t.exports=function(t){return 1- --t*t*t*t}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},function(t,e){t.exports=function(t){return t*t*t*t*t}},function(t,e){t.exports=function(t){return--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},function(t,e,i){var n=i(0),s=i(35),r=i(41),o=new n({initialize:function(t){this.emitter=t,this.frame=null,this.index=0,this.x=0,this.y=0,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.scrollFactorX=1,this.scrollFactorY=1,this.tint=4294967295,this.color=4294967295,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215,current:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1}}},isAlive:function(){return this.lifeCurrent>0},fire:function(t,e){var i=this.emitter;this.frame=i.getFrame(),i.emitZone&&i.emitZone.getPoint(this),void 0===t?(i.follow&&(this.x+=i.follow.x+i.followOffset.x),this.x+=i.x.onEmit(this,"x")):this.x+=t,void 0===e?(i.follow&&(this.y+=i.follow.y+i.followOffset.y),this.y+=i.y.onEmit(this,"y")):this.y+=e,this.life=i.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0;var n=i.speedX.onEmit(this,"speedX"),o=i.speedY?i.speedY.onEmit(this,"speedY"):n;if(i.radial){var a=s(i.angle.onEmit(this,"angle"));this.velocityX=Math.cos(a)*Math.abs(n),this.velocityY=Math.sin(a)*Math.abs(o)}else if(i.moveTo){var h=i.moveToX.onEmit(this,"moveToX"),u=i.moveToY?i.moveToY.onEmit(this,"moveToY"):h,l=Math.atan2(u-this.y,h-this.x),c=r(this.x,this.y,h,u)/(this.life/1e3);this.velocityX=Math.cos(l)*c,this.velocityY=Math.sin(l)*c}else this.velocityX=n,this.velocityY=o;i.acceleration&&(this.accelerationX=i.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=i.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=i.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=i.maxVelocityY.onEmit(this,"maxVelocityY"),this.delayCurrent=i.delay.onEmit(this,"delay"),this.scaleX=i.scaleX.onEmit(this,"scaleX"),this.scaleY=i.scaleY?i.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=i.rotate.onEmit(this,"rotate"),this.rotation=s(this.angle),this.bounce=i.bounce.onEmit(this,"bounce"),this.alpha=i.alpha.onEmit(this,"alpha"),this.tint=i.tint.onEmit(this,"tint"),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.index=i.alive.length},computeVelocity:function(t,e,i,n){var s=this.velocityX,r=this.velocityY,o=this.accelerationX,a=this.accelerationY,h=this.maxVelocityX,u=this.maxVelocityY;s+=t.gravityX*i,r+=t.gravityY*i,o&&(s+=o*i),a&&(r+=a*i),s>h?s=h:s<-h&&(s=-h),r>u?r=u:r<-u&&(r=-u),this.velocityX=s,this.velocityY=r;for(var l=0;le.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(this.delayCurrent>0)return this.delayCurrent-=t,!1;var n=this.emitter,r=1-this.lifeCurrent/this.life;return this.lifeT=r,this.computeVelocity(n,t,e,i),this.x+=this.velocityX*e,this.y+=this.velocityY*e,n.bounds&&this.checkBounds(n),n.deathZone&&n.deathZone.willKill(this)?(this.lifeCurrent=0,!0):(this.scaleX=n.scaleX.onUpdate(this,"scaleX",r,this.scaleX),n.scaleY?this.scaleY=n.scaleY.onUpdate(this,"scaleY",r,this.scaleY):this.scaleY=this.scaleX,this.angle=n.rotate.onUpdate(this,"rotate",r,this.angle),this.rotation=s(this.angle),this.alpha=n.alpha.onUpdate(this,"alpha",r,this.alpha),this.tint=n.tint.onUpdate(this,"tint",r,this.tint),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(6),r=new n({initialize:function(t){this.source=t,this._tempVec=new s},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},function(t,e,i){var n=i(3),s=i(3);n=i(613),s=i(614),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){0===e.emitters.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.drawEmitterManager(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.emitters.list;if(!(0===r.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id))for(var o=0;o>24&255)/255;if(!(v<=0)){var y=g.frame,m=.5*y.width,x=.5*y.height,w=y.canvasData,b=-m,T=-x;l.globalAlpha=v,l.save(),l.translate(g.x-d*g.scrollFactorX,g.y-f*g.scrollFactorY),l.rotate(g.rotation),l.scale(g.scaleX,g.scaleY),l.drawImage(y.source.image,w.sx,w.sy,w.sWidth,w.sHeight,b,T,w.dWidth,w.dHeight),l.restore()}}l.globalAlpha=c}}}},function(t,e){t.exports={fill:function(t){return this},clear:function(){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;return t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},draw:function(t,e,i){return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(t,e,i,0,0,t.width,t.height,this.currentMatrix),this.renderer.setFramebuffer(null),this},drawFrame:function(t,e,i,n){return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(t,n.x,n.y,n.width,n.height,t.width,t.height,this.currentMatrix),this.renderer.setFramebuffer(null),this}}},function(t,e,i){var n=i(3),s=i(3);n=i(617),s=i(618),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchTexture(e,e.texture,e.texture.width,e.texture.height,e.x,e.y,e.width,e.height,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,e.texture.width,e.texture.height,4294967295,4294967295,4294967295,4294967295,0,0,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&(e.cameraFilter,s._id)}},function(t,e){t.exports=function(t,e,i){var n=t.canvas,s=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLinesc&&(f=-c),0!==f&&(d+=f>0?f*i.length:f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(3),s=i(3);n=i(621),s=i(622),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text||(e.dirty&&(e.canvasTexture=t.canvasToTexture(e.canvas,e.canvasTexture,!0,e.scaleMode),e.dirty=!1),this.pipeline.batchText(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=e.canvas;r.save(),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.translate(o.width*(e.flipX?1:0),o.height*(e.flipY?1:0)),r.scale(e.flipX?-1:1,e.flipY?-1:1),r.drawImage(o,0,0,o.width,o.height,-e.displayOriginX,-e.displayOriginY,o.width,o.height),r.restore()}}},function(t,e,i){var n=i(0),s=i(10),r=i(4),o=i(624),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new n({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.rtl,this.testString,this._font,this.setStyle(e,!1);var i=r(e,"metrics",!1);this.metrics=i?{ascent:r(i,"ascent",0),descent:r(i,"descent",0),fontSize:r(i,"fontSize",0)}:o(this)},setStyle:function(t,e){void 0===e&&(e=!0),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");for(var i in a)this[i]="wordWrapCallback"===i||"wordWrapCallbackScope"===i?r(t,a[i][0],a[i][1]):s(t,a[i][0],a[i][1]);var n=r(t,"font",null);this._font=null===n?[this.fontStyle,this.fontSize,this.fontFamily].join(" "):n;var o=r(t,"fill",null);return null!==o&&(this.color=o),e&&this.update(!0),this},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" "),this.metrics=o(this)),this.parent.updateText()},setFont:function(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=r(t,"fontFamily","Courier"),this.fontSize=r(t,"fontSize","16px"),this.fontStyle=r(t,"fontStyle","")),this.update(!0)},setFontFamily:function(t){return this.fontFamily=t,this.update(!0)},setFontStyle:function(t){return this.fontStyle=t,this.update(!0)},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.text.width=t),e&&(this.text.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setStroke:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=t,this.strokeThickness=e),this.update(!0)},setShadow:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},function(t,e,i){var n=i(21);t.exports=function(t){var e=n.create(this),i=e.getContext("2d");t.syncFont(e,i);var s=Math.ceil(1.2*i.measureText(t.testString).width),r=s,o=2*r;r=1.4*r|0,e.width=s,e.height=o,i.fillStyle="#f00",i.fillRect(0,0,s,o),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,r);var a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,s,o))return a.ascent=r,a.descent=r+6,a.fontSize=a.ascent+a.descent,n.remove(e),a;var h,u,l=i.getImageData(0,0,s,o).data,c=l.length,d=4*s,f=0,p=!1;for(h=0;hr;h--){for(u=0;u0&&e.cameraFilter&s._id||(e.updateTileTexture(),this.pipeline.batchTileSprite(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext,o=e.frame;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var a=o.x-e.originX*e.width,h=o.y-e.originY*e.height;r.save(),r.translate(a,h),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.fillStyle=e.canvasPattern,r.translate(-this.tilePositionX,-this.tilePositionY),r.fillRect(this.tilePositionX,this.tilePositionY,e.width,e.height),r.restore()}}},function(t,e,i){var n=i(132);i(9).register("blitter",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(133);i(9).register("dynamicBitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(134);i(9).register("graphics",function(t){return this.displayList.add(new n(this.scene,t))})},function(t,e,i){var n=i(69);i(9).register("group",function(t,e){return"object"==typeof t&&void 0===e&&(e=t,t=[]),this.updateList.add(new n(this.scene,t,e))})},function(t,e,i){var n=i(70);i(9).register("image",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(9),s=i(137);n.register("particles",function(t,e,i){var n=new s(this.scene,t,e,i);return this.displayList.add(n),this.updateList.add(n),n})},function(t,e,i){var n=i(9),s=i(289);n.register("follower",function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),this.updateList.add(o),o})},function(t,e,i){var n=i(9),s=i(139);n.register("renderTexture",function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))})},function(t,e,i){var n=i(81);i(9).register("sprite3D",function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o.gameObject),this.updateList.add(o.gameObject),o})},function(t,e,i){var n=i(9),s=i(37);n.register("sprite",function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.displayList.add(r),this.updateList.add(r),r})},function(t,e,i){var n=i(131);i(9).register("bitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(140);i(9).register("text",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(141);i(9).register("tileSprite",function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))})},function(t,e,i){var n=i(77);i(9).register("zone",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(132),s=i(19),r=i(13),o=i(10);r.register("blitter",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new n(this.scene,0,0,e,i);return s(this.scene,r,t),r})},function(t,e,i){var n=i(133),s=i(19),r=i(13),o=i(10);r.register("dynamicBitmapText",function(t){var e=o(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),a=o(t,"align","left"),h=new n(this.scene,0,0,e,i,r,a);return s(this.scene,h,t),h})},function(t,e,i){var n=i(13),s=i(134);n.register("graphics",function(t){return new s(this.scene,t)})},function(t,e,i){var n=i(13),s=i(69);n.register("group",function(t){return new s(this.scene,null,t)})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(70);s.register("image",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=new o(this.scene,0,0,e,i);return n(this.scene,s,t),s})},function(t,e,i){var n=i(13),s=i(10),r=i(2),o=i(137);n.register("particles",function(t){var e=s(t,"key",null),i=s(t,"frame",null),n=r(t,"emitters",null),a=new o(this.scene,e,i,n);return r(t,"add",!1)&&this.displayList.add(a),this.updateList.add(a),a})},function(t,e,i){var n=i(19),s=(i(142),i(13)),r=i(10),o=i(139);s.register("renderTexture",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",32),a=r(t,"height",32),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(19),s=i(142),r=i(13),o=i(10),a=i(81);r.register("sprite3D",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(19),s=i(142),r=i(13),o=i(10),a=i(37);r.register("sprite",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(131),s=i(19),r=i(13),o=i(10),a=i(4);r.register("bitmapText",function(t){var e=a(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),h=new n(this.scene,0,0,e,i,r);return s(this.scene,h,t),h})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(140);s.register("text",function(t){var e=r(t,"text",""),i=r(t,"style",null),s=r(t,"padding",null);null!==s&&(i.padding=s);var a=new o(this.scene,0,0,e,i);return n(this.scene,a,t),a.autoRound=r(t,"autoRound",!0),a.resolution=r(t,"resolution",1),a})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(141);s.register("tileSprite",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",512),a=r(t,"height",512),h=r(t,"key",""),u=r(t,"frame",""),l=new o(this.scene,e,i,s,a,h,u);return n(this.scene,l,t),l})},function(t,e,i){var n=i(13),s=i(10),r=i(77);n.register("zone",function(t){var e=s(t,"x",0),i=s(t,"y",0),n=s(t,"width",1),o=s(t,"height",n);return new r(this.scene,e,i,n,o)})},function(t,e,i){var n=i(3),s=i(3);n=i(656),s=i(657),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchMesh(e,s)}},function(t,e){t.exports=function(){}},function(t,e,i){var n=i(88);i(9).register("mesh",function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))})},function(t,e,i){var n=i(143);i(9).register("quad",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(4),a=i(88);s.register("mesh",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=o(t,"vertices",[]),h=o(t,"colors",[]),u=o(t,"alphas",[]),l=o(t,"uv",[]),c=new a(this.scene,0,0,s,l,h,u,e,i);return n(this.scene,c,t),c})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(143);s.register("quad",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"key",null),a=r(t,"frame",null),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(0),s=i(292),r=i(12),o=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",o,"lights"),t.exports=o},function(t,e,i){var n=i(63);n.Area=i(664),n.Circumference=i(183),n.CircumferencePoint=i(104),n.Clone=i(665),n.Contains=i(32),n.ContainsPoint=i(666),n.ContainsRect=i(667),n.CopyFrom=i(668),n.Equals=i(669),n.GetBounds=i(670),n.GetPoint=i(181),n.GetPoints=i(182),n.Offset=i(671),n.OffsetPoint=i(672),n.Random=i(105),t.exports=n},function(t,e){t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},function(t,e,i){var n=i(63);t.exports=function(t){return new n(t.x,t.y,t.radius)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(41);t.exports=function(t,e){return n(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},function(t,e){t.exports=function(t,e){var i=e.width/2,n=e.height/2,s=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-n),o=i+t.radius,a=n+t.radius;if(s>o||r>a)return!1;if(s<=i||r<=n)return!0;var h=s-i,u=r-n;return h*h+u*u<=t.radius*t.radius}},function(t,e,i){var n=i(8),s=i(295);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},function(t,e){t.exports=function(t,e){var i=t.x1,n=t.y1,s=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,u=e.bottom,l=0;if(i>=o&&i<=h&&n>=a&&n<=u||s>=o&&s<=h&&r>=a&&r<=u)return!0;if(i=o){if((l=n+(r-n)*(o-i)/(s-i))>a&&l<=u)return!0}else if(i>h&&s<=h&&(l=n+(r-n)*(h-i)/(s-i))>=a&&l<=u)return!0;if(n=a){if((l=i+(s-i)*(a-n)/(r-n))>=o&&l<=h)return!0}else if(n>u&&r<=u&&(l=i+(s-i)*(u-n)/(r-n))>=o&&l<=h)return!0;return!1}},function(t,e,i){var n=i(297);t.exports=function(t,e){if(!n(t,e))return!1;var i=Math.min(e.x1,e.x2),s=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=s&&t.y>=r&&t.y<=o}},function(t,e,i){var n=i(89),s=i(33),r=i(144),o=i(298);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||se.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(300);n.Angle=i(54),n.BresenhamPoints=i(191),n.CenterOn=i(684),n.Clone=i(685),n.CopyFrom=i(686),n.Equals=i(687),n.GetMidPoint=i(688),n.GetNormal=i(689),n.GetPoint=i(301),n.GetPoints=i(108),n.Height=i(690),n.Length=i(65),n.NormalAngle=i(302),n.NormalX=i(691),n.NormalY=i(692),n.Offset=i(693),n.PerpSlope=i(694),n.Random=i(110),n.ReflectAngle=i(695),n.Rotate=i(696),n.RotateAroundPoint=i(697),n.RotateAroundXY=i(145),n.SetToAngle=i(698),n.Slope=i(699),n.Width=i(700),t.exports=n},function(t,e){t.exports=function(t,e,i){var n=e-(t.x1+t.x2)/2,s=i-(t.y1+t.y2)/2;return t.x1+=n,t.y1+=s,t.x2+=n,t.y2+=s,t}},function(t,e,i){var n=i(300);t.exports=function(t){return new n(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},function(t,e,i){var n=i(16),s=i(54),r=i(5);t.exports=function(t,e){void 0===e&&(e=new r);var i=s(t)-n.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},function(t,e){t.exports=function(t){return Math.abs(t.y1-t.y2)}},function(t,e,i){var n=i(16),s=i(54);t.exports=function(t){return Math.cos(s(t)-n.TAU)}},function(t,e,i){var n=i(16),s=i(54);t.exports=function(t){return Math.sin(s(t)-n.TAU)}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},function(t,e){t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},function(t,e,i){var n=i(54),s=i(302);t.exports=function(t,e){return 2*s(e)-Math.PI-n(t)}},function(t,e,i){var n=i(145);t.exports=function(t,e){var i=(t.x1+t.x2)/2,s=(t.y1+t.y2)/2;return n(t,i,s,e)}},function(t,e,i){var n=i(145);t.exports=function(t,e,i){return n(t,e.x,e.y,i)}},function(t,e){t.exports=function(t,e,i,n,s){return t.x1=e,t.y1=i,t.x2=e+Math.cos(n)*s,t.y2=i+Math.sin(n)*s,t}},function(t,e){t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},function(t,e){t.exports=function(t){return Math.abs(t.x1-t.x2)}},function(t,e,i){var n=i(5);n.Ceil=i(702),n.Clone=i(703),n.CopyFrom=i(704),n.Equals=i(705),n.Floor=i(706),n.GetCentroid=i(707),n.GetMagnitude=i(303),n.GetMagnitudeSq=i(304),n.GetRectangleFromPoints=i(708),n.Interpolate=i(709),n.Invert=i(710),n.Negative=i(711),n.Project=i(712),n.ProjectUnit=i(713),n.SetMagnitude=i(714),t.exports=n},function(t,e){t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t){return new n(t.x,t.y)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},function(t,e){t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t,e){if(void 0===e&&(e=new n),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var s=0;si&&(i=h.x),h.xr&&(r=h.y),h.yt.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottomn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var n=i(307);t.exports=function(t,e,i){var s=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),n(t,s,r)}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var n=i(5),s=i(35);t.exports=function(t,e,i){void 0===i&&(i=new n),e=s(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._list=s.concat(e.splice(0))}},clear:function(t){var e=t.input;return e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,t.input=null,t},disable:function(t){t.input.enabled=!1},enable:function(t,e,i){return t.input?t.input.enabled=!0:this.setHitArea(t,e,i),this},hitTestPointer:function(t){var e=this.cameras.getCameraBelowPointer(t);return e?(t.camera=e,this.manager.hitTest(t.x,t.y,this._list,e)):[]},processDownEvents:function(t){var e=this._temp;this.emit("pointerdown",t,e);for(var i=0,n=0;n0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var u=[];for(i=0;i1&&(this.sortGameObjects(u),this.topOnly&&u.splice(1)),this._drag[t.id]=u,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&o(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&(t.dragState=3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&(t.dragState=3)),3!==t.dragState){if(4===t.dragState&&t.justMoved){var l=[];for(n=0;n0?(s.emit("dragleave",t,a.target),this.emit("dragleave",t,s,a.target),a.target=l[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target)):(s.emit("dragleave",t,a.target),this.emit("dragleave",t,s,a.target),l[0]?(a.target=l[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target)):a.target=null)}else!a.target&&l[0]&&(a.target=l[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target));var d=t.x-s.input.dragX,f=t.y-s.input.dragY;s.emit("drag",t,d,f),this.emit("drag",t,s,d,f)}}if(5===t.dragState){for(r=this._drag[t.id],i=0;i0}for(r=this._drag[t.id],i=0;i0)for(this.sortGameObjects(s),this.emit("pointerout",t,s),e=0;e0)for(this.sortGameObjects(r),this.emit("pointerover",t,r),e=0;e-1&&this._draggable.splice(s,1)}return this},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);for(var n=0;nn?-1:0},sortHandlerIO:function(t,e){var i=this.displayList.getIndex(t.gameObject),n=this.displayList.getIndex(e.gameObject);return in?-1:0},sortInteractiveObjects:function(t){return t.length<2?t:(this.scene.sys.depthSort(),t.sort(this.sortHandlerIO.bind(this)))},stopPropagation:function(){return this.manager.globalTopOnly&&(this.manager.ignoreEvents=!0),this},update:function(t,e){var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.activePointer,s=n.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(s=!0,this._pollTimer=this.pollRate)),s){this._temp=this.hitTestPointer(n),this.sortGameObjects(this._temp),this.topOnly&&this._temp.length&&this._temp.splice(1);var r=this.processDragEvents(n,t);n.wasTouch||(r+=this.processOverOutEvents(n)),n.justDown&&(r+=this.processDownEvents(n)),n.justUp&&this.processUpEvents(n),n.justMoved&&(r+=this.processMoveEvents(n)),r>0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}},shutdown:function(){this._temp.length=0,this._list.length=0,this._draggable.length=0,this._pendingRemoval.length=0,this._pendingInsertion.length=0;for(var t=0;t<10;t++)this._drag[t]=[],this._over[t]=[];this.removeAllListeners()},destroy:function(){this.shutdown(),this.scene=void 0,this.cameras=void 0,this.manager=void 0,this.events=void 0,this.keyboard=void 0,this.mouse=void 0,this.gamepad=void 0},activePointer:{get:function(){return this.manager.activePointer}},x:{get:function(){return this.manager.activePointer.x}},y:{get:function(){return this.manager.activePointer.y}}});c.register("InputPlugin",v,"input"),t.exports=v},function(t,e,i){t.exports={KeyboardManager:i(244),Key:i(245),KeyCodes:i(128),KeyCombo:i(246),JustDown:i(767),JustUp:i(768),DownDuration:i(769),UpDuration:i(770)}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justDown,t._justDown=!1),e}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justUp,t._justUp=!1),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=50),t.isDown&&t.duration'),n.push(''),n.push(''),n.push(this.xhrLoader.responseText),n.push(""),n.push(""),n.push("");var o=[n.join("\n")],a=this;try{var h=new window.Blob(o,{type:"image/svg+xml;charset=utf-8"})}catch(e){return a.state=s.FILE_ERRORED,void t(a)}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(a.data),a.onComplete(),t(a)},this.data.onerror=function(){r.revokeObjectURL(a.data),a.state=s.FILE_ERRORED,t(a)},r.createObjectURL(this.data,h,"image/svg+xml")}});o.register("html",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0?this.processLoadQueue():0===this.inflight.size&&this.finishedLoading()},finishedLoading:function(){this.state!==s.LOADER_PROCESSING&&(this.progress=1,this.state=s.LOADER_PROCESSING,this.storage.clear(),0===this.queue.size?this.processComplete():this.queue.each(function(t){t.onProcess(this.processUpdate.bind(this))},this))},processUpdate:function(t){if(t.state===s.FILE_ERRORED)return this.failed.set(t),t.linkFile&&this.queue.delete(t.linkFile),this.removeFromQueue(t);t.linkFile?t.state===s.FILE_COMPLETE&&t.linkFile.state===s.FILE_COMPLETE&&(this.storage.set({type:t.linkType,fileA:t,fileB:t.linkFile}),this.queue.delete(t.linkFile),this.removeFromQueue(t)):(this.storage.set(t),this.removeFromQueue(t))},removeFromQueue:function(t){this.queue.delete(t),0===this.queue.size&&this.state===s.LOADER_PROCESSING&&this.processComplete()},processComplete:function(){this.list.clear(),this.inflight.clear(),this.queue.clear(),this.processCallback(),this.state=s.LOADER_COMPLETE,this.emit("complete",this,this.storage.size,this.failed.size)},processCallback:function(){if(0!==this.storage.size){var t,e,i,n=this.scene.sys.cache,s=this.scene.sys.textures,r=this.scene.sys.anims;for(var o in this._multilist){for(var a=[],h=[],l=this._multilist[o],c=0;c0},file:function(t){var e,i=t.key;switch(t.type){case"spritesheet":e=this.spritesheet(i,t.url,t.config,t.xhrSettings);break;case"atlas":e=this.atlas(i,t.textureURL,t.atlasURL,t.textureXhrSettings,t.atlasXhrSettings);break;case"bitmapFont":e=this.bitmapFont(i,t.textureURL,t.xmlURL,t.textureXhrSettings,t.xmlXhrSettings);break;case"multiatlas":e=this.multiatlas(i,t.textureURLs,t.atlasURLs,t.textureXhrSettings,t.atlasXhrSettings);break;case"audioSprite":e=this.audioSprite(i,t.urls,t.json,t.config,t.audioXhrSettings,t.jsonXhrSettings);break;default:e=this[t.type](i,t.url,t.xhrSettings)}return e},shutdown:function(){this.reset(),this.state=s.LOADER_SHUTDOWN},destroy:function(){this.reset(),this.state=s.LOADER_DESTROYED}});l.register("Loader",d,"load"),t.exports=d},function(t,e,i){var n=i(16),s=i(23),r={Angle:i(792),Distance:i(800),Easing:i(803),Fuzzy:i(804),Interpolation:i(810),Pow2:i(813),Snap:i(815),Average:i(819),Bernstein:i(321),Between:i(228),CatmullRom:i(122),CeilTo:i(820),Clamp:i(60),DegToRad:i(35),Difference:i(821),Factorial:i(322),FloatBetween:i(275),FloorTo:i(822),FromPercent:i(64),GetSpeed:i(823),IsEven:i(824),IsEvenStrict:i(825),Linear:i(227),MaxAdd:i(826),MinSub:i(827),Percent:i(828),RadToDeg:i(218),RandomXY:i(829),RandomXYZ:i(206),RandomXYZW:i(207),Rotate:i(323),RotateAround:i(185),RotateAroundDistance:i(112),RoundAwayFromZero:i(324),RoundTo:i(830),SinCosTableGenerator:i(831),SmootherStep:i(192),SmoothStep:i(193),TransformXY:i(250),Within:i(832),Wrap:i(50),Vector2:i(6),Vector3:i(51),Vector4:i(119),Matrix3:i(210),Matrix4:i(118),Quaternion:i(209),RotateVec3:i(208)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Between:i(793),BetweenY:i(794),BetweenPoints:i(795),BetweenPointsY:i(796),Reverse:i(797),RotateTo:i(798),ShortestBetween:i(799),Normalize:i(320),Wrap:i(162),WrapDegrees:i(163)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(i-t,n-e)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},function(t,e,i){var n=i(320);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(16);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e?t:(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:ee-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t1?t[i]-(n(s-i,t[i],t[i],t[i-1],t[i-1])-t[i]):n(s-r,t[r?r-1:0],t[r],t[i0&&0==(t&t-1)}},function(t,e,i){t.exports={Ceil:i(816),Floor:i(817),To:i(818)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.ceil(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.floor(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.round(t/e)))}},function(t,e){t.exports=function(t){for(var e=0,i=0;i1?void 0!==n?(s=(n-t)/(n-i))<0&&(s=0):s=1:s<0&&(s=0),s}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var n=Math.pow(i,-e);return Math.round(t*n)/n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),n*=Math.PI/t;for(var s=[],r=[],o=0;o=0;o--){var a=e[o],h=u(s,r,a.x,a.y);h=0;o--){var a=e[o],h=u(s,r,a.x,a.y);h>i&&(n=a,i=h)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=u(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},moveToObject:function(t,e,i,n){return this.moveTo(t,e.x,e.y,i,n)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(l(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(t,e)},shutdown:function(){this.world.shutdown()},destroy:function(){this.world.destroy()}});a.register("ArcadePhysics",c,"arcadePhysics"),t.exports=c},function(t,e){t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},function(t,e){t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},function(t,e){t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t){return this.body.collideWorldBounds=t,this}}},function(t,e){t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},function(t,e){t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this}}},function(t,e){var i={enableBody:function(t,e,i,n,s){return t&&this.body.reset(e,i),n&&(this.body.gameObject.active=!0),s&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}};t.exports=i},function(t,e){t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},function(t,e){t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},function(t,e){var i={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}};t.exports=i},function(t,e){t.exports={setMass:function(t){return this.body.mass=t,this}}},function(t,e){t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},function(t,e){var i={setVelocity:function(t,e){return this.body.velocity.set(t,e),this},setVelocityX:function(t){return this.body.velocity.x=t,this},setVelocityY:function(t){return this.body.velocity.y=t,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.body.maxVelocity.set(t,e),this}};t.exports=i},function(t,e){t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},function(t,e,i){var n=i(849),s=i(851),r=i(338);t.exports=function(t,e,i,o,a,h){var u=o.left,l=o.top,c=o.right,d=o.bottom,f=i.faceLeft||i.faceRight,p=i.faceTop||i.faceBottom;if(!f&&!p)return!1;var g=0,v=0,y=0,m=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right>i&&(o=t.right-i)>r&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.left=!0:e>0&&(t.blocked.right=!0),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},function(t,e,i){var n=i(852);t.exports=function(t,e,i,s,r){var o=0;return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom>i&&(o=t.bottom-i)>r&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.up=!0:e>0&&(t.blocked.down=!0),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},function(t,e,i){var n=i(333);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.x,a=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=r,e.velocity.x=o-a*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=r,t.velocity.x=a-o*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{r*=.5,t.x-=r,e.x+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),u=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),l=.5*(h+u);h-=l,u-=l,t.velocity.x=l+h*t.bounce.x,e.velocity.x=l+u*e.bounce.x}return!0}},function(t,e,i){var n=i(334);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.y,a=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=r,e.velocity.y=o-a*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=r,t.velocity.y=a-o*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{r*=.5,t.y-=r,e.y+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),u=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),l=.5*(h+u);h-=l,u-=l,t.velocity.y=l+h*t.bounce.y,e.velocity.y=l+u*e.bounce.y}return!0}},,,,,,,,,,function(t,e,i){t.exports={SceneManager:i(251),ScenePlugin:i(865),Settings:i(254),Systems:i(129)}},function(t,e,i){var n=i(0),s=i(83),r=i(12),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},start:function(t,e){return void 0===t&&(t=this.key),t!==this.key&&(this.settings.status!==s.RUNNING?(this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t)):(this.manager.stop(this.key),this.manager.start(t,e))),this},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("start",t):this.manager.start(t,e)),this},pause:function(t){return void 0===t&&(t=this.key),this.manager.pause(t),this},resume:function(t){return void 0===t&&(t=this.key),this.manager.resume(t),this},sleep:function(t){return void 0===t&&(t=this.key),this.manager.sleep(t),this},wake:function(t){return void 0===t&&(t=this.key),this.manager.wake(t),this},switch:function(t){return t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("switch",this.key,t):this.manager.switch(this.key,t)),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.stop(t),this},setActive:function(t){return this.settings.active=t,this},setVisible:function(t){return this.settings.visible=t,this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t){return t&&t!==this.key&&this.manager.swapPosition(this.key,t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},shutdown:function(){},destroy:function(){}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={SoundManagerCreator:i(255),BaseSound:i(85),BaseSoundManager:i(84),WebAudioSound:i(261),WebAudioSoundManager:i(260),HTML5AudioSound:i(257),HTML5AudioSoundManager:i(256),NoAudioSound:i(259),NoAudioSoundManager:i(258)}},function(t,e,i){t.exports={List:i(86),Map:i(113),ProcessQueue:i(335),RTree:i(336),Set:i(61)}},function(t,e,i){t.exports={Parsers:i(263),FilterMode:i(869),Frame:i(130),Texture:i(264),TextureManager:i(262),TextureSource:i(265)}},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(96),Parsers:i(900),Formats:i(20),ImageCollection:i(350),ParseToTilemap:i(156),Tile:i(44),Tilemap:i(354),TilemapCreator:i(917),TilemapFactory:i(918),Tileset:i(100),LayerData:i(75),MapData:i(76),ObjectLayer:i(352),DynamicTilemapLayer:i(355),StaticTilemapLayer:i(356)}},function(t,e,i){var n=i(15),s=i(34);t.exports=function(t,e,i,r,o,a,h,u){t<0&&(t=0),e<0&&(e=0),void 0===h&&(h=!0);for(var l=n(t,e,i,r,null,u),c=o-t,d=a-e,f=0;f=0&&p=0&&g-c&&y>-d&&v=0;r--)for(s=n.width-1;s>=0;s--)if((o=n.data[r][s])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;re)){for(var h=t;h<=e;h++)r(h,i,a);for(var u=0;u=t&&c.index<=e&&n(c,i)}o&&s(0,0,a.width,a.height,a)}}},function(t,e,i){var n=i(43),s=i(34),r=i(154);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e){t.exports=function(t,e,i,n){if("number"==typeof t)n.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var s=0,r=t.length;s0){var y=new a(l,v.gid,c,f.length,t.tilewidth,t.tileheight);y.rotation=v.rotation,y.flipX=v.flipped,d.push(y)}else{var m=e?null:new a(l,-1,c,f.length,t.tilewidth,t.tileheight);d.push(m)}++c===u.width&&(f.push(d),c=0,d=[])}l.data=f,i.push(l)}}return i}},function(t,e){t.exports=function(t){for(var e=window.atob(t),i=e.length,n=new Array(i),s=0;s>>0;return n}},function(t,e,i){var n=i(2);t.exports=function(t){for(var e=[],i=0;i-1?new s(a,f,c,l,o.tilesize,o.tilesize):e?null:new s(a,-1,c,l,o.tilesize,o.tilesize),h.push(d)}u.push(h),h=[]}a.data=u,i.push(a)}return i}},function(t,e,i){var n=i(100);t.exports=function(t){for(var e=[],i=[],s=0;s0&&e.cameraFilter&s._id||(e.cull(s),this.pipeline.batchDynamicTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=r.length,a=e.tileset.image.getSourceImage(),h=this.tileset,u=e.x-s.scrollX*e.scrollFactorX,l=e.y-s.scrollY*e.scrollFactorY,c=t.gameContext;c.save(),c.translate(u,l),c.rotate(e.rotation),c.scale(e.scaleX,e.scaleY),c.scale(e.flipX?-1:1,e.flipY?-1:1);for(var d=0;d0&&e.cameraFilter&s._id||(e.upload(s),this.pipeline.drawStaticTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=this.tileset,a=t.gameContext,h=r.length,u=o.image.getSourceImage(),l=e.x-s.scrollX*e.scrollFactorX,c=e.y-s.scrollY*e.scrollFactorY;a.save(),a.translate(l,c),a.rotate(e.rotation),a.scale(e.scaleX,e.scaleY),a.scale(e.flipX?-1:1,e.flipY?-1:1),a.globalAlpha=e.alpha;for(var d=0;d-1&&this._active.splice(s,1),n.destroy()}for(i=0;i=n.delay)){var s=n.elapsed-n.delay;n.elapsed=n.delay,!n.hasDispatched&&n.callback&&(n.hasDispatched=!0,n.callback.apply(n.callbackScope,n.args)),n.repeatCount>0?(n.repeatCount--,n.elapsed=s,n.hasDispatched=!1):this._pendingRemoval.push(n)}}}},shutdown:function(){var t;for(t=0;t0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},transformMat3:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},transformMat4:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[4]*i+n[12],this.y=n[1]*e+n[5]*i+n[13],this},reset:function(){return this.x=0,this.y=0,this}});n.ZERO=new n,t.exports=n},function(t,e){var i={},n={install:function(t){for(var e in i)t[e]=i[e]},register:function(t,e){i[t]=e},destroy:function(){i={}}};t.exports=n},function(t,e,i){var n=i(0),s=i(33),r=i(107),o=i(185),a=i(108),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(){return{x1:this.x,y1:this.y,x2:this.right,y2:this.y}},getLineB:function(){return{x1:this.right,y1:this.y,x2:this.right,y2:this.bottom}},getLineC:function(){return{x1:this.right,y1:this.bottom,x2:this.x,y2:this.bottom}},getLineD:function(){return{x1:this.x,y1:this.bottom,x2:this.x,y2:this.y}},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.displayList,this.updateList},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList;var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){},destroy:function(){this.scene=null,this.displayList=null,this.updateList=null}});r.register=function(t,e){r.prototype.hasOwnProperty(t)||(r.prototype[t]=e)},s.register("GameObjectFactory",r,"add"),t.exports=r},function(t,e,i){var n=i(16),s=i(4);t.exports=function(t,e,i){var r=s(t,e,null);if(null===r)return i;if(Array.isArray(r))return n.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return n.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return n.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},function(t,e,i){t.exports={Alpha:i(392),Animation:i(366),BlendMode:i(393),ComputedSize:i(394),Depth:i(395),Flip:i(396),GetBounds:i(397),MatrixStack:i(398),Origin:i(399),Pipeline:i(187),ScaleMode:i(400),ScrollFactor:i(401),Size:i(402),Texture:i(403),Tint:i(404),ToJSON:i(405),Transform:i(406),TransformMatrix:i(188),Visible:i(407)}},function(t,e,i){var n=i(0),s={},r=new n({initialize:function(t){this.game=t,t.events.once("boot",this.boot,this)},boot:function(){this.game.events.once("destroy",this.destroy,this)},installGlobal:function(t,e){for(var i=t.game,n=t.scene,s=t.settings.map,r=0;ro.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var l=[],c=e;c0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},function(t,e,i){var n=i(97),s=i(15);t.exports=function(t,e,i,r,o){for(var a=null,h=null,u=null,l=null,c=s(t,e,i,r,null,o),d=0;d>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return this.getLeft(t)+this.width/2},getCenterY:function(t){return this.getTop(t)+this.height/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){(void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){(void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight-(this.height-this.baseHeight),this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.tilemapLayer;return t?t.tileset:null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e){t.exports={SKIP_CHECK:-1,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}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z;return this.x=i*o-n*r,this.y=n*s-e*o,this.z=e*r-i*s,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this},transformMat3:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=e*s[0]+i*s[3]+n*s[6],this.y=e*s[1]+i*s[4]+n*s[7],this.z=e*s[2]+i*s[5]+n*s[8],this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=e*s[0]+i*s[4]+n*s[8]+s[12],o=e*s[1]+i*s[5]+n*s[9]+s[13],a=e*s[2]+i*s[6]+n*s[10]+s[14],h=e*s[3]+i*s[7]+n*s[11]+s[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,u=a*i+o*e-s*n,l=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+u*-o-l*-r,this.y=u*a+c*-r+l*-s-h*-o,this.z=l*a+c*-o+h*-r-u*-s,this},project:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=s[0],o=s[1],a=s[2],h=s[3],u=s[4],l=s[5],c=s[6],d=s[7],f=s[8],p=s[9],g=s[10],v=s[11],y=s[12],m=s[13],x=s[14],w=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*u+n*f+y)*w,this.y=(e*o+i*l+n*p+m)*w,this.z=(e*a+i*c+n*g+x)*w,this},unproject:function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,o=this.x-i,a=r-this.y-1-n,h=this.z;return this.x=2*o/s-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});t.exports=n},function(t,e,i){var n=i(0),s=i(122),r=i(8),o=i(6),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var n=Math.max(1,Math.round(i/e));return s(this.getSpacedPoints(n),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],n=this.getPoint(0,this._tmpVec2A),s=0;i.push(0);for(var r=1;r<=t;r++)s+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(n),i.push(s),n.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++){var n=this.getUtoTmapping(i/t,null,t);e.push(this.getPoint(n))}return e},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=t-1e-4,n=t+1e-4;return i<0&&(i=0),n>1&&(n=1),this.getPoint(i,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var n,s=this.getLengths(i),r=0,o=s.length;n=e?Math.min(e,s[o-1]):t*s[o-1];for(var a,h=0,u=o-1;h<=u;)if((a=s[r=Math.floor(h+(u-h)/2)]-n)<0)h=r+1;else{if(!(a>0)){u=r;break}u=r-1}if(s[r=u]===n)return r/(o-1);var l=s[r];return(r+(n-l)/(s[r+1]-l))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},function(t,e){t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},function(t,e){t.exports=function(t,e,i){var n=t.x3-t.x1,s=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,u=n*n+s*s,l=n*r+s*o,c=n*a+s*h,d=r*r+o*o,f=r*a+o*h,p=u*d-l*l,g=0===p?0:1/p,v=(d*c-l*f)*g,y=(u*f-l*c)*g;return v>=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},function(t,e,i){var n=i(0),s=i(54),r=i(310),o=i(311),a=i(112),h=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r,this},getLineA:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2}},getLineB:function(){return{x1:this.x2,y1:this.y2,x2:this.x3,y2:this.y3}},getLineC:function(){return{x1:this.x3,y1:this.y3,x2:this.x1,y2:this.y1}},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=h},function(t,e,i){var n=i(0),s=i(17),r=i(18),o=i(7),a=i(2),h=new n({Extends:r,initialize:function(t,e,i,n){var o="string"==typeof t?t:a(t,"key",""),h={type:"json",extension:a(t,"extension","json"),responseType:"text",key:o,url:a(t,"file",e),path:i,xhrSettings:a(t,"xhr",n)};r.call(this,h),"object"==typeof h.url&&(this.data=h.url,this.state=s.FILE_POPULATED)},onProcess:function(t){this.state=s.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText),this.onComplete(),t(this)}});o.register("json",function(t,e,i){if(Array.isArray(t))for(var n=0;n-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new n;return t.entries.forEach(function(t){e.set(t)}),this.entries.forEach(function(t){e.set(t)}),e},intersect:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)&&e.set(i)}),e},difference:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)||e.set(i)}),e},size:{get:function(){return this.entries.length},set:function(t){return this.entries.length=t}}});t.exports=n},function(t,e){t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(0),s=i(32),r=i(182),o=i(183),a=i(106),h=new n({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=h},function(t,e,i){var n=i(61);t.exports=function(t,e,i){return(i-e)*(t=n(t,0,1))}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e,i){(function(e){var i={android:!1,chromeOS:!1,cocoonJS:!1,cocoonJSApp:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){var t=navigator.userAgent;/Windows/.test(t)?i.windows=!0:/Mac OS/.test(t)?i.macOS=!0:/Linux/.test(t)?i.linux=!0:/Android/.test(t)?i.android=!0:/iP[ao]d|iPhone/i.test(t)?(i.iOS=!0,navigator.appVersion.match(/OS (\d+)/),i.iOSVersion=parseInt(RegExp.$1,10)):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?i.kindle=!0:/CrOS/.test(t)&&(i.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(i.android=!1,i.iOS=!1,i.macOS=!1,i.windows=!0,i.windowsPhone=!0);var n=/Silk/.test(t);if((i.windows||i.macOS||i.linux&&!n||i.chromeOS)&&(i.desktop=!0),(i.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(i.desktop=!1),navigator.standalone&&(i.webApp=!0),void 0!==window.cordova&&(i.cordova=!0),void 0!==e&&void 0!==e.versions.node&&(i.node=!0),i.node&&"object"==typeof e.versions&&(i.nodeWebkit=!!e.versions["node-webkit"],i.electron=!!e.versions.electron),navigator.isCocoonJS){i.cocoonJS=!0;try{i.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){i.cocoonJSApp=!1}}return void 0!==window.ejecta&&(i.ejecta=!0),/Crosswalk/.test(t)&&(i.crosswalk=!0),i.iPhone=-1!==t.toLowerCase().indexOf("iphone"),i.iPad=-1!==t.toLowerCase().indexOf("ipad"),i.pixelRatio=window.devicePixelRatio||1,i}()}).call(e,i(507))},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var n=i(169),s=i(0),r=i(2),o=i(4),a=i(275),h=i(62),u=i(37),l=new s({initialize:function(t,e,i){void 0!==i||Array.isArray(e)||"object"!=typeof e||(i=e,e=null),this.scene=t,this.children=new h(e),this.isParent=!0,this.classType=r(i,"classType",u),this.active=r(i,"active",!0),this.maxSize=r(i,"maxSize",-1),this.defaultKey=r(i,"defaultKey",null),this.defaultFrame=r(i,"defaultFrame",null),this.runChildUpdate=r(i,"runChildUpdate",!1),this.createCallback=r(i,"createCallback",null),this.removeCallback=r(i,"removeCallback",null),this.createMultipleCallback=r(i,"createMultipleCallback",null),i&&this.createMultiple(i)},create:function(t,e,i,n,s){if(void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),this.isFull())return null;var r=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(r),r.preUpdate&&this.scene.sys.updateList.add(r),r.visible=s,this.add(r),r},createMultiple:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i=0&&t=0&&e0){this.blockSet=!1;var i=this;if(this.events.emit("changedata",this.parent,t,e,function(e){i.blockSet=!0,i.list[t]=e,i.events.emit("setdata",i.parent,t,e)}),this.blockSet)return this}return this.list[t]=e,this.events.emit("setdata",this.parent,t,e),this},each:function(t,e){for(var i=[this.parent,null,void 0],n=1;n0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e,i){var n=i(0),s=i(1),r=i(37),o=i(6),a=i(120),h=new n({Extends:s,initialize:function(t,e,i,n,h,u){s.call(this,t,"Sprite3D"),this.gameObject=new r(t,0,0,h,u),this.position=new a(e,i,n),this.size=new o(this.gameObject.width,this.gameObject.height),this.scale=new o(1,1),this.adjustScaleX=!0,this.adjustScaleY=!0,this._visible=!0},project:function(t){var e=this.position,i=this.gameObject;t.project(e,i),t.getPointSize(e,this.size,this.scale),this.scale.x<=0||this.scale.y<=0?i.setVisible(!1):(i.visible||i.setVisible(!0),this.adjustScaleX&&(i.scaleX=this.scale.x),this.adjustScaleY&&(i.scaleY=this.scale.y),i.setDepth(-1*i.z))},setVisible:function(t){return this.visible=t,this},visible:{get:function(){return this._visible},set:function(t){this._visible=t,this.gameObject.visible=t}},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},z:{get:function(){return this.position.z},set:function(t){this.position.z=t}}});t.exports=h},function(t,e,i){var n,s=i(67),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0};t.exports=(n=navigator.userAgent,/Edge\/\d+/.test(n)?r.edge=!0:/Chrome\/(\d+)/.test(n)&&!s.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10)):/Firefox\D+(\d+)/.test(n)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(n)&&s.iOS?r.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(n)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Opera/.test(n)?r.opera=!0:/Safari/.test(n)&&!s.windowsPhone?r.safari=!0:/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(n)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(n)&&(r.silk=!0),r)},function(t,e){t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},function(t,e,i){var n=i(0),s=i(14),r=i(3),o=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.once("destroy",this.destroy,this),this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.locked&&this.unlock()},add:r,addAudioSprite:function(t,e){var i=this.add(t,e);for(var n in i.spritemap=this.game.cache.json.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var s=i.spritemap[n];i.addMarker({name:n,start:s.start,duration:s.end-s.start,config:e})}return i},play:function(t,e){var i=this.add(t);return i.once("ended",i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var n=this.addAudioSprite(t);return n.once("ended",n.destroy,n),n.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var n=this.sounds[i];n.key===t&&(n.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound(function(t){t.pause()}),this.emit("pauseall",this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit("resumeall",this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit("stopall",this)},unlock:r,onBlur:r,onFocus:r,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit("unlocked",this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach(function(i){i.update(t,e)})},destroy:function(){this.removeAllListeners(),this.forEachActiveSound(function(t){t.destroy()}),this.sounds.length=0,this.sounds=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach(function(n,s){n.pendingRemove||t.call(e||i,n,s,i.sounds)})},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("rate",this,t)}},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("detune",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(14),r=i(23),o=i(3),a=new n({Extends:s,initialize:function(t,e,i){s.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={delay:0},this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.config=r(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(console.error("addMarker - Marker with name '"+t.name+"' already exists for sound '"+this.key+"'!"),!1):(t=r(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0}},t),this.markers[t.name]=t,!0))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(this.markers[t.name]=r(!0,this.markers[t.name],t),!0):(console.error("updateMarker - Marker with name '"+t.name+"' does not exist for sound '"+this.key+"'!"),!1))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return console.error("Sound marker name has to be a string!"),!1;if(t){if(!this.markers[t])return console.error("No marker with name '"+t+"' found for sound '"+this.key+"'!"),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=r(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!0,!0)},resume:function(){return!(!this.isPaused||this.isPlaying)&&(this.isPlaying=!0,this.isPaused=!1,!0)},stop:function(){return!(!this.isPaused&&!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),!0)},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:o,destroy:function(){this.pendingRemove||(this.pendingRemove=!0,this.manager=null,this.key="",this.removeAllListeners(),this.isPlaying=!1,this.isPaused=!1,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)},setRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e}});Object.defineProperty(a.prototype,"rate",{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.setRate(),this.emit("rate",this,t)}}),Object.defineProperty(a.prototype,"detune",{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.setRate(),this.emit("detune",this,t)}}),t.exports=a},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.list=[],this.position=0},add:function(t){return-1===this.getIndex(t)&&this.list.push(t),t},addAt:function(t,e){return void 0===e&&(e=0),0===this.list.length?this.add(t):(e>=0&&e<=this.list.length&&-1===this.getIndex(t)&&this.list.splice(e,0,t),t)},addMultiple:function(t){if(Array.isArray(t))for(var e=0;en?1:0},getByKey:function(t,e){for(var i=0;ithis.list.length)return null;var i=t+Math.floor(Math.random()*e);return this.list[i]},getFirst:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.list.length);for(var s=i;s=this.list.length)throw new Error("List.moveTo: The supplied index is out of bounds");return this.list.splice(i,1),this.list.splice(e,0,t),t},remove:function(t){var e=this.list.indexOf(t);return-1!==e&&this.list.splice(e,1),t},removeAt:function(t){var e=this.list[t];return e&&this.children.splice(t,1),e},removeBetween:function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.list.length);var i=e-t;if(i>0&&i<=e)return this.list.splice(t,i);if(0===i&&0===this.list.length)return[];throw new Error("List.removeBetween: Range Error, numeric values are outside the acceptable range")},removeAll:function(){for(var t=this.list.length;t--;)this.remove(this.list[t]);return this},bringToTop:function(t){return this.getIndex(t)0&&(this.remove(t),this.addAt(t,0)),t},moveUp:function(t){var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getAt(e-1);i&&this.swap(t,i)}return t},reverse:function(){return this.list.reverse(),this},shuffle:function(){for(var t=this.list.length-1;t>0;t--){var e=Math.floor(Math.random()*(t+1)),i=this.list[t];this.list[t]=this.list[e],this.list[e]=i}return this},replace:function(t,e){var i=this.getIndex(t);if(-1!==i)return this.remove(t),this.addAt(e,i),t},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e){for(var i=0;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=n},function(t,e){t.exports={CREATED:0,INIT:1,DELAY:2,OFFSET_DELAY:3,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING_ADD:20,PAUSED:21,LOOP_DELAY:22,ACTIVE:23,COMPLETE_DELAY:24,PENDING_REMOVE:25,REMOVED:26}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(658),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Size,s.Texture,s.Transform,s.Visible,s.ScrollFactor,o],initialize:function(t,e,i,n,s,o,a,h,u){if(r.call(this,t,"Mesh"),this.setTexture(h,u),this.setPosition(e,i),this.setSizeToFrame(),this.setOrigin(),this.initPipeline("TextureTintPipeline"),n.length!==s.length)throw new Error("Mesh Vertex count must match UV count");var l,c=n.length/2|0;if(o.length>0&&o.length0&&a.length=0&&f<=1&&p>=0&&p<=1&&(i.x=s+f*(o-s),i.y=r+f*(a-r),!0)}},function(t,e){t.exports=function(t,e,i,n,s){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),{responseType:t,async:e,user:i,password:n,timeout:s,header:void 0,headerValue:void 0,overrideMimeType:void 0}}},function(t,e,i){var n=i(0),s=i(329),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},,,,,function(t,e,i){t.exports={CalculateFacesAt:i(151),CalculateFacesWithin:i(34),Copy:i(874),CreateFromTiles:i(875),CullTiles:i(876),Fill:i(877),FilterTiles:i(878),FindByIndex:i(879),FindTile:i(880),ForEachTile:i(881),GetTileAt:i(97),GetTileAtWorldXY:i(882),GetTilesWithin:i(15),GetTilesWithinShape:i(883),GetTilesWithinWorldXY:i(884),HasTileAt:i(346),HasTileAtWorldXY:i(885),IsInLayerBounds:i(74),PutTileAt:i(152),PutTileAtWorldXY:i(886),PutTilesAt:i(887),Randomize:i(888),RemoveTileAt:i(347),RemoveTileAtWorldXY:i(889),RenderDebug:i(890),ReplaceByIndex:i(345),SetCollision:i(891),SetCollisionBetween:i(892),SetCollisionByExclusion:i(893),SetCollisionByProperty:i(894),SetCollisionFromCollisionGroup:i(895),SetTileIndexCallback:i(896),SetTileLocationCallback:i(897),Shuffle:i(898),SwapByIndex:i(899),TileToWorldX:i(98),TileToWorldXY:i(900),TileToWorldY:i(99),WeightedRandomize:i(901),WorldToTileX:i(39),WorldToTileXY:i(902),WorldToTileY:i(40)}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),n(t,e,s)){var r=s.data[e][t];return null===r?null:-1===r.index?i?r:null:r}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o,a){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o={}),void 0===a&&(a={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=n,this.tileMargin=s,this.tileSpacing=r,this.tileProperties=o,this.tileData=a,this.image=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&t=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this},bind:function(){var t=this.gl,e=this.vertexBuffer,i=this.attributes,n=this.program,s=this.renderer,r=this.vertexSize;s.setProgram(n),s.setVertexBuffer(e);for(var o=0;o=0?(t.enableVertexAttribArray(h),t.vertexAttribPointer(h,a.size,a.type,a.normalized,r,a.offset)):t.disableVertexAttribArray(h)}return this},onBind:function(){return this},onPreRender:function(){return this},onRender:function(){return this},onPostRender:function(){return this},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t=this.gl,e=this.vertexCount,i=this.topology,n=this.vertexSize;if(0!==e)return t.bufferSubData(t.ARRAY_BUFFER,0,this.bytes.subarray(0,e*n)),t.drawArrays(i,0,e),this.vertexCount=0,this.flushLocked=!1,this;this.flushLocked=!1},destroy:function(){var t=this.gl;return t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),delete this.program,delete this.vertexBuffer,delete this.gl,this},setFloat1:function(t,e){return this.renderer.setFloat1(this.program,t,e),this},setFloat2:function(t,e,i){return this.renderer.setFloat2(this.program,t,e,i),this},setFloat3:function(t,e,i,n){return this.renderer.setFloat3(this.program,t,e,i,n),this},setFloat4:function(t,e,i,n,s){return this.renderer.setFloat4(this.program,t,e,i,n,s),this},setInt1:function(t,e){return this.renderer.setInt1(this.program,t,e),this},setInt2:function(t,e,i){return this.renderer.setInt2(this.program,t,e,i),this},setInt3:function(t,e,i,n){return this.renderer.setInt3(this.program,t,e,i,n),this},setInt4:function(t,e,i,n,s){return this.renderer.setInt4(this.program,t,e,i,n,s),this},setMatrix2:function(t,e,i){return this.renderer.setMatrix2(this.program,t,e,i),this},setMatrix3:function(t,e,i){return this.renderer.setMatrix3(this.program,t,e,i),this},setMatrix4:function(t,e,i){return this.renderer.setMatrix4(this.program,t,e,i),this}});t.exports=r},function(t,e,i){var n=i(53);t.exports=function(t,e){var i=n(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){void 0===e&&(e=new n);var i=2*Math.PI*Math.random(),s=Math.random()+Math.random(),r=s>1?2-s:s,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},function(t,e,i){var n=i(78),s=i(5);t.exports=function(t,e,i){if(void 0===i&&(i=new s),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=n(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},function(t,e,i){var n=i(66),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=n(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,u=t.y2,l=0;l=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(s*a+o*h),e}},function(t,e){t.exports=function(t,e,i,n,s){var r=n+Math.atan2(t.y-i,t.x-e);return t.x=e+s*Math.cos(r),t.y=i+s*Math.sin(r),t}},function(t,e,i){var n=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e-y||T>-m||b-y||S>-m||A-y||T>-m||b-y||S>-m||A-v&&S*n+C*r+h>-y&&(S+v)*i+(C+y)*s+a0?this:(this._fadeRed=e,this._fadeGreen=i,this._fadeBlue=n,t<=0&&(t=Number.MIN_VALUE),this._fadeDuration=t,this._fadeAlpha=Number.MIN_VALUE,this)},flash:function(t,e,i,n,s){return!s&&this._flashAlpha>0?this:(void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),this._flashRed=e,this._flashGreen=i,this._flashBlue=n,t<=0&&(t=Number.MIN_VALUE),this._flashDuration=t,this._flashAlpha=1,this)},getWorldPoint:function(t,e,i){void 0===i&&(i=new h);var n=this.matrix.matrix,s=n[0],r=n[1],o=n[2],a=n[3],u=n[4],l=n[5],c=s*a-r*o;if(!c)return i.x=t,i.y=e,i;var d=a*(c=1/c),f=-r*c,p=-o*c,g=s*c,v=(o*l-a*u)*c,y=(r*u-s*l)*c,m=Math.cos(this.rotation),x=Math.sin(this.rotation),w=this.zoom,b=this.scrollX,T=this.scrollY,A=t+(b*m-T*x)*w,S=e+(b*x+T*m)*w;return i.x=A*d+S*p+v,i.y=A*f+S*g+y,i},ignore:function(t){if(t instanceof Array)for(var e=0;el&&(this.scrollX=l),this.scrollYc&&(this.scrollY=c)}this.roundPixels&&(this.scrollX=Math.round(this.scrollX),this.scrollY=Math.round(this.scrollY)),r.loadIdentity(),r.scale(e,e),r.translate(this.x+o,this.y+a),r.rotate(this.rotation),r.scale(s,s),r.translate(-o,-a),r.translate(this._shakeOffsetX,this._shakeOffsetY)},removeBounds:function(){return this.useBounds=!1,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=s(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=a(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n){return this._bounds.setTo(t,e,i,n),this.useBounds=!0,this},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t){return this.scene=t,this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setZoom:function(t){return void 0===t&&(t=1),this.zoom=t,this},shake:function(t,e,i){return void 0===e&&(e=.05),i||0===this._shakeOffsetX&&0===this._shakeOffsetY?(this._shakeDuration=t,this._shakeIntensity=e,this._shakeOffsetX=0,this._shakeOffsetY=0,this):this},startFollow:function(t,e){return this._follow=t,void 0!==e&&(this.roundPixels=e),this},stopFollow:function(){return this._follow=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},resetFX:function(){return this._flashAlpha=0,this._fadeAlpha=0,this._shakeOffsetX=0,this._shakeOffsetY=0,this._shakeDuration=0,this},update:function(t,e){if(this._flashAlpha>0&&(this._flashAlpha-=e/this._flashDuration,this._flashAlpha<0&&(this._flashAlpha=0)),this._fadeAlpha>0&&this._fadeAlpha<1&&(this._fadeAlpha+=e/this._fadeDuration,this._fadeAlpha>=1&&(this._fadeAlpha=1)),this._shakeDuration>0){var i=this._shakeIntensity;this._shakeDuration-=e,this._shakeDuration<=0?(this._shakeOffsetX=0,this._shakeOffsetY=0):(this._shakeOffsetX=(Math.random()*i*this.width*2-i*this.width)*this.zoom,this._shakeOffsetY=(Math.random()*i*this.height*2-i*this.height)*this.zoom,this.roundPixels&&(this._shakeOffsetX|=0,this._shakeOffsetY|=0))}},destroy:function(){this._bounds=void 0,this.matrix=void 0,this.culledObjects=[],this.scene=void 0}});t.exports=u},function(t,e,i){var n=i(201),s=i(203),r=i(205),o=i(206);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):n(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var n=i(0),s=i(119),r=i(207),o=i(208),a=i(209),h=i(62),u=i(81),l=i(6),c=i(51),d=i(120),f=new c,p=new d,g=new c,v=new c,y=new s,m=new n({initialize:function(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,this.name="",this.direction=new c(0,0,-1),this.up=new c(0,1,0),this.position=new c,this.pixelScale=128,this.projection=new s,this.view=new s,this.combined=new s,this.invProjectionView=new s,this.near=1,this.far=100,this.ray={origin:new c,direction:new c},this.viewportWidth=0,this.viewportHeight=0,this.billboardMatrixDirty=!0,this.children=new h},setPosition:function(t,e,i){return this.position.set(t,e,i),this.update()},setScene:function(t){return this.scene=t,this},setPixelScale:function(t){return this.pixelScale=t,this.update()},add:function(t){return this.children.set(t),this.updateChildren(),t},remove:function(t){return this.displayList.remove(t.gameObject),this.updateList.remove(t.gameObject),this.children.delete(t),this},clear:function(){for(var t=this.getChildren(),e=0;e0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return Math.sqrt(e*e+i*i+n*n+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return e*e+i*i+n*n+s*s},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,u=a*i+o*e-s*n,l=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+u*-o-l*-r,this.y=u*a+c*-r+l*-s-h*-o,this.z=l*a+c*-o+h*-r-u*-s,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});n.prototype.sub=n.prototype.subtract,n.prototype.mul=n.prototype.multiply,n.prototype.div=n.prototype.divide,n.prototype.dist=n.prototype.distance,n.prototype.distSq=n.prototype.distanceSq,n.prototype.len=n.prototype.length,n.prototype.lenSq=n.prototype.lengthSq,t.exports=n},function(t,e){var i,n="";t.exports={disable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!1),t},enable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!0),t},getPrefix:i=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e){t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,LINE_FX_TO:12,MOVE_FX_TO:13,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18}},function(t,e){t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221}},function(t,e,i){var n=i(0),s=i(83),r=i(531),o=i(532),a=i(236),h=i(255),u=new n({initialize:function(t,e){this.scene=t,this.game,this.config=e,this.settings=h.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList},init:function(t){this.settings.status=s.INIT,this.game=t,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.installGlobal(this,a.Global),e.installLocal(this,a.CoreScene),e.installLocal(this,o(this)),e.installLocal(this,r(this)),this.events.emit("boot",this),this.settings.isBooted=!0},install:function(t){Array.isArray(t)||(t=[t]),this.plugins.installLocal(this,t)},step:function(t,e){this.events.emit("preupdate",t,e),this.events.emit("update",t,e),this.scene.update.call(this.scene,t,e),this.events.emit("postupdate",t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.cameras.render(t,e),this.events.emit("render",t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(){return this.settings.active&&(this.settings.status=s.PAUSED,this.settings.active=!1,this.events.emit("pause",this)),this},resume:function(){return this.settings.active||(this.settings.status=s.RUNNING,this.settings.active=!0,this.events.emit("resume",this)),this},sleep:function(){return this.settings.status=s.SLEEPING,this.settings.active=!1,this.settings.visible=!1,this.events.emit("sleep",this),this},wake:function(){return this.settings.status=s.RUNNING,this.settings.active=!0,this.settings.visible=!0,this.events.emit("wake",this),this},isSleeping:function(){return this.settings.status===s.SLEEPING},isActive:function(){return this.settings.status===s.RUNNING},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t){return t?this.resume():this.pause()},start:function(t){this.settings.status=s.START,this.settings.data=t,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this)},resize:function(t,e){this.events.emit("resize",t,e)},shutdown:function(){this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this)}});t.exports=u},function(t,e,i){var n=i(0),s=i(23),r=new n({initialize:function(t,e,i,n,s,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX=n,this.cutY=s,this.cutWidth=r,this.cutHeight=o,this.x=0,this.y=0,this.width=r,this.height=o,this.halfWidth=Math.floor(.5*r),this.halfHeight=Math.floor(.5*o),this.centerX=Math.floor(r/2),this.centerY=Math.floor(o/2),this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.data={cut:{x:n,y:s,w:r,h:o,r:n+r,b:s+o},trim:!1,sourceSize:{w:r,h:o},spriteSourceSize:{x:0,y:0,w:r,h:o},uvs:{x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},radius:.5*Math.sqrt(r*r+o*o),drawImage:{sx:n,sy:s,sWidth:r,sHeight:o,dWidth:r,dHeight:o}},this.updateUVs()},setTrim:function(t,e,i,n,s,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=n,a.w=s,a.h=r,this.x=i,this.y=n,this.width=s,this.height=r,this.halfWidth=.5*s,this.halfHeight=.5*r,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.updateUVs()},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.sWidth=i,s.sHeight=n,s.dWidth=i,s.dHeight=n;var r=this.source.width,o=this.source.height,a=this.data.uvs;return a.x0=t/r,a.y0=e/o,a.x1=t/r,a.y1=(e+n)/o,a.x2=(t+i)/r,a.y2=(e+n)/o,a.x3=(t+i)/r,a.y3=e/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height,i=this.data.uvs;return i.x3=(this.cutX+this.cutHeight)/t,i.y3=(this.cutY+this.cutWidth)/e,i.x2=this.cutX/t,i.y2=(this.cutY+this.cutWidth)/e,i.x1=this.cutX/t,i.y1=this.cutY/e,i.x0=(this.cutX+this.cutHeight)/t,i.y0=this.cutY/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},uvs:{get:function(){return this.data.uvs}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(268),a=i(548),h=i(549),u=i(550),l=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.ScaleMode,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,u],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"BitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds()},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this.text=t.toString()),this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});l.ParseRetroFont=h,l.ParseFromAtlas=a,t.exports=l},function(t,e,i){var n=i(553),s=i(556),r=i(0),o=i(11),a=i(130),h=i(1),u=i(86),l=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,n],initialize:function(t,e,i,n,s){h.call(this,t,"Blitter"),this.setTexture(n,s),this.setPosition(e,i),this.initPipeline("TextureTintPipeline"),this.children=new u,this.renderList=[],this.dirty=!1},create:function(t,e,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new s(this,t,e,i,n);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,n){for(var s=this.createMultiple(e,i,n),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0}});t.exports=l},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(268),a=i(557),h=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"DynamicBitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds(),this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this.text=t.toString()),this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});t.exports=h},function(t,e,i){var n=i(115),s=i(0),r=i(127),o=i(11),a=i(270),h=i(1),u=i(4),l=i(16),c=i(569),d=new s({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.Transform,o.Visible,o.ScrollFactor,c],initialize:function(t,e){var i=u(e,"x",0),n=u(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,n),this.initPipeline("FlatTintPipeline"),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.setDefaultStyles(e)},setDefaultStyles:function(t){return u(t,"lineStyle",null)&&(this.defaultStrokeWidth=u(t,"lineStyle.width",1),this.defaultStrokeColor=u(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=u(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),u(t,"fillStyle",null)&&(this.defaultFillColor=u(t,"fillStyle.color",16777215),this.defaultFillAlpha=u(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,l.PI2),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,l.PI2),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,n){return this.commandBuffer.push(r.FILL_RECT,t,e,i,n),this},strokeRect:function(t,e,i,n){var s=this._lineWidth/2,r=t-s,o=t+s;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+n),this.strokePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+n),this.strokePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.beginPath(),this.moveTo(r,e+n),this.lineTo(o+i,e+n),this.strokePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,n,s,o),this},strokeTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,n,s,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,n){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,n),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},lineFxTo:function(t,e,i,n){return this.commandBuffer.push(r.LINE_FX_TO,t,e,i,n,1),this},moveFxTo:function(t,e,i,n){return this.commandBuffer.push(r.MOVE_FX_TO,t,e,i,n,1),this},strokePoints:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var n,s,r=this.scene.sys;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),d.TargetCamera.setViewport(0,0,e,i),d.TargetCamera.scrollX=this.x,d.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var o=(n=r.textures.get(t)).getSourceImage();o instanceof HTMLCanvasElement&&(s=o.getContext("2d"))}else s=(n=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d");else t instanceof HTMLCanvasElement&&(s=t.getContext("2d"));return s&&(this.renderCanvas(r.game.renderer,this,0,d.TargetCamera,s),r.game.renderer.gl&&n&&(n.source[0].glTexture=r.game.renderer.canvasToTexture(s.canvas,n.source[0].glTexture,!0,0))),this}});d.TargetCamera=new n(0,0,0,0),t.exports=d},function(t,e,i){var n=i(0),s=i(68),r=i(271),o=i(272),a=i(110),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(5);t.exports=function(t,e,i){void 0===i&&(i=new n);var s=t.width/2,r=t.height/2;return i.x=t.x+s*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(574),a=i(86),h=i(575),u=i(614),l=new n({Extends:r,Mixins:[s.Depth,s.Visible,s.Pipeline,u],initialize:function(t,e,i,n){if(r.call(this,t,"ParticleEmitterManager"),this.blendMode=-1,this.timeScale=1,this.texture=null,this.frame=null,this.frameNames=[],null===i||"object"!=typeof i&&!Array.isArray(i)||(n=i,i=null),this.setTexture(e,i),this.initPipeline("TextureTintPipeline"),this.emitters=new a(this),this.wells=new a(this),n){Array.isArray(n)||(n=[n]);for(var s=0;s0?e.defaultFrame=i[0]:e.defaultFrame=this.defaultFrame,this},addEmitter:function(t){return this.emitters.add(t)},createEmitter:function(t){return this.addEmitter(new h(this,t))},addGravityWell:function(t){return this.wells.add(t)},createGravityWell:function(t){return this.addGravityWell(new o(t))},emitParticle:function(t,e,i){for(var n=this.emitters.list,s=0;su){if(0===c){for(var g=f;g.length&&(g=g.slice(0,-1),!((p=e.measureText(g).width)<=u)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var v=d.substr(g.length);l[c]=v,h+=g}var y=l[c].length?c:c+1,m=l.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=m+" "+(s[o+1]||""),r=s.length;break}h+=f,u-=p}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var n="",s=t.split(this.splitRegExp),r=0;ro?(h>0&&(n+="\n"),n+=a[h]+" ",o=i-u):(o-=l,n+=a[h]+" ")}r0&&(a+=l.lineSpacing*p),i.rtl?o=d-o:"right"===i.align?o+=l.width-l.lineWidths[p]:"center"===i.align&&(o+=(l.width-l.lineWidths[p])/2),this.autoRound&&(o=Math.round(o),a=Math.round(a)),i.strokeThickness&&(this.style.syncShadow(e,i.shadowStroke),e.strokeText(u[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(u[p],o,a));return e.restore(),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this.text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t},preDestroy:function(){this.style.rtl&&l(this.canvas),s.remove(this.canvas)}});t.exports=f},function(t,e,i){var n=i(19),s=i(0),r=i(11),o=i(1),a=i(291),h=i(628),u=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Origin,r.Pipeline,r.ScaleMode,r.ScrollFactor,r.Size,r.Texture,r.Tint,r.Transform,r.Visible,h],initialize:function(t,e,i,s,r,h,u){var l=t.sys.game.renderer;o.call(this,t,"TileSprite"),this.tilePositionX=0,this.tilePositionY=0,this.dirty=!0,this.tileTexture=null,this.renderer=l,this.setTexture(h,u),this.setPosition(e,i),this.setSize(s,r),this.setOriginFromFrame(),this.initPipeline("TextureTintPipeline"),this.potWidth=a(this.frame.width),this.potHeight=a(this.frame.height),this.canvasPattern=null,this.canvasBuffer=n.create2D(null,this.potWidth,this.potHeight),this.canvasBufferCtx=this.canvasBuffer.getContext("2d"),this.oldFrame=null,this.updateTileTexture(),t.sys.game.renderer.onContextRestored(function(t){var e=t.gl;this.tileTexture=null,this.dirty=!0,this.tileTexture=t.createTexture2D(0,e.LINEAR,e.LINEAR,e.REPEAT,e.REPEAT,e.RGBA,this.canvasBuffer,this.potWidth,this.potHeight)},this)},updateTileTexture:function(){(this.dirty||this.oldFrame!==this.frame)&&(this.oldFrame=this.frame,this.canvasBufferCtx.clearRect(0,0,this.canvasBuffer.width,this.canvasBuffer.height),this.canvasBufferCtx.drawImage(this.frame.source.image,this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight,0,0,this.potWidth,this.potHeight),this.renderer.gl?this.tileTexture=this.renderer.canvasToTexture(this.canvasBuffer,this.tileTexture,null===this.tileTexture,this.scaleMode):this.canvasPattern=this.canvasBufferCtx.createPattern(this.canvasBuffer,"repeat"),this.dirty=!1)},destroy:function(){this.renderer&&this.renderer.deleteTexture(this.tileTexture),n.remove(this.canvasBuffer),this.canvasPattern=null,this.canvasBufferCtx=null,this.canvasBuffer=null,this.renderer=null,this.visible=!1}});t.exports=u},function(t,e,i){var n=i(0),s=i(88),r=new n({Extends:s,initialize:function(t,e,i,n,r){s.call(this,t,e,i,[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,1,1,1,0],[16777215,16777215,16777215,16777215,16777215,16777215],[1,1,1,1,1,1],n,r),this.resetPosition()},topLeftX:{get:function(){return this.x+this.vertices[0]},set:function(t){this.vertices[0]=t-this.x,this.vertices[6]=t-this.x}},topLeftY:{get:function(){return this.y+this.vertices[1]},set:function(t){this.vertices[1]=t-this.y,this.vertices[7]=t-this.y}},topRightX:{get:function(){return this.x+this.vertices[10]},set:function(t){this.vertices[10]=t-this.x}},topRightY:{get:function(){return this.y+this.vertices[11]},set:function(t){this.vertices[11]=t-this.y}},bottomLeftX:{get:function(){return this.x+this.vertices[2]},set:function(t){this.vertices[2]=t-this.x}},bottomLeftY:{get:function(){return this.y+this.vertices[3]},set:function(t){this.vertices[3]=t-this.y}},bottomRightX:{get:function(){return this.x+this.vertices[4]},set:function(t){this.vertices[4]=t-this.x,this.vertices[8]=t-this.x}},bottomRightY:{get:function(){return this.y+this.vertices[5]},set:function(t){this.vertices[5]=t-this.y,this.vertices[9]=t-this.y}},topLeftAlpha:{get:function(){return this.alphas[0]},set:function(t){this.alphas[0]=t,this.alphas[3]=t}},topRightAlpha:{get:function(){return this.alphas[5]},set:function(t){this.alphas[5]=t}},bottomLeftAlpha:{get:function(){return this.alphas[1]},set:function(t){this.alphas[1]=t}},bottomRightAlpha:{get:function(){return this.alphas[2]},set:function(t){this.alphas[2]=t,this.alphas[4]=t}},topLeftColor:{get:function(){return this.colors[0]},set:function(t){this.colors[0]=t,this.colors[3]=t}},topRightColor:{get:function(){return this.colors[5]},set:function(t){this.colors[5]=t}},bottomLeftColor:{get:function(){return this.colors[1]},set:function(t){this.colors[1]=t}},bottomRightColor:{get:function(){return this.colors[2]},set:function(t){this.colors[2]=t,this.colors[4]=t}},setTopLeft:function(t,e){return this.topLeftX=t,this.topLeftY=e,this},setTopRight:function(t,e){return this.topRightX=t,this.topRightY=e,this},setBottomLeft:function(t,e){return this.bottomLeftX=t,this.bottomLeftY=e,this},setBottomRight:function(t,e){return this.bottomRightX=t,this.bottomRightY=e,this},resetPosition:function(){var t=this.x,e=this.y,i=Math.floor(this.width/2),n=Math.floor(this.height/2);return this.setTopLeft(t-i,e-n),this.setTopRight(t+i,e-n),this.setBottomLeft(t-i,e+n),this.setBottomRight(t+i,e+n),this},resetAlpha:function(){var t=this.alphas;return t[0]=1,t[1]=1,t[2]=1,t[3]=1,t[4]=1,t[5]=1,this},resetColors:function(){var t=this.colors;return t[0]=16777215,t[1]=16777215,t[2]=16777215,t[3]=16777215,t[4]=16777215,t[5]=16777215,this},reset:function(){return this.resetPosition(),this.resetAlpha(),this.resetColors()}});t.exports=r},function(t,e){t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=[]);for(var s,r,o,a,h,u,l=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=l*l+c*c,g=l*d+c*f,v=d*d+f*f,y=p*v-g*g,m=0===y?0:1/y,x=t.x1,w=t.y1,b=0;b=0&&r>=0&&s+r<1&&(n.push({x:e[b].x,y:e[b].y}),i)));b++);return n}},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*s-a*r+e,t.y1=o*r+a*s+i,o=t.x2-e,a=t.y2-i,t.x2=o*s-a*r+e,t.y2=o*r+a*s+i,t}},function(t,e){t.exports=function(t,e,i){for(var n=!1,s=-1,r=t.points.length-1;++s0&&(n.totalDuration+=n.t2*n.repeat),n.totalDuration>t&&(t=n.totalDuration)}this.duration=t,this.loopCounter=-1===this.loop?999999999999:this.loop,this.loopCounter>0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){for(var t=this.data,e=this.totalTargets,i=0;i0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&(t.params[1]=this.targets,t.func.apply(t.scope,t.params)),this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},pause:function(){if(this.state!==o.PAUSED)return this.paused=!0,this._pausedState=this.state,this.state=o.PAUSED,this},play:function(t){if(this.state!==o.ACTIVE){this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?(e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.ACTIVE):(this.countdown=this.calculatedOffset,this.state=o.OFFSET_DELAY)):this.paused?(this.paused=!1,this.parent.makeActive(this)):(this.resetTweenData(t),this.state=o.ACTIVE,e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)))}},resetTweenData:function(t){for(var e=this.data,i=0;i0?(n.elapsed=n.delay,n.state=o.DELAY):n.state=o.PENDING_RENDER}},resume:function(){return this.state===o.PAUSED&&(this.paused=!1,this.state=this._pausedState),this},seek:function(t){for(var e=this.data,i=0;i=s.totalDuration?(r=1,o=s.duration):n>s.delay&&n<=s.t1?(r=(n=Math.max(0,n-s.delay))/s.t1,o=s.duration*r):n>s.t1&&ns.repeatDelay&&(r=n/s.t1,o=s.duration*r)),s.progress=r,s.elapsed=o;var a=s.ease(s.progress);s.current=s.start+(s.end-s.start)*a,s.target[s.key]=s.current}},setCallback:function(t,e,i,n){return this.callbacks[t]={func:e,scope:n,params:i},this},complete:function(t){if(void 0===t&&(t=0),t)this.countdown=t,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},stop:function(t){void 0!==t&&this.seek(t),this.state=o.PENDING_REMOVE},update:function(t,e){if(this.state===o.PAUSED)return!1;switch(this.useFrames&&(e=1*this.parent.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var i=!1,n=0;n0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var s=t.callbacks.onRepeat;return s&&(s.params[1]=e.target,s.func.apply(s.scope,s.params)),e.start=e.getStartValue(e.target,e.key,e.start),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},setStateFromStart:function(t,e,i){if(e.repeatCounter>0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var n=t.callbacks.onRepeat;return n&&(n.params[1]=e.target,n.func.apply(n.scope,n.params)),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},updateTweenData:function(t,e,i){switch(e.state){case o.PLAYING_FORWARD:case o.PLAYING_BACKWARD:if(!e.target){e.state=o.COMPLETE;break}var n=e.elapsed,s=e.duration,r=0;(n+=i)>s&&(r=n-s,n=s);var a,h=e.state===o.PLAYING_FORWARD,u=n/s;a=h?e.ease(u):e.ease(1-u),e.current=e.start+(e.end-e.start)*a,e.target[e.key]=e.current,e.elapsed=n,e.progress=u;var l=t.callbacks.onUpdate;l&&(l.params[1]=e.target,l.func.apply(l.scope,l.params)),1===u&&(h?e.hold>0?(e.elapsed=e.hold-r,e.state=o.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,r):e.state=this.setStateFromStart(t,e,r));break;case o.DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PENDING_RENDER);break;case o.REPEAT_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PLAYING_FORWARD);break;case o.HOLD_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case o.PENDING_RENDER:e.target?(e.start=e.getStartValue(e.target,e.key,e.target[e.key]),e.end=e.getEndValue(e.target,e.key,e.start),e.current=e.start,e.target[e.key]=e.start,e.state=o.PLAYING_FORWARD):e.state=o.COMPLETE}return e.state!==o.COMPLETE}});a.TYPES=["onComplete","onLoop","onRepeat","onStart","onUpdate","onYoyo"],r.register("tween",function(t){return this.scene.sys.tweens.add(t)}),s.register("tween",function(t){return this.scene.sys.tweens.create(t)}),t.exports=a},function(t,e){t.exports=function(t,e,i,n,s,r,o,a,h,u,l,c,d){return{target:t,key:e,getEndValue:i,getStartValue:n,ease:s,duration:0,totalDuration:0,delay:0,yoyo:a,hold:0,repeat:0,repeatDelay:0,flipX:c,flipY:d,progress:0,elapsed:0,repeatCounter:0,start:0,current:0,end:0,t1:0,t2:0,gen:{delay:r,duration:o,hold:h,repeat:u,repeatDelay:l},state:0}}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(0),s=i(516),r=i(164),o=new n({Extends:r,initialize:function(t){t.fragShader=s.replace("%LIGHT_COUNT%",10..toString()),r.call(this,t)},onBind:function(){r.prototype.onBind.call(this);var t=this.renderer,e=this.program;return this.mvpUpdate(),t.setInt1(e,"uNormSampler",1),t.setFloat2(e,"uResolution",this.width,this.height),this},onRender:function(t,e){var i=t.lights;if(i.culledLights.length=0,i.lights.length<=0||!i.active)return this;var n,s=this.renderer,r=this.program,o=t.lights.cull(e),a=Math.min(o.length,10),h=e.matrix,u={x:0,y:0},l=s.height;for(n=0;n<10;++n)s.setFloat1(r,"uLights["+n+"].radius",0);if(a<=0)return this;for(s.setFloat4(r,"uCamera",e.x,e.y,e.rotation,e.zoom),s.setFloat3(r,"uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),n=0;n0?(n.textures[e-1]&&n.textures[e-1]!==t&&this.pushBatch(),i[i.length-1].textures[e-1]=t):(null!==n.texture&&n.texture!==t&&this.pushBatch(),i[i.length-1].texture=t),this},pushBatch:function(){var t={first:this.vertexCount,texture:null,textures:[]};this.batches.push(t)},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.renderer,r=this.vertexCount,o=this.topology,a=this.vertexSize,h=this.batches,u=0,l=null;if(0===h.length||0===r)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,r*a));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(s.setTexture2D(l.texture,0),n.drawArrays(o,l.first,u)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},onBind:function(){return h.prototype.onBind.call(this),this.mvpUpdate(),0===this.batches.length&&this.pushBatch(),this},resize:function(t,e,i){return h.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},drawStaticTilemapLayer:function(t){if(t.vertexCount>0){var e=this.vertexBuffer,i=this.gl,n=this.renderer,s=t.tileset.image.get();n.currentPipeline&&n.currentPipeline.vertexCount>0&&n.flush(),this.vertexBuffer=t.vertexBuffer,n.setPipeline(this),n.setTexture2D(s.source.glTexture,0),i.drawArrays(this.topology,0,t.vertexCount),this.vertexBuffer=e}this.viewIdentity(),this.modelIdentity()},drawEmitterManager:function(t,e){this.renderer.setPipeline(this);var i=this.renderer.config.roundPixels,n=t.emitters.list,s=n.length,r=this.vertexViewF32,o=this.vertexViewU32,a=this.renderer,h=this.maxQuads,u=e.scrollX,l=e.scrollY,c=e.matrix.matrix,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=Math.sin,x=Math.cos,w=this.vertexComponentCount,b=this.vertexCapacity,T=t.defaultFrame.source.glTexture;this.setTexture2D(T,0);for(var A=0;A=b&&(this.flush(),this.setTexture2D(T,0));for(var F=0;F=b&&(this.flush(),this.setTexture2D(T,0))}}}this.setTexture2D(T,0)},drawBlitter:function(t,e){this.renderer.setPipeline(this);for(var i=this.renderer.config.roundPixels,n=a.getTintAppendFloatAlpha,s=this.vertexViewF32,r=this.vertexViewU32,o=t.getRenderList(),h=o.length,u=e.matrix.matrix,l=u[0],c=u[1],d=u[2],f=u[3],p=u[4],g=u[5],v=e.scrollX*t.scrollFactorX,y=e.scrollY*t.scrollFactorY,m=Math.ceil(h/this.maxQuads),x=0,w=t.x-v,b=t.y-y,T=0;T=this.vertexCapacity&&this.flush()}x+=A,h-=A,this.vertexCount>=this.vertexCapacity&&this.flush()}},batchSprite:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n=this.renderer.config.roundPixels,s=a.getTintAppendFloatAlpha,r=this.vertexViewF32,o=this.vertexViewU32,h=e.matrix.matrix,u=t.frame,l=u.texture.source[u.sourceIndex].glTexture,c=!!l.isRenderTexture,d=t.flipX,f=t.flipY^c,p=u.uvs,g=u.width*(d?-1:1),v=u.height*(f?-1:1),y=-t.displayOriginX+u.x+u.width*(d?1:0),m=-t.displayOriginY+u.y+u.height*(f?1:0),x=(n?0|y:y)+g,w=(n?0|m:m)+v,b=t.x-e.scrollX*t.scrollFactorX,T=t.y-e.scrollY*t.scrollFactorY,A=t.scaleX,S=t.scaleY,C=-t.rotation,M=t._alphaTL,E=t._alphaTR,_=t._alphaBL,L=t._alphaBR,P=t._tintTL,F=t._tintTR,k=t._tintBL,R=t._tintBR,O=Math.sin(C),D=Math.cos(C),I=D*A,B=-O*A,Y=O*S,X=D*S,z=b,N=T,G=h[0],W=h[1],U=h[2],V=h[3],H=I*G+B*U,j=I*W+B*V,q=Y*G+X*U,K=Y*W+X*V,J=z*G+N*U+h[4],Z=z*W+N*V+h[5],Q=y*H+m*q+J,$=y*j+m*K+Z,tt=y*H+w*q+J,et=y*j+w*K+Z,it=x*H+w*q+J,nt=x*j+w*K+Z,st=x*H+m*q+J,rt=x*j+m*K+Z,ot=s(P,M),at=s(F,E),ht=s(k,_),ut=s(R,L);n&&(Q|=0,$|=0,tt|=0,et|=0,it|=0,nt|=0,st|=0,rt|=0),this.setTexture2D(l,0),r[(i=this.vertexCount*this.vertexComponentCount)+0]=Q,r[i+1]=$,r[i+2]=p.x0,r[i+3]=p.y0,o[i+4]=ot,r[i+5]=tt,r[i+6]=et,r[i+7]=p.x1,r[i+8]=p.y1,o[i+9]=ht,r[i+10]=it,r[i+11]=nt,r[i+12]=p.x2,r[i+13]=p.y2,o[i+14]=ut,r[i+15]=Q,r[i+16]=$,r[i+17]=p.x0,r[i+18]=p.y0,o[i+19]=ot,r[i+20]=it,r[i+21]=nt,r[i+22]=p.x2,r[i+23]=p.y2,o[i+24]=ut,r[i+25]=st,r[i+26]=rt,r[i+27]=p.x3,r[i+28]=p.y3,o[i+29]=at,this.vertexCount+=6},batchMesh:function(t,e){var i=t.vertices,n=i.length,s=n/2|0;this.renderer.setPipeline(this),this.vertexCount+s>this.vertexCapacity&&this.flush();var r=this.renderer.config.roundPixels,o=a.getTintAppendFloatAlpha,h=t.uv,u=t.colors,l=t.alphas,c=this.vertexViewF32,d=this.vertexViewU32,f=e.matrix.matrix,p=t.frame,g=t.texture.source[p.sourceIndex].glTexture,v=t.x-e.scrollX*t.scrollFactorX,y=t.y-e.scrollY*t.scrollFactorY,m=t.scaleX,x=t.scaleY,w=-t.rotation,b=Math.sin(w),T=Math.cos(w),A=T*m,S=-b*m,C=b*x,M=T*x,E=v,_=y,L=f[0],P=f[1],F=f[2],k=f[3],R=A*L+S*F,O=A*P+S*k,D=C*L+M*F,I=C*P+M*k,B=E*L+_*F+f[4],Y=E*P+_*k+f[5],X=0;this.setTexture2D(g,0),X=this.vertexCount*this.vertexComponentCount;for(var z=0,N=0;zthis.vertexCapacity&&this.flush();var i,n,s,r,o,h,u,l,c=this.renderer.config.roundPixels,d=t.text,f=d.length,p=a.getTintAppendFloatAlpha,g=this.vertexViewF32,v=this.vertexViewU32,y=e.matrix.matrix,m=e.width+50,x=e.height+50,w=t.frame,b=t.texture.source[w.sourceIndex],T=e.scrollX*t.scrollFactorX,A=e.scrollY*t.scrollFactorY,S=t.fontData,C=S.lineHeight,M=t.fontSize/S.size,E=S.chars,_=t.alpha,L=p(t._tintTL,_),P=p(t._tintTR,_),F=p(t._tintBL,_),k=p(t._tintBR,_),R=t.x,O=t.y,D=w.cutX,I=w.cutY,B=b.width,Y=b.height,X=b.glTexture,z=0,N=0,G=0,W=0,U=null,V=0,H=0,j=0,q=0,K=0,J=0,Z=0,Q=0,$=0,tt=0,et=0,it=0,nt=null,st=0,rt=R-T+w.x,ot=O-A+w.y,at=-t.rotation,ht=t.scaleX,ut=t.scaleY,lt=Math.sin(at),ct=Math.cos(at),dt=ct*ht,ft=-lt*ht,pt=lt*ut,gt=ct*ut,vt=rt,yt=ot,mt=y[0],xt=y[1],wt=y[2],bt=y[3],Tt=dt*mt+ft*wt,At=dt*xt+ft*bt,St=pt*mt+gt*wt,Ct=pt*xt+gt*bt,Mt=vt*mt+yt*wt+y[4],Et=vt*xt+yt*bt+y[5],_t=0;this.setTexture2D(X,0);for(var Lt=0;Ltm||n<-50||n>x)&&(s<-50||s>m||r<-50||r>x)&&(o<-50||o>m||h<-50||h>x)&&(u<-50||u>m||l<-50||l>x)||(this.vertexCount+6>this.vertexCapacity&&this.flush(),c&&(i|=0,n|=0,s|=0,r|=0,o|=0,h|=0,u|=0,l|=0),g[(_t=this.vertexCount*this.vertexComponentCount)+0]=i,g[_t+1]=n,g[_t+2]=$,g[_t+3]=et,v[_t+4]=L,g[_t+5]=s,g[_t+6]=r,g[_t+7]=$,g[_t+8]=it,v[_t+9]=F,g[_t+10]=o,g[_t+11]=h,g[_t+12]=tt,g[_t+13]=it,v[_t+14]=k,g[_t+15]=i,g[_t+16]=n,g[_t+17]=$,g[_t+18]=et,v[_t+19]=L,g[_t+20]=o,g[_t+21]=h,g[_t+22]=tt,g[_t+23]=it,v[_t+24]=k,g[_t+25]=u,g[_t+26]=l,g[_t+27]=tt,g[_t+28]=et,v[_t+29]=P,this.vertexCount+=6))}}else z=0,G=0,N+=C,nt=null},batchDynamicBitmapText:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n,s,r,o,h,u,l,c,d,f,p,g,v,y=this.renderer.config.roundPixels,m=t.displayCallback,x=t.text,w=x.length,b=a.getTintAppendFloatAlpha,T=this.vertexViewF32,A=this.vertexViewU32,S=this.renderer,C=e.matrix.matrix,M=t.frame,E=t.texture.source[M.sourceIndex],_=e.scrollX*t.scrollFactorX,L=e.scrollY*t.scrollFactorY,P=t.scrollX,F=t.scrollY,k=t.fontData,R=k.lineHeight,O=t.fontSize/k.size,D=k.chars,I=t.alpha,B=b(t._tintTL,I),Y=b(t._tintTR,I),X=b(t._tintBL,I),z=b(t._tintBR,I),N=t.x,G=t.y,W=M.cutX,U=M.cutY,V=E.width,H=E.height,j=E.glTexture,q=0,K=0,J=0,Z=0,Q=null,$=0,tt=0,et=0,it=0,nt=0,st=0,rt=0,ot=0,at=0,ht=0,ut=0,lt=0,ct=null,dt=0,ft=N+M.x,pt=G+M.y,gt=-t.rotation,vt=t.scaleX,yt=t.scaleY,mt=Math.sin(gt),xt=Math.cos(gt),wt=xt*vt,bt=-mt*vt,Tt=mt*yt,At=xt*yt,St=ft,Ct=pt,Mt=C[0],Et=C[1],_t=C[2],Lt=C[3],Pt=wt*Mt+bt*_t,Ft=wt*Et+bt*Lt,kt=Tt*Mt+At*_t,Rt=Tt*Et+At*Lt,Ot=St*Mt+Ct*_t+C[4],Dt=St*Et+Ct*Lt+C[5],It=t.cropWidth>0||t.cropHeight>0,Bt=0;this.setTexture2D(j,0),It&&S.pushScissor(t.x,t.y,t.cropWidth*t.scaleX,t.cropHeight*t.scaleY);for(var Yt=0;Ytthis.vertexCapacity&&this.flush(),y&&(i|=0,n|=0,s|=0,r|=0,o|=0,h|=0,u|=0,l|=0),T[(Bt=this.vertexCount*this.vertexComponentCount)+0]=i,T[Bt+1]=n,T[Bt+2]=at,T[Bt+3]=ut,A[Bt+4]=B,T[Bt+5]=s,T[Bt+6]=r,T[Bt+7]=at,T[Bt+8]=lt,A[Bt+9]=X,T[Bt+10]=o,T[Bt+11]=h,T[Bt+12]=ht,T[Bt+13]=lt,A[Bt+14]=z,T[Bt+15]=i,T[Bt+16]=n,T[Bt+17]=at,T[Bt+18]=ut,A[Bt+19]=B,T[Bt+20]=o,T[Bt+21]=h,T[Bt+22]=ht,T[Bt+23]=lt,A[Bt+24]=z,T[Bt+25]=u,T[Bt+26]=l,T[Bt+27]=ht,T[Bt+28]=ut,A[Bt+29]=Y,this.vertexCount+=6}}}else q=0,J=0,K+=R,ct=null;It&&S.popScissor()},batchText:function(t,e){var i=a.getTintAppendFloatAlpha;this.batchTexture(t,t.canvasTexture,t.canvasTexture.width,t.canvasTexture.height,t.x,t.y,t.canvasTexture.width,t.canvasTexture.height,t.scaleX,t.scaleY,t.rotation,t.flipX,t.flipY,t.scrollFactorX,t.scrollFactorY,t.displayOriginX,t.displayOriginY,0,0,t.canvasTexture.width,t.canvasTexture.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),0,0,e)},batchDynamicTilemapLayer:function(t,e){for(var i=t.culledTiles,n=i.length,s=t.tileset.image.get().source.glTexture,r=t.tileset,o=t.scrollFactorX,h=t.scrollFactorY,u=t.alpha,l=t.x,c=t.y,d=t.scaleX,f=t.scaleY,p=a.getTintAppendFloatAlpha,g=0;gthis.vertexCapacity&&this.flush(),d^=e.isRenderTexture?1:0,l=-l;var _,L=this.renderer.config.roundPixels,P=this.vertexViewF32,F=this.vertexViewU32,k=E.matrix.matrix,R=o*(c?1:0)-g,O=a*(d?1:0)-v,D=R+o*(c?-1:1),I=O+a*(d?-1:1),B=s-E.scrollX*f,Y=r-E.scrollY*p,X=Math.sin(l),z=Math.cos(l),N=z*h,G=-X*h,W=X*u,U=z*u,V=B,H=Y,j=k[0],q=k[1],K=k[2],J=k[3],Z=N*j+G*K,Q=N*q+G*J,$=W*j+U*K,tt=W*q+U*J,et=V*j+H*K+k[4],it=V*q+H*J+k[5],nt=R*Z+O*$+et,st=R*Q+O*tt+it,rt=R*Z+I*$+et,ot=R*Q+I*tt+it,at=D*Z+I*$+et,ht=D*Q+I*tt+it,ut=D*Z+O*$+et,lt=D*Q+O*tt+it,ct=y/i+C,dt=m/n+M,ft=(y+x)/i+C,pt=(m+w)/n+M;this.setTexture2D(e,0),L&&(nt|=0,st|=0,rt|=0,ot|=0,at|=0,ht|=0,ut|=0,lt|=0),P[(_=this.vertexCount*this.vertexComponentCount)+0]=nt,P[_+1]=st,P[_+2]=ct,P[_+3]=dt,F[_+4]=b,P[_+5]=rt,P[_+6]=ot,P[_+7]=ct,P[_+8]=pt,F[_+9]=T,P[_+10]=at,P[_+11]=ht,P[_+12]=ft,P[_+13]=pt,F[_+14]=A,P[_+15]=nt,P[_+16]=st,P[_+17]=ct,P[_+18]=dt,F[_+19]=b,P[_+20]=at,P[_+21]=ht,P[_+22]=ft,P[_+23]=pt,F[_+24]=A,P[_+25]=ut,P[_+26]=lt,P[_+27]=ft,P[_+28]=dt,F[_+29]=S,this.vertexCount+=6},drawTexture:function(t,e,i,n,s,r,o,h,u,l){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var c,d=this.renderer.config.roundPixels,f=this.vertexViewF32,p=this.vertexViewU32,g=e,v=i,y=g+h,m=v+u,x=l[0],w=l[1],b=l[2],T=l[3],A=l[4],S=l[5],C=g*x+v*b+A,M=g*w+v*T+S,E=g*x+m*b+A,_=g*w+m*T+S,L=y*x+m*b+A,P=y*w+m*T+S,F=y*x+v*b+A,k=y*w+v*T+S,R=t.width,O=t.height,D=r/R,I=o/O,B=(r+h)/R,Y=(o+u)/O;n=a.getTintAppendFloatAlpha(n,s),this.setTexture2D(t,0),d&&(C|=0,M|=0,E|=0,_|=0,L|=0,P|=0,F|=0,k|=0),f[(c=this.vertexCount*this.vertexComponentCount)+0]=C,f[c+1]=M,f[c+2]=D,f[c+3]=I,p[c+4]=n,f[c+5]=E,f[c+6]=_,f[c+7]=D,f[c+8]=Y,p[c+9]=n,f[c+10]=L,f[c+11]=P,f[c+12]=B,f[c+13]=Y,p[c+14]=n,f[c+15]=C,f[c+16]=M,f[c+17]=D,f[c+18]=I,p[c+19]=n,f[c+20]=L,f[c+21]=P,f[c+22]=B,f[c+23]=Y,p[c+24]=n,f[c+25]=F,f[c+26]=k,f[c+27]=B,f[c+28]=I,p[c+29]=n,this.vertexCount+=6,this.flush()},batchGraphics:function(){}});t.exports=u},,,function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){t.exports=function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0}},function(t,e,i){t.exports={Angle:i(387),Call:i(388),GetFirst:i(389),GridAlign:i(390),IncAlpha:i(408),IncX:i(409),IncXY:i(410),IncY:i(411),PlaceOnCircle:i(412),PlaceOnEllipse:i(413),PlaceOnLine:i(414),PlaceOnRectangle:i(415),PlaceOnTriangle:i(416),PlayAnimation:i(417),RandomCircle:i(418),RandomEllipse:i(419),RandomLine:i(420),RandomRectangle:i(421),RandomTriangle:i(422),Rotate:i(423),RotateAround:i(424),RotateAroundDistance:i(425),ScaleX:i(426),ScaleXY:i(427),ScaleY:i(428),SetAlpha:i(429),SetBlendMode:i(430),SetDepth:i(431),SetHitArea:i(432),SetOrigin:i(433),SetRotation:i(434),SetScale:i(435),SetScaleX:i(436),SetScaleY:i(437),SetTint:i(438),SetVisible:i(439),SetX:i(440),SetXY:i(441),SetY:i(442),ShiftPosition:i(443),Shuffle:i(444),SmootherStep:i(445),SmoothStep:i(446),Spread:i(447),ToggleVisible:i(448)}},function(t,e,i){var n=i(171),s=[];s[n.BOTTOM_CENTER]=i(172),s[n.BOTTOM_LEFT]=i(173),s[n.BOTTOM_RIGHT]=i(174),s[n.CENTER]=i(175),s[n.LEFT_CENTER]=i(177),s[n.RIGHT_CENTER]=i(178),s[n.TOP_CENTER]=i(179),s[n.TOP_LEFT]=i(180),s[n.TOP_RIGHT]=i(181);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e){t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},function(t,e,i){var n=i(24),s=i(46),r=i(25),o=i(47);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(26),r=i(25),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(28),r=i(25),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(176),s=i(46),r=i(49);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),n(t,s(e)+i,r(e)+o),t}},function(t,e,i){var n=i(47),s=i(48);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(49),s=i(26),r=i(48),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(49),s=i(28),r=i(48),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(46),s=i(30),r=i(47),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(26),s=i(30),r=i(27),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)-a),t}},function(t,e,i){var n=i(28),s=i(30),r=i(29),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(105),s=i(65),r=i(16),o=i(5);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=s(e,0,r.PI2);return n(t,a,i)}},function(t,e,i){var n=i(184),s=i(105),r=i(65),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;n-h&&(c-=h,n+=u),f0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var n=this.frames.slice(0,t),s=this.frames.slice(t);this.frames=n.concat(i,s)}this.updateFrameSequence()}return this},checkFrame:function(t){return t0){o.isLast=!0,o.nextFrame=u[0],u[0].prevFrame=o;var v=1/(u.length-1);for(a=0;a=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,t._timeScale=1,t.frameRate=this.frameRate,t.duration=this.duration,t.msPerFrame=this.msPerFrame,t.skipMissedFrames=this.skipMissedFrames,t._delay=this.delay,t._repeat=this.repeat,t._repeatDelay=this.repeatDelay,t._yoyo=this.yoyo,t._callbackArgs[1]=this,t._updateParams=t._callbackArgs.concat(this.onUpdateParams)),t.updateFrame(this.frames[e])},nextFrame:function(t){var e=t.currentFrame;e.isLast?this.yoyo?(t.forward=!1,t.updateFrame(e.prevFrame),this.getNextTick(t)):t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.nextFrame),this.getNextTick(t))},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.prevFrame),this.getNextTick(t))},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=1e3*t._repeatDelay):(t.repeatCounter--,t.forward=!0,t.updateFrame(t.currentFrame.nextFrame),this.getNextTick(t),t.pendingRepeat=!1,this.onRepeat&&this.onRepeat.apply(this.callbackScope,t._callbackArgs.concat(this.onRepeatParams)))},setFrame:function(t){t.forward?this.nextFrame(t):this.previousFrame(t)},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showOnStart:this.showOnStart,hideOnComplete:this.hideOnComplete};return this.frames.forEach(function(e){t.frames.push(e.toJSON())}),t},updateFrameSequence:function(){for(var t=this.frames.length,e=1/(t-1),i=0;i1&&(n.prevFrame=this.frames[i-1],n.nextFrame=this.frames[i+1])}return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){}});t.exports=o},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.onUpdate=null},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0,this.onUpdate=void 0}});t.exports=n},function(t,e,i){var n=i(195),s=i(0),r=i(114),o=i(14),a=i(4),h=i(198),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.paused=!1,this.name="AnimationManager",t.events.once("boot",this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once("destroy",this.destroy,this)},add:function(t,e){if(!this.anims.has(t))return e.key=t,this.anims.set(t,e),this.emit("add",t,e),this;console.warn("Animation with key",t,"already exists")},create:function(t){var e=t.key;if(e&&!this.anims.has(e)){var i=new n(this,e,t);return this.anims.set(e,i),this.emit("add",e,i),i}console.warn("Invalid Animation Key, or Key already in use: "+e)},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var n=0;n=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(0),s=i(114),r=i(14),o=new n({initialize:function(){this.entries=new s,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit("add",this,t,e),this},has:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit("remove",this,t,e.data)),this},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=o},function(t,e,i){var n=i(199),s=new(i(0))({initialize:function(t){this.game=t,this.binary=new n,this.bitmapFont=new n,this.json=new n,this.physics=new n,this.shader=new n,this.audio=new n,this.text=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once("destroy",this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new n),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","text","obj","tilemap","xml"],e=0;e16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(36);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var n=i(36);t.exports=function(t){var e=new n,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var s=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(s,r,o,255*a)}return e}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,n=2*Math.random()-1,s=Math.sqrt(1-n*n)*e;return t.x=Math.cos(i)*s,t.y=Math.sin(i)*s,t.z=n*e,t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},function(t,e,i){var n=i(51),s=i(119),r=i(210),o=new s,a=new r,h=new n;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},function(t,e,i){var n=i(0),s=i(51),r=i(211),o=new Int8Array([1,2,0]),a=new Float32Array([0,0,0]),h=new s(1,0,0),u=new s(0,1,0),l=new s,c=new r,d=new n({initialize:function(t,e,i,n){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},set:function(t,e,i,n){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(l.copy(h).cross(t).length()<1e-6&&l.copy(u).cross(t),l.normalize(),this.setAxisAngle(l,Math.PI)):i>.999999?(this.x=0,this.y=0,this.z=0,this.w=1,this):(l.copy(t).cross(e),this.x=l.x,this.y=l.y,this.z=l.z,this.w=1+i,this.normalize())},setAxes:function(t,e,i){var n=c.val;return n[0]=e.x,n[3]=e.y,n[6]=e.z,n[1]=i.x,n[4]=i.y,n[7]=i.z,n[2]=-t.x,n[5]=-t.y,n[8]=-t.z,this.fromMat3(c).normalize()},identity:function(){return this.x=0,this.y=0,this.z=0,this.w=1,this},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=Math.cos(e),this},multiply:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.x=e*h+s*r+i*a-n*o,this.y=i*h+s*o+n*r-e*a,this.z=n*h+s*a+e*o-i*r,this.w=s*h-e*r-i*o-n*a,this},slerp:function(t,e){var i=this.x,n=this.y,s=this.z,r=this.w,o=t.x,a=t.y,h=t.z,u=t.w,l=i*o+n*a+s*h+r*u;l<0&&(l=-l,o=-o,a=-a,h=-h,u=-u);var c=1-e,d=e;if(1-l>1e-6){var f=Math.acos(l),p=Math.sin(f);c=Math.sin((1-e)*f)/p,d=Math.sin(e*f)/p}return this.x=c*i+d*o,this.y=c*n+d*a,this.z=c*s+d*h,this.w=c*r+d*u,this},invert:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n,r=s?1/s:0;return this.x=-t*r,this.y=-e*r,this.z=-i*r,this.w=n*r,this},conjugate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+s*r,this.y=i*o+n*r,this.z=n*o-i*r,this.w=s*o-e*r,this},rotateY:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o-n*r,this.y=i*o+s*r,this.z=n*o+e*r,this.w=s*o-i*r,this},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+i*r,this.y=i*o-e*r,this.z=n*o+s*r,this.w=s*o-n*r,this},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(Math.abs(1-t*t-e*e-i*i)),this},fromMat3:function(t){var e,i=t.val,n=i[0]+i[4]+i[8];if(n>0)e=Math.sqrt(n+1),this.w=.5*e,e=.5/e,this.x=(i[7]-i[5])*e,this.y=(i[2]-i[6])*e,this.z=(i[3]-i[1])*e;else{var s=0;i[4]>i[0]&&(s=1),i[8]>i[3*s+s]&&(s=2);var r=o[s],h=o[r];e=Math.sqrt(i[3*s+s]-i[3*r+r]-i[3*h+h]+1),a[s]=.5*e,e=.5/e,a[r]=(i[3*r+s]+i[3*s+r])*e,a[h]=(i[3*h+s]+i[3*s+h])*e,this.x=a[0],this.y=a[1],this.z=a[2],this.w=(i[3*h+r]-i[3*r+h])*e}return this}});t.exports=d},function(t,e,i){var n=new(i(0))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new n(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=n,this},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8],l=u*r-o*h,c=-u*s+o*a,d=h*s-r*a,f=e*l+i*c+n*d;return f?(f=1/f,t[0]=l*f,t[1]=(-u*i+n*h)*f,t[2]=(o*i-n*r)*f,t[3]=c*f,t[4]=(u*e-n*a)*f,t[5]=(-o*e+n*s)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*s)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8];return t[0]=r*u-o*h,t[1]=n*h-i*u,t[2]=i*o-n*r,t[3]=o*a-s*u,t[4]=e*u-n*a,t[5]=n*s-e*o,t[6]=s*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*s,this},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],u=t[8];return e*(u*r-o*h)+i*(-u*s+o*a)+n*(h*s-r*a)},multiply:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=e[6],u=e[7],l=e[8],c=t.val,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=c[6],x=c[7],w=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*n+f*o+p*u,e[2]=d*s+f*a+p*l,e[3]=g*i+v*r+y*h,e[4]=g*n+v*o+y*u,e[5]=g*s+v*a+y*l,e[6]=m*i+x*r+w*h,e[7]=m*n+x*o+w*u,e[8]=m*s+x*a+w*l,this},translate:function(t){var e=this.val,i=t.x,n=t.y;return e[6]=i*e[0]+n*e[3]+e[6],e[7]=i*e[1]+n*e[4]+e[7],e[8]=i*e[2]+n*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),u=Math.cos(t);return e[0]=u*i+h*r,e[1]=u*n+h*o,e[2]=u*s+h*a,e[3]=u*r-h*i,e[4]=u*o-h*n,e[5]=u*a-h*s,this},scale:function(t){var e=this.val,i=t.x,n=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=n*e[3],e[4]=n*e[4],e[5]=n*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,o=i+i,a=n+n,h=e*r,u=e*o,l=e*a,c=i*o,d=i*a,f=n*a,p=s*r,g=s*o,v=s*a,y=this.val;return y[0]=1-(c+f),y[3]=u+v,y[6]=l-g,y[1]=u-v,y[4]=1-(h+f),y[7]=d+p,y[2]=l+g,y[5]=d-p,y[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],h=e[5],u=e[6],l=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],v=e[13],y=e[14],m=e[15],x=n*h-s*a,w=n*u-r*a,b=n*l-o*a,T=s*u-r*h,A=s*l-o*h,S=r*l-o*u,C=c*v-d*g,M=c*y-f*g,E=c*m-p*g,_=d*y-f*v,L=d*m-p*v,P=f*m-p*y,F=x*P-w*L+b*_+T*E-A*M+S*C;return F?(F=1/F,i[0]=(h*P-u*L+l*_)*F,i[1]=(u*E-a*P-l*M)*F,i[2]=(a*L-h*E+l*C)*F,i[3]=(r*L-s*P-o*_)*F,i[4]=(n*P-r*E+o*M)*F,i[5]=(s*E-n*L-o*C)*F,i[6]=(v*S-y*A+m*T)*F,i[7]=(y*b-g*S-m*w)*F,i[8]=(g*A-v*b+m*x)*F,this):null}});t.exports=n},function(t,e,i){var n=i(118),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),n.call(this,t),this.viewportWidth=e,this.viewportHeight=i,this._zoom=1,this.near=0,this.update()},setToOrtho:function(t,e,i){void 0===e&&(e=this.viewportWidth),void 0===i&&(i=this.viewportHeight);var n=this.zoom;return this.up.set(0,t?-1:1,0),this.direction.set(0,0,t?1:-1),this.position.set(n*e/2,n*i/2,0),this.viewportWidth=e,this.viewportHeight=i,this.update()},update:function(){var t=this.viewportWidth,e=this.viewportHeight,i=Math.abs(this.near),n=Math.abs(this.far),s=this.zoom;return 0===t||0===e?this:(this.projection.ortho(s*-t/2,s*t/2,s*-e/2,s*e/2,i,n),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this)},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.update()}}});t.exports=o},function(t,e,i){var n=i(118),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e=80),void 0===i&&(i=0),void 0===s&&(s=0),n.call(this,t),this.viewportWidth=i,this.viewportHeight=s,this.fieldOfView=e*Math.PI/180,this.update()},setFOV:function(t){return this.fieldOfView=t*Math.PI/180,this},update:function(){var t=this.viewportWidth/this.viewportHeight;return this.projection.perspective(this.fieldOfView,t,Math.abs(this.near),Math.abs(this.far)),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this}});t.exports=o},function(t,e,i){var n=i(215),s=i(19),r=i(4);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",n),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),u=r(t,"resizeCanvas",!0),l=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=s.create2D(this,f,p),u=!1,l=!1),u&&(i.width=f,i.height=p);var g=i.getContext("2d");l&&g.clearRect(0,0,f,p),c&&c(i,g);for(var v=0;vi;)n-=i;ni.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(n(a,h.x,u.x,l.x,c.x),n(a,h.y,u.y,l.y,c.y))},toJSON:function(){for(var t=[],e=0;e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}}).call(e,i(497)(t))},function(t,e,i){var n=i(117);t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var s=Math.floor(6*t),r=6*t-s,o=Math.floor(i*(1-e)*255),a=Math.floor(i*(1-r*e)*255),h=Math.floor(i*(1-(1-r)*e)*255),u={r:i=Math.floor(i*=255),g:i,b:i,color:0},l=s%6;return 0===l?(u.g=h,u.b=o):1===l?(u.r=a,u.b=o):2===l?(u.r=o,u.b=h):3===l?(u.r=o,u.g=a):4===l?(u.r=h,u.g=o):5===l&&(u.g=o,u.b=a),u.color=n(u.r,u.g,u.b),u}},function(t,e,i){var n=i(230);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return e<0?n(t[0],t[1],s):e>1?n(t[i],t[i-1],i-s):n(t[r],t[r+1>i?i:r+1],s-r)}},function(t,e){t.exports=function(t,e,i){return(e-t)*i+t}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e,i){var n=i(67);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?n.cordova&&!n.cocoonJS?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},function(t,e){t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},function(t,e){t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0;var t=this;this.step=function e(i){t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.requestAnimationFrame(e)},this.stepTimeout=function e(){var i=Date.now(),n=Math.max(16+t.lastTime-i,0);t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.setTimeout(e,n)}},start:function(t,e){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e){t.exports={Global:["anims","cache","registry","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["CameraManager3D","Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},function(t,e,i){var n,s,r,o=i(19),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create(t,6,1).getContext("2d");if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,u,l,f,g,v=e&&e.length,y=v?e[0]*i:t.length,m=s(t,0,y,i,!0),x=[];if(!m)return x;if(v&&(m=function(t,e,i,n){var o,a,h,u,l,f=[];for(o=0,a=e.length;o80*i){n=h=t[0],a=u=t[1];for(var w=i;wh&&(h=l),f>u&&(u=f);g=Math.max(h-n,u-a)}return o(m,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===C(t,e,i,n)>0)for(r=e;r=e;r-=n)o=T(r,t[r],t[r+1],o);return o&&m(o,o.next)&&(A(o),o=o.next),o}function r(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!m(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(A(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,s,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,h,u=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,u*=2}while(o>1)}(s)}(t,n,s,c);for(var p,g,v=t;t.prev!==t.next;)if(p=t.prev,g=t.next,c?h(t,n,s,c):a(t))e.push(p.i/i),e.push(t.i/i),e.push(g.i/i),A(t),t=g.next,v=g.next;else if((t=g)===v){d?1===d?o(t=u(t,e,i),e,i,n,s,c,2):2===d&&l(t,e,i,n,s,c):o(r(t),e,i,n,s,c,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(y(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&y(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function h(t,e,i,n){var s=t.prev,r=t,o=t.next;if(y(s,r,o)>=0)return!1;for(var a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(a,h,e,i,n),d=f(u,l,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function u(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!m(s,r)&&x(s,n,n.next,r)&&w(s,r)&&w(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),A(n),A(n.next),n=t=r),n=n.next}while(n!==t);return n}function l(t,e,i,n,s,a){var h=t;do{for(var u=h.next.next;u!==h.prev;){if(h.i!==u.i&&v(h,u)){var l=b(h,u);return h=r(h,h.next),l=r(l,l.next),o(h,e,i,n,s,a),void o(l,e,i,n,s,a)}u=u.next}h=h.next}while(h!==t)}function c(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&a>o){if(o=a,a===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=l&&s!==n.x&&g(ri.x)&&w(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=b(e,t);r(i,i.next)}}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&x(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&w(t,e)&&w(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function y(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function m(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,i,n){return!!(m(t,e)&&m(i,n)||m(t,n)&&m(i,e))||y(t,e,i)>0!=y(t,e,n)>0&&y(i,n,t)>0!=y(i,n,e)>0}function w(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function b(t,e){var i=new S(t.i,t.x,t.y),n=new S(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function T(t,e,i,n){var s=new S(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},function(t,e){var i={modelMatrixDirty:!1,viewMatrixDirty:!1,projectionMatrixDirty:!1,modelMatrix:null,viewMatrix:null,projectionMatrix:null,mvpInit:function(){return this.modelMatrixDirty=!0,this.viewMatrixDirty=!0,this.projectionMatrixDirty=!0,this.modelMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},mvpUpdate:function(){var t=this.program;return this.modelMatrixDirty&&(this.renderer.setMatrix4(t,"uModelMatrix",!1,this.modelMatrix),this.modelMatrixDirty=!1),this.viewMatrixDirty&&(this.renderer.setMatrix4(t,"uViewMatrix",!1,this.viewMatrix),this.viewMatrixDirty=!1),this.projectionMatrixDirty&&(this.renderer.setMatrix4(t,"uProjectionMatrix",!1,this.projectionMatrix),this.projectionMatrixDirty=!1),this},modelIdentity:function(){var t=this.modelMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.modelMatrixDirty=!0,this},modelScale:function(t,e,i){var n=this.modelMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.modelMatrixDirty=!0,this},modelTranslate:function(t,e,i){var n=this.modelMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.modelMatrixDirty=!0,this},modelRotateX:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],u=e[9],l=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+u*i,e[6]=o*n+l*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=u*n-r*i,e[10]=l*n-o*i,e[11]=c*n-a*i,this.modelMatrixDirty=!0,this},modelRotateY:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],u=e[9],l=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-u*i,e[2]=o*n-l*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+u*n,e[10]=o*i+l*n,e[11]=a*i+c*n,this.modelMatrixDirty=!0,this},modelRotateZ:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],u=e[5],l=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+u*i,e[2]=o*n+l*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=u*n-r*i,e[6]=l*n-o*i,e[7]=c*n-a*i,this.modelMatrixDirty=!0,this},viewIdentity:function(){var t=this.viewMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.viewMatrixDirty=!0,this},viewScale:function(t,e,i){var n=this.viewMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.viewMatrixDirty=!0,this},viewTranslate:function(t,e,i){var n=this.viewMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.viewMatrixDirty=!0,this},viewRotateX:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],u=e[9],l=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+u*i,e[6]=o*n+l*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=u*n-r*i,e[10]=l*n-o*i,e[11]=c*n-a*i,this.viewMatrixDirty=!0,this},viewRotateY:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],u=e[9],l=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-u*i,e[2]=o*n-l*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+u*n,e[10]=o*i+l*n,e[11]=a*i+c*n,this.viewMatrixDirty=!0,this},viewRotateZ:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],u=e[5],l=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+u*i,e[2]=o*n+l*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=u*n-r*i,e[6]=l*n-o*i,e[7]=c*n-a*i,this.viewMatrixDirty=!0,this},viewLoad2D:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=0,e[4]=t[2],e[5]=t[3],e[6]=0,e[7]=0,e[8]=t[4],e[9]=t[5],e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this.viewMatrixDirty=!0,this},viewLoad:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this.viewMatrixDirty=!0,this},projIdentity:function(){var t=this.projectionMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.projectionMatrixDirty=!0,this},projOrtho:function(t,e,i,n,s,r){var o=this.projectionMatrix,a=1/(t-e),h=1/(i-n),u=1/(s-r);return o[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*h,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*u,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*h,o[14]=(r+s)*u,o[15]=1,this.projectionMatrixDirty=!0,this},projPersp:function(t,e,i,n){var s=this.projectionMatrix,r=1/Math.tan(t/2),o=1/(i-n);return s[0]=r/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*n*i*o,s[15]=0,this.projectionMatrixDirty=!0,this}};t.exports=i},function(t,e,i){var n=i(0),s=i(14),r=i(241),o=i(245),a=i(248),h=i(249),u=i(8),l=i(250),c=i(251),d=new n({initialize:function(t,e){this.game=t,this.canvas,this.config=e,this.enabled=!0,this.events=new s,this.queue=[],this.keyboard=new o(this),this.mouse=new a(this),this.touch=new l(this),this.gamepad=new r(this),this.activePointer=new h(this,0),this.scale={x:1,y:1},this.globalTopOnly=!0,this.ignoreEvents=!1,this.bounds=new u,this._tempPoint={x:0,y:0},this._tempHitTest=[],t.events.once("boot",this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.updateBounds(),this.keyboard.boot(),this.mouse.boot(),this.touch.boot(),this.gamepad.boot(),this.game.events.once("destroy",this.destroy,this)},updateBounds:function(){var t=this.bounds,e=this.canvas.getBoundingClientRect();t.x=e.left+window.pageXOffset-document.documentElement.clientLeft,t.y=e.top+window.pageYOffset-document.documentElement.clientTop,t.width=e.width,t.height=e.height},resize:function(){this.updateBounds();var t=this.game.config.width,e=this.game.config.height,i=this.bounds.width,n=this.bounds.height;this.scale.x=t/i,this.scale.y=e/n},update:function(t){this.keyboard.update(),this.gamepad.update(),this.ignoreEvents=!1;var e=this.queue.length,i=this.activePointer;if(i.reset(),this.enabled&&0!==e){this.updateBounds(),this.scale.x=this.game.config.width/this.bounds.width,this.scale.y=this.game.config.height/this.bounds.height;for(var n=this.queue.splice(0,e),s=0;s=n.x&&e>=n.y&&t<=n.x+o&&e<=n.y+a))return s;n.getWorldPoint(t,e,r);for(var h=n.cull(i),u={x:0,y:0},l=0;l0?1:-1)}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=0,this.pressed=!1},update:function(t){this.value=t.value,this.value>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",this.pad,this,this.value,t)):this.pressed&&(this.pressed=!1,this.events.emit("up",this.pad,this,this.value,t))}});t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(246),o=i(128),a=i(247),h=i(528),u=i(529),l=i(530),c=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.enabled=!1,this.target,this.keys=[],this.combos=[],this.captures=[],this.queue=[],this.handler},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.enabled&&this.startListeners()},startListeners:function(){var t=this.queue,e=this.captures,i=function(i){i.defaultPrevented||(t.push(i),e[i.keyCode]&&i.preventDefault())};this.handler=i,this.target.addEventListener("keydown",i,!1),this.target.addEventListener("keyup",i,!1)},stopListeners:function(){this.target.removeEventListener("keydown",this.handler),this.target.removeEventListener("keyup",this.handler)},createCursorKeys:function(){return this.addKeys({up:o.UP,down:o.DOWN,left:o.LEFT,right:o.RIGHT,space:o.SPACE,shift:o.SHIFT})},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},addKey:function(t){var e=this.keys;return e[t]||(e[t]=new r(t),this.captures[t]=!0),e[t]},removeKey:function(t){this.keys[t]&&(this.keys[t]=void 0,this.captures[t]=!1)},addKeyCapture:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e-1&&(this.keys[n]=void 0,this.scenes.splice(i,1),this._start.indexOf(n)>-1&&(i=this._start.indexOf(n),this._start.splice(i,1)),e.sys.destroy())}return this},bootScene:function(t){var e;t.init&&t.init.call(t,t.sys.settings.data),t.sys.load&&(e=t.sys.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(t.sys.settings.status=s.LOADING,e.once("complete",this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this._processing=1;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status===s.RUNNING&&n.step(t,e)}},resize:function(t,e){for(var i=0;i0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this._processing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,n=this.getScene(t),s=this.getAt(i);this.scenes[e]=s,this.scenes[i]=n}}return this},moveUp:function(t){if(this._processing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(en&&-1!==i&&-1!==n){var s=this.getAt(n);this.scenes.splice(n,1),this.scenes.splice(i,0,s)}}return this},moveBelow:function(t,e){if(t===e)return this;if(this._processing)this._queue.push({op:"moveBelow",keyA:t,keyB:e});else{var i=this.getIndex(t),n=this.getIndex(e);if(i=0;t--){this.scenes[t].sys.destroy()}this.scenes=[],this._pending=[],this._start=[],this._queue=[],this.game=null}});t.exports=u},function(t,e,i){var n=i(0),s=i(129),r=new n({initialize:function(t){this.sys=new s(this,t)},update:function(){}});t.exports=r},function(t,e){t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},function(t,e,i){var n=i(83),s=i(4),r=i(533),o={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:n.PENDING,key:s(t,"key",""),active:s(t,"active",!1),visible:s(t,"visible",!0),isBooted:!1,data:{},files:s(t,"files",!1),cameras:s(t,"cameras",null),map:s(t,"map",r),physics:s(t,"physics",{}),loader:s(t,"loader",{}),plugins:s(t,"plugins",!1)}}};t.exports=o},function(t,e,i){var n=i(257),s=i(259),r=i(261),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e&&e.noAudio||!i.webAudio&&!i.audioData?new s(t):!i.webAudio||e&&e.disableWebAudio?new n(t):new r(t)}};t.exports=o},function(t,e,i){var n=i(84),s=i(0),r=i(258),o=new s({Extends:n,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,n.call(this,t)},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=!1,i=function(){e=!0},n=function(){if(t.game.cache.audio.entries.size)if(e)e=!1;else{document.body.removeEventListener("touchmove",i),document.body.removeEventListener("touchend",n);var s=[];t.game.cache.audio.entries.each(function(t,e){for(var i=0;i0)&&(!!s.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit("pause",this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!s.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit("stop",this),!0))},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s=n)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit("ended",this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},setMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},setVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},setRate:function(){s.prototype.setRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)}});Object.defineProperty(r.prototype,"mute",{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.setMute(),this.emit("mute",this,t))}}),Object.defineProperty(r.prototype,"volume",{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.setVolume(),this.emit("volume",this,t))}}),Object.defineProperty(r.prototype,"rate",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"rate").get.call(this)},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||Object.getOwnPropertyDescriptor(s.prototype,"rate").set.call(this,t)}}),Object.defineProperty(r.prototype,"detune",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"detune").get.call(this)},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||Object.getOwnPropertyDescriptor(s.prototype,"detune").set.call(this,t)}}),Object.defineProperty(r.prototype,"seek",{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit("seek",this,t))}}),Object.defineProperty(r.prototype,"loop",{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit("loop",this,t))}}),t.exports=r},function(t,e,i){var n=i(84),s=i(0),r=i(14),o=i(260),a=i(3),h=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return n.prototype.remove.call(this,t)},removeByKey:function(t){return n.prototype.removeByKey.call(this,t)},pauseAll:a,resumeAll:a,stopAll:a,update:a,destroy:function(){n.prototype.destroy.call(this)},forEachActiveSound:function(t,e){n.prototype.forEachActiveSound.call(this,t,e)}});t.exports=h},function(t,e,i){var n=i(85),s=i(0),r=i(14),o=i(23),a=new s({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!1},updateMarker:function(t){return!1},removeMarker:function(t){return null},play:function(t,e){return!1},pause:function(){return!1},resume:function(){return!1},stop:function(){return!1},destroy:function(){this.manager.remove(this),n.prototype.destroy.call(this)}});t.exports=a},function(t,e,i){var n=i(84),s=i(0),r=i(262),o=new s({Extends:n,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&"ontouchstart"in window,n.call(this,t)},createAudioContext:function(t){var e=t.config.audio;return e&&e.context?(e.context.resume(),e.context):new AudioContext},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=function(){t.context.resume().then(function(){document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),t.unlocked=!0})};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("touchend",e,!1)},onBlur:function(){this.context.suspend()},onFocus:function(){this.context.resume()},destroy:function(){this.destination=null,this.masterVolumeNode.disconnect(),this.masterVolumeNode=null,this.masterMuteNode.disconnect(),this.masterMuteNode=null,this.game.config.audio&&this.game.config.audio.context?this.context.suspend():this.context.close(),this.context=null,n.prototype.destroy.call(this)},mute:{get:function(){return 0===this.masterMuteNode.gain.value},set:function(t){this.masterMuteNode.gain.setValueAtTime(t?0:1,0),this.emit("mute",this,t)}},volume:{get:function(){return this.masterVolumeNode.gain.value},set:function(t){this.masterVolumeNode.gain.setValueAtTime(t,0),this.emit("volume",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(85),r=new n({Extends:s,initialize:function(t,e,i){void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),this.audioBuffer?(this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)):console.error("No audio loaded in cache with key: '"+e+"'!")},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit("play",this),!0)},pause:function(){return!(this.manager.context.currentTime=0&&t<=o.width&&e>=0&&e<=o.height){t+=s.cutX,e+=s.cutY;var a=this._tempContext;a.clearRect(0,0,1,1),a.drawImage(o,t,e,1,1,0,0,1,1);var h=a.getImageData(0,0,1,1);return new r(h.data[0],h.data[1],h.data[2],h.data[3])}}return null},setTexture:function(t,e,i){return this.list[e]&&(t.texture=this.list[e],t.frame=t.texture.get(i)),t},each:function(t,e){for(var i=[null],n=1;nu&&(r=u),o>u&&(o=u),a=s,h=r;;)if(ay&&(s=y),r>m&&(r=m);var A=y+g-s,S=m+v-r;o0&&e.cameraFilter&r._id)){var h=r.scrollX*e.scrollFactorX,u=r.scrollY*e.scrollFactorY,l=e.x,c=e.y,d=e.scaleX,f=e.scaleY,p=e.rotation,g=e.commandBuffer,v=o||t.currentContext,y=1,m=1,x=0,w=0,b=1,T=0,A=0,S=0;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,v.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,v.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),v.save(),v.translate(l-h,c-u),v.rotate(p),v.scale(d,f),v.fillStyle="#fff",v.globalAlpha=e.alpha;for(var C=0,M=g.length;C>>16,A=(65280&x)>>>8,S=255&x,v.strokeStyle="rgba("+T+","+A+","+S+","+y+")",v.lineWidth=b,C+=3;break;case n.FILL_STYLE:w=g[C+1],m=g[C+2],T=(16711680&w)>>>16,A=(65280&w)>>>8,S=255&w,v.fillStyle="rgba("+T+","+A+","+S+","+m+")",C+=2;break;case n.BEGIN_PATH:v.beginPath();break;case n.CLOSE_PATH:v.closePath();break;case n.FILL_PATH:a||v.fill();break;case n.STROKE_PATH:a||v.stroke();break;case n.FILL_RECT:a?v.rect(g[C+1],g[C+2],g[C+3],g[C+4]):v.fillRect(g[C+1],g[C+2],g[C+3],g[C+4]),C+=4;break;case n.FILL_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.fill(),C+=6;break;case n.STROKE_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.stroke(),C+=6;break;case n.LINE_TO:v.lineTo(g[C+1],g[C+2]),C+=2;break;case n.MOVE_TO:v.moveTo(g[C+1],g[C+2]),C+=2;break;case n.LINE_FX_TO:v.lineTo(g[C+1],g[C+2]),C+=5;break;case n.MOVE_FX_TO:v.moveTo(g[C+1],g[C+2]),C+=5;break;case n.SAVE:v.save();break;case n.RESTORE:v.restore();break;case n.TRANSLATE:v.translate(g[C+1],g[C+2]),C+=2;break;case n.SCALE:v.scale(g[C+1],g[C+2]),C+=2;break;case n.ROTATE:v.rotate(g[C+1]),C+=1}v.restore()}}},function(t,e,i){var n=i(4),s=i(80),r=function(t,e,i){for(var n=[],s=0;s0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(0),s=i(41),r=new n({initialize:function(t,e,i,n,s,r,o){this.x=t,this.y=e,this.radius=i,this.r=n,this.g=s,this.b=r,this.intensity=o,this.scrollFactorX=1,this.scrollFactorY=1},set:function(t,e,i,n,s,r,o){return this.x=t,this.y=e,this.radius=i,this.r=n,this.g=s,this.b=r,this.intensity=o,this.scrollFactorX=1,this.scrollFactorY=1,this},setScrollFactor:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this},setColor:function(t){var e=s.getFloatsFromUintRGB(t);return this.r=e[0],this.g=e[1],this.b=e[2],this},setIntensity:function(t){return this.intensity=t,this},setPosition:function(t,e){return this.x=t,this.y=e,this},setRadius:function(t){return this.radius=t,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(293),r=i(163),o=i(41),a=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1},enable:function(){return this.active=!0,this},disable:function(){return this.active=!1,this},cull:function(t){var e=this.lights,i=this.culledLights,n=e.length,s=t.x+t.width/2,o=t.y+t.height/2,a=(t.width+t.height)/2,h={x:0,y:0},u=t.matrix,l=this.systems.game.config.height;i.length=0;for(var c=0;c0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],r):h=new s(t,e,i,a[0],a[1],a[2],r),this.lights.push(h),h},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&(this.lightPool.push(t),this.lights.splice(e,1)),this},shutdown:function(){for(;this.lights.length>0;)this.lightPool.push(this.lights.pop());this.ambientColor={r:.1,g:.1,b:.1},this.culledLights.length=0,this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=a},function(t,e,i){t.exports={Circle:i(666),Ellipse:i(270),Intersects:i(296),Line:i(686),Point:i(704),Polygon:i(718),Rectangle:i(308),Triangle:i(747)}},function(t,e,i){t.exports={CircleToCircle:i(676),CircleToRectangle:i(677),GetRectangleIntersection:i(678),LineToCircle:i(298),LineToLine:i(89),LineToRectangle:i(679),PointToLine:i(299),PointToLineSegment:i(680),RectangleToRectangle:i(297),RectangleToTriangle:i(681),RectangleToValues:i(682),TriangleToCircle:i(683),TriangleToLine:i(684),TriangleToTriangle:i(685)}},function(t,e){t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},function(t,e,i){var n=i(32),s=new(i(5));t.exports=function(t,e,i){if(void 0===i&&(i=s),n(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(n(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,u=r*r+o*o,l=r,c=o;if(u>0){var d=(a*r+h*o)/u;l*=d,c*=d}return i.x=t.x1+l,i.y=t.y1+c,l*l+c*c<=u&&l*r+c*o>=0&&n(e,i.x,i.y)}},function(t,e){t.exports=function(t,e){return(t.x-e.x1)*(e.y2-e.y1)==(e.x2-e.x1)*(t.y-e.y1)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},function(t,e,i){var n=i(0),s=i(303),r=i(109),o=i(111),a=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return o(this,t)},setTo:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this},getPointA:function(){return{x:this.x1,y:this.y1}},getPointB:function(){return{x:this.x2,y:this.y2}},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=a},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},function(t,e,i){var n=i(16),s=i(50),r=i(55);t.exports=function(t){var e=r(t)-n.TAU;return s(e,-Math.PI,Math.PI)}},function(t,e){t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},function(t,e){t.exports=function(t){return t.x*t.x+t.y*t.y}},function(t,e,i){var n=i(0),s=i(145),r=new n({initialize:function(t){this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return s(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],!Array.isArray(t))return this;for(var e,i=Number.MAX_VALUE,n=0;n=1)return i.x=r.x1,i.y=r.y1,i;var h=s(r),u=s(o),l=s(a),c=(h+u+l)*e,d=0;return ch+u?(d=(c-=h+u)/l,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/u,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},function(t,e,i){var n=i(66),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),u=n(o),l=n(a),c=n(h),d=u+l+c;e||(e=d/i);for(var f=0;fu+l?(g=(p-=u+l)/c,v.x=h.x1+(h.x2-h.x1)*g,v.y=h.y1+(h.y2-h.y1)*g):(g=(p-=u)/l,v.x=a.x1+(a.x2-a.x1)*g,v.y=a.y1+(a.y2-a.y1)*g),r.push(v)}return r}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},function(t,e,i){var n=i(5);function s(t,e,i,n){var s=t-i,r=e-n,o=s*s+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,u=t.y3,l=s(h,u,o,a),c=s(i,r,h,u),d=s(o,a,i,r),f=l+c+d;return e.x=(i*l+o*c+h*d)/f,e.y=(r*l+a*c+u*d)/f,e}},function(t,e){t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragX:0,dragY:0}}},function(t,e,i){var n=i(149);t.exports=function(t,e){var i=n(e,t.xhrSettings),s=new XMLHttpRequest;return s.open("GET",t.src,i.async,i.user,i.password),s.responseType=t.xhrSettings.responseType,s.timeout=i.timeout,i.header&&i.headerValue&&s.setRequestHeader(i.header,i.headerValue),i.overrideMimeType&&s.overrideMimeType(i.overrideMimeType),s.onload=t.onLoad.bind(t),s.onerror=t.onError.bind(t),s.onprogress=t.onProgress.bind(t),s.send(),s}},function(t,e,i){var n=i(0),s=i(22),r=i(18),o=i(7),a=i(2),h=i(318),u=new n({Extends:r,initialize:function(t,e,i,n,s){this.context=s;var o={type:"audio",extension:a(e,"type",""),responseType:"arraybuffer",key:t,url:a(e,"uri",e),path:i,xhrSettings:n};r.call(this,o)},onProcess:function(t){this.state=s.FILE_PROCESSING;var e=this;this.context.decodeAudioData(this.xhrLoader.response,function(i){e.data=i,e.onComplete(),t(e)},function(i){console.error("Error with decoding audio data for '"+this.key+"':",i.message),e.state=s.FILE_ERRORED,t(e)}),this.context=null}});u.create=function(t,e,i,n,s){var r=t.systems.game,o=r.config.audio,a=r.device.audio;if(o&&o.noAudio||!a.webAudio&&!a.audioData)return null;var l=u.findAudioURL(r,i);return l?!a.webAudio||o&&o.disableWebAudio?new h(e,l,t.path,n,r.sound.locked):new u(e,l,t.path,s,r.sound.context):null},o.register("audio",function(t,e,i,n){var s=u.create(this,t,e,i,n);return s&&this.addFile(s),this}),u.findAudioURL=function(t,e){e.constructor!==Array&&(e=[e]);for(var i=0;i=0?t:t+2*Math.PI}},function(t,e,i){var n=i(324);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e){t.exports=function(t,e){var i=t.x,n=t.y;return t.x=i*Math.cos(e)-n*Math.sin(e),t.y=i*Math.sin(e)+n*Math.cos(e),t}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e,i){var n=i(328),s=i(91),r=i(0),o=i(59),a=i(330),h=i(331),u=new r({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,n,s){return this.world.addCollider(t,e,i,n,s)},overlap:function(t,e,i,n,s){return this.world.addOverlap(t,e,i,n,s)},existing:function(t,e){var i=e?o.STATIC_BODY:o.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},image:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticSprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},sprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new a(this.world,this.world.scene,t,e))}});t.exports=u},function(t,e,i){var n=i(0),s=i(329),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){t.exports={Acceleration:i(838),Angular:i(839),Bounce:i(840),Debug:i(841),Drag:i(842),Enable:i(843),Friction:i(844),Gravity:i(845),Immovable:i(846),Mass:i(847),Size:i(848),Velocity:i(849)}},function(t,e,i){var n=i(91),s=i(0),r=i(59),o=i(2),a=i(69),h=new s({Extends:a,initialize:function(t,e,i,s){void 0!==s||Array.isArray(i)||"object"!=typeof i?void 0===s&&(s={}):(s=i,i=null),this.world=t,s.createCallback=this.createCallback,s.removeCallback=this.removeCallback,s.classType=o(s,"classType",n),this.physicsType=r.DYNAMIC_BODY,this.defaults={setCollideWorldBounds:o(s,"collideWorldBounds",!1),setAccelerationX:o(s,"accelerationX",0),setAccelerationY:o(s,"accelerationY",0),setBounceX:o(s,"bounceX",0),setBounceY:o(s,"bounceY",0),setDragX:o(s,"dragX",0),setDragY:o(s,"dragY",0),setGravityX:o(s,"gravityX",0),setGravityY:o(s,"gravityY",0),setFrictionX:o(s,"frictionX",0),setFrictionY:o(s,"frictionY",0),setVelocityX:o(s,"velocityX",0),setVelocityY:o(s,"velocityY",0),setAngularVelocity:o(s,"angularVelocity",0),setAngularAcceleration:o(s,"angularAcceleration",0),setAngularDrag:o(s,"angularDrag",0),setMass:o(s,"mass",1),setImmovable:o(s,"immovable",!1)},a.call(this,e,i,s)},createCallback:function(t){t.body||this.world.enableBody(t,r.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallback:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var n=this.getChildren(),s=0;s0){var u=this.tree,l=this.staticTree;for(o=(r=s.entries).length,t=0;t0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},separate:function(t,e,i,n,s){if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return!1;if(i&&!1===i.call(n,t.gameObject,e.gameObject))return!1;if(t.isCircle&&e.isCircle)return this.separateCircle(t,e,s);if(t.isCircle!==e.isCircle){var r=t.isCircle?e:t,o=t.isCircle?t:e,a={x:r.x,y:r.y,right:r.right,bottom:r.bottom},h=o.center;if((h.ya.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var u=!1,l=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)u.right&&(a=h(d.x,d.y,u.right,u.y)-d.radius):d.y>u.bottom&&(d.xu.right&&(a=h(d.x,d.y,u.right,u.bottom)-d.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-h(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap||e.onOverlap)&&this.emit("overlap",t.gameObject,e.gameObject,t,e),0!==a;var f=t.velocity.x,p=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=f*Math.cos(o)+p*Math.sin(o),w=f*Math.sin(o)-p*Math.cos(o),b=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),A=((g-m)*x+2*m*b)/(g+m),S=(2*g*x+(m-g)*b)/(g+m);return t.immovable||(t.velocity.x=(A*Math.cos(o)-w*Math.sin(o))*t.bounce.x,t.velocity.y=(w*Math.cos(o)+A*Math.sin(o))*t.bounce.y,f=t.velocity.x,p=t.velocity.y),e.immovable||(e.velocity.x=(S*Math.cos(o)-T*Math.sin(o))*e.bounce.x,e.velocity.y=(T*Math.cos(o)+S*Math.sin(o))*e.bounce.y,v=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>f?t.velocity.x*=-1:v<0&&!e.immovable&&f0&&!t.immovable&&y>p?t.velocity.y*=-1:y<0&&!e.immovable&&pMath.PI/2&&(f<0&&!t.immovable&&v0&&!e.immovable&&f>v?e.velocity.x*=-1:p<0&&!t.immovable&&y0&&!e.immovable&&f>y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.delta-a*Math.cos(o),t.y+=t.velocity.y*this.delta-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.delta+a*Math.cos(o),e.y+=e.velocity.y*this.delta+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),!0},intersects:function(t,e){return t!==e&&(t.isCircle?e.isCircle?h(t.center.x,t.center.y,e.center.x,e.center.y)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):e.isCircle?this.circleBodyIntersects(e,t):!(t.right<=e.position.x)&&(!(t.bottom<=e.position.y)&&(!(t.position.x>=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=s(t.center.x,e.left,e.right),n=s(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t=t.isParent&&void 0===t.physicsType?t.children.entries:t,e=e.isParent&&void 0===e.physicsType?e.children.entries:e;var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;o0},collideHandler:function(t,e,i,n,s,r){if(void 0===e&&t.isParent)return this.collideGroupVsGroup(t,t,i,n,s,r);if(!t||!e)return!1;if(t.body){if(e.body)return this.collideSpriteVsSprite(t,e,i,n,s,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,n,s,r)}else if(t.isParent){if(e.body)return this.collideSpriteVsGroup(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,n,s,r)}else if(t.isTilemap){if(e.body)return this.collideSpriteVsTilemapLayer(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,n,s,r)}},collideSpriteVsSprite:function(t,e,i,n,s,r){return!(!t.body||!e.body)&&(this.separate(t.body,e.body,n,s,r)&&(i&&i.call(s,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,n,s,r){var o=t.body;if(0!==e.length&&o){var h=this.treeMinMax;h.minX=o.left,h.minY=o.top,h.maxX=o.right,h.maxY=o.bottom;var u=e.physicsType===a.DYNAMIC_BODY?this.tree.search(h):this.staticTree.search(h);if(0!==u.length)for(var l=e.getChildren(),c=0;cc.baseTileWidth){var d=(c.tileWidth-c.baseTileWidth)*e.scaleX;a-=d,u+=d}c.tileHeight>c.baseTileHeight&&(l+=(c.tileHeight-c.baseTileHeight)*e.scaleY);var f,g=e.getTilesWithinWorldXY(a,h,u,l);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},m=0;m0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),this.moves&&(0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.gameObject.x+=this._dx,this.gameObject.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.world.bounds,i=this.world.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n=this.gameObject;if(this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&n.getCenter){var s=n.displayWidth/2,r=n.displayHeight/2;this.offset.set(s-this.halfWidth,r-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i.setPosition(t,e),i.getTopLeft(this.position),this.prev.copy(this.position),this.rotation=i.angle,this.preRotation=i.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):a(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.radius):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.velocity.x/2,n+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t){return this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this},setVelocityX:function(t){return this.velocity.x=t,this},setVelocityY:function(t){return this.velocity.y=t,this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return this.immovable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=u},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=n,this.collideCallback=s,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(s=t.right-e.x)>r&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()r&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?s=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=s,e.overlapX=s,s}},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(s=t.bottom-e.y)>r&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()r&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?s=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=s,e.overlapY=s,s}},function(t,e,i){var n=new(i(0))({initialize:function(){this._pending=[],this._active=[],this._destroy=[],this._toProcess=0},add:function(t){return this._pending.push(t),this._toProcess++,this},remove:function(t){return this._destroy.push(t),this._toProcess++,this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,n=this._active;for(t=0;t=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,s,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=s||(o=e+Math.ceil((i-e)/s/2)*s,n(t,o,e,i,r),a.push(e,o,o,i))}s.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!p(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),a=g(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,s,r,o,h,u,l,d,f,p,g,v,y,m;for(u=l=1/0,n=e;n<=i-e;n++)s=a(t,0,n,this.toBBox),r=a(t,n,i,this.toBBox),f=s,p=r,void 0,void 0,void 0,void 0,g=Math.max(f.minX,p.minX),v=Math.max(f.minY,p.minY),y=Math.min(f.maxX,p.maxX),m=Math.min(f.maxY,p.maxY),o=Math.max(0,y-g)*Math.max(0,m-v),h=c(s)+c(r),o=e;s--)r=t.children[s],h(l,t.leaf?o(r):r),c+=d(l);return c},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},t.exports=s},function(t,e){var i=function(t,e,r,o,a){for(r=r||0,o=o||t.length-1,a=a||s;o>r;){if(o-r>600){var h=o-r+1,u=e-r+1,l=Math.log(h),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(h-c)/h)*(u-h/2<0?-1:1),f=Math.max(r,Math.floor(e-u*c/h+d)),p=Math.min(o,Math.floor(e+(h-u)*c/h+d));i(t,e,f,p,a)}var g=t[e],v=r,y=o;for(n(t,r,e),a(t[o],g)>0&&n(t,r,o);v0;)y--}0===a(t[r],g)?n(t,r,y):n(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};function n(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function s(t,e){return te?1:0}t.exports=i},function(t,e){t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},function(t,e,i){var n=i(32),s=i(0),r=i(59),o=i(33),a=i(6),h=new s({initialize:function(t,e){this.world=t,this.gameObject=e,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new a,this.position=new a(e.x-e.displayOriginX,e.y-e.displayOriginY),this.width=e.displayWidth,this.height=e.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new a(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=a.ZERO,this.allowGravity=!1,this.gravity=a.ZERO,this.bounce=a.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=r.STATIC_BODY},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){return void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),this.offset.set(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):o(this,t,e)},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=h},,,,function(t,e,i){var n=i(15);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),u=0;u-1}return!1}},function(t,e,i){var n=i(44),s=i(74),r=i(151);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!1),void 0===o&&(o=!0),!s(t,e,a))return null;var h=a.data[e][t];return null===h?null:(a.data[e][t]=i?null:new n(a,-1,t,e,h.width,h.height),o&&h&&h.collides&&r(t,e,a),h)}},function(t,e,i){var n=i(21),s=i(154),r=i(349),o=i(350),a=i(355);t.exports=function(t,e,i,h,u,l){var c;switch(e){case n.ARRAY_2D:c=s(t,i,h,u,l);break;case n.CSV:c=r(t,i,h,u,l);break;case n.TILED_JSON:c=o(t,i,l);break;case n.WELTMEISTER:c=a(t,i,l);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},function(t,e,i){var n=i(21),s=i(154);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map(function(t){return t.split(",")}),h=s(t,a,i,r,o);return h.format=n.CSV,h}},function(t,e,i){var n=i(21),s=i(76),r=i(904),o=i(906),a=i(907),h=i(909),u=i(910),l=i(911);t.exports=function(t,e,i){if("orthogonal"!==e.orientation)return console.warn("Only orthogonal map types are supported in this version of Phaser"),null;var c=new s({width:e.width,height:e.height,name:t,tileWidth:e.tilewidth,tileHeight:e.tileheight,orientation:e.orientation,format:n.TILED_JSON,version:e.version,properties:e.properties});c.layers=r(e,i),c.images=o(e);var d=a(e);return c.tilesets=d.tilesets,c.imageCollections=d.imageCollections,c.objects=h(e),c.tiles=u(c),l(c),c}},function(t,e){t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),n=Boolean(536870912&t);t&=536870911;var s=0,r=!1;return e&&i&&n?(s=Math.PI/2,r=!0):e&&i&&!n?(s=Math.PI,r=!1):e&&!i&&n?(s=Math.PI/2,r=!1):!e||i||n?!e&&i&&n?(s=3*Math.PI/2,r=!1):e||!i||n?e||i||!n?e||i||n||(s=0,r=!1):(s=3*Math.PI/2,r=!0):(s=Math.PI,r=!0):(s=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:n,rotation:s,flipped:r}}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&ta&&(a=e.layer[u].width),e.layer[u].height>h&&(h=e.layer[u].height);var l=new s({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:n.WELTMEISTER});return l.layers=r(e,i),l.tilesets=o(e),l}},function(t,e,i){var n=i(0),s=i(35),r=i(357),o=i(23),a=i(21),h=i(75),u=i(325),l=i(358),c=i(44),d=i(96),f=i(100),p=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0},addTilesetImage:function(t,e,i,n,s,r,o){if(void 0===t)return null;if(null==e&&(e=t),!this.scene.sys.textures.exists(e))return console.warn('Invalid image key given for tileset: "'+e+'"'),null;var h=this.scene.sys.textures.get(e),u=this.getTilesetIndex(t);if(null===u&&this.format===a.TILED_JSON)return console.warn('No data found in the JSON tilemap from Tiled matching the tileset name: "'+t+'"'),null;if(this.tilesets[u])return this.tilesets[u].setTileSize(i,n),this.tilesets[u].setSpacing(s,r),this.tilesets[u].setImage(h),this.tilesets[u];void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0);var l=new f(t,o,i,n,s,r);return l.setImage(h),this.tilesets.push(l),l},convertLayerToStatic:function(t){if(null===(t=this.getLayer(t)))return null;var e=t.tilemapLayer;if(!(e&&e instanceof r))return null;var i=new l(e.scene,e.tilemap,e.layerIndex,e.tileset,e.x,e.y);return this.scene.sys.displayList.add(i),e.destroy(),i},copy:function(t,e,i,n,s,r,o,a){return a=this.getLayer(a),this._isStaticCall(a,"copy")?this:(null!==a&&d.Copy(t,e,i,n,s,r,o,a),this)},createBlankDynamicLayer:function(t,e,i,n,s,o,a,u){if(void 0===a&&(a=e.tileWidth),void 0===u&&(u=e.tileHeight),void 0===s&&(s=this.width),void 0===o&&(o=this.height),void 0===i&&(i=0),void 0===n&&(n=0),null!==this.getLayerIndex(t))return console.warn("Cannot create blank layer: layer with matching name already exists "+t),null;for(var l,d=new h({name:t,tileWidth:a,tileHeight:u,width:s,height:o}),f=0;f0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},function(t,e,i){var n=i(926);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substr(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===n.indexOf(e)&&"_"!==e.substr(0,1)&&i.push({key:e,value:t[e]});return i}},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"tweens",null);return null===e?[]:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(158),s=i(10),r=i(73),o=i(71),a=i(101),h=i(4),u=i(157),l=i(159),c=i(160);t.exports=function(t,e,i){void 0===i&&(i=n);var d=h(e,"from",0),f=h(e,"to",1),p=[{value:d}],g=a(e,"delay",i.delay),v=a(e,"duration",i.duration),y=h(e,"easeParams",i.easeParams),m=o(h(e,"ease",i.ease),y),x=a(e,"hold",i.hold),w=a(e,"repeat",i.repeat),b=a(e,"repeatDelay",i.repeatDelay),T=r(e,"yoyo",i.yoyo),A=[],S=u("value",f),C=c(p[0],"value",S.getEnd,S.getStart,m,g,v,T,x,w,b,!1,!1);C.start=d,C.current=d,C.to=f,A.push(C);var M=new l(t,A,p);M.offset=s(e,"offset",null),M.completeDelay=s(e,"completeDelay",0),M.loop=Math.round(s(e,"loop",0)),M.loopDelay=Math.round(s(e,"loopDelay",0)),M.paused=r(e,"paused",!1),M.useFrames=r(e,"useFrames",!1);for(var E=h(e,"callbackScope",M),_=[M,null],L=l.TYPES,P=0;P0?Math.floor(v/p.length):h(e,"duration",g.duration),g.delay=h(e,"delay",g.delay),g.easeParams=c(e,"easeParams",g.easeParams),g.ease=a(c(e,"ease",g.ease),g.easeParams),g.hold=h(e,"hold",g.hold),g.repeat=h(e,"repeat",g.repeat),g.repeatDelay=h(e,"repeatDelay",g.repeatDelay),g.yoyo=o(e,"yoyo",g.yoyo),g.flipX=o(e,"flipX",g.flipX),g.flipY=o(e,"flipY",g.flipY);for(var y=0;y0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=o.PAUSED,!1)},resetTweens:function(t){for(var e=0;e0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&t.func.apply(t.scope,t.params),this.emit("loop",this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit("complete",this),this.state=o.PENDING_REMOVE}},update:function(t,e){if(this.state!==o.PAUSED){var i=e;switch(this.useFrames&&(e=1*this.manager.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var n=this.totalData,s=0;s=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.nextTick&&this.currentAnim.setFrame(this))},updateFrame:function(t){var e=this.parent;if(this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;i.onUpdate&&i.onUpdate.apply(i.callbackScope,this._updateParams),t.onUpdate&&t.onUpdate(e,t)}},yoyo:function(t){return void 0===t?this._yoyo:(this._yoyo=t,this)},destroy:function(){}});t.exports=n},function(t,e,i){var n=i(368),s=i(369),r=i(0),o=i(22),a=i(370),h=i(371),u=i(63),l=i(121),c=new r({initialize:function(t){this.game=t,this.type=o.CANVAS,this.drawCount=0,this.width=t.config.width,this.height=t.config.height,this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,resolution:t.config.resolution,autoResize:t.config.autoResize,roundPixels:t.config.roundPixels},this.scaleMode=t.config.pixelArt?u.NEAREST:u.LINEAR,this.gameCanvas=t.canvas,this.gameContext=this.gameCanvas.getContext("2d"),this.currentContext=this.gameContext,this.drawImage=a(this.config.roundPixels),this.blitImage=n(this.config.roundPixels),this.blendModes=h(),this.currentAlpha=1,this.currentBlendMode=0,this.currentScaleMode=0,this.snapshotCallback=null,this.snapshotType=null,this.snapshotEncoder=null,this.init()},init:function(){this.resize(this.width,this.height)},resize:function(t,e){var i=this.config.resolution;this.width=t*i,this.height=e*i,this.gameCanvas.width=this.width,this.gameCanvas.height=this.height,this.config.autoResize&&(this.gameCanvas.style.width=this.width/i+"px",this.gameCanvas.style.height=this.height/i+"px"),this.scaleMode===u.NEAREST&&l.disable(this.gameContext)},onContextLost:function(){},onContextRestored:function(){},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(t){return this.currentBlendMode!==t&&(this.currentContext.globalCompositeOperation=t,this.currentBlendMode=t),this.currentBlendMode},setAlpha:function(t){return this.currentAlpha!==t&&(this.currentContext.globalAlpha=t,this.currentAlpha=t),this.currentAlpha},preRender:function(){var t=this.gameContext,e=this.config,i=this.width,n=this.height;e.clearBeforeRender&&t.clearRect(0,0,i,n),e.transparent||(t.fillStyle=e.backgroundColor.rgba,t.fillRect(0,0,i,n)),this.drawCount=0},render:function(t,e,i,n){var s=t.sys.context,r=0!==n.x||0!==n.y||n.width!==s.canvas.width||n.height!==s.canvas.height,o=e.list,a=this.config.resolution;this.currentContext=s,n.transparent||(s.fillStyle=n.backgroundColor.rgba,s.fillRect(n.x,n.y,n.width,n.height)),1!==this.currentAlpha&&(s.globalAlpha=1,this.currentAlpha=1),0!==this.currentBlendMode&&(s.globalCompositeOperation="source-over",this.currentBlendMode=0),this.currentScaleMode=0,this.drawCount+=o.length,r&&(s.save(),s.beginPath(),s.rect(n.x*a,n.y*a,n.width*a,n.height*a),s.clip());var h=n.matrix.matrix;s.setTransform(h[0],h[1],h[2],h[3],h[4],h[5]);for(var u=0;u0||n._flashAlpha>0)&&(s.globalCompositeOperation="source-over",s.fillStyle="rgb("+255*n._fadeRed+","+255*n._fadeGreen+","+255*n._fadeBlue+")",s.globalAlpha=n._fadeAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.fillStyle="rgb("+255*n._flashRed+","+255*n._flashGreen+","+255*n._flashBlue+")",s.globalAlpha=n._flashAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.globalAlpha=1),r&&s.restore()},postRender:function(){var t=this.gameContext;t.globalAlpha=1,t.globalCompositeOperation="source-over",this.currentAlpha=1,this.currentBlendMode=0,this.snapshotCallback&&(this.snapshotCallback(s(this.gameCanvas,this.snapshotType,this.snapshotEncoder)),this.snapshotCallback=null)},snapshot:function(t,e,i){this.snapshotCallback=t,this.snapshotType=e,this.snapshotEncoder=i},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e){var i=!1,n=function(t,e,n){var s=this.currentContext,r=n.canvasData;i&&(t|=0,e|=0),s.drawImage(n.source.image,r.sx,r.sy,r.sWidth,r.sHeight,t,e,r.dWidth,r.dHeight)};t.exports=function(t){return i=t,n}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e="image/png"),void 0===i&&(i=.92);var n=t.toDataURL(e,i),s=new Image;return s.src=n,s}},function(t,e){var i=!1,n=function(t,e){var n=this.currentContext,s=t.frame,r=s.canvasData;this.currentBlendMode!==t.blendMode&&(this.currentBlendMode=t.blendMode,n.globalCompositeOperation=this.blendModes[t.blendMode]),this.currentAlpha!==t.alpha&&(this.currentAlpha=t.alpha,n.globalAlpha=t.alpha),this.currentScaleMode!==t.scaleMode&&(this.currentScaleMode=t.scaleMode);var o=s.x,a=s.y,h=1,u=1;t.flipX?(h=-1,o-=r.dWidth-t.displayOriginX):o-=t.displayOriginX,t.flipY?(u=-1,a-=r.dHeight-t.displayOriginY):a-=t.displayOriginY;var l=t.x-e.scrollX*t.scrollFactorX,c=t.y-e.scrollY*t.scrollFactorY;i&&(l|=0,c|=0,o|=0,a|=0),n.save(),n.translate(l,c),n.rotate(t.rotation),n.scale(t.scaleX,t.scaleY),n.scale(h,u),n.drawImage(s.source.image,r.sx,r.sy,r.sWidth,r.sHeight,o,a,r.dWidth,r.dHeight),n.restore()};t.exports=function(t){return i=t,n}},function(t,e,i){var n=i(45),s=i(237);t.exports=function(){var t=[],e=s.supportNewBlendModes;return t[n.NORMAL]="source-over",t[n.ADD]="lighter",t[n.MULTIPLY]=e?"multiply":"source-over",t[n.SCREEN]=e?"screen":"source-over",t[n.OVERLAY]=e?"overlay":"source-over",t[n.DARKEN]=e?"darken":"source-over",t[n.LIGHTEN]=e?"lighten":"source-over",t[n.COLOR_DODGE]=e?"color-dodge":"source-over",t[n.COLOR_BURN]=e?"color-burn":"source-over",t[n.HARD_LIGHT]=e?"hard-light":"source-over",t[n.SOFT_LIGHT]=e?"soft-light":"source-over",t[n.DIFFERENCE]=e?"difference":"source-over",t[n.EXCLUSION]=e?"exclusion":"source-over",t[n.HUE]=e?"hue":"source-over",t[n.SATURATION]=e?"saturation":"source-over",t[n.COLOR]=e?"color":"source-over",t[n.LUMINOSITY]=e?"luminosity":"source-over",t}},function(t,e,i){var n=i(0),s=i(22),r=i(126),o=i(41),a=i(373),h=i(374),u=i(375),l=i(163),c=i(164),d=new n({initialize:function(t){var e=this,i={alpha:t.config.transparent,depth:!1,antialias:t.config.antialias,premultipliedAlpha:t.config.transparent,stencil:!0,preserveDrawingBuffer:t.config.preserveDrawingBuffer,failIfMajorPerformanceCaveat:!1,powerPreference:t.config.powerPreference};this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,contextCreation:i,resolution:t.config.resolution,autoResize:t.config.autoResize,roundPixels:t.config.roundPixels},this.game=t,this.type=s.WEBGL,this.width=t.config.width,this.height=t.config.height,this.canvas=t.canvas,this.lostContextCallbacks=[],this.restoredContextCallbacks=[],this.blendModes=[],this.nativeTextures=[],this.contextLost=!1,this.pipelines=null,this.snapshotState={callback:null,type:null,encoder:null},this.currentActiveTextureUnit=0,this.currentTextures=new Array(16),this.currentFramebuffer=null,this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=new Uint32Array([0,0,this.width,this.height]),this.currentScissorIdx=0,this.scissorStack=new Uint32Array(4e3),this.canvas.addEventListener("webglcontextlost",function(t){e.contextLost=!0,t.preventDefault();for(var i=0;i=0&&n>=0;if(r[0]===t&&r[1]===e&&r[2]===i&&r[3]===n||this.flush(),r[0]=t,r[1]=e,r[2]=i,r[3]=n,this.currentScissorEnabled=o,!o)return s.enable(s.SCISSOR_TEST),s.scissor(t,s.drawingBufferHeight-e-n,i,n),this;s.disable(s.SCISSOR_TEST)},pushScissor:function(t,e,i,n){var s=this.scissorStack,r=this.currentScissorIdx,o=this.currentScissor;return s[r+0]=o[0],s[r+1]=o[1],s[r+2]=o[2],s[r+3]=o[3],this.currentScissorIdx+=4,this.setScissor(t,e,i,n),this},popScissor:function(){var t=this.scissorStack,e=this.currentScissorIdx-4,i=t[e+0],n=t[e+1],s=t[e+2],r=t[e+3];return this.currentScissorIdx=e,this.setScissor(i,n,s,r),this},setPipeline:function(t){return this.currentPipeline===t&&this.currentPipeline.vertexBuffer===this.currentVertexBuffer&&this.currentPipeline.program===this.currentProgram||(this.flush(),this.currentPipeline=t,this.currentPipeline.bind()),this.currentPipeline.onBind(),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==s.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t&&(this.flush(),e.enable(e.BLEND),e.blendEquation(i.equation),i.func.length>2?e.blendFuncSeparate(i.func[0],i.func[1],i.func[2],i.func[3]):e.blendFunc(i.func[0],i.func[1]),this.currentBlendMode=t),this},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>16&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setTexture2D:function(t,e){var i=this.gl;return t!==this.currentTextures[e]&&(this.flush(),this.currentActiveTextureUnit!==e&&(i.activeTexture(i.TEXTURE0+e),this.currentActiveTextureUnit=e),i.bindTexture(i.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t){var e=this.gl;return t!==this.currentFramebuffer&&(this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),this.currentFramebuffer=t),this},setProgram:function(t){var e=this.gl;return t!==this.currentProgram&&(this.flush(),e.useProgram(t),this.currentProgram=t),this},setVertexBuffer:function(t){var e=this.gl;return t!==this.currentVertexBuffer&&(this.flush(),e.bindBuffer(e.ARRAY_BUFFER,t),this.currentVertexBuffer=t),this},setIndexBuffer:function(t){var e=this.gl;return t!==this.currentIndexBuffer&&(this.flush(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.currentIndexBuffer=t),this},createTextureFromSource:function(t,e,i,n){var o=this.gl,a=o.NEAREST,h=o.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,r(e,i)&&(h=o.REPEAT),n===s.ScaleModes.LINEAR?a=o.LINEAR:(n===s.ScaleModes.NEAREST||this.config.pixelArt)&&(a=o.NEAREST),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,o.RGBA,t):this.createTexture2D(0,a,a,h,h,o.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,u){var l=this.gl,c=l.createTexture();return u=null==u||u,this.setTexture2D(c,0),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,s),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,n),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),null==o?l.texImage2D(l.TEXTURE_2D,t,r,a,h,0,r,l.UNSIGNED_BYTE,null):(l.texImage2D(l.TEXTURE_2D,t,r,r,l.UNSIGNED_BYTE,o),a=o.width,h=o.height),this.setTexture2D(null,0),c.isAlphaPremultiplied=u,c.isRenderTexture=!1,c.width=a,c.height=h,this.nativeTextures.push(c),c},createFramebuffer:function(t,e,i,n){var s,r=this.gl,o=r.createFramebuffer();if(this.setFramebuffer(o),n){var a=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,a),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)}if(i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),(s=r.checkFramebufferStatus(r.FRAMEBUFFER))!==r.FRAMEBUFFER_COMPLETE){throw new Error("Framebuffer incomplete. Framebuffer status: "+{36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"}[s])}return o.renderTexture=i,this.setFramebuffer(null),o},createProgram:function(t,e){var i=this.gl,n=i.createProgram(),s=i.createShader(i.VERTEX_SHADER),r=i.createShader(i.FRAGMENT_SHADER);if(i.shaderSource(s,t),i.shaderSource(r,e),i.compileShader(s),i.compileShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS))throw new Error("Failed to compile Vertex Shader:\n"+i.getShaderInfoLog(s));if(!i.getShaderParameter(r,i.COMPILE_STATUS))throw new Error("Failed to compile Fragment Shader:\n"+i.getShaderInfoLog(r));if(i.attachShader(n,s),i.attachShader(n,r),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS))throw new Error("Failed to link program:\n"+i.getProgramInfoLog(n));return n},createVertexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setVertexBuffer(n),i.bufferData(i.ARRAY_BUFFER,t,e),this.setVertexBuffer(null),n},createIndexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setIndexBuffer(n),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t,e),this.setIndexBuffer(null),n},deleteTexture:function(t){return this.gl.deleteTexture(t),this},deleteFramebuffer:function(t){return this.gl.deleteFramebuffer(t),this},deleteProgram:function(t){return this.gl.deleteProgram(t),this},deleteBuffer:function(t){return this.gl.deleteBuffer(t),this},preRenderCamera:function(t){var e=this.config.resolution;if(this.pushScissor(t.x*e,t.y*e,t.width*e,t.height*e),t.backgroundColor.alphaGL>0){var i=t.backgroundColor,n=this.pipelines.FlatTintPipeline;n.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(i.redGL,i.greenGL,i.blueGL,1),i.alphaGL,1,0,0,1,0,0,[1,0,0,1,0,0]),n.flush()}},postRenderCamera:function(t){if(t._fadeAlpha>0||t._flashAlpha>0){var e=this.pipelines.FlatTintPipeline;e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._fadeRed,t._fadeGreen,t._fadeBlue,1),t._fadeAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._flashRed,t._flashGreen,t._flashBlue,1),t._flashAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.flush()}this.popScissor()},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;for(var n in t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),this.config.clearBeforeRender&&t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT),i)i[n].onPreRender()}},render:function(t,e,i,n){if(!this.contextLost){var r=e.list,o=r.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var u=0;uthis.vertexCapacity&&this.flush();var x=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount,T=r+a,A=o+h,S=m[0],C=m[1],M=m[2],E=m[3],_=d*S+f*M,L=d*C+f*E,P=p*S+g*M,F=p*C+g*E,k=v*S+y*M+m[4],R=v*C+y*E+m[5],O=r*_+o*P+k,D=r*L+o*F+R,I=r*_+A*P+k,B=r*L+A*F+R,Y=T*_+A*P+k,X=T*L+A*F+R,z=T*_+o*P+k,N=T*L+o*F+R,G=u.getTintAppendFloatAlphaAndSwap(l,c);x[b+0]=O,x[b+1]=D,w[b+2]=G,x[b+3]=I,x[b+4]=B,w[b+5]=G,x[b+6]=Y,x[b+7]=X,w[b+8]=G,x[b+9]=O,x[b+10]=D,w[b+11]=G,x[b+12]=Y,x[b+13]=X,w[b+14]=G,x[b+15]=z,x[b+16]=N,w[b+17]=G,this.vertexCount+=6},batchFillTriangle:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y,m,x,w){this.renderer.setPipeline(this),this.vertexCount+3>this.vertexCapacity&&this.flush();var b=this.vertexViewF32,T=this.vertexViewU32,A=this.vertexCount*this.vertexComponentCount,S=w[0],C=w[1],M=w[2],E=w[3],_=p*S+g*M,L=p*C+g*E,P=v*S+y*M,F=v*C+y*E,k=m*S+x*M+w[4],R=m*C+x*E+w[5],O=r*_+o*P+k,D=r*L+o*F+R,I=a*_+h*P+k,B=a*L+h*F+R,Y=l*_+c*P+k,X=l*L+c*F+R,z=u.getTintAppendFloatAlphaAndSwap(d,f);b[A+0]=O,b[A+1]=D,T[A+2]=z,b[A+3]=I,b[A+4]=B,T[A+5]=z,b[A+6]=Y,b[A+7]=X,T[A+8]=z,this.vertexCount+=3},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,y,m,x,w){var b=this.tempTriangle;b[0].x=r,b[0].y=o,b[0].width=c,b[0].rgb=d,b[0].alpha=f,b[1].x=a,b[1].y=h,b[1].width=c,b[1].rgb=d,b[1].alpha=f,b[2].x=u,b[2].y=l,b[2].width=c,b[2].rgb=d,b[2].alpha=f,b[3].x=r,b[3].y=o,b[3].width=c,b[3].rgb=d,b[3].alpha=f,this.batchStrokePath(t,e,i,n,s,b,c,d,f,p,g,v,y,m,x,!1,w)},batchFillPath:function(t,e,i,n,s,o,a,h,l,c,d,f,p,g,v){this.renderer.setPipeline(this);for(var y,m,x,w,b,T,A,S,C,M,E,_,L,P,F,k,R,O=o.length,D=this.polygonCache,I=this.vertexViewF32,B=this.vertexViewU32,Y=0,X=v[0],z=v[1],N=v[2],G=v[3],W=l*X+c*N,U=l*z+c*G,V=d*X+f*N,H=d*z+f*G,j=p*X+g*N+v[4],q=p*z+g*G+v[5],K=u.getTintAppendFloatAlphaAndSwap(a,h),J=0;Jthis.vertexCapacity&&this.flush(),Y=this.vertexCount*this.vertexComponentCount,_=(T=D[x+0])*W+(A=D[x+1])*V+j,L=T*U+A*H+q,P=(S=D[w+0])*W+(C=D[w+1])*V+j,F=S*U+C*H+q,k=(M=D[b+0])*W+(E=D[b+1])*V+j,R=M*U+E*H+q,I[Y+0]=_,I[Y+1]=L,B[Y+2]=K,I[Y+3]=P,I[Y+4]=F,B[Y+5]=K,I[Y+6]=k,I[Y+7]=R,B[Y+8]=K,this.vertexCount+=3;D.length=0},batchStrokePath:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y){var m,x;this.renderer.setPipeline(this);for(var w,b,T,A,S=r.length,C=this.polygonCache,M=this.vertexViewF32,E=this.vertexViewU32,_=u.getTintAppendFloatAlphaAndSwap,L=0;L+1this.vertexCapacity&&this.flush(),w=C[P-1]||C[F-1],b=C[P],M[(T=this.vertexCount*this.vertexComponentCount)+0]=w[6],M[T+1]=w[7],E[T+2]=_(w[8],h),M[T+3]=w[0],M[T+4]=w[1],E[T+5]=_(w[2],h),M[T+6]=b[9],M[T+7]=b[10],E[T+8]=_(b[11],h),M[T+9]=w[0],M[T+10]=w[1],E[T+11]=_(w[2],h),M[T+12]=w[6],M[T+13]=w[7],E[T+14]=_(w[8],h),M[T+15]=b[3],M[T+16]=b[4],E[T+17]=_(b[5],h),this.vertexCount+=6;C.length=0},batchLine:function(t,e,i,n,s,r,o,a,h,l,c,d,f,p,g,v,y,m,x,w,b){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var T=b[0],A=b[1],S=b[2],C=b[3],M=g*T+v*S,E=g*A+v*C,_=y*T+m*S,L=y*A+m*C,P=x*T+w*S+b[4],F=x*A+w*C+b[5],k=this.vertexViewF32,R=this.vertexViewU32,O=a-r,D=h-o,I=Math.sqrt(O*O+D*D),B=l*(h-o)/I,Y=l*(r-a)/I,X=c*(h-o)/I,z=c*(r-a)/I,N=a-X,G=h-z,W=r-B,U=o-Y,V=a+X,H=h+z,j=r+B,q=o+Y,K=N*M+G*_+P,J=N*E+G*L+F,Z=W*M+U*_+P,Q=W*E+U*L+F,$=V*M+H*_+P,tt=V*E+H*L+F,et=j*M+q*_+P,it=j*E+q*L+F,nt=u.getTintAppendFloatAlphaAndSwap,st=nt(d,p),rt=nt(f,p),ot=this.vertexCount*this.vertexComponentCount;return k[ot+0]=K,k[ot+1]=J,R[ot+2]=rt,k[ot+3]=Z,k[ot+4]=Q,R[ot+5]=st,k[ot+6]=$,k[ot+7]=tt,R[ot+8]=rt,k[ot+9]=Z,k[ot+10]=Q,R[ot+11]=st,k[ot+12]=et,k[ot+13]=it,R[ot+14]=st,k[ot+15]=$,k[ot+16]=tt,R[ot+17]=rt,this.vertexCount+=6,[K,J,f,Z,Q,d,$,tt,f,et,it,d]},batchGraphics:function(t,e){if(!(t.commandBuffer.length<=0)){this.renderer.setPipeline(this);var i,n,r=e.scrollX*t.scrollFactorX,o=e.scrollY*t.scrollFactorY,a=t.x-r,h=t.y-o,u=t.scaleX,l=t.scaleY,y=-t.rotation,m=t.commandBuffer,x=1,w=1,b=0,T=0,A=1,S=e.matrix.matrix,C=null,M=0,E=0,_=0,L=0,P=0,F=0,k=0,R=0,O=0,D=0,I=null,B=Math.sin,Y=Math.cos,X=2*Math.PI,z=B(y),N=Y(y),G=N*u,W=-z*u,U=z*l,V=N*l,H=a,j=h,q=S[0],K=S[1],J=S[2],Z=S[3],Q=G*q+W*J,$=G*K+W*Z,tt=U*q+V*J,et=U*K+V*Z,it=H*q+j*J+S[4],nt=H*K+j*Z+S[5];v.length=0;for(var st=0,rt=m.length;st0&&(O=O%X-X):O>X?O=X:O<0&&(O=X+O%X);M<1;)E=P+Y(L=O*M+R)*k,_=F+B(L)*k,C.points.push(new c(E,_,A,b,x)),M+=.01;E=P+Y(L=O+R)*k,_=F+B(L)*k,C.points.push(new c(E,_,A,b,x)),st+=6;break;case s.LINE_STYLE:A=m[st+1],b=m[st+2],x=m[st+3],st+=3;break;case s.FILL_STYLE:T=m[st+1],w=m[st+2],st+=2;break;case s.BEGIN_PATH:v.length=0,C=null;break;case s.CLOSE_PATH:C&&C.points.length&&C.points.push(C.points[0]);break;case s.FILL_PATH:for(i=0,n=v.length;i>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return this.n=i,2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e=0&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e){t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}}},function(t,e){var i={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.scene.sys.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}};t.exports=i},function(t,e){t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},function(t,e,i){var n=i(8),s=i(186),r=i(6),o={getCenter:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,t},getTopLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getTopRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBounds:function(t){void 0===t&&(t=new n),this.getTopLeft(t);var e=t.x,i=t.y;this.getTopRight(t);var s=t.x,r=t.y;this.getBottomLeft(t);var o=t.x,a=t.y;this.getBottomRight(t);var h=t.x,u=t.y;return t.x=Math.min(e,s,o,h),t.y=Math.min(i,r,a,u),t.width=Math.max(e,s,o,h)-t.x,t.height=Math.max(i,r,a,u)-t.y,t}};t.exports=o},function(t,e){var i={matrixStack:null,currentMatrix:null,currentMatrixIndex:0,initMatrixStack:function(){return this.matrixStack=new Float32Array(6e3),this.currentMatrix=new Float32Array([1,0,0,1,0,0]),this.currentMatrixIndex=0,this},save:function(){if(this.currentMatrixIndex>=this.matrixStack.length)return this;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return this.currentMatrixIndex+=6,t[i+0]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=e[3],t[i+4]=e[4],t[i+5]=e[5],this},restore:function(){if(this.currentMatrixIndex<=0)return this;this.currentMatrixIndex-=6;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return e[0]=t[i+0],e[1]=t[i+1],e[2]=t[i+2],e[3]=t[i+3],e[4]=t[i+4],e[5]=t[i+5],this},loadIdentity:function(){return this.setTransform(1,0,0,1,0,0),this},transform:function(t,e,i,n,s,r){var o=this.currentMatrix,a=o[0],h=o[1],u=o[2],l=o[3],c=o[4],d=o[5];return o[0]=a*t+u*e,o[1]=h*t+l*e,o[2]=a*i+u*n,o[3]=h*i+l*n,o[4]=a*s+u*r+c,o[5]=h*s+l*r+d,this},setTransform:function(t,e,i,n,s,r){var o=this.currentMatrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},translate:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3],a=i[4],h=i[5];return i[4]=n*t+r*e+a,i[5]=s*t+o*e+h,this},scale:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3];return i[0]=n*t,i[1]=s*t,i[2]=r*e,i[3]=o*e,this},rotate:function(t){var e=this.currentMatrix,i=e[0],n=e[1],s=e[2],r=e[3],o=Math.sin(t),a=Math.cos(t);return e[0]=i*a+s*o,e[1]=n*a+r*o,e[2]=i*-o+s*a,e[3]=n*-o+r*a,this}};t.exports=i},function(t,e){var i={_originComponent:!0,originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=Math.round(this.originX*this.width),this._displayOriginY=Math.round(this.originY*this.height),this}};t.exports=i},function(t,e,i){var n=i(63),s={_scaleMode:n.DEFAULT,scaleMode:{get:function(){return this._scaleMode},set:function(t){t!==n.LINEAR&&t!==n.NEAREST||(this._scaleMode=t)}},setScaleMode:function(t){return this.scaleMode=t,this}};t.exports=s},function(t,e){var i={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}};t.exports=i},function(t,e){var i={_sizeComponent:!0,width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.frame.realWidth},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return this.scaleY*this.frame.realHeight},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){return void 0===t&&(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=i},function(t,e){var i={texture:null,frame:null,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&this.setSizeToFrame(),this._originComponent&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this}};t.exports=i},function(t,e){var i=function(t){return(t>>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,n,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,n=t,s=t),this._tintTL=i(t),this._tintTR=i(e),this._tintBL=i(n),this._tintBR=i(s),this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t)}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t)}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t)}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t)}},tint:{set:function(t){this.setTint(t,t,t,t)}}};t.exports=n},function(t,e){t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,scaleMode:t.scaleMode,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},function(t,e,i){var n=i(16),s=i(161),r=i(162),o={_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4}},angle:{get:function(){return r(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=r(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=s(t)}},setPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this}};t.exports=o},function(t,e){var i={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}};t.exports=i},function(t,e){t.exports=function(t,e){for(var i=0;i0?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a1)if(0===s){var d=t.length-1;for(o=t[d].x,a=t[d].y,h=d-1;h>=0;h--)u=(c=t[h]).x,l=c.y,c.x=o,c.y=a,o=u,a=l;t[d].x=e,t[d].y=i}else{for(o=t[0].x,a=t[0].y,h=1;h0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.1&&(e.zoom=.1))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(115),CameraManager:i(456)}},function(t,e,i){var n=i(115),s=i(0),r=i(2),o=i(12),a=i(33),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.currentCameraId=1,this.cameras=[],this.cameraPool=[],t.sys.settings.cameras?this.fromJSON(t.sys.settings.cameras):this.add(),this.main=this.cameras[0],this.baseScale=1},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i,s,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===s&&(s=this.scene.sys.game.config.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=null;return this.cameraPool.length>0?(a=this.cameraPool.pop()).setViewport(t,e,i,s):a=new n(t,e,i,s),a.setName(o),a.setScene(this.scene),this.cameras.push(a),r&&(this.main=a),a._id=this.currentCameraId,this.currentCameraId=this.currentCameraId<<1,a},addExisting:function(t){var e=this.cameras.indexOf(t),i=this.cameraPool.indexOf(t);return e<0&&i>=0?(this.cameras.push(t),this.cameraPool.slice(i,1),t):null},fromJSON:function(t){Array.isArray(t)||(t=[t]);for(var e=this.scene.sys.game.config.width,i=this.scene.sys.game.config.height,n=0;n=0;i--){var n=e[i];if(n.inputEnabled&&a(n,t.x,t.y))return n}},remove:function(t){var e=this.cameras.indexOf(t);e>=0&&this.cameras.length>1&&(this.cameraPool.push(this.cameras[e]),this.cameras.splice(e,1),this.main===t&&(this.main=this.cameras[0]))},render:function(t,e,i){for(var n=this.cameras,s=this.baseScale,r=0,o=n.length;r0;)this.cameraPool.push(this.cameras.pop());return this.main=this.add(),this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(212),r=i(213),o=i(12),a=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.cameras=[],t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i){return this.addPerspectiveCamera(t,e,i)},addOrthographicCamera:function(t,e){var i=this.scene.sys.game.config;void 0===t&&(t=i.width),void 0===e&&(e=i.height);var n=new s(this.scene,t,e);return this.cameras.push(n),n},addPerspectiveCamera:function(t,e,i){var n=this.scene.sys.game.config;void 0===t&&(t=80),void 0===e&&(e=n.width),void 0===i&&(i=n.height);var s=new r(this.scene,t,e,i);return this.cameras.push(s),s},getCamera:function(t){return this.cameras.forEach(function(e){if(e.name===t)return e}),null},removeCamera:function(t){var e=this.cameras.indexOf(t);-1!==e&&this.cameras.splice(e,1)},removeAll:function(){for(;this.cameras.length>0;){this.cameras.pop().destroy()}return this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),n=this.getCurveLengths(),s=0;s=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},getRandomPoint:function(t){return void 0===t&&(t=new d),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new d),t.copy(this.startPoint)},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e,i){var n=i(36),s=i(227);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,u=2*i-h;r=s(u,h,t+1/3),o=s(u,h,t),a=s(u,h,t-1/3)}return(new n).setGLTo(r,o,a,1)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){var n=i(228);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n(s/359,t,e));return i}},function(t,e,i){var n=i(229),s=function(t,e,i,s,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var u=h/a;return{r:n(t,s,u),g:n(e,r,u),b:n(i,o,u)}};t.exports={RGBWithRGB:s,ColorWithRGB:function(t,e,i,n,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),s(t.r,t.g,t.b,e,i,n,r,o)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),s(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(231),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e){t.exports=function(t,e,i){t/=255,e/=255,i/=255;var n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n,o=0;return s!==n&&(s===t?o=(e-i)/r+(e1)for(var i=1;i=1)&&(r.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(r.mspointer=!0),navigator.getGamepads&&(r.gamepads=!0),n.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll")),r)},function(t,e,i){var n=i(82),s={audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(n.edge)s.dolby=!0;else if(n.safari&&n.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var i=parseInt(RegExp.$1,10),r=parseInt(RegExp.$2,10);(10===i&&r>=11||i>10)&&(s.dolby=!0)}}catch(t){}return s}()},function(t,e){var i={h264Video:!1,hlsVideo:!1,mp4Video:!1,oggVideo:!1,vp9Video:!1,webmVideo:!1};t.exports=function(){var t=document.createElement("video"),e=!!t.canPlayType;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(i.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.h264Video=!0,i.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(i.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(i.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.hlsVideo=!0))}catch(t){}return i}()},function(t,e){var i={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){var t,e=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],n=document.createElement("div");for(t=0;t0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(s=!0,i=n(t,e))}else s=!0,i=n(t,e);return!s&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},function(t,e){t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},function(t,e){t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},function(t,e,i){var n=i(128),s={};for(var r in n)s[n[r]]=r;t.exports=s},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.altKey=e.altKey,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.location=e.location,!1===t.isDown&&(t.isDown=!0,t.isUp=!1,t.timeDown=e.timeStamp,t.duration=0),t.repeats++,t._justDown=!0,t._justUp=!1,t}},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.isDown=!1,t.isUp=!0,t.timeUp=e.timeStamp,t.duration=t.timeUp-t.timeDown,t.repeats=0,t._justDown=!1,t._justUp=!0,t}},function(t,e,i){var n=i(2),s=i(254);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=n(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(s(e+"Physics")),i)for(var o in i)o=s(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},function(t,e,i){var n=i(2);t.exports=function(t){var e=t.game.config.defaultPlugins,i=n(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},function(t,e){t.exports={game:"game",anims:"anims",cache:"cache",registry:"registry",sound:"sound",textures:"textures",events:"events",cameras:"cameras",cameras3d:"cameras3d",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e,i){var n=i(53);t.exports=function(t,e,i){if(i.frames||i.textures){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var r,o=Array.isArray(i.textures)?i.textures[e].frames:i.frames,a=0;ag||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,y=f,m=0,x=0,w=0;wr&&(m=b-r),T>o&&(x=T-o),t.add(w,e,i+v,s+y,h-m,u-x),(v+=h+p)+h>r&&(v=f,y+=u+p)}return t}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){var s=n(i,"frameWidth",null),r=n(i,"frameHeight",s);if(!s)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o,a=n(i,"startFrame",0),h=n(i,"endFrame",-1),u=n(i,"margin",0),l=n(i,"spacing",0),c=e.cutX,d=e.cutY,f=e.cutWidth,p=e.cutHeight,g=e.realWidth,v=e.realHeight,y=Math.floor((g-u+l)/(s+l)),m=Math.floor((v-u+l)/(r+l)),x=y*m,w=e.x,b=s-w,T=s-(g-f-w),A=e.y,S=r-A,C=r-(v-p-A);(a>x||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var M=u,E=u,_=0,L=e.sourceIndex,P=0;P0||!this.inFocus)&&(this._coolDown--,s=Math.min(s,this._target)),s>this._min&&(s=i[e],s=Math.min(s,this._min)),i[e]=s,this.deltaIndex++,this.deltaIndex>n&&(this.deltaIndex=0);for(var r=0,o=0;othis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var a=r/this._target;this.callback(t,r,a),this.lastTime=t},tick:function(){this.step(window.performance.now())},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running?this.sleep():t&&(this.startTime+=-this.lastTime+(this.lastTime=window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step(window.performance.now())},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e){t.exports=function(t){var e;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(e){document.hidden||"pause"===e.type?t.emit("hidden"):t.emit("visible")},!1),window.onblur=function(){t.emit("blur")},window.onfocus=function(){t.emit("focus")}}},function(t,e,i){var n={DisplayList:i(546),GameObjectCreator:i(13),GameObjectFactory:i(9),UpdateList:i(547),Components:i(11),BitmapText:i(131),Blitter:i(132),DynamicBitmapText:i(133),Graphics:i(134),Group:i(69),Image:i(70),Particles:i(137),PathFollower:i(290),RenderTexture:i(139),Sprite3D:i(81),Sprite:i(37),Text:i(140),TileSprite:i(141),Zone:i(77),Factories:{Blitter:i(631),DynamicBitmapText:i(632),Graphics:i(633),Group:i(634),Image:i(635),Particles:i(636),PathFollower:i(637),RenderTexture:i(638),Sprite3D:i(639),Sprite:i(640),StaticBitmapText:i(641),Text:i(642),TileSprite:i(643),Zone:i(644)},Creators:{Blitter:i(645),DynamicBitmapText:i(646),Graphics:i(647),Group:i(648),Image:i(649),Particles:i(650),RenderTexture:i(651),Sprite3D:i(652),Sprite:i(653),StaticBitmapText:i(654),Text:i(655),TileSprite:i(656),Zone:i(657)}};n.Mesh=i(88),n.Quad=i(142),n.Factories.Mesh=i(661),n.Factories.Quad=i(662),n.Creators.Mesh=i(663),n.Creators.Quad=i(664),n.Light=i(293),i(294),i(665),t.exports=n},function(t,e,i){var n=i(0),s=i(86),r=i(12),o=i(267),a=new n({Extends:s,initialize:function(t){s.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(o.inplace(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},sortGameObjects:function(t){return void 0===t&&(t=this.list),this.scene.sys.depthSort(),t.sort(this.sortIndexHandler.bind(this))},getTopGameObject:function(t){return this.sortGameObjects(t),t[t.length-1]}});r.register("DisplayList",a,"displayList"),t.exports=a},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this._list=[],this._pendingInsertion=[],this._pendingRemoval=[]},boot:function(){var t=this.systems.events;t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t){return-1===this._list.indexOf(t)&&-1===this._pendingInsertion.indexOf(t)&&this._pendingInsertion.push(t),t},preUpdate:function(){var t=this._pendingRemoval.length,e=this._pendingInsertion.length;if(0!==t||0!==e){var i,n;for(i=0;i-1&&this._list.splice(s,1)}this._list=this._list.concat(this._pendingInsertion.splice(0)),this._pendingRemoval.length=0,this._pendingInsertion.length=0}},update:function(t,e){for(var i=0;ia.length&&(f=a.length);for(var p=u,g=l,v={retroFont:!0,font:h,size:i,lineHeight:s,chars:{}},y=0,m=0;m?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",s.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",s.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",s.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",s.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",s.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",s.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",s.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",t.exports=s},function(t,e,i){var n=i(3),s=i(3);n=i(551),s=i(552),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text.length;n.RENDER_MASK!==e.renderFlags||0===r||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchBitmapText(this,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.fontData.chars,u=e.fontData.lineHeight,l=0,c=0,d=0,f=0,p=null,g=0,v=0,y=0,m=0,x=0,w=0,b=null,T=0,A=t.currentContext,S=e.frame.source.image,C=a.cutX,M=a.cutY,E=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,A.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,A.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var _=t.config.roundPixels,L=e.x-s.scrollX*e.scrollFactorX+e.frame.x,P=e.y-s.scrollY*e.scrollFactorY+e.frame.y;_&&(L|=0,P|=0),A.save(),A.translate(L,P),A.rotate(e.rotation),A.translate(-e.displayOriginX,-e.displayOriginY),A.scale(e.scaleX,e.scaleY);for(var F=0;F0&&e.cameraFilter&s._id||this.pipeline.drawBlitter(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=e.getRenderList();t.setBlendMode(e.blendMode);for(var o=t.gameContext,a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY,u=0;u0&&e.cameraFilter&s._id||this.pipeline.batchDynamicBitmapText(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.displayCallback,u=s.scrollX*e.scrollFactorX,l=s.scrollY*e.scrollFactorY,c=e.fontData.chars,d=e.fontData.lineHeight,f=0,p=0,g=0,v=0,y=null,m=0,x=0,w=0,b=0,T=0,A=0,S=null,C=0,M=t.currentContext,E=e.frame.source.image,_=a.cutX,L=a.cutY,P=0,F=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,M.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,M.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),M.save(),M.translate(e.x,e.y),M.rotate(e.rotation),M.translate(-e.displayOriginX,-e.displayOriginY),M.scale(e.scaleX,e.scaleY),e.cropWidth>0&&e.cropHeight>0&&(M.save(),M.beginPath(),M.rect(0,0,e.cropWidth,e.cropHeight),M.clip());for(var k=t.config.roundPixels,R=0;R0&&e.cropHeight>0&&M.restore(),M.restore()}}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(135);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(3),s=i(3);n=i(570),s=i(274),s=i(274),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchGraphics(this,s)}},function(t,e,i){var n=i(3),s=i(3);n=i(572),s=i(573),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t,e,i,n,r){if("object"==typeof t){var o=t;t=s(o,"x",0),e=s(o,"y",0),i=s(o,"power",0),n=s(o,"epsilon",100),r=s(o,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=50);this.x=t,this.y=e,this.active=!0,this._gravity=r,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i=this.x-t.x,n=this.y-t.y,s=i*i+n*n;if(0!==s){var r=Math.sqrt(s);s0&&this.getParticleCount()===this.maxParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,n=i.length,s=0;s0?n.pop():new this.particleClass(this)).fire(e,i),this.particleBringToTop?this.alive.push(r):this.alive.unshift(r),this.emitCallback&&this.emitCallback.call(this.emitCallbackScope,r,this),this.atLimit())break}return r}},preUpdate:function(t,e){var i=(e*=this.timeScale)/1e3;this.trackVisible&&(this.visible=this.follow.visible);for(var n=this.manager.getProcessors(),s=this.alive,r=s.length,o=0;o0){var l=s.splice(s.length-u,u),c=this.deathCallback,d=this.deathCallbackScope;if(c)for(var f=0;f0&&(this._counter-=e,this._counter<=0&&(this.emitParticle(),this._counter=this.frequency-Math.abs(this._counter))))},depthSortCallback:function(t,e){return t.y-e.y},indexSortCallback:function(t,e){return t.index-e.index}});t.exports=x},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=this.source.contains(t.x,t.y);return e&&this.killOnEnter||!e&&!this.killOnEnter}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===n&&(n=!1),void 0===s&&(s=!0),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=n,this.counter=-1,this.seamless=s,this._length=0,this._direction=0,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e,i){var n=i(0),s=i(276),r=i(71),o=i(2),a=i(50),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t=this.propertyValue,e=typeof t;if("number"===e)this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate;else if(Array.isArray(t))this.onEmit=this.randomStaticValueEmit;else if("function"===e)this.emitOnly?this.onEmit=t:this.onUpdate=t;else if("object"===e&&(this.has(t,"random")||this.hasBoth(t,"start","end")||this.hasBoth(t,"min","max"))){this.start=this.has(t,"start")?t.start:t.min,this.end=this.has(t,"end")?t.end:t.max;var i=this.hasBoth(t,"min","max")||this.has(t,"random");if(i){var n=t.random;Array.isArray(n)&&(this.start=n[0],this.end=n[1]),this.onEmit=this.randomRangedValueEmit}if(this.has(t,"steps"))this.steps=t.steps,this.counter=this.start,this.onEmit=this.steppedEmit;else{var s=this.has(t,"ease")?t.ease:"Linear";this.ease=r(s),i||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate}}else"object"===e&&this.hasEither(t,"onEmit","onUpdate")&&(this.has(t,"onEmit")&&(this.onEmit=t.onEmit),this.has(t,"onUpdate")&&(this.onUpdate=t.onUpdate));return this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(277),s=i(278),r=i(279),o=i(280),a=i(281),h=i(282),u=i(283),l=i(284),c=i(285),d=i(286),f=i(287),p=i(288);t.exports={Power0:u,Power1:l.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:u,Quad:l.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:n.Out,Bounce:s.Out,Stepped:p,"Quad.easeIn":l.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":n.In,"Bounce.easeIn":s.In,"Quad.easeOut":l.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":n.Out,"Bounce.easeOut":s.Out,"Quad.easeInOut":l.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":n.InOut,"Bounce.easeInOut":s.InOut}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},function(t,e){t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},function(t,e){t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},function(t,e){t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},function(t,e){t.exports=function(t){return Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},function(t,e){t.exports=function(t){return t*t*t}},function(t,e){t.exports=function(t){return--t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/i)+1}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*.5+1}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},function(t,e){t.exports=function(t){return 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},function(t,e){t.exports=function(t){return t}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return t*(2-t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},function(t,e){t.exports=function(t){return t*t*t*t}},function(t,e){t.exports=function(t){return 1- --t*t*t*t}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},function(t,e){t.exports=function(t){return t*t*t*t*t}},function(t,e){t.exports=function(t){return--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},function(t,e,i){var n=i(0),s=i(35),r=i(42),o=new n({initialize:function(t){this.emitter=t,this.frame=null,this.index=0,this.x=0,this.y=0,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.scrollFactorX=1,this.scrollFactorY=1,this.tint=4294967295,this.color=4294967295,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215,current:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1}}},isAlive:function(){return this.lifeCurrent>0},fire:function(t,e){var i=this.emitter;this.frame=i.getFrame(),i.emitZone&&i.emitZone.getPoint(this),void 0===t?(i.follow&&(this.x+=i.follow.x+i.followOffset.x),this.x+=i.x.onEmit(this,"x")):this.x+=t,void 0===e?(i.follow&&(this.y+=i.follow.y+i.followOffset.y),this.y+=i.y.onEmit(this,"y")):this.y+=e,this.life=i.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0;var n=i.speedX.onEmit(this,"speedX"),o=i.speedY?i.speedY.onEmit(this,"speedY"):n;if(i.radial){var a=s(i.angle.onEmit(this,"angle"));this.velocityX=Math.cos(a)*Math.abs(n),this.velocityY=Math.sin(a)*Math.abs(o)}else if(i.moveTo){var h=i.moveToX.onEmit(this,"moveToX"),u=i.moveToY?i.moveToY.onEmit(this,"moveToY"):h,l=Math.atan2(u-this.y,h-this.x),c=r(this.x,this.y,h,u)/(this.life/1e3);this.velocityX=Math.cos(l)*c,this.velocityY=Math.sin(l)*c}else this.velocityX=n,this.velocityY=o;i.acceleration&&(this.accelerationX=i.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=i.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=i.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=i.maxVelocityY.onEmit(this,"maxVelocityY"),this.delayCurrent=i.delay.onEmit(this,"delay"),this.scaleX=i.scaleX.onEmit(this,"scaleX"),this.scaleY=i.scaleY?i.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=i.rotate.onEmit(this,"rotate"),this.rotation=s(this.angle),this.bounce=i.bounce.onEmit(this,"bounce"),this.alpha=i.alpha.onEmit(this,"alpha"),this.tint=i.tint.onEmit(this,"tint"),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.index=i.alive.length},computeVelocity:function(t,e,i,n){var s=this.velocityX,r=this.velocityY,o=this.accelerationX,a=this.accelerationY,h=this.maxVelocityX,u=this.maxVelocityY;s+=t.gravityX*i,r+=t.gravityY*i,o&&(s+=o*i),a&&(r+=a*i),s>h?s=h:s<-h&&(s=-h),r>u?r=u:r<-u&&(r=-u),this.velocityX=s,this.velocityY=r;for(var l=0;le.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(this.delayCurrent>0)return this.delayCurrent-=t,!1;var n=this.emitter,r=1-this.lifeCurrent/this.life;return this.lifeT=r,this.computeVelocity(n,t,e,i),this.x+=this.velocityX*e,this.y+=this.velocityY*e,n.bounds&&this.checkBounds(n),n.deathZone&&n.deathZone.willKill(this)?(this.lifeCurrent=0,!0):(this.scaleX=n.scaleX.onUpdate(this,"scaleX",r,this.scaleX),n.scaleY?this.scaleY=n.scaleY.onUpdate(this,"scaleY",r,this.scaleY):this.scaleY=this.scaleX,this.angle=n.rotate.onUpdate(this,"rotate",r,this.angle),this.rotation=s(this.angle),this.alpha=n.alpha.onUpdate(this,"alpha",r,this.alpha),this.tint=n.tint.onUpdate(this,"tint",r,this.tint),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(6),r=new n({initialize:function(t){this.source=t,this._tempVec=new s},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},function(t,e,i){var n=i(3),s=i(3);n=i(615),s=i(616),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){0===e.emitters.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.drawEmitterManager(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.emitters.list;if(!(0===r.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id))for(var o=0;o>24&255)/255;if(!(y<=0)){var m=v.frame,x=.5*m.width,w=.5*m.height,b=m.canvasData,T=-x,A=-w,S=v.x-d*v.scrollFactorX,C=v.y-f*v.scrollFactorY;p&&(S|=0,C|=0),l.globalAlpha=y,l.save(),l.translate(S,C),l.rotate(v.rotation),l.scale(v.scaleX,v.scaleY),l.drawImage(m.source.image,b.sx,b.sy,b.sWidth,b.sHeight,T,A,b.dWidth,b.dHeight),l.restore()}}l.globalAlpha=c}}}},function(t,e,i){var n=i(3),s=i(3);n=i(618),s=i(619),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchTexture(e,e.texture,e.texture.width,e.texture.height,e.x,e.y,e.width,e.height,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,e.texture.width,e.texture.height,4294967295,4294967295,4294967295,4294967295,0,0,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=0,a=0,h=1,u=1;e.flipX?(h=-1,o-=e.canvas.width-e.displayOriginX):o-=e.displayOriginX,e.flipY?(u=-1,a-=e.canvas.height-e.displayOriginY):a-=e.displayOriginY,r.save(),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.scale(h,u),r.drawImage(e.canvas,o,a),r.restore()}}},function(t,e){t.exports={fill:function(t){var e=255&(t>>16|0),i=255&(t>>8|0),n=255&(0|t);return this.context.fillStyle="rgb("+e+","+i+","+n+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this},clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this},draw:function(t,e,i,n){var s=this.currentMatrix;return this.context.globalAlpha=this.globalAlpha,this.context.setTransform(s[0],s[1],s[2],s[3],s[4],s[5]),this.context.drawImage(t.source[e.sourceIndex].image,e.x,e.y,e.width,e.height,i,n,e.width,e.height),this}}},function(t,e){t.exports={fill:function(t){var e=255&(t>>16|0),i=255&(t>>8|0),n=255&(0|t);this.renderer.setFramebuffer(this.framebuffer);var s=this.gl;return s.clearColor(e/255,i/255,n/255,1),s.clear(s.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},clear:function(){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;return t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},draw:function(t,e,i,n){var s=t.source[e.sourceIndex].glTexture,r=(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16);return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(s,i,n,r,this.globalAlpha,e.x,e.y,e.width,e.height,this.currentMatrix),this.renderer.setFramebuffer(null),this}}},function(t,e){t.exports=function(t,e,i){var n=t.canvas,s=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLinesc&&(f=-c),0!==f&&(d+=f>0?f*i.length:f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(3),s=i(3);n=i(624),s=i(625),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text||(e.dirty&&(e.canvasTexture=t.canvasToTexture(e.canvas,e.canvasTexture,!0,e.scaleMode),e.dirty=!1),this.pipeline.batchText(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=e.canvas;r.save();var a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY;t.config.roundPixels&&(a|=0,h|=0),r.translate(a,h),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.translate(o.width*(e.flipX?1:0),o.height*(e.flipY?1:0)),r.scale(e.flipX?-1:1,e.flipY?-1:1),r.drawImage(o,0,0,o.width,o.height,-e.displayOriginX,-e.displayOriginY,o.width,o.height),r.restore()}}},function(t,e,i){var n=i(0),s=i(10),r=i(4),o=i(627),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new n({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.rtl,this.testString,this._font,this.setStyle(e,!1);var i=r(e,"metrics",!1);this.metrics=i?{ascent:r(i,"ascent",0),descent:r(i,"descent",0),fontSize:r(i,"fontSize",0)}:o(this)},setStyle:function(t,e){for(var i in void 0===e&&(e=!0),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),a)this[i]="wordWrapCallback"===i||"wordWrapCallbackScope"===i?r(t,a[i][0],a[i][1]):s(t,a[i][0],a[i][1]);var n=r(t,"font",null);this._font=null===n?[this.fontStyle,this.fontSize,this.fontFamily].join(" "):n;var o=r(t,"fill",null);return null!==o&&(this.color=o),e&&this.update(!0),this},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" "),this.metrics=o(this)),this.parent.updateText()},setFont:function(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=r(t,"fontFamily","Courier"),this.fontSize=r(t,"fontSize","16px"),this.fontStyle=r(t,"fontStyle","")),this.update(!0)},setFontFamily:function(t){return this.fontFamily=t,this.update(!0)},setFontStyle:function(t){return this.fontStyle=t,this.update(!0)},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.text.width=t),e&&(this.text.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setStroke:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=t,this.strokeThickness=e),this.update(!0)},setShadow:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},function(t,e,i){var n=i(19);t.exports=function(t){var e=n.create(this),i=e.getContext("2d");t.syncFont(e,i);var s=Math.ceil(1.2*i.measureText(t.testString).width),r=s,o=2*r;r=1.4*r|0,e.width=s,e.height=o,i.fillStyle="#f00",i.fillRect(0,0,s,o),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,r);var a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,s,o))return a.ascent=r,a.descent=r+6,a.fontSize=a.ascent+a.descent,n.remove(e),a;var h,u,l=i.getImageData(0,0,s,o).data,c=l.length,d=4*s,f=0,p=!1;for(h=0;hr;h--){for(u=0;u0&&e.cameraFilter&s._id||(e.updateTileTexture(),this.pipeline.batchTileSprite(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext,o=e.frame;e.updateTileTexture(),t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var a=o.x-e.originX*e.width,h=o.y-e.originY*e.height,u=e.x-s.scrollX*e.scrollFactorX,l=e.y-s.scrollY*e.scrollFactorY;t.config.roundPixels&&(a|=0,h|=0,u|=0,l|=0),r.save(),r.translate(a,h),r.translate(u,l),r.fillStyle=e.canvasPattern,r.translate(-this.tilePositionX,-this.tilePositionY),r.fillRect(this.tilePositionX,this.tilePositionY,e.width,e.height),r.restore()}}},function(t,e,i){var n=i(132);i(9).register("blitter",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(133);i(9).register("dynamicBitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(134);i(9).register("graphics",function(t){return this.displayList.add(new n(this.scene,t))})},function(t,e,i){var n=i(69);i(9).register("group",function(t,e){return"object"==typeof t&&void 0===e&&(e=t,t=[]),this.updateList.add(new n(this.scene,t,e))})},function(t,e,i){var n=i(70);i(9).register("image",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(9),s=i(137);n.register("particles",function(t,e,i){var n=new s(this.scene,t,e,i);return this.displayList.add(n),this.updateList.add(n),n})},function(t,e,i){var n=i(9),s=i(290);n.register("follower",function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),this.updateList.add(o),o})},function(t,e,i){var n=i(9),s=i(139);n.register("renderTexture",function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))})},function(t,e,i){var n=i(81);i(9).register("sprite3D",function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o.gameObject),this.updateList.add(o.gameObject),o})},function(t,e,i){var n=i(9),s=i(37);n.register("sprite",function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.displayList.add(r),this.updateList.add(r),r})},function(t,e,i){var n=i(131);i(9).register("bitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(140);i(9).register("text",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(141);i(9).register("tileSprite",function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))})},function(t,e,i){var n=i(77);i(9).register("zone",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(132),s=i(20),r=i(13),o=i(10);r.register("blitter",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new n(this.scene,0,0,e,i);return s(this.scene,r,t),r})},function(t,e,i){var n=i(133),s=i(20),r=i(13),o=i(10);r.register("dynamicBitmapText",function(t){var e=o(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),a=o(t,"align","left"),h=new n(this.scene,0,0,e,i,r,a);return s(this.scene,h,t),h})},function(t,e,i){var n=i(13),s=i(134);n.register("graphics",function(t){return new s(this.scene,t)})},function(t,e,i){var n=i(13),s=i(69);n.register("group",function(t){return new s(this.scene,null,t)})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(70);s.register("image",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=new o(this.scene,0,0,e,i);return n(this.scene,s,t),s})},function(t,e,i){var n=i(13),s=i(10),r=i(2),o=i(137);n.register("particles",function(t){var e=s(t,"key",null),i=s(t,"frame",null),n=r(t,"emitters",null),a=new o(this.scene,e,i,n);return r(t,"add",!1)&&this.displayList.add(a),this.updateList.add(a),a})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(139);s.register("renderTexture",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",32),a=r(t,"height",32),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(20),s=i(292),r=i(13),o=i(10),a=i(81);r.register("sprite3D",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(20),s=i(292),r=i(13),o=i(10),a=i(37);r.register("sprite",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(131),s=i(20),r=i(13),o=i(10),a=i(4);r.register("bitmapText",function(t){var e=a(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),h=new n(this.scene,0,0,e,i,r);return s(this.scene,h,t),h})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(140);s.register("text",function(t){var e=r(t,"text",""),i=r(t,"style",null),s=r(t,"padding",null);null!==s&&(i.padding=s);var a=new o(this.scene,0,0,e,i);return n(this.scene,a,t),a.autoRound=r(t,"autoRound",!0),a.resolution=r(t,"resolution",1),a})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(141);s.register("tileSprite",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",512),a=r(t,"height",512),h=r(t,"key",""),u=r(t,"frame",""),l=new o(this.scene,e,i,s,a,h,u);return n(this.scene,l,t),l})},function(t,e,i){var n=i(13),s=i(10),r=i(77);n.register("zone",function(t){var e=s(t,"x",0),i=s(t,"y",0),n=s(t,"width",1),o=s(t,"height",n);return new r(this.scene,e,i,n,o)})},function(t,e,i){var n=i(3),s=i(3);n=i(659),s=i(660),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchMesh(e,s)}},function(t,e){t.exports=function(){}},function(t,e,i){var n=i(88);i(9).register("mesh",function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))})},function(t,e,i){var n=i(142);i(9).register("quad",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(4),a=i(88);s.register("mesh",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=o(t,"vertices",[]),h=o(t,"colors",[]),u=o(t,"alphas",[]),l=o(t,"uv",[]),c=new a(this.scene,0,0,s,l,h,u,e,i);return n(this.scene,c,t),c})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(142);s.register("quad",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"key",null),a=r(t,"frame",null),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(0),s=i(294),r=i(12),o=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",o,"lights"),t.exports=o},function(t,e,i){var n=i(64);n.Area=i(667),n.Circumference=i(184),n.CircumferencePoint=i(105),n.Clone=i(668),n.Contains=i(32),n.ContainsPoint=i(669),n.ContainsRect=i(670),n.CopyFrom=i(671),n.Equals=i(672),n.GetBounds=i(673),n.GetPoint=i(182),n.GetPoints=i(183),n.Offset=i(674),n.OffsetPoint=i(675),n.Random=i(106),t.exports=n},function(t,e){t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},function(t,e,i){var n=i(64);t.exports=function(t){return new n(t.x,t.y,t.radius)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(42);t.exports=function(t,e){return n(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},function(t,e){t.exports=function(t,e){var i=e.width/2,n=e.height/2,s=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-n),o=i+t.radius,a=n+t.radius;if(s>o||r>a)return!1;if(s<=i||r<=n)return!0;var h=s-i,u=r-n;return h*h+u*u<=t.radius*t.radius}},function(t,e,i){var n=i(8),s=i(297);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},function(t,e){t.exports=function(t,e){var i=t.x1,n=t.y1,s=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,u=e.bottom,l=0;if(i>=o&&i<=h&&n>=a&&n<=u||s>=o&&s<=h&&r>=a&&r<=u)return!0;if(i=o){if((l=n+(r-n)*(o-i)/(s-i))>a&&l<=u)return!0}else if(i>h&&s<=h&&(l=n+(r-n)*(h-i)/(s-i))>=a&&l<=u)return!0;if(n=a){if((l=i+(s-i)*(a-n)/(r-n))>=o&&l<=h)return!0}else if(n>u&&r<=u&&(l=i+(s-i)*(u-n)/(r-n))>=o&&l<=h)return!0;return!1}},function(t,e,i){var n=i(299);t.exports=function(t,e){if(!n(t,e))return!1;var i=Math.min(e.x1,e.x2),s=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=s&&t.y>=r&&t.y<=o}},function(t,e,i){var n=i(89),s=i(33),r=i(143),o=i(300);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||se.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(302);n.Angle=i(55),n.BresenhamPoints=i(192),n.CenterOn=i(687),n.Clone=i(688),n.CopyFrom=i(689),n.Equals=i(690),n.GetMidPoint=i(691),n.GetNormal=i(692),n.GetPoint=i(303),n.GetPoints=i(109),n.Height=i(693),n.Length=i(66),n.NormalAngle=i(304),n.NormalX=i(694),n.NormalY=i(695),n.Offset=i(696),n.PerpSlope=i(697),n.Random=i(111),n.ReflectAngle=i(698),n.Rotate=i(699),n.RotateAroundPoint=i(700),n.RotateAroundXY=i(144),n.SetToAngle=i(701),n.Slope=i(702),n.Width=i(703),t.exports=n},function(t,e){t.exports=function(t,e,i){var n=e-(t.x1+t.x2)/2,s=i-(t.y1+t.y2)/2;return t.x1+=n,t.y1+=s,t.x2+=n,t.y2+=s,t}},function(t,e,i){var n=i(302);t.exports=function(t){return new n(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},function(t,e,i){var n=i(16),s=i(55),r=i(5);t.exports=function(t,e){void 0===e&&(e=new r);var i=s(t)-n.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},function(t,e){t.exports=function(t){return Math.abs(t.y1-t.y2)}},function(t,e,i){var n=i(16),s=i(55);t.exports=function(t){return Math.cos(s(t)-n.TAU)}},function(t,e,i){var n=i(16),s=i(55);t.exports=function(t){return Math.sin(s(t)-n.TAU)}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},function(t,e){t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},function(t,e,i){var n=i(55),s=i(304);t.exports=function(t,e){return 2*s(e)-Math.PI-n(t)}},function(t,e,i){var n=i(144);t.exports=function(t,e){var i=(t.x1+t.x2)/2,s=(t.y1+t.y2)/2;return n(t,i,s,e)}},function(t,e,i){var n=i(144);t.exports=function(t,e,i){return n(t,e.x,e.y,i)}},function(t,e){t.exports=function(t,e,i,n,s){return t.x1=e,t.y1=i,t.x2=e+Math.cos(n)*s,t.y2=i+Math.sin(n)*s,t}},function(t,e){t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},function(t,e){t.exports=function(t){return Math.abs(t.x1-t.x2)}},function(t,e,i){var n=i(5);n.Ceil=i(705),n.Clone=i(706),n.CopyFrom=i(707),n.Equals=i(708),n.Floor=i(709),n.GetCentroid=i(710),n.GetMagnitude=i(305),n.GetMagnitudeSq=i(306),n.GetRectangleFromPoints=i(711),n.Interpolate=i(712),n.Invert=i(713),n.Negative=i(714),n.Project=i(715),n.ProjectUnit=i(716),n.SetMagnitude=i(717),t.exports=n},function(t,e){t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t){return new n(t.x,t.y)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},function(t,e){t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t,e){if(void 0===e&&(e=new n),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var s=0;si&&(i=h.x),h.xr&&(r=h.y),h.yt.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottomn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var n=i(309);t.exports=function(t,e,i){var s=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),n(t,s,r)}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var n=i(5),s=i(35);t.exports=function(t,e,i){void 0===i&&(i=new n),e=s(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._list=s.concat(e.splice(0))}},clear:function(t){var e=t.input;e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,t.input=null;var i=this._draggable.indexOf(t);return i>-1&&this._draggable.splice(i,1),(i=this._drag[0].indexOf(t))>-1&&this._drag[0].splice(i,1),(i=this._over[0].indexOf(t))>-1&&this._over[0].splice(i,1),t},disable:function(t){t.input.enabled=!1},enable:function(t,e,i,n){return void 0===n&&(n=!1),t.input?t.input.enabled=!0:this.setHitArea(t,e,i),t.input.dropZone=n,this},hitTestPointer:function(t){var e=this.cameras.getCameraBelowPointer(t);if(e){t.camera=e;for(var i=this.manager.hitTest(t.x,t.y,this._list,e),n=0;n0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var h=[];for(i=0;i1&&(this.sortGameObjects(h),this.topOnly&&h.splice(1)),this._drag[t.id]=h,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&o(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&(t.dragState=3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&(t.dragState=3)),3===t.dragState){for(s=this._drag[t.id],i=0;i0?(n.emit("dragleave",t,r.target),this.emit("dragleave",t,n,r.target),r.target=u[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target)):(n.emit("dragleave",t,r.target),this.emit("dragleave",t,n,r.target),u[0]?(r.target=u[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target)):r.target=null)}else!r.target&&u[0]&&(r.target=u[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target));var c=t.x-n.input.dragX,d=t.y-n.input.dragY;n.emit("drag",t,c,d),this.emit("drag",t,n,c,d)}}if(5===t.dragState){for(s=this._drag[t.id],i=0;i0},processMoveEvents:function(t){var e=this._temp;this.emit("pointermove",t,e);for(var i=0,n=0;n0)for(this.sortGameObjects(s),this.emit("pointerout",t,s),e=0;e0)for(this.sortGameObjects(r),this.emit("pointerover",t,r),e=0;e-1&&this._draggable.splice(s,1)}return this},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);for(var n=0;nn?-1:0},sortHandlerIO:function(t,e){var i=this.displayList.getIndex(t.gameObject),n=this.displayList.getIndex(e.gameObject);return in?-1:0},sortInteractiveObjects:function(t){return t.length<2?t:(this.scene.sys.depthSort(),t.sort(this.sortHandlerIO.bind(this)))},stopPropagation:function(){return this.manager.globalTopOnly&&(this.manager.ignoreEvents=!0),this},update:function(t,e){var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.activePointer,s=n.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(s=!0,this._pollTimer=this.pollRate)),s){this._tempZones=[],this._temp=this.hitTestPointer(n),this.sortGameObjects(this._temp),this.sortGameObjects(this._tempZones),this.topOnly&&(this._temp.length&&this._temp.splice(1),this._tempZones.length&&this._tempZones.splice(1));var r=this.processDragEvents(n,t);n.wasTouch||(r+=this.processOverOutEvents(n)),n.justDown&&(r+=this.processDownEvents(n)),n.justUp&&(r+=this.processUpEvents(n)),n.justMoved&&(r+=this.processMoveEvents(n)),r>0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}},shutdown:function(){this._temp.length=0,this._list.length=0,this._draggable.length=0,this._pendingRemoval.length=0,this._pendingInsertion.length=0;for(var t=0;t<10;t++)this._drag[t]=[],this._over[t]=[];this.removeAllListeners()},destroy:function(){this.shutdown(),this.scene=void 0,this.cameras=void 0,this.manager=void 0,this.events=void 0,this.keyboard=void 0,this.mouse=void 0,this.gamepad=void 0},activePointer:{get:function(){return this.manager.activePointer}},x:{get:function(){return this.manager.activePointer.x}},y:{get:function(){return this.manager.activePointer.y}}});c.register("InputPlugin",v,"input"),t.exports=v},function(t,e,i){t.exports={KeyboardManager:i(245),Key:i(246),KeyCodes:i(128),KeyCombo:i(247),JustDown:i(770),JustUp:i(771),DownDuration:i(772),UpDuration:i(773)}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justDown,t._justDown=!1),e}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justUp,t._justUp=!1),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=50),t.isDown&&t.duration'),n.push(''),n.push(''),n.push(this.xhrLoader.responseText),n.push(""),n.push(""),n.push("");var o=[n.join("\n")],a=this;try{var h=new window.Blob(o,{type:"image/svg+xml;charset=utf-8"})}catch(e){return a.state=s.FILE_ERRORED,void t(a)}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(a.data),a.onComplete(),t(a)},this.data.onerror=function(){r.revokeObjectURL(a.data),a.state=s.FILE_ERRORED,t(a)},r.createObjectURL(this.data,h,"image/svg+xml")}});o.register("html",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0?this.processLoadQueue():0===this.inflight.size&&this.finishedLoading()},finishedLoading:function(){this.state!==s.LOADER_PROCESSING&&(this.progress=1,this.state=s.LOADER_PROCESSING,this.storage.clear(),0===this.queue.size?this.processComplete():this.queue.each(function(t){t.onProcess(this.processUpdate.bind(this))},this))},processUpdate:function(t){if(t.state===s.FILE_ERRORED)return this.failed.set(t),t.linkFile&&this.queue.delete(t.linkFile),this.removeFromQueue(t);t.linkFile?t.state===s.FILE_COMPLETE&&t.linkFile.state===s.FILE_COMPLETE&&(this.storage.set({type:t.linkType,fileA:t,fileB:t.linkFile}),this.queue.delete(t.linkFile),this.removeFromQueue(t)):(this.storage.set(t),this.removeFromQueue(t))},removeFromQueue:function(t){this.queue.delete(t),0===this.queue.size&&this.state===s.LOADER_PROCESSING&&this.processComplete()},processComplete:function(){this.list.clear(),this.inflight.clear(),this.queue.clear(),this.processCallback(),this.state=s.LOADER_COMPLETE,this.emit("complete",this,this.storage.size,this.failed.size)},processCallback:function(){if(0!==this.storage.size){var t,e,i,n=this.scene.sys.cache,s=this.scene.sys.textures,r=this.scene.sys.anims;for(var o in this._multilist){for(var a=[],h=[],l=this._multilist[o],c=0;c0},file:function(t){var e,i=t.key;switch(t.type){case"spritesheet":e=this.spritesheet(i,t.url,t.config,t.xhrSettings);break;case"atlas":e=this.atlas(i,t.textureURL,t.atlasURL,t.textureXhrSettings,t.atlasXhrSettings);break;case"bitmapFont":e=this.bitmapFont(i,t.textureURL,t.xmlURL,t.textureXhrSettings,t.xmlXhrSettings);break;case"multiatlas":e=this.multiatlas(i,t.textureURLs,t.atlasURLs,t.textureXhrSettings,t.atlasXhrSettings);break;case"audioSprite":e=this.audioSprite(i,t.urls,t.json,t.config,t.audioXhrSettings,t.jsonXhrSettings);break;default:e=this[t.type](i,t.url,t.xhrSettings)}return e},shutdown:function(){this.reset(),this.state=s.LOADER_SHUTDOWN},destroy:function(){this.reset(),this.state=s.LOADER_DESTROYED}});l.register("Loader",d,"load"),t.exports=d},function(t,e,i){var n=i(16),s=i(23),r={Angle:i(795),Distance:i(803),Easing:i(806),Fuzzy:i(807),Interpolation:i(813),Pow2:i(816),Snap:i(818),Average:i(822),Bernstein:i(323),Between:i(231),CatmullRom:i(123),CeilTo:i(823),Clamp:i(61),DegToRad:i(35),Difference:i(824),Factorial:i(324),FloatBetween:i(276),FloorTo:i(825),FromPercent:i(65),GetSpeed:i(826),IsEven:i(827),IsEvenStrict:i(828),Linear:i(230),MaxAdd:i(829),MinSub:i(830),Percent:i(831),RadToDeg:i(219),RandomXY:i(832),RandomXYZ:i(207),RandomXYZW:i(208),Rotate:i(325),RotateAround:i(186),RotateAroundDistance:i(113),RoundAwayFromZero:i(326),RoundTo:i(833),SinCosTableGenerator:i(834),SmootherStep:i(193),SmoothStep:i(194),TransformXY:i(251),Within:i(835),Wrap:i(50),Vector2:i(6),Vector3:i(51),Vector4:i(120),Matrix3:i(211),Matrix4:i(119),Quaternion:i(210),RotateVec3:i(209)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Between:i(796),BetweenY:i(797),BetweenPoints:i(798),BetweenPointsY:i(799),Reverse:i(800),RotateTo:i(801),ShortestBetween:i(802),Normalize:i(322),Wrap:i(161),WrapDegrees:i(162)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(i-t,n-e)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},function(t,e,i){var n=i(322);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(16);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e?t:(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:ee-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t1?t[i]-(n(s-i,t[i],t[i],t[i-1],t[i-1])-t[i]):n(s-r,t[r?r-1:0],t[r],t[i0&&0==(t&t-1)}},function(t,e,i){t.exports={Ceil:i(819),Floor:i(820),To:i(821)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.ceil(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.floor(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.round(t/e)))}},function(t,e){t.exports=function(t){for(var e=0,i=0;i1?void 0!==n?(s=(n-t)/(n-i))<0&&(s=0):s=1:s<0&&(s=0),s}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var n=Math.pow(i,-e);return Math.round(t*n)/n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),n*=Math.PI/t;for(var s=[],r=[],o=0;o=0;o--){var a=e[o],h=u(s,r,a.x,a.y);h=0;o--){var a=e[o],h=u(s,r,a.x,a.y);h>i&&(n=a,i=h)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=u(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},moveToObject:function(t,e,i,n){return this.moveTo(t,e.x,e.y,i,n)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(l(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(t,e)},shutdown:function(){this.world.shutdown()},destroy:function(){this.world.destroy()}});a.register("ArcadePhysics",c,"arcadePhysics"),t.exports=c},function(t,e){t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},function(t,e){t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},function(t,e){t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t){return this.body.collideWorldBounds=t,this}}},function(t,e){t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},function(t,e){t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this}}},function(t,e){var i={enableBody:function(t,e,i,n,s){return t&&this.body.reset(e,i),n&&(this.body.gameObject.active=!0),s&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}};t.exports=i},function(t,e){t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},function(t,e){t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},function(t,e){var i={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}};t.exports=i},function(t,e){t.exports={setMass:function(t){return this.body.mass=t,this}}},function(t,e){t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},function(t,e){var i={setVelocity:function(t,e){return this.body.velocity.set(t,e),this},setVelocityX:function(t){return this.body.velocity.x=t,this},setVelocityY:function(t){return this.body.velocity.y=t,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.body.maxVelocity.set(t,e),this}};t.exports=i},function(t,e){t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},function(t,e,i){var n=i(852),s=i(854),r=i(340);t.exports=function(t,e,i,o,a,h){var u=o.left,l=o.top,c=o.right,d=o.bottom,f=i.faceLeft||i.faceRight,p=i.faceTop||i.faceBottom;if(!f&&!p)return!1;var g=0,v=0,y=0,m=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right>i&&(o=t.right-i)>r&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.left=!0:e>0&&(t.blocked.right=!0),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},function(t,e,i){var n=i(855);t.exports=function(t,e,i,s,r){var o=0;return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom>i&&(o=t.bottom-i)>r&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.up=!0:e>0&&(t.blocked.down=!0),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},function(t,e,i){var n=i(335);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.x,a=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=r,e.velocity.x=o-a*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=r,t.velocity.x=a-o*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{r*=.5,t.x-=r,e.x+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),u=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),l=.5*(h+u);h-=l,u-=l,t.velocity.x=l+h*t.bounce.x,e.velocity.x=l+u*e.bounce.x}return!0}},function(t,e,i){var n=i(336);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.y,a=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=r,e.velocity.y=o-a*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=r,t.velocity.y=a-o*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{r*=.5,t.y-=r,e.y+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),u=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),l=.5*(h+u);h-=l,u-=l,t.velocity.y=l+h*t.bounce.y,e.velocity.y=l+u*e.bounce.y}return!0}},,,,,,,,,,function(t,e,i){t.exports={SceneManager:i(252),ScenePlugin:i(868),Settings:i(255),Systems:i(129)}},function(t,e,i){var n=i(0),s=i(83),r=i(12),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},start:function(t,e){return void 0===t&&(t=this.key),t!==this.key&&(this.settings.status!==s.RUNNING?(this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t)):(this.manager.stop(this.key),this.manager.start(t,e))),this},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("start",t,e):this.manager.start(t,e)),this},pause:function(t){return void 0===t&&(t=this.key),this.manager.pause(t),this},resume:function(t){return void 0===t&&(t=this.key),this.manager.resume(t),this},sleep:function(t){return void 0===t&&(t=this.key),this.manager.sleep(t),this},wake:function(t){return void 0===t&&(t=this.key),this.manager.wake(t),this},switch:function(t){return t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("switch",this.key,t):this.manager.switch(this.key,t)),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.stop(t),this},setActive:function(t){return this.settings.active=t,this},setVisible:function(t){return this.settings.visible=t,this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},shutdown:function(){},destroy:function(){}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={SoundManagerCreator:i(256),BaseSound:i(85),BaseSoundManager:i(84),WebAudioSound:i(262),WebAudioSoundManager:i(261),HTML5AudioSound:i(258),HTML5AudioSoundManager:i(257),NoAudioSound:i(260),NoAudioSoundManager:i(259)}},function(t,e,i){t.exports={List:i(86),Map:i(114),ProcessQueue:i(337),RTree:i(338),Set:i(62)}},function(t,e,i){t.exports={Parsers:i(264),FilterMode:i(872),Frame:i(130),Texture:i(265),TextureManager:i(263),TextureSource:i(266)}},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(96),Parsers:i(903),Formats:i(21),ImageCollection:i(352),ParseToTilemap:i(155),Tile:i(44),Tilemap:i(356),TilemapCreator:i(920),TilemapFactory:i(921),Tileset:i(100),LayerData:i(75),MapData:i(76),ObjectLayer:i(354),DynamicTilemapLayer:i(357),StaticTilemapLayer:i(358)}},function(t,e,i){var n=i(15),s=i(34);t.exports=function(t,e,i,r,o,a,h,u){t<0&&(t=0),e<0&&(e=0),void 0===h&&(h=!0);for(var l=n(t,e,i,r,null,u),c=o-t,d=a-e,f=0;f=0&&p=0&&g-c&&y>-d&&v=0;r--)for(s=n.width-1;s>=0;s--)if((o=n.data[r][s])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;re)){for(var h=t;h<=e;h++)r(h,i,a);for(var u=0;u=t&&c.index<=e&&n(c,i)}o&&s(0,0,a.width,a.height,a)}}},function(t,e,i){var n=i(43),s=i(34),r=i(153);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e){t.exports=function(t,e,i,n){if("number"==typeof t)n.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var s=0,r=t.length;s0){var y=new a(l,v.gid,c,f.length,t.tilewidth,t.tileheight);y.rotation=v.rotation,y.flipX=v.flipped,d.push(y)}else{var m=e?null:new a(l,-1,c,f.length,t.tilewidth,t.tileheight);d.push(m)}++c===u.width&&(f.push(d),c=0,d=[])}l.data=f,i.push(l)}}return i}},function(t,e){t.exports=function(t){for(var e=window.atob(t),i=e.length,n=new Array(i),s=0;s>>0;return n}},function(t,e,i){var n=i(2);t.exports=function(t){for(var e=[],i=0;i-1?new s(a,f,c,l,o.tilesize,o.tilesize):e?null:new s(a,-1,c,l,o.tilesize,o.tilesize),h.push(d)}u.push(h),h=[]}a.data=u,i.push(a)}return i}},function(t,e,i){var n=i(100);t.exports=function(t){for(var e=[],i=[],s=0;s0&&e.cameraFilter&s._id||(e.cull(s),this.pipeline.batchDynamicTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=r.length,a=e.tileset.image.getSourceImage(),h=this.tileset,u=e.x-s.scrollX*e.scrollFactorX,l=e.y-s.scrollY*e.scrollFactorY,c=t.gameContext;c.save(),c.translate(u,l),c.rotate(e.rotation),c.scale(e.scaleX,e.scaleY),c.scale(e.flipX?-1:1,e.flipY?-1:1);for(var d=0;d0&&e.cameraFilter&s._id||(e.upload(s),this.pipeline.drawStaticTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=this.tileset,a=t.gameContext,h=r.length,u=o.image.getSourceImage(),l=e.x-s.scrollX*e.scrollFactorX,c=e.y-s.scrollY*e.scrollFactorY;a.save(),a.translate(l,c),a.rotate(e.rotation),a.scale(e.scaleX,e.scaleY),a.scale(e.flipX?-1:1,e.flipY?-1:1),a.globalAlpha=e.alpha;for(var d=0;d-1&&this._active.splice(s,1),n.destroy()}for(i=0;i=n.delay)){var s=n.elapsed-n.delay;n.elapsed=n.delay,!n.hasDispatched&&n.callback&&(n.hasDispatched=!0,n.callback.apply(n.callbackScope,n.args)),n.repeatCount>0?(n.repeatCount--,n.elapsed=s,n.hasDispatched=!1):this._pendingRemoval.push(n)}}}},shutdown:function(){var t;for(t=0;t= this.bottom) { this.height = 0; - this.y = value; } else { this.height = (this.bottom - value); } + + this.y = value; } }, @@ -2228,25 +2238,25 @@ module.exports = GetAdvancedValue; module.exports = { - Alpha: __webpack_require__(381), - Animation: __webpack_require__(364), - BlendMode: __webpack_require__(382), - ComputedSize: __webpack_require__(383), - Depth: __webpack_require__(384), - Flip: __webpack_require__(385), - GetBounds: __webpack_require__(386), - MatrixStack: __webpack_require__(387), - Origin: __webpack_require__(388), - Pipeline: __webpack_require__(186), - ScaleMode: __webpack_require__(389), - ScrollFactor: __webpack_require__(390), - Size: __webpack_require__(391), - Texture: __webpack_require__(392), - Tint: __webpack_require__(393), - ToJSON: __webpack_require__(394), - Transform: __webpack_require__(395), - TransformMatrix: __webpack_require__(187), - Visible: __webpack_require__(396) + Alpha: __webpack_require__(392), + Animation: __webpack_require__(366), + BlendMode: __webpack_require__(393), + ComputedSize: __webpack_require__(394), + Depth: __webpack_require__(395), + Flip: __webpack_require__(396), + GetBounds: __webpack_require__(397), + MatrixStack: __webpack_require__(398), + Origin: __webpack_require__(399), + Pipeline: __webpack_require__(187), + ScaleMode: __webpack_require__(400), + ScrollFactor: __webpack_require__(401), + Size: __webpack_require__(402), + Texture: __webpack_require__(403), + Tint: __webpack_require__(404), + ToJSON: __webpack_require__(405), + Transform: __webpack_require__(406), + TransformMatrix: __webpack_require__(188), + Visible: __webpack_require__(407) }; @@ -3014,7 +3024,7 @@ module.exports = GetTilesWithin; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RND = __webpack_require__(380); +var RND = __webpack_require__(391); var MATH_CONST = { @@ -3269,9 +3279,9 @@ module.exports = FILE_CONST; var Class = __webpack_require__(0); var CONST = __webpack_require__(17); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(149); -var MergeXHRSettings = __webpack_require__(150); -var XHRLoader = __webpack_require__(314); +var GetURL = __webpack_require__(148); +var MergeXHRSettings = __webpack_require__(149); +var XHRLoader = __webpack_require__(316); var XHRSettings = __webpack_require__(90); /** @@ -3327,7 +3337,7 @@ var File = new Class({ { this.url = GetFastValue(fileConfig, 'path', '') + this.key + '.' + GetFastValue(fileConfig, 'extension', ''); } - else + else if (typeof(this.url) !== 'function') { this.url = GetFastValue(fileConfig, 'path', '').concat(this.url); } @@ -3380,7 +3390,7 @@ var File = new Class({ * @type {integer} * @since 3.0.0 */ - this.state = CONST.FILE_PENDING; + this.state = typeof(this.url) === 'function' ? CONST.FILE_POPULATED : CONST.FILE_PENDING; /** * The total size of this file. @@ -3706,194 +3716,6 @@ module.exports = File; /* 19 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var BlendModes = __webpack_require__(45); -var GetAdvancedValue = __webpack_require__(10); -var ScaleModes = __webpack_require__(62); - -/** - * Builds a Game Object using the provided configuration object. - * - * @function Phaser.Gameobjects.BuildGameObject - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.GameObject} gameObject - [description] - * @param {object} config - [description] - * - * @return {Phaser.GameObjects.GameObject} The built Game Object. - */ -var BuildGameObject = function (scene, gameObject, config) -{ - // Position - - gameObject.x = GetAdvancedValue(config, 'x', 0); - gameObject.y = GetAdvancedValue(config, 'y', 0); - gameObject.depth = GetAdvancedValue(config, 'depth', 0); - - // Flip - - gameObject.flipX = GetAdvancedValue(config, 'flipX', false); - gameObject.flipY = GetAdvancedValue(config, 'flipY', false); - - // Scale - // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} - - var scale = GetAdvancedValue(config, 'scale', null); - - if (typeof scale === 'number') - { - gameObject.setScale(scale); - } - else if (scale !== null) - { - gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); - gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); - } - - // ScrollFactor - // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} - - var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); - - if (typeof scrollFactor === 'number') - { - gameObject.setScrollFactor(scrollFactor); - } - else if (scrollFactor !== null) - { - gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); - gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); - } - - // Rotation - - gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - - var angle = GetAdvancedValue(config, 'angle', null); - - if (angle !== null) - { - gameObject.angle = angle; - } - - // Alpha - - gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); - - // Origin - // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - - var origin = GetAdvancedValue(config, 'origin', null); - - if (typeof origin === 'number') - { - gameObject.setOrigin(origin); - } - else if (origin !== null) - { - var ox = GetAdvancedValue(origin, 'x', 0.5); - var oy = GetAdvancedValue(origin, 'y', 0.5); - - gameObject.setOrigin(ox, oy); - } - - // ScaleMode - - gameObject.scaleMode = GetAdvancedValue(config, 'scaleMode', ScaleModes.DEFAULT); - - // BlendMode - - gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - - // Visible - - gameObject.visible = GetAdvancedValue(config, 'visible', true); - - // Add to Scene - - var add = GetAdvancedValue(config, 'add', true); - - if (add) - { - scene.sys.displayList.add(gameObject); - } - - if (gameObject.preUpdate) - { - scene.sys.updateList.add(gameObject); - } - - return gameObject; -}; - -module.exports = BuildGameObject; - - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * @namespace Phaser.Tilemaps.Formats - */ - -module.exports = { - - /** - * CSV Map Type - * - * @name Phaser.Tilemaps.Formats.CSV - * @type {number} - * @since 3.0.0 - */ - CSV: 0, - - /** - * Tiled JSON Map Type - * - * @name Phaser.Tilemaps.Formats.TILED_JSON - * @type {number} - * @since 3.0.0 - */ - TILED_JSON: 1, - - /** - * 2D Array Map Type - * - * @name Phaser.Tilemaps.Formats.ARRAY_2D - * @type {number} - * @since 3.0.0 - */ - ARRAY_2D: 2, - - /** - * Weltmeister (Impact.js) Map Type - * - * @name Phaser.Tilemaps.Formats.WELTMEISTER - * @type {number} - * @since 3.0.0 - */ - WELTMEISTER: 3 - -}; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -3901,7 +3723,7 @@ module.exports = { */ var CONST = __webpack_require__(22); -var Smoothing = __webpack_require__(120); +var Smoothing = __webpack_require__(121); // The pool into which the canvas elements are placed. var pool = []; @@ -4135,6 +3957,194 @@ var CanvasPool = function () module.exports = CanvasPool(); +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BlendModes = __webpack_require__(45); +var GetAdvancedValue = __webpack_require__(10); +var ScaleModes = __webpack_require__(63); + +/** + * Builds a Game Object using the provided configuration object. + * + * @function Phaser.Gameobjects.BuildGameObject + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.GameObject} The built Game Object. + */ +var BuildGameObject = function (scene, gameObject, config) +{ + // Position + + gameObject.x = GetAdvancedValue(config, 'x', 0); + gameObject.y = GetAdvancedValue(config, 'y', 0); + gameObject.depth = GetAdvancedValue(config, 'depth', 0); + + // Flip + + gameObject.flipX = GetAdvancedValue(config, 'flipX', false); + gameObject.flipY = GetAdvancedValue(config, 'flipY', false); + + // Scale + // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} + + var scale = GetAdvancedValue(config, 'scale', null); + + if (typeof scale === 'number') + { + gameObject.setScale(scale); + } + else if (scale !== null) + { + gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); + gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); + } + + // ScrollFactor + // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} + + var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); + + if (typeof scrollFactor === 'number') + { + gameObject.setScrollFactor(scrollFactor); + } + else if (scrollFactor !== null) + { + gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); + gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); + } + + // Rotation + + gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); + + var angle = GetAdvancedValue(config, 'angle', null); + + if (angle !== null) + { + gameObject.angle = angle; + } + + // Alpha + + gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); + + // Origin + // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} + + var origin = GetAdvancedValue(config, 'origin', null); + + if (typeof origin === 'number') + { + gameObject.setOrigin(origin); + } + else if (origin !== null) + { + var ox = GetAdvancedValue(origin, 'x', 0.5); + var oy = GetAdvancedValue(origin, 'y', 0.5); + + gameObject.setOrigin(ox, oy); + } + + // ScaleMode + + gameObject.scaleMode = GetAdvancedValue(config, 'scaleMode', ScaleModes.DEFAULT); + + // BlendMode + + gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); + + // Visible + + gameObject.visible = GetAdvancedValue(config, 'visible', true); + + // Add to Scene + + var add = GetAdvancedValue(config, 'add', true); + + if (add) + { + scene.sys.displayList.add(gameObject); + } + + if (gameObject.preUpdate) + { + scene.sys.updateList.add(gameObject); + } + + return gameObject; +}; + +module.exports = BuildGameObject; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Tilemaps.Formats + */ + +module.exports = { + + /** + * CSV Map Type + * + * @name Phaser.Tilemaps.Formats.CSV + * @type {number} + * @since 3.0.0 + */ + CSV: 0, + + /** + * Tiled JSON Map Type + * + * @name Phaser.Tilemaps.Formats.TILED_JSON + * @type {number} + * @since 3.0.0 + */ + TILED_JSON: 1, + + /** + * 2D Array Map Type + * + * @name Phaser.Tilemaps.Formats.ARRAY_2D + * @type {number} + * @since 3.0.0 + */ + ARRAY_2D: 2, + + /** + * Weltmeister (Impact.js) Map Type + * + * @name Phaser.Tilemaps.Formats.WELTMEISTER + * @type {number} + * @since 3.0.0 + */ + WELTMEISTER: 3 + +}; + + /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { @@ -4154,11 +4164,11 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.1.2', + VERSION: '3.2.0', BlendModes: __webpack_require__(45), - ScaleModes: __webpack_require__(62), + ScaleModes: __webpack_require__(63), /** * AUTO Detect Renderer. @@ -4266,7 +4276,7 @@ module.exports = CONST; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var IsPlainObject = __webpack_require__(167); +var IsPlainObject = __webpack_require__(168); // @param {boolean} deep - Perform a deep copy? // @param {object} target - The target object to copy to. @@ -4773,8 +4783,8 @@ module.exports = DegToRad; */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(116); -var GetColor32 = __webpack_require__(201); +var GetColor = __webpack_require__(117); +var GetColor32 = __webpack_require__(202); /** * @classdesc @@ -5289,7 +5299,7 @@ module.exports = Color; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var SpriteRender = __webpack_require__(447); +var SpriteRender = __webpack_require__(458); /** * @classdesc @@ -5399,7 +5409,7 @@ var Sprite = new Class({ * @param {boolean} ignoreIfPlaying - [description] * @param {integer|string} startFrame - [description] * - * @return {[type]} [description] + * @return {Phaser.GameObjects.Sprite} This Game Object. */ play: function (key, ignoreIfPlaying, startFrame) { @@ -6077,40 +6087,6 @@ module.exports = WorldToTileY; /* 41 */ /***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Math.Distance.Between - * @since 3.0.0 - * - * @param {number} x1 - [description] - * @param {number} y1 - [description] - * @param {number} x2 - [description] - * @param {number} y2 - [description] - * - * @return {number} [description] - */ -var DistanceBetween = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; - - return Math.sqrt(dx * dx + dy * dy); -}; - -module.exports = DistanceBetween; - - -/***/ }), -/* 42 */ -/***/ (function(module, exports) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -6238,6 +6214,40 @@ module.exports = { }; +/***/ }), +/* 42 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Math.Distance.Between + * @since 3.0.0 + * + * @param {number} x1 - [description] + * @param {number} y1 - [description] + * @param {number} x2 - [description] + * @param {number} y2 - [description] + * + * @return {number} [description] + */ +var DistanceBetween = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; + + return Math.sqrt(dx * dx + dy * dy); +}; + +module.exports = DistanceBetween; + + /***/ }), /* 43 */ /***/ (function(module, exports) { @@ -6285,7 +6295,7 @@ module.exports = SetTileCollision; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Rectangle = __webpack_require__(306); +var Rectangle = __webpack_require__(308); /** * @classdesc @@ -8216,6 +8226,569 @@ module.exports = Vector3; /***/ }), /* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var FromPoints = __webpack_require__(122); +var Rectangle = __webpack_require__(8); +var Vector2 = __webpack_require__(6); + +/** + * @classdesc + * A Base Curve class, which all other curve types extend. + * + * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + * + * @class Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {string} type - [description] + */ +var Curve = new Class({ + + initialize: + + function Curve (type) + { + /** + * String based identifier for the type of curve. + * + * @name Phaser.Curves.Curve#type + * @type {string} + * @since 3.0.0 + */ + this.type = type; + + /** + * The default number of divisions within the curve. + * + * @name Phaser.Curves.Curve#defaultDivisions + * @type {integer} + * @default 5 + * @since 3.0.0 + */ + this.defaultDivisions = 5; + + /** + * The quantity of arc length divisions within the curve. + * + * @name Phaser.Curves.Curve#arcLengthDivisions + * @type {integer} + * @default 100 + * @since 3.0.0 + */ + this.arcLengthDivisions = 100; + + /** + * An array of cached arc length values. + * + * @name Phaser.Curves.Curve#cacheArcLengths + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.cacheArcLengths = []; + + /** + * Does the data of this curve need updating? + * + * @name Phaser.Curves.Curve#needsUpdate + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.needsUpdate = true; + + /** + * [description] + * + * @name Phaser.Curves.Curve#active + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.active = true; + + /** + * A temporary calculation Vector. + * + * @name Phaser.Curves.Curve#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2A = new Vector2(); + + /** + * A temporary calculation Vector. + * + * @name Phaser.Curves.Curve#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tmpVec2B = new Vector2(); + }, + + /** + * Draws this curve on the given Graphics object. + * + * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. + * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. + * + * @method Phaser.Curves.Curve#draw + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. + * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. + */ + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } + + // So you can chain graphics calls + return graphics.strokePoints(this.getPoints(pointsTotal)); + }, + + /** + * Returns a Rectangle where the position and dimensions match the bounds of this Curve. + * + * You can control the accuracy of the bounds. The value given is used to work out how many points + * to plot across the curve. Higher values are more accurate at the cost of calculation speed. + * + * @method Phaser.Curves.Curve#getBounds + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} out - The Rectangle to store the bounds in. If falsey a new object will be created. + * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. + * + * @return {Phaser.Geom.Rectangle} A Rectangle containing the bounds values of this Curve. + */ + getBounds: function (out, accuracy) + { + if (!out) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } + + var len = this.getLength(); + + if (accuracy > len) + { + accuracy = len / 2; + } + + // The length of the curve in pixels + // So we'll have 1 spaced point per 'accuracy' pixels + + var spaced = Math.max(1, Math.round(len / accuracy)); + + return FromPoints(this.getSpacedPoints(spaced), out); + }, + + /** + * Returns an array of points, spaced out X distance pixels apart. + * The smaller the distance, the larger the array will be. + * + * @method Phaser.Curves.Curve#getDistancePoints + * @since 3.0.0 + * + * @param {integer} distance - The distance, in pixels, between each point along the curve. + * + * @return {Phaser.Geom.Point[]} An Array of Point objects. + */ + getDistancePoints: function (distance) + { + var len = this.getLength(); + + var spaced = Math.max(1, len / distance); + + return this.getSpacedPoints(spaced); + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#getEndPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} out - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(1, out); + }, + + // Get total curve arc length + + /** + * [description] + * + * @method Phaser.Curves.Curve#getLength + * @since 3.0.0 + * + * @return {number} [description] + */ + getLength: function () + { + var lengths = this.getLengths(); + + return lengths[lengths.length - 1]; + }, + + // Get list of cumulative segment lengths + + /** + * [description] + * + * @method Phaser.Curves.Curve#getLengths + * @since 3.0.0 + * + * @param {integer} [divisions] - [description] + * + * @return {number[]} [description] + */ + getLengths: function (divisions) + { + if (divisions === undefined) { divisions = this.arcLengthDivisions; } + + if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) + { + return this.cacheArcLengths; + } + + this.needsUpdate = false; + + var cache = []; + var current; + var last = this.getPoint(0, this._tmpVec2A); + var sum = 0; + + cache.push(0); + + for (var p = 1; p <= divisions; p++) + { + current = this.getPoint(p / divisions, this._tmpVec2B); + + sum += current.distance(last); + + cache.push(sum); + + last.copy(current); + } + + this.cacheArcLengths = cache; + + return cache; // { sums: cache, sum:sum }; Sum is in the last element. + }, + + // Get point at relative position in curve according to arc length + + // - u [0 .. 1] + + /** + * [description] + * + * @method Phaser.Curves.Curve#getPointAt + * @since 3.0.0 + * + * @param {float} u - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getPointAt: function (u, out) + { + var t = this.getUtoTmapping(u); + + return this.getPoint(t, out); + }, + + // Get sequence of points using getPoint( t ) + + /** + * [description] + * + * @method Phaser.Curves.Curve#getPoints + * @since 3.0.0 + * + * @param {integer} [divisions] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] + */ + getPoints: function (divisions) + { + if (divisions === undefined) { divisions = this.defaultDivisions; } + + var points = []; + + for (var d = 0; d <= divisions; d++) + { + points.push(this.getPoint(d / divisions)); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#getRandomPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getRandomPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); + }, + + // Get sequence of points using getPointAt( u ) + + /** + * [description] + * + * @method Phaser.Curves.Curve#getSpacedPoints + * @since 3.0.0 + * + * @param {integer} [divisions] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] + */ + getSpacedPoints: function (divisions) + { + if (divisions === undefined) { divisions = this.defaultDivisions; } + + var points = []; + + for (var d = 0; d <= divisions; d++) + { + var t = this.getUtoTmapping(d / divisions, null, divisions); + + points.push(this.getPoint(t)); + } + + return points; + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#getStartPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(0, out); + }, + + // Returns a unit vector tangent at t + // In case any sub curve does not implement its tangent derivation, + // 2 points a small delta apart will be used to find its gradient + // which seems to give a reasonable approximation + + /** + * [description] + * + * @method Phaser.Curves.Curve#getTangent + * @since 3.0.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getTangent: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + var delta = 0.0001; + var t1 = t - delta; + var t2 = t + delta; + + // Capping in case of danger + + if (t1 < 0) + { + t1 = 0; + } + + if (t2 > 1) + { + t2 = 1; + } + + this.getPoint(t1, this._tmpVec2A); + this.getPoint(t2, out); + + return out.subtract(this._tmpVec2A).normalize(); + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#getTangentAt + * @since 3.0.0 + * + * @param {float} u - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getTangentAt: function (u, out) + { + var t = this.getUtoTmapping(u); + + return this.getTangent(t, out); + }, + + // Given a distance in pixels, get a t to find p. + /** + * [description] + * + * @method Phaser.Curves.Curve#getTFromDistance + * @since 3.0.0 + * + * @param {integer} distance - [description] + * @param {integer} [divisions] - [description] + * + * @return {float} [description] + */ + getTFromDistance: function (distance, divisions) + { + if (distance <= 0) + { + return 0; + } + + return this.getUtoTmapping(0, distance, divisions); + }, + + // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant + + /** + * [description] + * + * @method Phaser.Curves.Curve#getUtoTmapping + * @since 3.0.0 + * + * @param {float} u - [description] + * @param {integer} distance - [description] + * @param {integer} [divisions] - [description] + * + * @return {number} [description] + */ + getUtoTmapping: function (u, distance, divisions) + { + var arcLengths = this.getLengths(divisions); + + var i = 0; + var il = arcLengths.length; + + var targetArcLength; // The targeted u distance value to get + + if (distance) + { + // Cannot overshoot the curve + targetArcLength = Math.min(distance, arcLengths[il - 1]); + } + else + { + targetArcLength = u * arcLengths[il - 1]; + } + + // binary search for the index with largest value smaller than target u distance + + var low = 0; + var high = il - 1; + var comparison; + + while (low <= high) + { + i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats + + comparison = arcLengths[i] - targetArcLength; + + if (comparison < 0) + { + low = i + 1; + } + else if (comparison > 0) + { + high = i - 1; + } + else + { + high = i; + break; + } + } + + i = high; + + if (arcLengths[i] === targetArcLength) + { + return i / (il - 1); + } + + // we could get finer grain at lengths, or use simple interpolation between two points + + var lengthBefore = arcLengths[i]; + var lengthAfter = arcLengths[i + 1]; + + var segmentLength = lengthAfter - lengthBefore; + + // determine where we are between the 'before' and 'after' points + + var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; + + // add that fractional amount to t + + return (i + segmentFraction) / (il - 1); + }, + + /** + * [description] + * + * @method Phaser.Curves.Curve#updateArcLengths + * @since 3.0.0 + */ + updateArcLengths: function () + { + this.needsUpdate = true; + + this.getLengths(); + } + +}); + +module.exports = Curve; + + +/***/ }), +/* 53 */ /***/ (function(module, exports) { /** @@ -8257,7 +8830,7 @@ module.exports = Clone; /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports) { /** @@ -8310,7 +8883,7 @@ module.exports = Contains; /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports) { /** @@ -8338,7 +8911,7 @@ module.exports = Angle; /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8348,10 +8921,10 @@ module.exports = Angle; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(53); -var GetPoint = __webpack_require__(308); -var GetPoints = __webpack_require__(309); -var Random = __webpack_require__(111); +var Contains = __webpack_require__(54); +var GetPoint = __webpack_require__(310); +var GetPoints = __webpack_require__(311); +var Random = __webpack_require__(112); /** * @classdesc @@ -8742,7 +9315,7 @@ module.exports = Triangle; /***/ }), -/* 56 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8858,7 +9431,7 @@ module.exports = JSONFile; /***/ }), -/* 57 */ +/* 58 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9030,7 +9603,7 @@ module.exports = ImageFile; /***/ }), -/* 58 */ +/* 59 */ /***/ (function(module, exports) { /** @@ -9126,7 +9699,7 @@ module.exports = { /***/ }), -/* 59 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9145,10 +9718,10 @@ module.exports = Body; var Vertices = __webpack_require__(93); var Vector = __webpack_require__(94); -var Sleeping = __webpack_require__(342); +var Sleeping = __webpack_require__(344); var Common = __webpack_require__(38); var Bounds = __webpack_require__(95); -var Axes = __webpack_require__(856); +var Axes = __webpack_require__(859); (function() { @@ -10334,7 +10907,7 @@ var Axes = __webpack_require__(856); /***/ }), -/* 60 */ +/* 61 */ /***/ (function(module, exports) { /** @@ -10364,7 +10937,7 @@ module.exports = Clamp; /***/ }), -/* 61 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10759,7 +11332,7 @@ module.exports = Set; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports) { /** @@ -10805,7 +11378,7 @@ module.exports = { /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10816,9 +11389,9 @@ module.exports = { var Class = __webpack_require__(0); var Contains = __webpack_require__(32); -var GetPoint = __webpack_require__(181); -var GetPoints = __webpack_require__(182); -var Random = __webpack_require__(105); +var GetPoint = __webpack_require__(182); +var GetPoints = __webpack_require__(183); +var Random = __webpack_require__(106); /** * @classdesc @@ -11162,7 +11735,7 @@ module.exports = Circle; /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11171,7 +11744,7 @@ module.exports = Circle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(60); +var Clamp = __webpack_require__(61); /** * Return a value based on the range between `min` and `max` and the percentage given. @@ -11196,7 +11769,7 @@ module.exports = FromPercent; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports) { /** @@ -11223,569 +11796,6 @@ var Length = function (line) module.exports = Length; -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var FromPoints = __webpack_require__(121); -var Rectangle = __webpack_require__(8); -var Vector2 = __webpack_require__(6); - -/** - * @classdesc - * A Base Curve class, which all other curve types extend. - * - * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - * - * @class Curve - * @memberOf Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {string} type - [description] - */ -var Curve = new Class({ - - initialize: - - function Curve (type) - { - /** - * String based identifier for the type of curve. - * - * @name Phaser.Curves.Curve#type - * @type {string} - * @since 3.0.0 - */ - this.type = type; - - /** - * The default number of divisions within the curve. - * - * @name Phaser.Curves.Curve#defaultDivisions - * @type {integer} - * @default 5 - * @since 3.0.0 - */ - this.defaultDivisions = 5; - - /** - * The quantity of arc length divisions within the curve. - * - * @name Phaser.Curves.Curve#arcLengthDivisions - * @type {integer} - * @default 100 - * @since 3.0.0 - */ - this.arcLengthDivisions = 100; - - /** - * An array of cached arc length values. - * - * @name Phaser.Curves.Curve#cacheArcLengths - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.cacheArcLengths = []; - - /** - * Does the data of this curve need updating? - * - * @name Phaser.Curves.Curve#needsUpdate - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.needsUpdate = true; - - /** - * [description] - * - * @name Phaser.Curves.Curve#active - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.active = true; - - /** - * A temporary calculation Vector. - * - * @name Phaser.Curves.Curve#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); - - /** - * A temporary calculation Vector. - * - * @name Phaser.Curves.Curve#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); - }, - - /** - * Draws this curve on the given Graphics object. - * - * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. - * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. - * - * @method Phaser.Curves.Curve#draw - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. - * - * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. - */ - draw: function (graphics, pointsTotal) - { - if (pointsTotal === undefined) { pointsTotal = 32; } - - // So you can chain graphics calls - return graphics.strokePoints(this.getPoints(pointsTotal)); - }, - - /** - * Returns a Rectangle where the position and dimensions match the bounds of this Curve. - * - * You can control the accuracy of the bounds. The value given is used to work out how many points - * to plot across the curve. Higher values are more accurate at the cost of calculation speed. - * - * @method Phaser.Curves.Curve#getBounds - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} out - The Rectangle to store the bounds in. If falsey a new object will be created. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. - * - * @return {Phaser.Geom.Rectangle} A Rectangle containing the bounds values of this Curve. - */ - getBounds: function (out, accuracy) - { - if (!out) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } - - var len = this.getLength(); - - if (accuracy > len) - { - accuracy = len / 2; - } - - // The length of the curve in pixels - // So we'll have 1 spaced point per 'accuracy' pixels - - var spaced = Math.max(1, Math.round(len / accuracy)); - - return FromPoints(this.getSpacedPoints(spaced), out); - }, - - /** - * Returns an array of points, spaced out X distance pixels apart. - * The smaller the distance, the larger the array will be. - * - * @method Phaser.Curves.Curve#getDistancePoints - * @since 3.0.0 - * - * @param {integer} distance - The distance, in pixels, between each point along the curve. - * - * @return {Phaser.Geom.Point[]} An Array of Point objects. - */ - getDistancePoints: function (distance) - { - var len = this.getLength(); - - var spaced = Math.max(1, len / distance); - - return this.getSpacedPoints(spaced); - }, - - /** - * [description] - * - * @method Phaser.Curves.Curve#getEndPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} out - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getEndPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return this.getPointAt(1, out); - }, - - // Get total curve arc length - - /** - * [description] - * - * @method Phaser.Curves.Curve#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lengths = this.getLengths(); - - return lengths[lengths.length - 1]; - }, - - // Get list of cumulative segment lengths - - /** - * [description] - * - * @method Phaser.Curves.Curve#getLengths - * @since 3.0.0 - * - * @param {integer} [divisions] - [description] - * - * @return {number[]} [description] - */ - getLengths: function (divisions) - { - if (divisions === undefined) { divisions = this.arcLengthDivisions; } - - if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) - { - return this.cacheArcLengths; - } - - this.needsUpdate = false; - - var cache = []; - var current; - var last = this.getPoint(0, this._tmpVec2A); - var sum = 0; - - cache.push(0); - - for (var p = 1; p <= divisions; p++) - { - current = this.getPoint(p / divisions, this._tmpVec2B); - - sum += current.distance(last); - - cache.push(sum); - - last.copy(current); - } - - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. - }, - - // Get point at relative position in curve according to arc length - - // - u [0 .. 1] - - /** - * [description] - * - * @method Phaser.Curves.Curve#getPointAt - * @since 3.0.0 - * - * @param {float} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getPointAt: function (u, out) - { - var t = this.getUtoTmapping(u); - - return this.getPoint(t, out); - }, - - // Get sequence of points using getPoint( t ) - - /** - * [description] - * - * @method Phaser.Curves.Curve#getPoints - * @since 3.0.0 - * - * @param {integer} [divisions] - [description] - * - * @return {Phaser.Math.Vector2[]} [description] - */ - getPoints: function (divisions) - { - if (divisions === undefined) { divisions = this.defaultDivisions; } - - var points = []; - - for (var d = 0; d <= divisions; d++) - { - points.push(this.getPoint(d / divisions)); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Curve#getRandomPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getRandomPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return this.getPoint(Math.random(), out); - }, - - // Get sequence of points using getPointAt( u ) - - /** - * [description] - * - * @method Phaser.Curves.Curve#getSpacedPoints - * @since 3.0.0 - * - * @param {integer} [divisions] - [description] - * - * @return {Phaser.Math.Vector2[]} [description] - */ - getSpacedPoints: function (divisions) - { - if (divisions === undefined) { divisions = this.defaultDivisions; } - - var points = []; - - for (var d = 0; d <= divisions; d++) - { - var t = this.getUtoTmapping(d / divisions, null, divisions); - - points.push(this.getPoint(t)); - } - - return points; - }, - - /** - * [description] - * - * @method Phaser.Curves.Curve#getStartPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return this.getPointAt(0, out); - }, - - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - - /** - * [description] - * - * @method Phaser.Curves.Curve#getTangent - * @since 3.0.0 - * - * @param {number} t - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getTangent: function (t, out) - { - if (out === undefined) { out = new Vector2(); } - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger - - if (t1 < 0) - { - t1 = 0; - } - - if (t2 > 1) - { - t2 = 1; - } - - this.getPoint(t1, this._tmpVec2A); - this.getPoint(t2, out); - - return out.subtract(this._tmpVec2A).normalize(); - }, - - /** - * [description] - * - * @method Phaser.Curves.Curve#getTangentAt - * @since 3.0.0 - * - * @param {float} u - [description] - * @param {Phaser.Math.Vector2} [out] - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getTangentAt: function (u, out) - { - var t = this.getUtoTmapping(u); - - return this.getTangent(t, out); - }, - - // Given a distance in pixels, get a t to find p. - /** - * [description] - * - * @method Phaser.Curves.Curve#getTFromDistance - * @since 3.0.0 - * - * @param {integer} distance - [description] - * @param {integer} [divisions] - [description] - * - * @return {float} [description] - */ - getTFromDistance: function (distance, divisions) - { - if (distance <= 0) - { - return 0; - } - - return this.getUtoTmapping(0, distance, divisions); - }, - - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - - /** - * [description] - * - * @method Phaser.Curves.Curve#getUtoTmapping - * @since 3.0.0 - * - * @param {float} u - [description] - * @param {integer} distance - [description] - * @param {integer} [divisions] - [description] - * - * @return {number} [description] - */ - getUtoTmapping: function (u, distance, divisions) - { - var arcLengths = this.getLengths(divisions); - - var i = 0; - var il = arcLengths.length; - - var targetArcLength; // The targeted u distance value to get - - if (distance) - { - // Cannot overshoot the curve - targetArcLength = Math.min(distance, arcLengths[il - 1]); - } - else - { - targetArcLength = u * arcLengths[il - 1]; - } - - // binary search for the index with largest value smaller than target u distance - - var low = 0; - var high = il - 1; - var comparison; - - while (low <= high) - { - i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - - comparison = arcLengths[i] - targetArcLength; - - if (comparison < 0) - { - low = i + 1; - } - else if (comparison > 0) - { - high = i - 1; - } - else - { - high = i; - break; - } - } - - i = high; - - if (arcLengths[i] === targetArcLength) - { - return i / (il - 1); - } - - // we could get finer grain at lengths, or use simple interpolation between two points - - var lengthBefore = arcLengths[i]; - var lengthAfter = arcLengths[i + 1]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; - - // add that fractional amount to t - - return (i + segmentFraction) / (il - 1); - }, - - /** - * [description] - * - * @method Phaser.Curves.Curve#updateArcLengths - * @since 3.0.0 - */ - updateArcLengths: function () - { - this.needsUpdate = true; - - this.getLengths(); - } - -}); - -module.exports = Curve; - - /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { @@ -11973,7 +11983,7 @@ function init () module.exports = init(); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(496))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(507))) /***/ }), /* 68 */ @@ -12027,12 +12037,12 @@ module.exports = Contains; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Actions = __webpack_require__(168); +var Actions = __webpack_require__(169); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var Range = __webpack_require__(274); -var Set = __webpack_require__(61); +var Range = __webpack_require__(275); +var Set = __webpack_require__(62); var Sprite = __webpack_require__(37); /** @@ -12867,7 +12877,7 @@ module.exports = Group; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var ImageRender = __webpack_require__(569); +var ImageRender = __webpack_require__(571); /** * @classdesc @@ -12955,7 +12965,7 @@ module.exports = Image; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EaseMap = __webpack_require__(577); +var EaseMap = __webpack_require__(579); /** * [description] @@ -13540,7 +13550,7 @@ module.exports = MapData; */ var BlendModes = __webpack_require__(45); -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); var Components = __webpack_require__(11); @@ -13783,13 +13793,9 @@ var Zone = new Class({ this.setRectangleDropZone(this.width, this.height); } else + if (!this.input) { - if (!this.input) - { - this.setInteractive(shape, callback); - } - - this.input.dropZone = true; + this.setInteractive(shape, callback, true); } return this; @@ -14329,7 +14335,7 @@ var Class = __webpack_require__(0); var GameObject = __webpack_require__(1); var Sprite = __webpack_require__(37); var Vector2 = __webpack_require__(6); -var Vector4 = __webpack_require__(119); +var Vector4 = __webpack_require__(120); /** * @classdesc @@ -15270,7 +15276,7 @@ var BaseSoundManager = new Class({ * @since 3.0.0 * * @param {function} callbackfn - Callback function. (sound: ISound, index: number, array: ISound[]) => void - * @param {object} scope - Callback context. + * @param {object} [scope] - Callback context. */ forEachActiveSound: function (callbackfn, scope) { @@ -17021,7 +17027,7 @@ module.exports = TWEEN_CONST; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var MeshRender = __webpack_require__(655); +var MeshRender = __webpack_require__(658); /** * @classdesc @@ -17318,7 +17324,7 @@ module.exports = XHRSettings; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(327); +var Components = __webpack_require__(329); var Sprite = __webpack_require__(37); /** @@ -17425,10 +17431,10 @@ module.exports = Bodies; var Vertices = __webpack_require__(93); var Common = __webpack_require__(38); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); var Bounds = __webpack_require__(95); var Vector = __webpack_require__(94); -var decomp = __webpack_require__(945); +var decomp = __webpack_require__(948); (function() { @@ -18591,47 +18597,47 @@ module.exports = Bounds; module.exports = { - CalculateFacesAt: __webpack_require__(152), + CalculateFacesAt: __webpack_require__(151), CalculateFacesWithin: __webpack_require__(34), - Copy: __webpack_require__(871), - CreateFromTiles: __webpack_require__(872), - CullTiles: __webpack_require__(873), - Fill: __webpack_require__(874), - FilterTiles: __webpack_require__(875), - FindByIndex: __webpack_require__(876), - FindTile: __webpack_require__(877), - ForEachTile: __webpack_require__(878), + Copy: __webpack_require__(874), + CreateFromTiles: __webpack_require__(875), + CullTiles: __webpack_require__(876), + Fill: __webpack_require__(877), + FilterTiles: __webpack_require__(878), + FindByIndex: __webpack_require__(879), + FindTile: __webpack_require__(880), + ForEachTile: __webpack_require__(881), GetTileAt: __webpack_require__(97), - GetTileAtWorldXY: __webpack_require__(879), + GetTileAtWorldXY: __webpack_require__(882), GetTilesWithin: __webpack_require__(15), - GetTilesWithinShape: __webpack_require__(880), - GetTilesWithinWorldXY: __webpack_require__(881), - HasTileAt: __webpack_require__(344), - HasTileAtWorldXY: __webpack_require__(882), + GetTilesWithinShape: __webpack_require__(883), + GetTilesWithinWorldXY: __webpack_require__(884), + HasTileAt: __webpack_require__(346), + HasTileAtWorldXY: __webpack_require__(885), IsInLayerBounds: __webpack_require__(74), - PutTileAt: __webpack_require__(153), - PutTileAtWorldXY: __webpack_require__(883), - PutTilesAt: __webpack_require__(884), - Randomize: __webpack_require__(885), - RemoveTileAt: __webpack_require__(345), - RemoveTileAtWorldXY: __webpack_require__(886), - RenderDebug: __webpack_require__(887), - ReplaceByIndex: __webpack_require__(343), - SetCollision: __webpack_require__(888), - SetCollisionBetween: __webpack_require__(889), - SetCollisionByExclusion: __webpack_require__(890), - SetCollisionByProperty: __webpack_require__(891), - SetCollisionFromCollisionGroup: __webpack_require__(892), - SetTileIndexCallback: __webpack_require__(893), - SetTileLocationCallback: __webpack_require__(894), - Shuffle: __webpack_require__(895), - SwapByIndex: __webpack_require__(896), + PutTileAt: __webpack_require__(152), + PutTileAtWorldXY: __webpack_require__(886), + PutTilesAt: __webpack_require__(887), + Randomize: __webpack_require__(888), + RemoveTileAt: __webpack_require__(347), + RemoveTileAtWorldXY: __webpack_require__(889), + RenderDebug: __webpack_require__(890), + ReplaceByIndex: __webpack_require__(345), + SetCollision: __webpack_require__(891), + SetCollisionBetween: __webpack_require__(892), + SetCollisionByExclusion: __webpack_require__(893), + SetCollisionByProperty: __webpack_require__(894), + SetCollisionFromCollisionGroup: __webpack_require__(895), + SetTileIndexCallback: __webpack_require__(896), + SetTileLocationCallback: __webpack_require__(897), + Shuffle: __webpack_require__(898), + SwapByIndex: __webpack_require__(899), TileToWorldX: __webpack_require__(98), - TileToWorldXY: __webpack_require__(897), + TileToWorldXY: __webpack_require__(900), TileToWorldY: __webpack_require__(99), - WeightedRandomize: __webpack_require__(898), + WeightedRandomize: __webpack_require__(901), WorldToTileX: __webpack_require__(39), - WorldToTileXY: __webpack_require__(899), + WorldToTileXY: __webpack_require__(902), WorldToTileY: __webpack_require__(40) }; @@ -19246,17 +19252,17 @@ module.exports = GetNewValue; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(159); +var Defaults = __webpack_require__(158); var GetAdvancedValue = __webpack_require__(10); var GetBoolean = __webpack_require__(73); var GetEaseFunction = __webpack_require__(71); var GetNewValue = __webpack_require__(101); -var GetProps = __webpack_require__(358); -var GetTargets = __webpack_require__(157); +var GetProps = __webpack_require__(360); +var GetTargets = __webpack_require__(156); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(158); -var Tween = __webpack_require__(160); -var TweenData = __webpack_require__(161); +var GetValueOp = __webpack_require__(157); +var Tween = __webpack_require__(159); +var TweenData = __webpack_require__(160); /** * [description] @@ -19377,7 +19383,634 @@ module.exports = TweenBuilder; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Class = __webpack_require__(0); +var Utils = __webpack_require__(41); + +/** + * @classdesc + * [description] + * + * @class WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {object} config - [description] + */ +var WebGLPipeline = new Class({ + + initialize: + + function WebGLPipeline (config) + { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#name + * @type {string} + * @since 3.0.0 + */ + this.name = 'WebGLPipeline'; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = config.game; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#view + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.view = config.game.canvas; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution + * @type {number} + * @since 3.0.0 + */ + this.resolution = config.game.config.resolution; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#width + * @type {number} + * @since 3.0.0 + */ + this.width = config.game.config.width * this.resolution; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#height + * @type {number} + * @since 3.0.0 + */ + this.height = config.game.config.height * this.resolution; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#gl + * @type {WebGLRenderingContext} + * @since 3.0.0 + */ + this.gl = config.gl; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.vertexCount = 0; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity + * @type {integer} + * @since 3.0.0 + */ + this.vertexCapacity = config.vertexCapacity; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = config.renderer; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData + * @type {ArrayBuffer} + * @since 3.0.0 + */ + this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize)); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer + * @type {WebGLBuffer} + * @since 3.0.0 + */ + this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#program + * @type {WebGLProgram} + * @since 3.0.0 + */ + this.program = this.renderer.createProgram(config.vertShader, config.fragShader); + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes + * @type {object} + * @since 3.0.0 + */ + this.attributes = config.attributes; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize + * @type {integer} + * @since 3.0.0 + */ + this.vertexSize = config.vertexSize; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#topology + * @type {integer} + * @since 3.0.0 + */ + this.topology = config.topology; + + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes + * @type {Uint8Array} + * @since 3.0.0 + */ + this.bytes = new Uint8Array(this.vertexData); + + /** + * This will store the amount of components of 32 bit length + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount + * @type {integer} + * @since 3.0.0 + */ + this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl); + + /** + * Indicates if the current pipeline is flushing the contents to the GPU. + * When the variable is set the flush function will be locked. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked + * @type {boolean} + * @since 3.1.0 + */ + this.flushLocked = false; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} size - [description] + * @param {int} type - [description] + * @param {boolean} normalized - [description] + * @param {int} offset - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + addAttribute: function (name, size, type, normalized, offset) + { + this.attributes.push({ + name: name, + size: size, + type: this.renderer.glFormats[type], + normalized: normalized, + offset: offset + }); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @since 3.0.0 + * + * @return {boolean} [description] + */ + shouldFlush: function () + { + return (this.vertexCount >= this.vertexCapacity); + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + resize: function (width, height, resolution) + { + this.width = width * resolution; + this.height = height * resolution; + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + bind: function () + { + var gl = this.gl; + var vertexBuffer = this.vertexBuffer; + var attributes = this.attributes; + var program = this.program; + var renderer = this.renderer; + var vertexSize = this.vertexSize; + + renderer.setProgram(program); + renderer.setVertexBuffer(vertexBuffer); + + for (var index = 0; index < attributes.length; ++index) + { + var element = attributes[index]; + var location = gl.getAttribLocation(program, element.name); + + if (location >= 0) + { + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); + } + else + { + gl.disableVertexAttribArray(location); + } + } + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onBind: function () + { + // This is for updating uniform data it's called on each bind attempt. + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onPreRender: function () + { + // called once every frame + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onRender: function () + { + // called for each camera + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + onPostRender: function () + { + // called once every frame + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + flush: function () + { + if (this.flushLocked) { return this; } + + this.flushLocked = true; + + var gl = this.gl; + var vertexCount = this.vertexCount; + var topology = this.topology; + var vertexSize = this.vertexSize; + + if (vertexCount === 0) + { + this.flushLocked = false; + return; + } + + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + gl.drawArrays(topology, 0, vertexCount); + + this.vertexCount = 0; + this.flushLocked = false; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + destroy: function () + { + var gl = this.gl; + + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); + + delete this.program; + delete this.vertexBuffer; + delete this.gl; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat1: function (name, x) + { + this.renderer.setFloat1(this.program, name, x); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat2: function (name, x, y) + { + + this.renderer.setFloat2(this.program, name, x, y); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat3: function (name, x, y, z) + { + + this.renderer.setFloat3(this.program, name, x, y, z); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * @param {float} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setFloat4: function (name, x, y, z, w) + { + + this.renderer.setFloat4(this.program, name, x, y, z, w); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt1: function (name, x) + { + this.renderer.setInt1(this.program, name, x); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt2: function (name, x, y) + { + this.renderer.setInt2(this.program, name, x, y); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * @param {int} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt3: function (name, x, y, z) + { + this.renderer.setInt3(this.program, name, x, y, z); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {int} x - [description] + * @param {int} y - [description] + * @param {int} z - [description] + * @param {int} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setInt4: function (name, x, y, z, w) + { + this.renderer.setInt4(this.program, name, x, y, z, w); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix2: function (name, transpose, matrix) + { + this.renderer.setMatrix2(this.program, name, transpose, matrix); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix3: function (name, transpose, matrix) + { + this.renderer.setMatrix3(this.program, name, transpose, matrix); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4 + * @since 3.2.0 + * + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] + */ + setMatrix4: function (name, transpose, matrix) + { + this.renderer.setMatrix4(this.program, name, transpose, matrix); + return this; + } + +}); + +module.exports = WebGLPipeline; + + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Clone = __webpack_require__(53); /** * Creates a new Object using all values from obj1 and obj2. @@ -19410,7 +20043,7 @@ module.exports = Merge; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19447,7 +20080,7 @@ module.exports = CircumferencePoint; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19489,7 +20122,7 @@ module.exports = Random; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19564,7 +20197,7 @@ module.exports = GetPoint; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19600,7 +20233,7 @@ module.exports = Random; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19609,7 +20242,7 @@ module.exports = Random; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); var Point = __webpack_require__(5); /** @@ -19658,7 +20291,7 @@ module.exports = GetPoints; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19697,7 +20330,7 @@ module.exports = Random; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19735,7 +20368,7 @@ module.exports = Random; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19789,7 +20422,7 @@ module.exports = Random; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports) { /** @@ -19826,7 +20459,7 @@ module.exports = RotateAroundDistance; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -20153,7 +20786,7 @@ module.exports = Map; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -20165,8 +20798,8 @@ module.exports = Map; var Class = __webpack_require__(0); var DegToRad = __webpack_require__(35); var Rectangle = __webpack_require__(8); -var TransformMatrix = __webpack_require__(187); -var ValueToColor = __webpack_require__(115); +var TransformMatrix = __webpack_require__(188); +var ValueToColor = __webpack_require__(116); var Vector2 = __webpack_require__(6); /** @@ -21511,7 +22144,7 @@ module.exports = Camera; /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21520,10 +22153,10 @@ module.exports = Camera; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HexStringToColor = __webpack_require__(200); -var IntegerToColor = __webpack_require__(202); -var ObjectToColor = __webpack_require__(204); -var RGBStringToColor = __webpack_require__(205); +var HexStringToColor = __webpack_require__(201); +var IntegerToColor = __webpack_require__(203); +var ObjectToColor = __webpack_require__(205); +var RGBStringToColor = __webpack_require__(206); /** * Converts the given source color value into an instance of a Color class. @@ -21567,7 +22200,7 @@ module.exports = ValueToColor; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports) { /** @@ -21597,7 +22230,7 @@ module.exports = GetColor; /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21607,15 +22240,15 @@ module.exports = GetColor; */ var Class = __webpack_require__(0); -var Matrix4 = __webpack_require__(118); -var RandomXYZ = __webpack_require__(206); -var RandomXYZW = __webpack_require__(207); -var RotateVec3 = __webpack_require__(208); -var Set = __webpack_require__(61); +var Matrix4 = __webpack_require__(119); +var RandomXYZ = __webpack_require__(207); +var RandomXYZW = __webpack_require__(208); +var RotateVec3 = __webpack_require__(209); +var Set = __webpack_require__(62); var Sprite3D = __webpack_require__(81); var Vector2 = __webpack_require__(6); var Vector3 = __webpack_require__(51); -var Vector4 = __webpack_require__(119); +var Vector4 = __webpack_require__(120); // Local cache vars var tmpVec3 = new Vector3(); @@ -22665,7 +23298,7 @@ module.exports = Camera; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24106,7 +24739,7 @@ module.exports = Matrix4; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24635,7 +25268,7 @@ module.exports = Vector4; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports) { /** @@ -24767,7 +25400,7 @@ module.exports = Smoothing(); /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24850,7 +25483,7 @@ module.exports = FromPoints; /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports) { /** @@ -24887,7 +25520,7 @@ module.exports = CatmullRom; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports) { /** @@ -24949,7 +25582,7 @@ module.exports = AddToDOM; /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24960,7 +25593,7 @@ module.exports = AddToDOM; var OS = __webpack_require__(67); var Browser = __webpack_require__(82); -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); /** * Determines the features of the browser running this Phaser Game instance. @@ -25147,7 +25780,7 @@ module.exports = init(); /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports) { /** @@ -25176,401 +25809,6 @@ var IsSizePowerOfTwo = function (width, height) module.exports = IsSizePowerOfTwo; -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var Utils = __webpack_require__(42); - -/** - * @classdesc - * [description] - * - * @class WebGLPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {object} config - [description] - */ -var WebGLPipeline = new Class({ - - initialize: - - function WebGLPipeline (config) - { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#name - * @type {string} - * @since 3.0.0 - */ - this.name = 'WebGLPipeline'; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = config.game; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#view - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.view = config.game.canvas; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution - * @type {number} - * @since 3.0.0 - */ - this.resolution = config.game.config.resolution; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#width - * @type {number} - * @since 3.0.0 - */ - this.width = config.game.config.width * this.resolution; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#height - * @type {number} - * @since 3.0.0 - */ - this.height = config.game.config.height * this.resolution; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#gl - * @type {WebGLRenderingContext} - * @since 3.0.0 - */ - this.gl = config.gl; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.vertexCount = 0; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity - * @type {integer} - * @since 3.0.0 - */ - this.vertexCapacity = config.vertexCapacity; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = config.renderer; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData - * @type {ArrayBuffer} - * @since 3.0.0 - */ - this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize)); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer - * @type {WebGLBuffer} - * @since 3.0.0 - */ - this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#program - * @type {WebGLProgram} - * @since 3.0.0 - */ - this.program = this.renderer.createProgram(config.vertShader, config.fragShader); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes - * @type {object} - * @since 3.0.0 - */ - this.attributes = config.attributes; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize - * @type {integer} - * @since 3.0.0 - */ - this.vertexSize = config.vertexSize; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#topology - * @type {integer} - * @since 3.0.0 - */ - this.topology = config.topology; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes - * @type {Uint8Array} - * @since 3.0.0 - */ - this.bytes = new Uint8Array(this.vertexData); - - /** - * This will store the amount of components of 32 bit length - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount - * @type {integer} - * @since 3.0.0 - */ - this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl); - - /** - * Indicates if the current pipeline is flushing the contents to the GPU. - * When the variable is set the flush function will be locked. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked - * @type {boolean} - * @since 3.1.0 - */ - this.flushLocked = false; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush - * @since 3.0.0 - * - * @return {boolean} [description] - */ - shouldFlush: function () - { - return (this.vertexCount >= this.vertexCapacity); - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - resize: function (width, height, resolution) - { - this.width = width * resolution; - this.height = height * resolution; - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - bind: function () - { - var gl = this.gl; - var vertexBuffer = this.vertexBuffer; - var attributes = this.attributes; - var program = this.program; - var renderer = this.renderer; - var vertexSize = this.vertexSize; - - renderer.setProgram(program); - renderer.setVertexBuffer(vertexBuffer); - - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - var location = gl.getAttribLocation(program, element.name); - - if (location >= 0) - { - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); - } - else - { - gl.disableVertexAttribArray(location); - } - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - onBind: function () - { - // This is for updating uniform data it's called on each bind attempt. - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - onPreRender: function () - { - // called once every frame - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - onRender: function () - { - // called for each camera - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - onPostRender: function () - { - // called once every frame - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#flush - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - flush: function () - { - if (this.flushLocked) { return this; } - - this.flushLocked = true; - - var gl = this.gl; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - - if (vertexCount === 0) - { - this.flushLocked = false; - return; - } - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - gl.drawArrays(topology, 0, vertexCount); - - this.vertexCount = 0; - this.flushLocked = false; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - destroy: function () - { - var gl = this.gl; - - gl.deleteProgram(this.program); - gl.deleteBuffer(this.vertexBuffer); - - delete this.program; - delete this.vertexBuffer; - delete this.gl; - - return this; - } - -}); - -module.exports = WebGLPipeline; - - /***/ }), /* 127 */ /***/ (function(module, exports) { @@ -26197,10 +26435,10 @@ module.exports = { var Class = __webpack_require__(0); var CONST = __webpack_require__(83); -var GetPhysicsPlugins = __webpack_require__(529); -var GetScenePlugins = __webpack_require__(530); -var Plugins = __webpack_require__(233); -var Settings = __webpack_require__(254); +var GetPhysicsPlugins = __webpack_require__(531); +var GetScenePlugins = __webpack_require__(532); +var Plugins = __webpack_require__(236); +var Settings = __webpack_require__(255); /** * @classdesc @@ -26700,6 +26938,21 @@ var Systems = new Class({ this.events.emit('start', this); }, + /** + * Called automatically by the SceneManager if the Game resizes. + * Dispatches an event you can respond to in your game code. + * + * @method Phaser.Scenes.Systems#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + */ + resize: function (width, height) + { + this.events.emit('resize', width, height); + }, + /** * Shutdown this Scene and send a shutdown event to all of its systems. * @@ -27335,10 +27588,10 @@ module.exports = Frame; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetBitmapTextSize = __webpack_require__(267); -var ParseFromAtlas = __webpack_require__(546); -var ParseRetroFont = __webpack_require__(547); -var Render = __webpack_require__(548); +var GetBitmapTextSize = __webpack_require__(268); +var ParseFromAtlas = __webpack_require__(548); +var ParseRetroFont = __webpack_require__(549); +var Render = __webpack_require__(550); /** * @classdesc @@ -27473,18 +27726,26 @@ var BitmapText = new Class({ * @method Phaser.GameObjects.BitmapText#setText * @since 3.0.0 * - * @param {string|string[]} text - [description] + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this BitmapText. * * @return {Phaser.GameObjects.BitmapText} This Game Object. */ setText: function (value) { + if (!value && value !== 0) + { + value = ''; + } + if (Array.isArray(value)) { value = value.join('\n'); } - this.text = value; + if (value !== this.text) + { + this.text = value.toString(); + } return this; }, @@ -27601,8 +27862,8 @@ module.exports = BitmapText; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlitterRender = __webpack_require__(551); -var Bob = __webpack_require__(554); +var BlitterRender = __webpack_require__(553); +var Bob = __webpack_require__(556); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var Frame = __webpack_require__(130); @@ -27862,8 +28123,8 @@ module.exports = Blitter; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetBitmapTextSize = __webpack_require__(267); -var Render = __webpack_require__(555); +var GetBitmapTextSize = __webpack_require__(268); +var Render = __webpack_require__(557); /** * @classdesc @@ -28081,18 +28342,26 @@ var DynamicBitmapText = new Class({ * @method Phaser.GameObjects.DynamicBitmapText#setText * @since 3.0.0 * - * @param {string|string[]} text - [description] + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this BitmapText. * * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object. */ setText: function (value) { + if (!value && value !== 0) + { + value = ''; + } + if (Array.isArray(value)) { value = value.join('\n'); } - this.text = value; + if (value !== this.text) + { + this.text = value.toString(); + } return this; }, @@ -28240,15 +28509,15 @@ module.exports = DynamicBitmapText; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(114); +var Camera = __webpack_require__(115); var Class = __webpack_require__(0); var Commands = __webpack_require__(127); var Components = __webpack_require__(11); -var Ellipse = __webpack_require__(269); +var Ellipse = __webpack_require__(270); var GameObject = __webpack_require__(1); var GetValue = __webpack_require__(4); var MATH_CONST = __webpack_require__(16); -var Render = __webpack_require__(567); +var Render = __webpack_require__(569); /** * @classdesc @@ -28586,7 +28855,6 @@ var Graphics = new Class({ { this.beginPath(); this.arc(x, y, radius, 0, MATH_CONST.PI2); - this.closePath(); this.fillPath(); return this; @@ -28608,7 +28876,6 @@ var Graphics = new Class({ { this.beginPath(); this.arc(x, y, radius, 0, MATH_CONST.PI2); - this.closePath(); this.strokePath(); return this; @@ -28690,25 +28957,21 @@ var Graphics = new Class({ this.moveTo(x, y); this.lineTo(x, y + height); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(x + width, y); this.lineTo(x + width, y + height); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(minx, y); this.lineTo(maxx + width, y); this.strokePath(); - this.closePath(); this.beginPath(); this.moveTo(minx, y + height); this.lineTo(maxx + width, y + height); this.strokePath(); - this.closePath(); return this; }, @@ -29375,9 +29638,9 @@ module.exports = Graphics; var Class = __webpack_require__(0); var Contains = __webpack_require__(68); -var GetPoint = __webpack_require__(270); -var GetPoints = __webpack_require__(271); -var Random = __webpack_require__(109); +var GetPoint = __webpack_require__(271); +var GetPoints = __webpack_require__(272); +var Random = __webpack_require__(110); /** * @classdesc @@ -29780,10 +30043,10 @@ module.exports = CircumferencePoint; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GravityWell = __webpack_require__(572); +var GravityWell = __webpack_require__(574); var List = __webpack_require__(86); -var ParticleEmitter = __webpack_require__(573); -var Render = __webpack_require__(612); +var ParticleEmitter = __webpack_require__(575); +var Render = __webpack_require__(614); /** * @classdesc @@ -30229,12 +30492,52 @@ module.exports = GetRandomElement; /* 139 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); +var CONST = __webpack_require__(22); var GameObject = __webpack_require__(1); -var RenderTextureWebGL = __webpack_require__(615); -var Render = __webpack_require__(616); +var Render = __webpack_require__(617); +var RenderTextureCanvas = __webpack_require__(620); +var RenderTextureWebGL = __webpack_require__(621); +/** + * @classdesc + * A Render Texture. + * + * @class RenderTexture + * @extends Phaser.GameObjects.GameObject + * @memberOf Phaser.GameObjects + * @constructor + * @since 3.2.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.MatrixStack + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScaleMode + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {integer} [width=32] - The width of the Render Texture. + * @param {integer} [height=32] - The height of the Render Texture. + */ var RenderTexture = new Class({ Extends: GameObject, @@ -30259,14 +30562,20 @@ var RenderTexture = new Class({ initialize: - function RenderTexture(scene, x, y, width, height) + function RenderTexture (scene, x, y, width, height) { + if (width === undefined) { width = 32; } + if (height === undefined) { height = 32; } + GameObject.call(this, scene, 'RenderTexture'); + this.initMatrixStack(); this.renderer = scene.sys.game.renderer; + this.globalTint = 0xFFFFFFF; + this.globalAlpha = 1.0; - if (this.renderer.type === Phaser.WEBGL) + if (this.renderer.type === CONST.WEBGL) { var gl = this.renderer.gl; this.gl = gl; @@ -30277,13 +30586,14 @@ var RenderTexture = new Class({ this.texture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false); this.framebuffer = this.renderer.createFramebuffer(width, height, this.texture, false); } - else + else if (this.renderer.type === CONST.CANVAS) { - // For now we'll just add canvas stubs - this.fill = function () {}; - this.clear = function () {}; - this.draw = function () {}; - this.drawFrame = function () {}; + this.fill = RenderTextureCanvas.fill; + this.clear = RenderTextureCanvas.clear; + this.draw = RenderTextureCanvas.draw; + this.drawFrame = RenderTextureCanvas.drawFrame; + this.canvas = CanvasPool.create2D(null, width, height); + this.context = this.canvas.getContext('2d'); } this.setPosition(x, y); @@ -30291,15 +30601,88 @@ var RenderTexture = new Class({ this.initPipeline('TextureTintPipeline'); }, + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#destroy + * @since 3.2.0 + */ destroy: function () { GameObject.destroy.call(this); - if (this.renderer.type === Phaser.WEBGL) + + if (this.renderer.type === CONST.WEBGL) { this.renderer.deleteTexture(this.texture); this.renderer.deleteFramebuffer(this.framebuffer); } - } + }, + + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#setGlobalTint + * @since 3.2.0 + * + * @param {int} tint [description] + * + * @return {Phaser.GameObjects.RenderTexture} [description] + */ + setGlobalTint: function (tint) + { + this.globalTint = tint; + return this; + }, + + /** + * [description] + * + * @method Phaser.GameObjects.RenderTexture#setGlobalAlpha + * @since 3.2.0 + * + * @param {float} alpha [description] + * + * @return {Phaser.GameObjects.RenderTexture} [description] + */ + setGlobalAlpha: function (alpha) + { + this.globalAlpha = alpha; + return this; + } + + /** + * Fills the Render Texture with the given color. + * + * @method Phaser.GameObjects.RenderTexture#fill + * @since 3.2.0 + * + * @param {number} rgb - The color to fill the Render Texture with. + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ + + /** + * Clears the Render Texture. + * + * @method Phaser.GameObjects.RenderTexture#clear + * @since 3.2.0 + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ + + /** + * Draws a texture frame to the Render Texture at the given position. + * + * @method Phaser.GameObjects.RenderTexture#draw + * @since 3.2.0 + * + * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number} x - The x position to draw the frame at. + * @param {number} y - The y position to draw the frame at. + * + * @return {Phaser.GameObjects.RenderTexture} This Game Object. + */ }); @@ -30316,16 +30699,16 @@ module.exports = RenderTexture; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(123); -var CanvasPool = __webpack_require__(21); +var AddToDOM = __webpack_require__(124); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetTextSize = __webpack_require__(619); +var GetTextSize = __webpack_require__(622); var GetValue = __webpack_require__(4); -var RemoveFromDOM = __webpack_require__(231); -var TextRender = __webpack_require__(620); -var TextStyle = __webpack_require__(623); +var RemoveFromDOM = __webpack_require__(234); +var TextRender = __webpack_require__(623); +var TextStyle = __webpack_require__(626); /** * @classdesc @@ -30512,6 +30895,11 @@ var Text = new Class({ { this.setPadding(style.padding); } + + if (style && style.lineSpacing) + { + this._lineSpacing = style.lineSpacing; + } this.setText(text); @@ -30802,13 +31190,13 @@ var Text = new Class({ * @method Phaser.GameObjects.Text#setText * @since 3.0.0 * - * @param {string|string[]} value - The text to set. + * @param {string|string[]} value - The string, or array of strings, to be set as the content of this Text object. * * @return {Phaser.GameObjects.Text} This Text object. */ setText: function (value) { - if (!value) + if (!value && value !== 0) { value = ''; } @@ -31418,12 +31806,12 @@ module.exports = Text; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var GetPowerOfTwo = __webpack_require__(290); -var TileSpriteRender = __webpack_require__(625); +var GetPowerOfTwo = __webpack_require__(291); +var TileSpriteRender = __webpack_require__(628); /** * @classdesc @@ -31589,6 +31977,8 @@ var TileSprite = new Class({ */ this.canvasBufferCtx = this.canvasBuffer.getContext('2d'); + this.oldFrame = null; + this.updateTileTexture(); scene.sys.game.renderer.onContextRestored(function (renderer) @@ -31608,11 +31998,15 @@ var TileSprite = new Class({ */ updateTileTexture: function () { - if (!this.dirty) + if (!this.dirty && this.oldFrame === this.frame) { return; } + this.oldFrame = this.frame; + + this.canvasBufferCtx.clearRect(0, 0, this.canvasBuffer.width, this.canvasBuffer.height); + this.canvasBufferCtx.drawImage( this.frame.source.image, this.frame.cutX, this.frame.cutY, @@ -31665,95 +32059,6 @@ module.exports = TileSprite; /* 142 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetAdvancedValue = __webpack_require__(10); - -/** - * Adds an Animation component to a Sprite and populates it based on the given config. - * - * @function Phaser.Gameobjects.BuildGameObjectAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {object} config - [description] - * - * @return {Phaser.GameObjects.Sprite} The updated Sprite. - */ -var BuildGameObjectAnimation = function (sprite, config) -{ - var animConfig = GetAdvancedValue(config, 'anims', null); - - if (animConfig === null) - { - return sprite; - } - - if (typeof animConfig === 'string') - { - // { anims: 'key' } - sprite.anims.play(animConfig); - } - else if (typeof animConfig === 'object') - { - // { anims: { - // key: string - // startFrame: [string|integer] - // delay: [float] - // repeat: [integer] - // repeatDelay: [float] - // yoyo: [boolean] - // play: [boolean] - // delayedPlay: [boolean] - // } - // } - - var anims = sprite.anims; - - var key = GetAdvancedValue(animConfig, 'key', undefined); - var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); - - var delay = GetAdvancedValue(animConfig, 'delay', 0); - var repeat = GetAdvancedValue(animConfig, 'repeat', 0); - var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); - var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); - - var play = GetAdvancedValue(animConfig, 'play', false); - var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); - - anims.delay(delay); - anims.repeat(repeat); - anims.repeatDelay(repeatDelay); - anims.yoyo(yoyo); - - if (play) - { - anims.play(key, startFrame); - } - else if (delayedPlay > 0) - { - anims.delayedPlay(delayedPlay, key, startFrame); - } - else - { - anims.load(key); - } - } - - return sprite; -}; - -module.exports = BuildGameObjectAnimation; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -32350,7 +32655,7 @@ module.exports = Quad; /***/ }), -/* 144 */ +/* 143 */ /***/ (function(module, exports) { /** @@ -32436,7 +32741,7 @@ module.exports = ContainsArray; /***/ }), -/* 145 */ +/* 144 */ /***/ (function(module, exports) { /** @@ -32482,7 +32787,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 146 */ +/* 145 */ /***/ (function(module, exports) { /** @@ -32531,7 +32836,7 @@ module.exports = Contains; /***/ }), -/* 147 */ +/* 146 */ /***/ (function(module, exports) { /** @@ -32559,7 +32864,7 @@ module.exports = GetAspectRatio; /***/ }), -/* 148 */ +/* 147 */ /***/ (function(module, exports) { /** @@ -32611,7 +32916,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 149 */ +/* 148 */ /***/ (function(module, exports) { /** @@ -32652,7 +32957,7 @@ module.exports = GetURL; /***/ }), -/* 150 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32700,7 +33005,7 @@ module.exports = MergeXHRSettings; /***/ }), -/* 151 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32718,9 +33023,9 @@ var Composite = {}; module.exports = Composite; -var Events = __webpack_require__(164); +var Events = __webpack_require__(165); var Common = __webpack_require__(38); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); (function() { @@ -33390,7 +33695,7 @@ var Body = __webpack_require__(59); /***/ }), -/* 152 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33465,7 +33770,7 @@ module.exports = CalculateFacesAt; /***/ }), -/* 153 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33476,7 +33781,7 @@ module.exports = CalculateFacesAt; var Tile = __webpack_require__(44); var IsInLayerBounds = __webpack_require__(74); -var CalculateFacesAt = __webpack_require__(152); +var CalculateFacesAt = __webpack_require__(151); var SetTileCollision = __webpack_require__(43); /** @@ -33544,7 +33849,7 @@ module.exports = PutTileAt; /***/ }), -/* 154 */ +/* 153 */ /***/ (function(module, exports) { /** @@ -33582,7 +33887,7 @@ module.exports = SetLayerCollisionIndex; /***/ }), -/* 155 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33591,7 +33896,7 @@ module.exports = SetLayerCollisionIndex; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var LayerData = __webpack_require__(75); var MapData = __webpack_require__(76); var Tile = __webpack_require__(44); @@ -33674,7 +33979,7 @@ module.exports = Parse2DArray; /***/ }), -/* 156 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33683,10 +33988,10 @@ module.exports = Parse2DArray; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var Parse = __webpack_require__(346); -var Tilemap = __webpack_require__(354); +var Parse = __webpack_require__(348); +var Tilemap = __webpack_require__(356); /** * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When @@ -33760,7 +34065,7 @@ module.exports = ParseToTilemap; /***/ }), -/* 157 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33807,7 +34112,7 @@ module.exports = GetTargets; /***/ }), -/* 158 */ +/* 157 */ /***/ (function(module, exports) { /** @@ -33980,7 +34285,7 @@ module.exports = GetValueOp; /***/ }), -/* 159 */ +/* 158 */ /***/ (function(module, exports) { /** @@ -34022,7 +34327,7 @@ module.exports = TWEEN_DEFAULTS; /***/ }), -/* 160 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -34851,6 +35156,43 @@ var Tween = new Class({ return this; }, + /** + * Flags the Tween as being complete, whatever stage of progress it is at. + * + * If an onComplete callback has been defined it will automatically invoke it, unless a `delay` + * argument is provided, in which case the Tween will delay for that period of time before calling the callback. + * + * If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead. + * + * @method Phaser.Tweens.Tween#complete + * @since 3.2.0 + * + * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. + */ + complete: function (delay) + { + if (delay === undefined) { delay = 0; } + + if (delay) + { + this.countdown = delay; + this.state = TWEEN_CONST.COMPLETE_DELAY; + } + else + { + var onComplete = this.callbacks.onComplete; + + if (onComplete) + { + onComplete.params[1] = this.targets; + + onComplete.func.apply(onComplete.scope, onComplete.params); + } + + this.state = TWEEN_CONST.PENDING_REMOVE; + } + }, + /** * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. * @@ -35356,7 +35698,7 @@ module.exports = Tween; /***/ }), -/* 161 */ +/* 160 */ /***/ (function(module, exports) { /** @@ -35470,7 +35812,7 @@ module.exports = TweenData; /***/ }), -/* 162 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35500,7 +35842,7 @@ module.exports = Wrap; /***/ }), -/* 163 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35530,609 +35872,405 @@ module.exports = WrapDegrees; /***/ }), -/* 164 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { /** -* The `Matter.Events` module contains methods to fire and listen to events on other objects. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Events -*/ + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -var Events = {}; +var Class = __webpack_require__(0); +var ShaderSourceFS = __webpack_require__(516); +var TextureTintPipeline = __webpack_require__(164); -module.exports = Events; +var LIGHT_COUNT = 10; -var Common = __webpack_require__(38); +/** + * @classdesc + * [description] + * + * @class ForwardDiffuseLightPipeline + * @extends Phaser.Renderer.WebGL.TextureTintPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {object} config - [description] + */ +var ForwardDiffuseLightPipeline = new Class({ -(function() { + Extends: TextureTintPipeline, - /** - * Subscribes a callback function to the given object's `eventName`. - * @method on - * @param {} object - * @param {string} eventNames - * @param {function} callback - */ - Events.on = function(object, eventNames, callback) { - var names = eventNames.split(' '), - name; + initialize: - for (var i = 0; i < names.length; i++) { - name = names[i]; - object.events = object.events || {}; - object.events[name] = object.events[name] || []; - object.events[name].push(callback); - } + function ForwardDiffuseLightPipeline (config) + { + config.fragShader = ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); - return callback; - }; + TextureTintPipeline.call(this, config); + }, /** - * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. - * @method off - * @param {} object - * @param {string} eventNames - * @param {function} callback + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] */ - Events.off = function(object, eventNames, callback) { - if (!eventNames) { - object.events = {}; - return; - } - - // handle Events.off(object, callback) - if (typeof eventNames === 'function') { - callback = eventNames; - eventNames = Common.keys(object.events).join(' '); - } + onBind: function () + { + TextureTintPipeline.prototype.onBind.call(this); - var names = eventNames.split(' '); + var renderer = this.renderer; + var program = this.program; - for (var i = 0; i < names.length; i++) { - var callbacks = object.events[names[i]], - newCallbacks = []; + this.mvpUpdate(); - if (callback && callbacks) { - for (var j = 0; j < callbacks.length; j++) { - if (callbacks[j] !== callback) - newCallbacks.push(callbacks[j]); - } - } + renderer.setInt1(program, 'uNormSampler', 1); + renderer.setFloat2(program, 'uResolution', this.width, this.height); - object.events[names[i]] = newCallbacks; - } - }; + return this; + }, /** - * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. - * @method trigger - * @param {} object - * @param {string} eventNames - * @param {} event + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onRender + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] */ - Events.trigger = function(object, eventNames, event) { - var names, - name, - callbacks, - eventClone; - - if (object.events) { - if (!event) - event = {}; - - names = eventNames.split(' '); - - for (var i = 0; i < names.length; i++) { - name = names[i]; - callbacks = object.events[name]; + onRender: function (scene, camera) + { + var lightManager = scene.lights; - if (callbacks) { - eventClone = Common.clone(event, false); - eventClone.name = name; - eventClone.source = object; + lightManager.culledLights.length = 0; - for (var j = 0; j < callbacks.length; j++) { - callbacks[j].apply(object, [eventClone]); - } - } - } + if (lightManager.lights.length <= 0 || !lightManager.active) + { + return this; // If not visible lights just passthrough } - }; - -})(); - - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Constraint` module contains methods for creating and manipulating constraints. -* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). -* The stiffness of constraints can be modified to create springs or elastic. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Constraint -*/ - -var Constraint = {}; - -module.exports = Constraint; - -var Vertices = __webpack_require__(93); -var Vector = __webpack_require__(94); -var Sleeping = __webpack_require__(342); -var Bounds = __webpack_require__(95); -var Axes = __webpack_require__(856); -var Common = __webpack_require__(38); - -(function() { - - Constraint._warming = 0.4; - Constraint._torqueDampen = 1; - Constraint._minLength = 0.000001; - - /** - * Creates a new constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {constraint} constraint - */ - Constraint.create = function(options) { - var constraint = options; - - // if bodies defined but no points, use body centre - if (constraint.bodyA && !constraint.pointA) - constraint.pointA = { x: 0, y: 0 }; - if (constraint.bodyB && !constraint.pointB) - constraint.pointB = { x: 0, y: 0 }; - - // calculate static length using initial world space points - var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA, - initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB, - length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); - - constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; - // option defaults - constraint.id = constraint.id || Common.nextId(); - constraint.label = constraint.label || 'Constraint'; - constraint.type = 'constraint'; - constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); - constraint.damping = constraint.damping || 0; - constraint.angularStiffness = constraint.angularStiffness || 0; - constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; - constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; - constraint.plugin = {}; - - // render - var render = { - visible: true, - lineWidth: 2, - strokeStyle: '#ffffff', - type: 'line', - anchors: true - }; + var renderer = this.renderer; + var program = this.program; + var lights = scene.lights.cull(camera); + var lightCount = Math.min(lights.length, LIGHT_COUNT); + var cameraMatrix = camera.matrix; + var point = {x: 0, y: 0}; + var height = renderer.height; + var index; - if (constraint.length === 0 && constraint.stiffness > 0.1) { - render.type = 'pin'; - render.anchors = false; - } else if (constraint.stiffness < 0.9) { - render.type = 'spring'; + for (index = 0; index < LIGHT_COUNT; ++index) + { + renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); // reset lights } - constraint.render = Common.extend(render, constraint.render); - - return constraint; - }; - - /** - * Prepares for solving by constraint warming. - * @private - * @method preSolveAll - * @param {body[]} bodies - */ - Constraint.preSolveAll = function(bodies) { - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i], - impulse = body.constraintImpulse; + if (lightCount <= 0) { return this; } - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } + renderer.setFloat4(program, 'uCamera', camera.x, camera.y, camera.rotation, camera.zoom); + renderer.setFloat3(program, 'uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); - body.position.x += impulse.x; - body.position.y += impulse.y; - body.angle += impulse.angle; + for (index = 0; index < lightCount; ++index) + { + var light = lights[index]; + var lightName = 'uLights[' + index + '].'; + cameraMatrix.transformPoint(light.x, light.y, point); + renderer.setFloat2(program, lightName + 'position', point.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (point.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); + renderer.setFloat3(program, lightName + 'color', light.r, light.g, light.b); + renderer.setFloat1(program, lightName + 'intensity', light.intensity); + renderer.setFloat1(program, lightName + 'radius', light.radius); } - }; + + return this; + }, /** - * Solves all constraints in a list of collisions. - * @private - * @method solveAll - * @param {constraint[]} constraints - * @param {number} timeScale + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * */ - Constraint.solveAll = function(constraints, timeScale) { - // Solve fixed constraints first. - for (var i = 0; i < constraints.length; i += 1) { - var constraint = constraints[i], - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); + drawStaticTilemapLayer: function (tilemap, camera) + { + var normalTexture = tilemap.texture.dataSource[0]; - if (fixedA || fixedB) { - Constraint.solve(constraints[i], timeScale); - } + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawStaticTilemapLayer.call(this, tilemap, camera); } - - // Solve free constraints last. - for (i = 0; i < constraints.length; i += 1) { - constraint = constraints[i]; - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - - if (!fixedA && !fixedB) { - Constraint.solve(constraints[i], timeScale); - } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. StaticTilemapLayer rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawStaticTilemapLayer(tilemap, camera); } - }; + }, /** - * Solves a distance constraint with Gauss-Siedel method. - * @private - * @method solve - * @param {constraint} constraint - * @param {number} timeScale + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * */ - Constraint.solve = function(constraint, timeScale) { - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB; - - if (!bodyA && !bodyB) - return; + drawEmitterManager: function (emitterManager, camera) + { + var normalTexture = emitterManager.texture.dataSource[0]; - // update reference angle - if (bodyA && !bodyA.isStatic) { - Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); - constraint.angleA = bodyA.angle; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawEmitterManager.call(this, emitterManager, camera); } - - // update reference angle - if (bodyB && !bodyB.isStatic) { - Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); - constraint.angleB = bodyB.angle; + else + { + console.warn('Normal map texture missing for using Light2D pipeline. EmitterManager rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawEmitterManager(emitterManager, camera); } + }, - var pointAWorld = pointA, - pointBWorld = pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); - - if (!pointAWorld || !pointBWorld) - return; - - var delta = Vector.sub(pointAWorld, pointBWorld), - currentLength = Vector.magnitude(delta); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + drawBlitter: function (blitter, camera) + { + var normalTexture = blitter.texture.dataSource[0]; - // prevent singularity - if (currentLength < Constraint._minLength) { - currentLength = Constraint._minLength; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.drawBlitter.call(this, blitter, camera); } - - // solve distance constraint with Gauss-Siedel method - var difference = (currentLength - constraint.length) / currentLength, - stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, - force = Vector.mult(delta, difference * stiffness), - massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), - inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), - resistanceTotal = massTotal + inertiaTotal, - torque, - share, - normal, - normalVelocity, - relativeVelocity; - - if (constraint.damping) { - var zero = Vector.create(); - normal = Vector.div(delta, currentLength); - - relativeVelocity = Vector.sub( - bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero, - bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero - ); - - normalVelocity = Vector.dot(normal, relativeVelocity); + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Blitter rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.drawBlitter(blitter, camera); } + }, - if (bodyA && !bodyA.isStatic) { - share = bodyA.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyA.constraintImpulse.x -= force.x * share; - bodyA.constraintImpulse.y -= force.y * share; - - // apply forces - bodyA.position.x -= force.x * share; - bodyA.position.y -= force.y * share; - - // apply damping - if (constraint.damping) { - bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share; - bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share; - } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + */ + batchSprite: function (sprite, camera) + { + var normalTexture = sprite.texture.dataSource[0]; - // apply torque - torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness); - bodyA.constraintImpulse.angle -= torque; - bodyA.angle -= torque; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera); } - - if (bodyB && !bodyB.isStatic) { - share = bodyB.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyB.constraintImpulse.x += force.x * share; - bodyB.constraintImpulse.y += force.y * share; - - // apply forces - bodyB.position.x += force.x * share; - bodyB.position.y += force.y * share; - - // apply damping - if (constraint.damping) { - bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share; - bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share; - } - - // apply torque - torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness); - bodyB.constraintImpulse.angle += torque; - bodyB.angle += torque; + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Sprite rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchSprite(sprite, camera); } - - }; + }, /** - * Performs body updates required after solving constraints. - * @private - * @method postSolveAll - * @param {body[]} bodies + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * */ - Constraint.postSolveAll = function(bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - Sleeping.set(body, false); - - // update geometry and reset - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - - Vertices.translate(part.vertices, impulse); - - if (j > 0) { - part.position.x += impulse.x; - part.position.y += impulse.y; - } - - if (impulse.angle !== 0) { - Vertices.rotate(part.vertices, impulse.angle, body.position); - Axes.rotate(part.axes, impulse.angle); - if (j > 0) { - Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); - } - } - - Bounds.update(part.bounds, part.vertices, body.velocity); - } + batchMesh: function (mesh, camera) + { + var normalTexture = mesh.texture.dataSource[0]; - // dampen the cached impulse for warming next step - impulse.angle *= Constraint._warming; - impulse.x *= Constraint._warming; - impulse.y *= Constraint._warming; + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchMesh.call(this, mesh, camera); } - }; + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Mesh rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchMesh(mesh, camera); - /* - * - * Properties Documentation - * - */ + } + }, /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * [description] * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchBitmapText + * @since 3.0.0 * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage bodies. + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] * - * @property label - * @type string - * @default "Constraint" */ + batchBitmapText: function (bitmapText, camera) + { + var normalTexture = bitmapText.texture.dataSource[0]; - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchBitmapText.call(this, bitmapText, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. BitmapText rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchBitmapText(bitmapText, camera); + } + }, /** - * A flag that indicates if the constraint should be rendered. + * [description] * - * @property render.visible - * @type boolean - * @default true - */ - - /** - * A `Number` that defines the line width to use when rendering the constraint outline. - * A value of `0` means no outline will be rendered. + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicBitmapText + * @since 3.0.0 * - * @property render.lineWidth - * @type number - * @default 2 - */ - - /** - * A `String` that defines the stroke style to use when rendering the constraint outline. - * It is the same as when using a canvas, so it accepts CSS style property values. + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] * - * @property render.strokeStyle - * @type string - * @default a random colour */ + batchDynamicBitmapText: function (bitmapText, camera) + { + var normalTexture = bitmapText.texture.dataSource[0]; - /** - * A `String` that defines the constraint rendering type. - * The possible values are 'line', 'pin', 'spring'. - * An appropriate render type will be automatically chosen unless one is given in options. - * - * @property render.type - * @type string - * @default 'line' - */ + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchDynamicBitmapText.call(this, bitmapText, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. DynamicBitmapText rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchDynamicBitmapText(bitmapText, camera); + } + }, /** - * A `Boolean` that defines if the constraint's anchor points should be rendered. + * [description] * - * @property render.anchors - * @type boolean - * @default true - */ - - /** - * The first possible `Body` that this constraint is attached to. + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchText + * @since 3.0.0 * - * @property bodyA - * @type body - * @default null - */ - - /** - * The second possible `Body` that this constraint is attached to. + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] * - * @property bodyB - * @type body - * @default null */ + batchText: function (text, camera) + { + var normalTexture = text.texture.dataSource[0]; - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. - * - * @property pointA - * @type vector - * @default { x: 0, y: 0 } - */ + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchText.call(this, text, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. Text rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchText(text, camera); + } + }, /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * [description] * - * @property pointB - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. - * A value of `1` means the constraint should be very stiff. - * A value of `0.2` means the constraint acts like a soft spring. + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer + * @since 3.0.0 * - * @property stiffness - * @type number - * @default 1 - */ - - /** - * A `Number` that specifies the damping of the constraint, - * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. - * Damping will only be apparent when the constraint also has a very low `stiffness`. - * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. - * A value of `0` means the constraint will apply no damping. + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] * - * @property damping - * @type number - * @default 0 */ + batchDynamicTilemapLayer: function (tilemapLayer, camera) + { + var normalTexture = tilemapLayer.texture.dataSource[0]; - /** - * A `Number` that specifies the target resting length of the constraint. - * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * - * @property length - * @type number - */ + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchDynamicTilemapLayer.call(this, tilemapLayer, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. DynamicTilemapLayer rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchDynamicTilemapLayer(tilemapLayer, camera); + } + }, /** - * An object reserved for storing plugin-specific properties. + * [description] + * + * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchTileSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] * - * @property plugin - * @type {} */ + batchTileSprite: function (tileSprite, camera) + { + var normalTexture = tileSprite.texture.dataSource[0]; -})(); - - -/***/ }), -/* 166 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); + if (normalTexture) + { + this.renderer.setPipeline(this); + this.setTexture2D(normalTexture.glTexture, 1); + TextureTintPipeline.prototype.batchTileSprite.call(this, tileSprite, camera); + } + else + { + console.warn('Normal map texture missing for using Light2D pipeline. TileSprite rendered with default pipeline.'); + this.renderer.pipelines.TextureTintPipeline.batchTileSprite(tileSprite, camera); + } + } -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} +}); -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} +ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; -module.exports = g; +module.exports = ForwardDiffuseLightPipeline; /***/ }), -/* 167 */ -/***/ (function(module, exports) { +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -36140,2680 +36278,3265 @@ module.exports = g; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); +var ModelViewProjection = __webpack_require__(239); +var ShaderSourceFS = __webpack_require__(517); +var ShaderSourceVS = __webpack_require__(518); +var Utils = __webpack_require__(41); +var WebGLPipeline = __webpack_require__(103); + /** - * This is a slightly modified version of jQuery.isPlainObject. - * A plain object is an object whose internal class property is [object Object]. + * @classdesc + * [description] * - * @function Phaser.Utils.Object.IsPlainObject + * @class TextureTintPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 * - * @param {object} obj - The object to inspect. - * - * @return {boolean} `true` if the object is plain, otherwise `false`. + * @param {object} config - [description] */ -var IsPlainObject = function (obj) -{ - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if (typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) - { - return false; - } - - // Support: Firefox <20 - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects, ie. |window.location| - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 - try - { - if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) - { - return false; - } - } - catch (e) - { - return false; - } - - // If the function hasn't returned already, we're confident that - // |obj| is a plain object, created by {} or constructed with new Object - return true; -}; - -module.exports = IsPlainObject; - +var TextureTintPipeline = new Class({ -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { + Extends: WebGLPipeline, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + Mixins: [ + ModelViewProjection + ], -/** - * @namespace Phaser.Actions - */ + initialize: -module.exports = { + function TextureTintPipeline (config) + { + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapacity ? config.vertexCapacity : 6 * 2000), + + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2 + + Float32Array.BYTES_PER_ELEMENT * 2 + + Uint8Array.BYTES_PER_ELEMENT * 4), - Angle: __webpack_require__(376), - Call: __webpack_require__(377), - GetFirst: __webpack_require__(378), - GridAlign: __webpack_require__(379), - IncAlpha: __webpack_require__(397), - IncX: __webpack_require__(398), - IncXY: __webpack_require__(399), - IncY: __webpack_require__(400), - PlaceOnCircle: __webpack_require__(401), - PlaceOnEllipse: __webpack_require__(402), - PlaceOnLine: __webpack_require__(403), - PlaceOnRectangle: __webpack_require__(404), - PlaceOnTriangle: __webpack_require__(405), - PlayAnimation: __webpack_require__(406), - RandomCircle: __webpack_require__(407), - RandomEllipse: __webpack_require__(408), - RandomLine: __webpack_require__(409), - RandomRectangle: __webpack_require__(410), - RandomTriangle: __webpack_require__(411), - Rotate: __webpack_require__(412), - RotateAround: __webpack_require__(413), - RotateAroundDistance: __webpack_require__(414), - ScaleX: __webpack_require__(415), - ScaleXY: __webpack_require__(416), - ScaleY: __webpack_require__(417), - SetAlpha: __webpack_require__(418), - SetBlendMode: __webpack_require__(419), - SetDepth: __webpack_require__(420), - SetHitArea: __webpack_require__(421), - SetOrigin: __webpack_require__(422), - SetRotation: __webpack_require__(423), - SetScale: __webpack_require__(424), - SetScaleX: __webpack_require__(425), - SetScaleY: __webpack_require__(426), - SetTint: __webpack_require__(427), - SetVisible: __webpack_require__(428), - SetX: __webpack_require__(429), - SetXY: __webpack_require__(430), - SetY: __webpack_require__(431), - ShiftPosition: __webpack_require__(432), - Shuffle: __webpack_require__(433), - SmootherStep: __webpack_require__(434), - SmoothStep: __webpack_require__(435), - Spread: __webpack_require__(436), - ToggleVisible: __webpack_require__(437) + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + }, + { + name: 'inTexCoord', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: Float32Array.BYTES_PER_ELEMENT * 2 + }, + { + name: 'inTint', + size: 4, + type: config.renderer.gl.UNSIGNED_BYTE, + normalized: true, + offset: Float32Array.BYTES_PER_ELEMENT * 4 + } + ] + }); -}; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32 = new Uint32Array(this.vertexData); -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#maxQuads + * @type {integer} + * @default 2000 + * @since 3.0.0 + */ + this.maxQuads = 2000; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.TextureTintPipeline#batches + * @type {array} + * @since 3.1.0 + */ + this.batches = []; -var ALIGN_CONST = __webpack_require__(170); + this.mvpInit(); + }, -var AlignInMap = []; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#setTexture2D + * @since 3.1.0 + * + * @param {WebGLTexture} texture - [description] + * @param {integer} textureUnit - [description] + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + setTexture2D: function (texture, unit) + { + if (!texture) + { + return this; + } -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(171); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(172); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(173); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(174); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(176); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(177); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(178); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(179); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(180); + var batches = this.batches; -/** - * Takes given Game Object and aligns it so that it is positioned relative to the other. - * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. - * - * @function Phaser.Display.Align.In.QuickSet - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var QuickSet = function (child, alignIn, position, offsetX, offsetY) -{ - return AlignInMap[position](child, alignIn, offsetX, offsetY); -}; + if (batches.length === 0) + { + this.pushBatch(); + } -module.exports = QuickSet; + var batch = batches[batches.length - 1]; + if (unit > 0) + { + if (batch.textures[unit - 1] && + batch.textures[unit - 1] !== texture) + { + this.pushBatch(); + } -/***/ }), -/* 170 */ -/***/ (function(module, exports) { + batches[batches.length - 1].textures[unit - 1] = texture; + } + else + { + if (batch.texture !== null && + batch.texture !== texture) + { + this.pushBatch(); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + batches[batches.length - 1].texture = texture; + } -var ALIGN_CONST = { + return this; + }, /** - * A constant representing a top-left alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_LEFT - * @since 3.0.0 - * @type {integer} - */ - TOP_LEFT: 0, - - /** - * A constant representing a top-center alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_CENTER - * @since 3.0.0 - * @type {integer} - */ - TOP_CENTER: 1, - - /** - * A constant representing a top-right alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_RIGHT - * @since 3.0.0 - * @type {integer} - */ - TOP_RIGHT: 2, + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#pushBatch + * @since 3.1.0 + */ + pushBatch: function () + { + var batch = { + first: this.vertexCount, + texture: null, + textures: [] + }; - /** - * A constant representing a left-top alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_TOP - * @since 3.0.0 - * @type {integer} - */ - LEFT_TOP: 3, + this.batches.push(batch); + }, /** - * A constant representing a left-center alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_CENTER - * @since 3.0.0 - * @type {integer} - */ - LEFT_CENTER: 4, + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#flush + * @since 3.1.0 + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} This Pipeline. + */ + flush: function () + { + if (this.flushLocked) + { + return this; + } - /** - * A constant representing a left-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_BOTTOM - * @since 3.0.0 - * @type {integer} - */ - LEFT_BOTTOM: 5, + this.flushLocked = true; - /** - * A constant representing a center alignment or position. - * @constant - * @name Phaser.Display.Align.CENTER - * @since 3.0.0 - * @type {integer} - */ - CENTER: 6, + var gl = this.gl; + var renderer = this.renderer; + var vertexCount = this.vertexCount; + var topology = this.topology; + var vertexSize = this.vertexSize; + var batches = this.batches; + var batchCount = batches.length; + var batchVertexCount = 0; + var batch = null; + var batchNext; + var textureIndex; + var nTexture; - /** - * A constant representing a right-top alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_TOP - * @since 3.0.0 - * @type {integer} - */ - RIGHT_TOP: 7, + if (batchCount === 0 || vertexCount === 0) + { + this.flushLocked = false; + return this; + } - /** - * A constant representing a right-center alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_CENTER - * @since 3.0.0 - * @type {integer} - */ - RIGHT_CENTER: 8, + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - /** - * A constant representing a right-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_BOTTOM - * @since 3.0.0 - * @type {integer} - */ - RIGHT_BOTTOM: 9, + for (var index = 0; index < batches.length - 1; ++index) + { + batch = batches[index]; + batchNext = batches[index + 1]; - /** - * A constant representing a bottom-left alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_LEFT - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_LEFT: 10, + if (batch.textures.length > 0) + { + for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) + { + nTexture = batch.textures[textureIndex]; - /** - * A constant representing a bottom-center alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_CENTER - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_CENTER: 11, + if (nTexture) + { + renderer.setTexture2D(nTexture, 1 + textureIndex); + } + } - /** - * A constant representing a bottom-right alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_RIGHT - * @since 3.0.0 - * @type {integer} - */ - BOTTOM_RIGHT: 12 + gl.activeTexture(gl.TEXTURE0); + } -}; + batchVertexCount = batchNext.first - batch.first; -module.exports = ALIGN_CONST; + if (batch.texture === null || batchVertexCount <= 0) { continue; } + renderer.setTexture2D(batch.texture, 0); + gl.drawArrays(topology, batch.first, batchVertexCount); + } -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { + // Left over data + batch = batches[batches.length - 1]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (batch.textures.length > 0) + { + for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) + { + nTexture = batch.textures[textureIndex]; -var GetBottom = __webpack_require__(24); -var GetCenterX = __webpack_require__(46); -var SetBottom = __webpack_require__(25); -var SetCenterX = __webpack_require__(47); + if (nTexture) + { + renderer.setTexture2D(nTexture, 1 + textureIndex); + } + } -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. - * - * @function Phaser.Display.Align.In.BottomCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + gl.activeTexture(gl.TEXTURE0); + } - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); + batchVertexCount = vertexCount - batch.first; - return gameObject; -}; + if (batch.texture && batchVertexCount > 0) + { + renderer.setTexture2D(batch.texture, 0); + gl.drawArrays(topology, batch.first, batchVertexCount); + } -module.exports = BottomCenter; + this.vertexCount = 0; + batches.length = 0; + this.pushBatch(); + this.flushLocked = false; + return this; + }, -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + onBind: function () + { + WebGLPipeline.prototype.onBind.call(this); + this.mvpUpdate(); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this.batches.length === 0) + { + this.pushBatch(); + } -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); + return this; + }, -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. - * - * @function Phaser.Display.Align.In.BottomLeft - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] + */ + resize: function (width, height, resolution) + { + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); + return this; + }, - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawStaticTilemapLayer: function (tilemap) + { + if (tilemap.vertexCount > 0) + { + var pipelineVertexBuffer = this.vertexBuffer; + var gl = this.gl; + var renderer = this.renderer; + var frame = tilemap.tileset.image.get(); - return gameObject; -}; + if (renderer.currentPipeline && + renderer.currentPipeline.vertexCount > 0) + { + renderer.flush(); + } -module.exports = BottomLeft; + this.vertexBuffer = tilemap.vertexBuffer; + renderer.setPipeline(this); + renderer.setTexture2D(frame.source.glTexture, 0); + gl.drawArrays(this.topology, 0, tilemap.vertexCount); + this.vertexBuffer = pipelineVertexBuffer; + } + this.viewIdentity(); + this.modelIdentity(); + }, -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawEmitterManager: function (emitterManager, camera) + { + this.renderer.setPipeline(this); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var roundPixels = this.renderer.config.roundPixels; + var emitters = emitterManager.emitters.list; + var emitterCount = emitters.length; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var renderer = this.renderer; + var maxQuads = this.maxQuads; + var cameraScrollX = camera.scrollX; + var cameraScrollY = camera.scrollY; + var cameraMatrix = camera.matrix.matrix; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var sin = Math.sin; + var cos = Math.cos; + var vertexComponentCount = this.vertexComponentCount; + var vertexCapacity = this.vertexCapacity; + var texture = emitterManager.defaultFrame.source.glTexture; -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); + this.setTexture2D(texture, 0); + + for (var emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex) + { + var emitter = emitters[emitterIndex]; + var particles = emitter.alive; + var aliveLength = particles.length; + var batchCount = Math.ceil(aliveLength / maxQuads); + var particleOffset = 0; + var scrollX = cameraScrollX * emitter.scrollFactorX; + var scrollY = cameraScrollY * emitter.scrollFactorY; -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. - * - * @function Phaser.Display.Align.In.BottomRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (!emitter.visible || aliveLength === 0) + { + continue; + } - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); + renderer.setBlendMode(emitter.blendMode); - return gameObject; -}; + if (this.vertexCount >= vertexCapacity) + { + this.flush(); + this.setTexture2D(texture, 0); + } -module.exports = BottomRight; + for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) + { + var batchSize = Math.min(aliveLength, maxQuads); + for (var index = 0; index < batchSize; ++index) + { + var particle = particles[particleOffset + index]; -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { + if (particle.alpha <= 0) + { + continue; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var frame = particle.frame; + var uvs = frame.uvs; + var x = -(frame.halfWidth); + var y = -(frame.halfHeight); + var color = particle.color; + var xw = x + frame.width; + var yh = y + frame.height; + var sr = sin(particle.rotation); + var cr = cos(particle.rotation); + var sra = cr * particle.scaleX; + var srb = -sr * particle.scaleX; + var src = sr * particle.scaleY; + var srd = cr * particle.scaleY; + var sre = particle.x - scrollX * particle.scrollFactorX; + var srf = particle.y - scrollY * particle.scrollFactorY; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = this.vertexCount * vertexComponentCount; -var CenterOn = __webpack_require__(175); -var GetCenterX = __webpack_require__(46); -var GetCenterY = __webpack_require__(49); + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } -/** - * Takes given Game Object and aligns it so that it is positioned in the center of the other. - * - * @function Phaser.Display.Align.In.Center - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var Center = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = color; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = color; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = color; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = color; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = color; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = color; - CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); + this.vertexCount += 6; + } - return gameObject; -}; + particleOffset += batchSize; + aliveLength -= batchSize; -module.exports = Center; + if (this.vertexCount >= vertexCapacity) + { + this.flush(); + this.setTexture2D(texture, 0); + } + } + } + + this.setTexture2D(texture, 0); + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawBlitter: function (blitter, camera) + { + this.renderer.setPipeline(this); -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var list = blitter.getRenderList(); + var length = list.length; + var cameraMatrix = camera.matrix.matrix; + var a = cameraMatrix[0]; + var b = cameraMatrix[1]; + var c = cameraMatrix[2]; + var d = cameraMatrix[3]; + var e = cameraMatrix[4]; + var f = cameraMatrix[5]; + var cameraScrollX = camera.scrollX * blitter.scrollFactorX; + var cameraScrollY = camera.scrollY * blitter.scrollFactorY; + var batchCount = Math.ceil(length / this.maxQuads); + var batchOffset = 0; + var blitterX = blitter.x - cameraScrollX; + var blitterY = blitter.y - cameraScrollY; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) + { + var batchSize = Math.min(length, this.maxQuads); -var SetCenterX = __webpack_require__(47); -var SetCenterY = __webpack_require__(48); + for (var index = 0; index < batchSize; ++index) + { + var bob = list[batchOffset + index]; + var frame = bob.frame; + var alpha = bob.alpha; + var tint = getTint(0xffffff, alpha); + var uvs = frame.uvs; + var flipX = bob.flipX; + var flipY = bob.flipY; + var width = frame.width * (flipX ? -1.0 : 1.0); + var height = frame.height * (flipY ? -1.0 : 1.0); + var x = blitterX + bob.x + frame.x + (frame.width * ((flipX) ? 1.0 : 0.0)); + var y = blitterY + bob.y + frame.y + (frame.height * ((flipY) ? 1.0 : 0.0)); + var xw = x + width; + var yh = y + height; + var tx0 = x * a + y * c + e; + var ty0 = x * b + y * d + f; + var tx1 = xw * a + yh * c + e; + var ty1 = xw * b + yh * d + f; + + // Bind Texture if texture wasn't bound. + // This needs to be here because of multiple + // texture atlas. + this.setTexture2D(frame.texture.source[frame.sourceIndex].glTexture, 0); -/** - * Positions the Game Object so that it is centered on the given coordinates. - * - * @function Phaser.Display.Bounds.CenterOn - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} x - The horizontal coordinate to position the Game Object on. - * @param {number} y - The vertical coordinate to position the Game Object on. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. - */ -var CenterOn = function (gameObject, x, y) -{ - SetCenterX(gameObject, x); + var vertexOffset = this.vertexCount * this.vertexComponentCount; - return SetCenterY(gameObject, y); -}; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + } + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = tint; + vertexViewF32[vertexOffset + 5] = tx0; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = tint; + vertexViewF32[vertexOffset + 10] = tx1; + vertexViewF32[vertexOffset + 11] = ty1; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = tint; + vertexViewF32[vertexOffset + 20] = tx1; + vertexViewF32[vertexOffset + 21] = ty1; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = tint; + vertexViewF32[vertexOffset + 25] = tx1; + vertexViewF32[vertexOffset + 26] = ty0; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = tint; -module.exports = CenterOn; + this.vertexCount += 6; + if (this.vertexCount >= this.vertexCapacity) + { + this.flush(); + } + } -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { + batchOffset += batchSize; + length -= batchSize; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this.vertexCount >= this.vertexCapacity) + { + this.flush(); + } + } + }, -var GetCenterY = __webpack_require__(49); -var GetLeft = __webpack_require__(26); -var SetCenterY = __webpack_require__(48); -var SetLeft = __webpack_require__(27); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchSprite: function (sprite, camera) + { + this.renderer.setPipeline(this); -/** - * Takes given Game Object and aligns it so that it is positioned in the left center of the other. - * - * @function Phaser.Display.Align.In.LeftCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var frame = sprite.frame; + var texture = frame.texture.source[frame.sourceIndex].glTexture; + var forceFlipY = (texture.isRenderTexture ? true : false); + var flipX = sprite.flipX; + var flipY = sprite.flipY ^ forceFlipY; + var uvs = frame.uvs; + var width = frame.width * (flipX ? -1.0 : 1.0); + var height = frame.height * (flipY ? -1.0 : 1.0); + var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0)); + var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0)); + var xw = (roundPixels ? (x|0) : x) + width; + var yh = (roundPixels ? (y|0) : y) + height; + var translateX = sprite.x - camera.scrollX * sprite.scrollFactorX; + var translateY = sprite.y - camera.scrollY * sprite.scrollFactorY; + var scaleX = sprite.scaleX; + var scaleY = sprite.scaleY; + var rotation = -sprite.rotation; + var alphaTL = sprite._alphaTL; + var alphaTR = sprite._alphaTR; + var alphaBL = sprite._alphaBL; + var alphaBR = sprite._alphaBR; + var tintTL = sprite._tintTL; + var tintTR = sprite._tintTR; + var tintBL = sprite._tintBL; + var tintBR = sprite._tintBR; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vTintTL = getTint(tintTL, alphaTL); + var vTintTR = getTint(tintTR, alphaTR); + var vTintBL = getTint(tintBL, alphaBL); + var vTintBR = getTint(tintBR, alphaBR); + var vertexOffset = 0; - return gameObject; -}; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } -module.exports = LeftCenter; + this.setTexture2D(texture, 0); + vertexOffset = this.vertexCount * this.vertexComponentCount; -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = uvs.x0; + vertexViewF32[vertexOffset + 3] = uvs.y0; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = uvs.x1; + vertexViewF32[vertexOffset + 8] = uvs.y1; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = uvs.x2; + vertexViewF32[vertexOffset + 13] = uvs.y2; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = uvs.x0; + vertexViewF32[vertexOffset + 18] = uvs.y0; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = uvs.x2; + vertexViewF32[vertexOffset + 23] = uvs.y2; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = uvs.x3; + vertexViewF32[vertexOffset + 28] = uvs.y3; + vertexViewU32[vertexOffset + 29] = vTintTR; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.vertexCount += 6; + }, -var GetCenterY = __webpack_require__(49); -var GetRight = __webpack_require__(28); -var SetCenterY = __webpack_require__(48); -var SetRight = __webpack_require__(29); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchMesh: function (mesh, camera) + { + var vertices = mesh.vertices; + var length = vertices.length; + var vertexCount = (length / 2)|0; -/** - * Takes given Game Object and aligns it so that it is positioned in the right center of the other. - * - * @function Phaser.Display.Align.In.RightCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var RightCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + this.renderer.setPipeline(this); - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + if (this.vertexCount + vertexCount > this.vertexCapacity) + { + this.flush(); + } - return gameObject; -}; + var roundPixels = this.renderer.config.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var uvs = mesh.uv; + var colors = mesh.colors; + var alphas = mesh.alphas; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var frame = mesh.frame; + var texture = mesh.texture.source[frame.sourceIndex].glTexture; + var translateX = mesh.x - camera.scrollX * mesh.scrollFactorX; + var translateY = mesh.y - camera.scrollY * mesh.scrollFactorY; + var scaleX = mesh.scaleX; + var scaleY = mesh.scaleY; + var rotation = -mesh.rotation; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var vertexOffset = 0; -module.exports = RightCenter; + this.setTexture2D(texture, 0); + vertexOffset = this.vertexCount * this.vertexComponentCount; -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { + for (var index = 0, index0 = 0; index < length; index += 2) + { + var x = vertices[index + 0]; + var y = vertices[index + 1]; + var tx = x * mva + y * mvc + mve; + var ty = x * mvb + y * mvd + mvf; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (roundPixels) + { + tx |= 0; + ty |= 0; + } -var GetCenterX = __webpack_require__(46); -var GetTop = __webpack_require__(30); -var SetCenterX = __webpack_require__(47); -var SetTop = __webpack_require__(31); + vertexViewF32[vertexOffset + 0] = tx; + vertexViewF32[vertexOffset + 1] = ty; + vertexViewF32[vertexOffset + 2] = uvs[index + 0]; + vertexViewF32[vertexOffset + 3] = uvs[index + 1]; + vertexViewU32[vertexOffset + 4] = getTint(colors[index0], alphas[index0]); -/** - * Takes given Game Object and aligns it so that it is positioned in the top center of the other. - * - * @function Phaser.Display.Align.In.TopCenter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + vertexOffset += 5; + index0 += 1; + } - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + this.vertexCount += vertexCount; + }, - return gameObject; -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchBitmapText: function (bitmapText, camera) + { + this.renderer.setPipeline(this); -module.exports = TopCenter; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + var roundPixels = this.renderer.config.roundPixels; + var text = bitmapText.text; + var textLength = text.length; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var cameraWidth = camera.width + 50; + var cameraHeight = camera.height + 50; + var cameraX = -50; + var cameraY = -50; + var frame = bitmapText.frame; + var textureSource = bitmapText.texture.source[frame.sourceIndex]; + var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; + var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; + var fontData = bitmapText.fontData; + var lineHeight = fontData.lineHeight; + var scale = (bitmapText.fontSize / fontData.size); + var chars = fontData.chars; + var alpha = bitmapText.alpha; + var vTintTL = getTint(bitmapText._tintTL, alpha); + var vTintTR = getTint(bitmapText._tintTR, alpha); + var vTintBL = getTint(bitmapText._tintBL, alpha); + var vTintBR = getTint(bitmapText._tintBR, alpha); + var srcX = bitmapText.x; + var srcY = bitmapText.y; + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = textureSource.width; + var textureHeight = textureSource.height; + var texture = textureSource.glTexture; + var xAdvance = 0; + var yAdvance = 0; + var indexCount = 0; + var charCode = 0; + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + var x = 0; + var y = 0; + var xw = 0; + var yh = 0; -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { + var tx0; + var ty0; + var tx1; + var ty1; + var tx2; + var ty2; + var tx3; + var ty3; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); - -/** - * Takes given Game Object and aligns it so that it is positioned in the top left of the other. - * - * @function Phaser.Display.Align.In.TopLeft - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); - - return gameObject; -}; - -module.exports = TopLeft; - - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); + var umin = 0; + var umax = 0; + var vmin = 0; + var vmax = 0; + var lastGlyph = null; + var lastCharCode = 0; + var translateX = (srcX - cameraScrollX) + frame.x; + var translateY = (srcY - cameraScrollY) + frame.y; + var rotation = -bitmapText.rotation; + var scaleX = bitmapText.scaleX; + var scaleY = bitmapText.scaleY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var vertexOffset = 0; -/** - * Takes given Game Object and aligns it so that it is positioned in the top right of the other. - * - * @function Phaser.Display.Align.In.TopRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + this.setTexture2D(texture, 0); - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + for (var index = 0; index < textLength; ++index) + { + charCode = text.charCodeAt(index); - return gameObject; -}; + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } -module.exports = TopRight; + glyph = chars[charCode]; + if (!glyph) + { + continue; + } -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + glyphW = glyph.width; + glyphH = glyph.height; -var CircumferencePoint = __webpack_require__(104); -var FromPercent = __webpack_require__(64); -var MATH_CONST = __webpack_require__(16); -var Point = __webpack_require__(5); + x = (indexCount + glyph.xOffset + xAdvance) * scale; + y = (glyph.yOffset + yAdvance) * scale; -/** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @function Phaser.Geom.Circle.GetPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. - * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. - * @param {Phaser.Geom.Point|object} [out] - An object to store the return values in. If not given a Point object will be created. - * - * @return {Phaser.Geom.Point|object} A Point, or point-like object, containing the coordinates of the point around the circle. - */ -var GetPoint = function (circle, position, out) -{ - if (out === undefined) { out = new Point(); } + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } - var angle = FromPercent(position, 0, MATH_CONST.PI2); + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; - return CircumferencePoint(circle, angle, out); -}; + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } -module.exports = GetPoint; + x -= bitmapText.displayOriginX; + y -= bitmapText.displayOriginY; + xw = x + glyphW * scale; + yh = y + glyphH * scale; + tx0 = x * mva + y * mvc + mve; + ty0 = x * mvb + y * mvd + mvf; + tx1 = x * mva + yh * mvc + mve; + ty1 = x * mvb + yh * mvd + mvf; + tx2 = xw * mva + yh * mvc + mve; + ty2 = xw * mvb + yh * mvd + mvf; + tx3 = xw * mva + y * mvc + mve; + ty3 = xw * mvb + y * mvd + mvf; -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { + umin = glyphX / textureWidth; + umax = (glyphX + glyphW) / textureWidth; + vmin = glyphY / textureHeight; + vmax = (glyphY + glyphH) / textureHeight; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if ((tx0 < cameraX || tx0 > cameraWidth || ty0 < cameraY || ty0 > cameraHeight) && + (tx1 < cameraX || tx1 > cameraWidth || ty1 < cameraY || ty1 > cameraHeight) && + (tx2 < cameraX || tx2 > cameraWidth || ty2 < cameraY || ty2 > cameraHeight) && + (tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight)) + { + continue; + } -var Circumference = __webpack_require__(183); -var CircumferencePoint = __webpack_require__(104); -var FromPercent = __webpack_require__(64); -var MATH_CONST = __webpack_require__(16); + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + vertexOffset = this.vertexCount * this.vertexComponentCount; -/** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, - * based on the given quantity or stepRate values. - * - * @function Phaser.Geom.Circle.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. - * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. - */ -var GetPoints = function (circle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity) - { - quantity = Circumference(circle) / stepRate; - } + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = umin; + vertexViewF32[vertexOffset + 3] = vmin; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = umin; + vertexViewF32[vertexOffset + 8] = vmax; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = umax; + vertexViewF32[vertexOffset + 13] = vmax; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = umin; + vertexViewF32[vertexOffset + 18] = vmin; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = umax; + vertexViewF32[vertexOffset + 23] = vmax; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = umax; + vertexViewF32[vertexOffset + 28] = vmin; + vertexViewU32[vertexOffset + 29] = vTintTR; + + this.vertexCount += 6; + } + }, - for (var i = 0; i < quantity; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchDynamicBitmapText: function (bitmapText, camera) { - var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - - out.push(CircumferencePoint(circle, angle)); - } - - return out; -}; - -module.exports = GetPoints; - - -/***/ }), -/* 183 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Returns the circumference of the given Circle. - * - * @function Phaser.Geom.Circle.Circumference - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. - * - * @return {number} The circumference of the Circle. - */ -var Circumference = function (circle) -{ - return 2 * (Math.PI * circle.radius); -}; - -module.exports = Circumference; - + this.renderer.setPipeline(this); -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var roundPixels = this.renderer.config.roundPixels; + var displayCallback = bitmapText.displayCallback; + var text = bitmapText.text; + var textLength = text.length; + var getTint = Utils.getTintAppendFloatAlpha; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var renderer = this.renderer; + var cameraMatrix = camera.matrix.matrix; + var frame = bitmapText.frame; + var textureSource = bitmapText.texture.source[frame.sourceIndex]; + var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; + var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; + var scrollX = bitmapText.scrollX; + var scrollY = bitmapText.scrollY; + var fontData = bitmapText.fontData; + var lineHeight = fontData.lineHeight; + var scale = (bitmapText.fontSize / fontData.size); + var chars = fontData.chars; + var alpha = bitmapText.alpha; + var vTintTL = getTint(bitmapText._tintTL, alpha); + var vTintTR = getTint(bitmapText._tintTR, alpha); + var vTintBL = getTint(bitmapText._tintBL, alpha); + var vTintBR = getTint(bitmapText._tintBR, alpha); + var srcX = bitmapText.x; + var srcY = bitmapText.y; + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = textureSource.width; + var textureHeight = textureSource.height; + var texture = textureSource.glTexture; + var xAdvance = 0; + var yAdvance = 0; + var indexCount = 0; + var charCode = 0; + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + var x = 0; + var y = 0; + var xw = 0; + var tx0; + var ty0; + var tx1; + var ty1; + var tx2; + var ty2; + var tx3; + var ty3; + var yh = 0; + var umin = 0; + var umax = 0; + var vmin = 0; + var vmax = 0; + var lastGlyph = null; + var lastCharCode = 0; + var translateX = srcX + frame.x; + var translateY = srcY + frame.y; + var rotation = -bitmapText.rotation; + var scaleX = bitmapText.scaleX; + var scaleY = bitmapText.scaleY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var crop = (bitmapText.cropWidth > 0 || bitmapText.cropHeight > 0); + var uta, utb, utc, utd, ute, utf; + var vertexOffset = 0; -var GetPoint = __webpack_require__(106); -var Perimeter = __webpack_require__(78); + this.setTexture2D(texture, 0); -// Return an array of points from the perimeter of the rectangle -// each spaced out based on the quantity or step required + if (crop) + { + renderer.pushScissor( + bitmapText.x, + bitmapText.y, + bitmapText.cropWidth * bitmapText.scaleX, + bitmapText.cropHeight * bitmapText.scaleY + ); + } -/** - * [description] - * - * @function Phaser.Geom.Rectangle.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectangle - [description] - * @param {number} step - [description] - * @param {integer} quantity - [description] - * @param {array} [out] - [description] - * - * @return {Phaser.Geom.Point[]} [description] - */ -var GetPoints = function (rectangle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + for (var index = 0; index < textLength; ++index) + { + scale = (bitmapText.fontSize / bitmapText.fontData.size); + rotation = 0; - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity) - { - quantity = Perimeter(rectangle) / stepRate; - } + charCode = text.charCodeAt(index); - for (var i = 0; i < quantity; i++) - { - var position = i / quantity; + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } - out.push(GetPoint(rectangle, position)); - } + glyph = chars[charCode]; - return out; -}; + if (!glyph) + { + continue; + } -module.exports = GetPoints; + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; + glyphW = glyph.width; + glyphH = glyph.height; + + x = (indexCount + glyph.xOffset + xAdvance) - scrollX; + y = (glyph.yOffset + yAdvance) - scrollY; -/***/ }), -/* 185 */ -/***/ (function(module, exports) { + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; -/** - * [description] - * - * @function Phaser.Math.RotateAround - * @since 3.0.0 - * - * @param {Phaser.Geom.Point|object} point - [description] - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} angle - [description] - * - * @return {Phaser.Geom.Point} [description] - */ -var RotateAround = function (point, x, y, angle) -{ - var c = Math.cos(angle); - var s = Math.sin(angle); + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } - var tx = point.x - x; - var ty = point.y - y; + if (displayCallback) + { + var output = displayCallback({ + color: 0, + tint: { + topLeft: vTintTL, + topRight: vTintTR, + bottomLeft: vTintBL, + bottomRight: vTintBR + }, + index: index, + charCode: charCode, + x: x, + y: y, + scale: scale, + rotation: 0, + data: glyph.data + }); - point.x = tx * c - ty * s + x; - point.y = tx * s + ty * c + y; + x = output.x; + y = output.y; + scale = output.scale; + rotation = output.rotation; - return point; -}; + if (output.color) + { + vTintTL = output.color; + vTintTR = output.color; + vTintBL = output.color; + vTintBR = output.color; + } + else + { + vTintTL = output.tint.topLeft; + vTintTR = output.tint.topRight; + vTintBL = output.tint.bottomLeft; + vTintBR = output.tint.bottomRight; + } -module.exports = RotateAround; + vTintTL = getTint(vTintTL, alpha); + vTintTR = getTint(vTintTR, alpha); + vTintBL = getTint(vTintBL, alpha); + vTintBR = getTint(vTintBR, alpha); + } + x -= bitmapText.displayOriginX; + y -= bitmapText.displayOriginY; + x *= scale; + y *= scale; + x -= cameraScrollX; + y -= cameraScrollY; -/***/ }), -/* 186 */ -/***/ (function(module, exports) { + sr = Math.sin(-rotation); + cr = Math.cos(-rotation); + uta = cr * scale; + utb = -sr * scale; + utc = sr * scale; + utd = cr * scale; + ute = x; + utf = y; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + sra = uta * mva + utb * mvc; + srb = uta * mvb + utb * mvd; + src = utc * mva + utd * mvc; + srd = utc * mvb + utd * mvd; + sre = ute * mva + utf * mvc + mve; + srf = ute * mvb + utf * mvd + mvf; -/** - * Provides methods used for setting the WebGL rendering pipeline of a Game Object. - * - * @name Phaser.GameObjects.Components.Pipeline - * @webglOnly - * @since 3.0.0 - */ + xw = glyphW; + yh = glyphH; + tx0 = sre; + ty0 = srf; + tx1 = yh * src + sre; + ty1 = yh * srd + srf; + tx2 = xw * sra + yh * src + sre; + ty2 = xw * srb + yh * srd + srf; + tx3 = xw * sra + sre; + ty3 = xw * srb + srf; -var Pipeline = { - - /** - * [description] - * - * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - defaultPipeline: null, + umin = glyphX / textureWidth; + umax = (glyphX + glyphW) / textureWidth; + vmin = glyphY / textureHeight; + vmax = (glyphY + glyphH) / textureHeight; - /** - * [description] - * - * @name Phaser.GameObjects.Components.Pipeline#pipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - pipeline: null, + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + vertexOffset = this.vertexCount * this.vertexComponentCount; - /** - * Sets the initial WebGL Pipeline of this Game Object. - * This should only be called during the instantiation of the Game Object. - * - * @method Phaser.GameObjects.Components.Pipeline#initPipeline - * @webglOnly - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline to set on this Game Object. - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - initPipeline: function (pipelineName) - { - var renderer = this.scene.sys.game.renderer; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } - if (renderer.gl && renderer.hasPipeline(pipelineName)) - { - this.defaultPipeline = renderer.getPipeline(pipelineName); - this.pipeline = this.defaultPipeline; - return true; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = umin; + vertexViewF32[vertexOffset + 3] = vmin; + vertexViewU32[vertexOffset + 4] = vTintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = umin; + vertexViewF32[vertexOffset + 8] = vmax; + vertexViewU32[vertexOffset + 9] = vTintBL; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = umax; + vertexViewF32[vertexOffset + 13] = vmax; + vertexViewU32[vertexOffset + 14] = vTintBR; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = umin; + vertexViewF32[vertexOffset + 18] = vmin; + vertexViewU32[vertexOffset + 19] = vTintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = umax; + vertexViewF32[vertexOffset + 23] = vmax; + vertexViewU32[vertexOffset + 24] = vTintBR; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = umax; + vertexViewF32[vertexOffset + 28] = vmin; + vertexViewU32[vertexOffset + 29] = vTintTR; + + this.vertexCount += 6; } - return false; - }, - - /** - * Sets the active WebGL Pipeline of this Game Object. - * - * @method Phaser.GameObjects.Components.Pipeline#setPipeline - * @webglOnly - * @since 3.0.0 - * - * @param {string} pipelineName - The name of the pipeline to set on this Game Object. - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - setPipeline: function (pipelineName) - { - var renderer = this.scene.sys.game.renderer; - - if (renderer.gl && renderer.hasPipeline(pipelineName)) + if (crop) { - this.pipeline = renderer.getPipeline(pipelineName); - return true; + renderer.popScissor(); } - - return false; - }, - - /** - * Resets the WebGL Pipeline of this Game Object back to the default it was created with. - * - * @method Phaser.GameObjects.Components.Pipeline#resetPipeline - * @webglOnly - * @since 3.0.0 - * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. - */ - resetPipeline: function () - { - this.pipeline = this.defaultPipeline; - return (this.pipeline !== null); - }, - - /** - * Gets the name of the WebGL Pipeline this Game Object is currently using. - * - * @method Phaser.GameObjects.Components.Pipeline#getPipelineName - * @webglOnly - * @since 3.0.0 - * - * @return {string} The string-based name of the pipeline being used by this Game Object. - */ - getPipelineName: function () - { - return this.pipeline.name; - } - -}; - -module.exports = Pipeline; - - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * [description] - * - * @class TransformMatrix - * @memberOf Phaser.GameObjects.Components - * @constructor - * @since 3.0.0 - * - * @param {number} [a=1] - [description] - * @param {number} [b=0] - [description] - * @param {number} [c=0] - [description] - * @param {number} [d=1] - [description] - * @param {number} [tx=0] - [description] - * @param {number} [ty=0] - [description] - */ -var TransformMatrix = new Class({ - - initialize: - - function TransformMatrix (a, b, c, d, tx, ty) - { - if (a === undefined) { a = 1; } - if (b === undefined) { b = 0; } - if (c === undefined) { c = 0; } - if (d === undefined) { d = 1; } - if (tx === undefined) { tx = 0; } - if (ty === undefined) { ty = 0; } - - /** - * [description] - * - * @name Phaser.GameObjects.Components.TransformMatrix#matrix - * @type {Float32Array} - * @since 3.0.0 - */ - this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); - - /** - * [description] - * - * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix - * @type {object} - * @since 3.0.0 - */ - this.decomposedMatrix = { - translateX: 0, - translateY: 0, - scaleX: 1, - scaleY: 1, - rotation: 0 - }; }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchText * @since 3.0.0 * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - loadIdentity: function () + batchText: function (text, camera) { - var matrix = this.matrix; - - matrix[0] = 1; - matrix[1] = 0; - matrix[2] = 0; - matrix[3] = 1; - matrix[4] = 0; - matrix[5] = 0; + var getTint = Utils.getTintAppendFloatAlpha; - return this; + this.batchTexture( + text, + text.canvasTexture, + text.canvasTexture.width, text.canvasTexture.height, + text.x, text.y, + text.canvasTexture.width, text.canvasTexture.height, + text.scaleX, text.scaleY, + text.rotation, + text.flipX, text.flipY, + text.scrollFactorX, text.scrollFactorY, + text.displayOriginX, text.displayOriginY, + 0, 0, text.canvasTexture.width, text.canvasTexture.height, + getTint(text._tintTL, text._alphaTL), + getTint(text._tintTR, text._alphaTR), + getTint(text._tintBL, text._alphaBL), + getTint(text._tintBR, text._alphaBR), + 0, 0, + camera + ); }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#translate + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicTilemapLayer * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - translate: function (x, y) + batchDynamicTilemapLayer: function (tilemapLayer, camera) { - var matrix = this.matrix; - - matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; - matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; + var renderTiles = tilemapLayer.culledTiles; + var length = renderTiles.length; + var texture = tilemapLayer.tileset.image.get().source.glTexture; + var tileset = tilemapLayer.tileset; + var scrollFactorX = tilemapLayer.scrollFactorX; + var scrollFactorY = tilemapLayer.scrollFactorY; + var alpha = tilemapLayer.alpha; + var x = tilemapLayer.x; + var y = tilemapLayer.y; + var sx = tilemapLayer.scaleX; + var sy = tilemapLayer.scaleY; + var getTint = Utils.getTintAppendFloatAlpha; - return this; - }, + for (var index = 0; index < length; ++index) + { + var tile = renderTiles[index]; - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#scale - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - scale: function (x, y) - { - var matrix = this.matrix; + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + if (tileTexCoords === null) { continue; } - matrix[0] *= x; - matrix[1] *= x; - matrix[2] *= y; - matrix[3] *= y; + var frameWidth = tile.width; + var frameHeight = tile.height; + var frameX = tileTexCoords.x; + var frameY = tileTexCoords.y; + var tint = getTint(tile.tint, alpha * tile.alpha); - return this; + this.batchTexture( + tilemapLayer, + texture, + texture.width, texture.height, + (tile.width / 2) + x + tile.pixelX * sx, (tile.height / 2) + y + tile.pixelY * sy, + tile.width * sx, tile.height * sy, + 1, 1, + tile.rotation, + tile.flipX, tile.flipY, + scrollFactorX, scrollFactorY, + (tile.width / 2), (tile.height / 2), + frameX, frameY, frameWidth, frameHeight, + tint, tint, tint, tint, + 0, 0, + camera + ); + } }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#rotate + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTileSprite * @since 3.0.0 * - * @param {number} radian - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - rotate: function (radian) + batchTileSprite: function (tileSprite, camera) { - var radianSin = Math.sin(radian); - var radianCos = Math.cos(radian); + var getTint = Utils.getTintAppendFloatAlpha; - return this.transform(radianCos, radianSin, -radianSin, radianCos, 0, 0); + this.batchTexture( + tileSprite, + tileSprite.tileTexture, + tileSprite.frame.width, tileSprite.frame.height, + tileSprite.x, tileSprite.y, + tileSprite.width, tileSprite.height, + tileSprite.scaleX, tileSprite.scaleY, + tileSprite.rotation, + tileSprite.flipX, tileSprite.flipY, + tileSprite.scrollFactorX, tileSprite.scrollFactorY, + tileSprite.originX * tileSprite.width, tileSprite.originY * tileSprite.height, + 0, 0, tileSprite.width, tileSprite.height, + getTint(tileSprite._tintTL, tileSprite._alphaTL), + getTint(tileSprite._tintTR, tileSprite._alphaTR), + getTint(tileSprite._tintBL, tileSprite._alphaBL), + getTint(tileSprite._tintBR, tileSprite._alphaBR), + tileSprite.tilePositionX / tileSprite.frame.width, + tileSprite.tilePositionY / tileSprite.frame.height, + camera + ); }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#multiply + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTexture * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {WebGLTexture} texture - [description] + * @param {integer} textureWidth - [description] + * @param {integer} textureHeight - [description] + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcWidth - [description] + * @param {float} srcHeight - [description] + * @param {float} scaleX - [description] + * @param {float} scaleY - [description] + * @param {float} rotation - [description] + * @param {boolean} flipX - [description] + * @param {boolean} flipY - [description] + * @param {float} scrollFactorX - [description] + * @param {float} scrollFactorY - [description] + * @param {float} displayOriginX - [description] + * @param {float} displayOriginY - [description] + * @param {float} frameX - [description] + * @param {float} frameY - [description] + * @param {float} frameWidth - [description] + * @param {float} frameHeight - [description] + * @param {integer} tintTL - [description] + * @param {integer} tintTR - [description] + * @param {integer} tintBL - [description] + * @param {integer} tintBR - [description] + * @param {float} uOffset - [description] + * @param {float} vOffset - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - multiply: function (rhs) + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, + uOffset, vOffset, + camera) { - var matrix = this.matrix; - var otherMatrix = rhs.matrix; + this.renderer.setPipeline(this); - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; - - var a1 = otherMatrix[0]; - var b1 = otherMatrix[1]; - var c1 = otherMatrix[2]; - var d1 = otherMatrix[3]; - var tx1 = otherMatrix[4]; - var ty1 = otherMatrix[5]; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - matrix[0] = a1 * a0 + b1 * c0; - matrix[1] = a1 * b0 + b1 * d0; - matrix[2] = c1 * a0 + d1 * c0; - matrix[3] = c1 * b0 + d1 * d0; - matrix[4] = tx1 * a0 + ty1 * c0 + tx0; - matrix[5] = tx1 * b0 + ty1 * d0 + ty0; + flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); + rotation = -rotation; - return this; - }, + var roundPixels = this.renderer.config.roundPixels; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var cameraMatrix = camera.matrix.matrix; + var width = srcWidth * (flipX ? -1.0 : 1.0); + var height = srcHeight * (flipY ? -1.0 : 1.0); + var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0)); + var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0)); + var xw = x + width; + var yh = y + height; + var translateX = srcX - camera.scrollX * scrollFactorX; + var translateY = srcY - camera.scrollY * scrollFactorY; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); + var sra = cr * scaleX; + var srb = -sr * scaleX; + var src = sr * scaleY; + var srd = cr * scaleY; + var sre = translateX; + var srf = translateY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = 0; + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + this.setTexture2D(texture, 0); - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#transform - * @since 3.0.0 - * - * @param {number} a - [description] - * @param {number} b - [description] - * @param {number} c - [description] - * @param {number} d - [description] - * @param {number} tx - [description] - * @param {number} ty - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - transform: function (a, b, c, d, tx, ty) - { - var matrix = this.matrix; + vertexOffset = this.vertexCount * this.vertexComponentCount; - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } - matrix[0] = a * a0 + b * c0; - matrix[1] = a * b0 + b * d0; - matrix[2] = c * a0 + d * c0; - matrix[3] = c * b0 + d * d0; - matrix[4] = tx * a0 + ty * c0 + tx0; - matrix[5] = tx * b0 + ty * d0 + ty0; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = u0; + vertexViewF32[vertexOffset + 3] = v0; + vertexViewU32[vertexOffset + 4] = tintTL; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = u0; + vertexViewF32[vertexOffset + 8] = v1; + vertexViewU32[vertexOffset + 9] = tintTR; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = u1; + vertexViewF32[vertexOffset + 13] = v1; + vertexViewU32[vertexOffset + 14] = tintBL; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = u0; + vertexViewF32[vertexOffset + 18] = v0; + vertexViewU32[vertexOffset + 19] = tintTL; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = u1; + vertexViewF32[vertexOffset + 23] = v1; + vertexViewU32[vertexOffset + 24] = tintBL; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = u1; + vertexViewF32[vertexOffset + 28] = v0; + vertexViewU32[vertexOffset + 29] = tintBR; - return this; + this.vertexCount += 6; }, /** - * [description] + * Immediately draws a texture with no batching. * - * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawTexture + * @since 3.2.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {Phaser.Geom.Point|Phaser.Math.Vec2|object} point - [description] + * @param {WebGLTexture} texture [description] + * @param {number} srcX - [description] + * @param {number} srcY - [description] + * @param {number} tint - [description] + * @param {number} alpha - [description] + * @param {number} frameX - [description] + * @param {number} frameY - [description] + * @param {number} frameWidth - [description] + * @param {number} frameHeight - [description] + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - [description] * - * @return {Phaser.Geom.Point|Phaser.Math.Vec2|object} [description] + * @return {Phaser.Renderer.WebGL.TextureTintPipeline} This Pipeline. */ - transformPoint: function (x, y, point) + drawTexture: function ( + texture, + srcX, srcY, + tint, alpha, + frameX, frameY, frameWidth, frameHeight, + transformMatrix + ) { - if (point === undefined) { point = { x: 0, y: 0 }; } + this.renderer.setPipeline(this); - var matrix = this.matrix; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; + var roundPixels = this.renderer.config.roundPixels; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var width = frameWidth; + var height = frameHeight; + var x = srcX; + var y = srcY; + var xw = x + width; + var yh = y + height; + var mva = transformMatrix[0]; + var mvb = transformMatrix[1]; + var mvc = transformMatrix[2]; + var mvd = transformMatrix[3]; + var mve = transformMatrix[4]; + var mvf = transformMatrix[5]; + var tx0 = x * mva + y * mvc + mve; + var ty0 = x * mvb + y * mvd + mvf; + var tx1 = x * mva + yh * mvc + mve; + var ty1 = x * mvb + yh * mvd + mvf; + var tx2 = xw * mva + yh * mvc + mve; + var ty2 = xw * mvb + yh * mvd + mvf; + var tx3 = xw * mva + y * mvc + mve; + var ty3 = xw * mvb + y * mvd + mvf; + var vertexOffset = 0; + var textureWidth = texture.width; + var textureHeight = texture.height; + var u0 = (frameX / textureWidth); + var v0 = (frameY / textureHeight); + var u1 = (frameX + frameWidth) / textureWidth; + var v1 = (frameY + frameHeight) / textureHeight; + tint = Utils.getTintAppendFloatAlpha(tint, alpha); + + this.setTexture2D(texture, 0); - point.x = x * a + y * c + tx; - point.y = x * b + y * d + ty; + vertexOffset = this.vertexCount * this.vertexComponentCount; - return point; + if (roundPixels) + { + tx0 |= 0; + ty0 |= 0; + tx1 |= 0; + ty1 |= 0; + tx2 |= 0; + ty2 |= 0; + tx3 |= 0; + ty3 |= 0; + } + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewF32[vertexOffset + 2] = u0; + vertexViewF32[vertexOffset + 3] = v0; + vertexViewU32[vertexOffset + 4] = tint; + vertexViewF32[vertexOffset + 5] = tx1; + vertexViewF32[vertexOffset + 6] = ty1; + vertexViewF32[vertexOffset + 7] = u0; + vertexViewF32[vertexOffset + 8] = v1; + vertexViewU32[vertexOffset + 9] = tint; + vertexViewF32[vertexOffset + 10] = tx2; + vertexViewF32[vertexOffset + 11] = ty2; + vertexViewF32[vertexOffset + 12] = u1; + vertexViewF32[vertexOffset + 13] = v1; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx0; + vertexViewF32[vertexOffset + 16] = ty0; + vertexViewF32[vertexOffset + 17] = u0; + vertexViewF32[vertexOffset + 18] = v0; + vertexViewU32[vertexOffset + 19] = tint; + vertexViewF32[vertexOffset + 20] = tx2; + vertexViewF32[vertexOffset + 21] = ty2; + vertexViewF32[vertexOffset + 22] = u1; + vertexViewF32[vertexOffset + 23] = v1; + vertexViewU32[vertexOffset + 24] = tint; + vertexViewF32[vertexOffset + 25] = tx3; + vertexViewF32[vertexOffset + 26] = ty3; + vertexViewF32[vertexOffset + 27] = u1; + vertexViewF32[vertexOffset + 28] = v0; + vertexViewU32[vertexOffset + 29] = tint; + + this.vertexCount += 6; + + // Force an immediate draw + this.flush(); }, /** * [description] * - * @method Phaser.GameObjects.Components.TransformMatrix#invert + * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchGraphics * @since 3.0.0 * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - invert: function () + batchGraphics: function () { - var matrix = this.matrix; + // Stub + } - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; +}); - var n = a * d - b * c; +module.exports = TextureTintPipeline; - matrix[0] = d / n; - matrix[1] = -b / n; - matrix[2] = -c / n; - matrix[3] = a / n; - matrix[4] = (c * ty - d * tx) / n; - matrix[5] = -(a * ty - b * tx) / n; - return this; - }, +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#setTransform - * @since 3.0.0 - * - * @param {number} a - [description] - * @param {number} b - [description] - * @param {number} c - [description] - * @param {number} d - [description] - * @param {number} tx - [description] - * @param {number} ty - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. - */ - setTransform: function (a, b, c, d, tx, ty) - { - var matrix = this.matrix; +/** +* The `Matter.Events` module contains methods to fire and listen to events on other objects. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Events +*/ - matrix[0] = a; - matrix[1] = b; - matrix[2] = c; - matrix[3] = d; - matrix[4] = tx; - matrix[5] = ty; +var Events = {}; - return this; - }, +module.exports = Events; + +var Common = __webpack_require__(38); + +(function() { /** - * [description] - * - * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix - * @since 3.0.0 - * - * @return {object} [description] + * Subscribes a callback function to the given object's `eventName`. + * @method on + * @param {} object + * @param {string} eventNames + * @param {function} callback */ - decomposeMatrix: function () - { - var decomposedMatrix = this.decomposedMatrix; + Events.on = function(object, eventNames, callback) { + var names = eventNames.split(' '), + name; - var matrix = this.matrix; + for (var i = 0; i < names.length; i++) { + name = names[i]; + object.events = object.events || {}; + object.events[name] = object.events[name] || []; + object.events[name].push(callback); + } - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; + return callback; + }; - var a2 = a * a; - var b2 = b * b; - var c2 = c * c; - var d2 = d * d; + /** + * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. + * @method off + * @param {} object + * @param {string} eventNames + * @param {function} callback + */ + Events.off = function(object, eventNames, callback) { + if (!eventNames) { + object.events = {}; + return; + } - var sx = Math.sqrt(a2 + c2); - var sy = Math.sqrt(b2 + d2); + // handle Events.off(object, callback) + if (typeof eventNames === 'function') { + callback = eventNames; + eventNames = Common.keys(object.events).join(' '); + } - decomposedMatrix.translateX = matrix[4]; - decomposedMatrix.translateY = matrix[5]; + var names = eventNames.split(' '); - decomposedMatrix.scaleX = sx; - decomposedMatrix.scaleY = sy; + for (var i = 0; i < names.length; i++) { + var callbacks = object.events[names[i]], + newCallbacks = []; - decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); + if (callback && callbacks) { + for (var j = 0; j < callbacks.length; j++) { + if (callbacks[j] !== callback) + newCallbacks.push(callbacks[j]); + } + } - return decomposedMatrix; - }, + object.events[names[i]] = newCallbacks; + } + }; /** - * Identity + Translate + Rotate + Scale - * - * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} rotation - [description] - * @param {number} scaleX - [description] - * @param {number} scaleY - [description] - * - * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. + * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. + * @method trigger + * @param {} object + * @param {string} eventNames + * @param {} event */ - applyITRS: function (x, y, rotation, scaleX, scaleY) - { - var matrix = this.matrix; + Events.trigger = function(object, eventNames, event) { + var names, + name, + callbacks, + eventClone; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); + if (object.events) { + if (!event) + event = {}; - // Translate - matrix[4] = x; - matrix[5] = y; + names = eventNames.split(' '); - // Rotate and Scale - matrix[0] = cr * scaleX; - matrix[1] = -sr * scaleX; - matrix[2] = sr * scaleY; - matrix[3] = cr * scaleY; + for (var i = 0; i < names.length; i++) { + name = names[i]; + callbacks = object.events[name]; - return this; - } + if (callbacks) { + eventClone = Common.clone(event, false); + eventClone.name = name; + eventClone.source = object; -}); + for (var j = 0; j < callbacks.length; j++) { + callbacks[j].apply(object, [eventClone]); + } + } + } + } + }; -module.exports = TransformMatrix; +})(); /***/ }), -/* 188 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Perimeter = __webpack_require__(78); -var Point = __webpack_require__(5); +* The `Matter.Constraint` module contains methods for creating and manipulating constraints. +* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). +* The stiffness of constraints can be modified to create springs or elastic. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Constraint +*/ -// Return an array of points from the perimeter of the rectangle -// each spaced out based on the quantity or step required +var Constraint = {}; -/** - * [description] - * - * @function Phaser.Geom.Rectangle.MarchingAnts - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {number} step - [description] - * @param {integer} quantity - [description] - * @param {array} [out] - [description] - * - * @return {Phaser.Geom.Point[]} [description] - */ -var MarchingAnts = function (rect, step, quantity, out) -{ - if (out === undefined) { out = []; } +module.exports = Constraint; - if (!step && !quantity) - { - // Bail out - return out; - } +var Vertices = __webpack_require__(93); +var Vector = __webpack_require__(94); +var Sleeping = __webpack_require__(344); +var Bounds = __webpack_require__(95); +var Axes = __webpack_require__(859); +var Common = __webpack_require__(38); - // If step is a falsey value (false, null, 0, undefined, etc) then we calculate - // it based on the quantity instead, otherwise we always use the step value - if (!step) - { - step = Perimeter(rect) / quantity; - } - else - { - quantity = Math.round(Perimeter(rect) / step); - } +(function() { - var x = rect.x; - var y = rect.y; - var face = 0; + Constraint._warming = 0.4; + Constraint._torqueDampen = 1; + Constraint._minLength = 0.000001; - // Loop across each face of the rectangle + /** + * Creates a new constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {constraint} constraint + */ + Constraint.create = function(options) { + var constraint = options; - for (var i = 0; i < quantity; i++) - { - out.push(new Point(x, y)); + // if bodies defined but no points, use body centre + if (constraint.bodyA && !constraint.pointA) + constraint.pointA = { x: 0, y: 0 }; + if (constraint.bodyB && !constraint.pointB) + constraint.pointB = { x: 0, y: 0 }; - switch (face) - { + // calculate static length using initial world space points + var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA, + initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB, + length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); + + constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; - // Top face - case 0: - x += step; + // option defaults + constraint.id = constraint.id || Common.nextId(); + constraint.label = constraint.label || 'Constraint'; + constraint.type = 'constraint'; + constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); + constraint.damping = constraint.damping || 0; + constraint.angularStiffness = constraint.angularStiffness || 0; + constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; + constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; + constraint.plugin = {}; - if (x >= rect.right) - { - face = 1; - y += (x - rect.right); - x = rect.right; - } - break; + // render + var render = { + visible: true, + lineWidth: 2, + strokeStyle: '#ffffff', + type: 'line', + anchors: true + }; - // Right face - case 1: - y += step; + if (constraint.length === 0 && constraint.stiffness > 0.1) { + render.type = 'pin'; + render.anchors = false; + } else if (constraint.stiffness < 0.9) { + render.type = 'spring'; + } - if (y >= rect.bottom) - { - face = 2; - x -= (y - rect.bottom); - y = rect.bottom; - } - break; + constraint.render = Common.extend(render, constraint.render); - // Bottom face - case 2: - x -= step; + return constraint; + }; - if (x <= rect.left) - { - face = 3; - y -= (rect.left - x); - x = rect.left; - } - break; + /** + * Prepares for solving by constraint warming. + * @private + * @method preSolveAll + * @param {body[]} bodies + */ + Constraint.preSolveAll = function(bodies) { + for (var i = 0; i < bodies.length; i += 1) { + var body = bodies[i], + impulse = body.constraintImpulse; - // Left face - case 3: - y -= step; + if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { + continue; + } - if (y <= rect.top) - { - face = 0; - y = rect.top; - } - break; + body.position.x += impulse.x; + body.position.y += impulse.y; + body.angle += impulse.angle; } - } - - return out; -}; - -module.exports = MarchingAnts; - + }; -/***/ }), -/* 189 */ -/***/ (function(module, exports) { + /** + * Solves all constraints in a list of collisions. + * @private + * @method solveAll + * @param {constraint[]} constraints + * @param {number} timeScale + */ + Constraint.solveAll = function(constraints, timeScale) { + // Solve fixed constraints first. + for (var i = 0; i < constraints.length; i += 1) { + var constraint = constraints[i], + fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), + fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (fixedA || fixedB) { + Constraint.solve(constraints[i], timeScale); + } + } -/** - * Moves the element at the start of the array to the end, shifting all items in the process. - * The "rotation" happens to the left. - * - * @function Phaser.Utils.Array.RotateLeft - * @since 3.0.0 - * - * @param {array} array - The array to shift to the left. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {any} The most recently shifted element. - */ -var RotateLeft = function (array, total) -{ - if (total === undefined) { total = 1; } + // Solve free constraints last. + for (i = 0; i < constraints.length; i += 1) { + constraint = constraints[i]; + fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); + fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - var element = null; + if (!fixedA && !fixedB) { + Constraint.solve(constraints[i], timeScale); + } + } + }; - for (var i = 0; i < total; i++) - { - element = array.shift(); - array.push(element); - } + /** + * Solves a distance constraint with Gauss-Siedel method. + * @private + * @method solve + * @param {constraint} constraint + * @param {number} timeScale + */ + Constraint.solve = function(constraint, timeScale) { + var bodyA = constraint.bodyA, + bodyB = constraint.bodyB, + pointA = constraint.pointA, + pointB = constraint.pointB; - return element; -}; + if (!bodyA && !bodyB) + return; -module.exports = RotateLeft; + // update reference angle + if (bodyA && !bodyA.isStatic) { + Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); + constraint.angleA = bodyA.angle; + } + + // update reference angle + if (bodyB && !bodyB.isStatic) { + Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); + constraint.angleB = bodyB.angle; + } + var pointAWorld = pointA, + pointBWorld = pointB; -/***/ }), -/* 190 */ -/***/ (function(module, exports) { + if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); + if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (!pointAWorld || !pointBWorld) + return; -/** - * Moves the element at the end of the array to the start, shifting all items in the process. - * The "rotation" happens to the right. - * - * @function Phaser.Utils.Array.RotateRight - * @since 3.0.0 - * - * @param {array} array - The array to shift to the right. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {any} The most recently shifted element. - */ -var RotateRight = function (array, total) -{ - if (total === undefined) { total = 1; } + var delta = Vector.sub(pointAWorld, pointBWorld), + currentLength = Vector.magnitude(delta); - var element = null; + // prevent singularity + if (currentLength < Constraint._minLength) { + currentLength = Constraint._minLength; + } - for (var i = 0; i < total; i++) - { - element = array.pop(); - array.unshift(element); - } + // solve distance constraint with Gauss-Siedel method + var difference = (currentLength - constraint.length) / currentLength, + stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, + force = Vector.mult(delta, difference * stiffness), + massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), + inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), + resistanceTotal = massTotal + inertiaTotal, + torque, + share, + normal, + normalVelocity, + relativeVelocity; - return element; -}; + if (constraint.damping) { + var zero = Vector.create(); + normal = Vector.div(delta, currentLength); -module.exports = RotateRight; + relativeVelocity = Vector.sub( + bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero, + bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero + ); + normalVelocity = Vector.dot(normal, relativeVelocity); + } -/***/ }), -/* 191 */ -/***/ (function(module, exports) { + if (bodyA && !bodyA.isStatic) { + share = bodyA.inverseMass / massTotal; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // keep track of applied impulses for post solving + bodyA.constraintImpulse.x -= force.x * share; + bodyA.constraintImpulse.y -= force.y * share; -/** - * Using Bresenham's line algorithm this will return an array of all coordinates on this line. - * The start and end points are rounded before this runs as the algorithm works on integers. - * - * @function Phaser.Geom.Line.BresenhamPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - [description] - * @param {integer} [stepRate=1] - [description] - * @param {array} [results] - [description] - * - * @return {array} [description] - */ -var BresenhamPoints = function (line, stepRate, results) -{ - if (stepRate === undefined) { stepRate = 1; } - if (results === undefined) { results = []; } + // apply forces + bodyA.position.x -= force.x * share; + bodyA.position.y -= force.y * share; - var x1 = Math.round(line.x1); - var y1 = Math.round(line.y1); - var x2 = Math.round(line.x2); - var y2 = Math.round(line.y2); + // apply damping + if (constraint.damping) { + bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share; + bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share; + } - var dx = Math.abs(x2 - x1); - var dy = Math.abs(y2 - y1); - var sx = (x1 < x2) ? 1 : -1; - var sy = (y1 < y2) ? 1 : -1; - var err = dx - dy; + // apply torque + torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness); + bodyA.constraintImpulse.angle -= torque; + bodyA.angle -= torque; + } - results.push({ x: x1, y: y1 }); + if (bodyB && !bodyB.isStatic) { + share = bodyB.inverseMass / massTotal; - var i = 1; + // keep track of applied impulses for post solving + bodyB.constraintImpulse.x += force.x * share; + bodyB.constraintImpulse.y += force.y * share; + + // apply forces + bodyB.position.x += force.x * share; + bodyB.position.y += force.y * share; - while (!((x1 === x2) && (y1 === y2))) - { - var e2 = err << 1; + // apply damping + if (constraint.damping) { + bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share; + bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share; + } - if (e2 > -dy) - { - err -= dy; - x1 += sx; + // apply torque + torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness); + bodyB.constraintImpulse.angle += torque; + bodyB.angle += torque; } - if (e2 < dx) - { - err += dx; - y1 += sy; - } + }; - if (i % stepRate === 0) - { - results.push({ x: x1, y: y1 }); - } + /** + * Performs body updates required after solving constraints. + * @private + * @method postSolveAll + * @param {body[]} bodies + */ + Constraint.postSolveAll = function(bodies) { + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + impulse = body.constraintImpulse; - i++; - } + if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { + continue; + } - return results; -}; + Sleeping.set(body, false); -module.exports = BresenhamPoints; + // update geometry and reset + for (var j = 0; j < body.parts.length; j++) { + var part = body.parts[j]; + + Vertices.translate(part.vertices, impulse); + if (j > 0) { + part.position.x += impulse.x; + part.position.y += impulse.y; + } -/***/ }), -/* 192 */ -/***/ (function(module, exports) { + if (impulse.angle !== 0) { + Vertices.rotate(part.vertices, impulse.angle, body.position); + Axes.rotate(part.axes, impulse.angle); + if (j > 0) { + Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); + } + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + Bounds.update(part.bounds, part.vertices, body.velocity); + } -/** - * [description] - * - * @function Phaser.Math.SmootherStep - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * - * @return {number} [description] - */ -var SmootherStep = function (x, min, max) -{ - x = Math.max(0, Math.min(1, (x - min) / (max - min))); + // dampen the cached impulse for warming next step + impulse.angle *= Constraint._warming; + impulse.x *= Constraint._warming; + impulse.y *= Constraint._warming; + } + }; - return x * x * x * (x * (x * 6 - 15) + 10); -}; + /* + * + * Properties Documentation + * + */ -module.exports = SmootherStep; + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + * @readOnly + */ -/***/ }), -/* 193 */ -/***/ (function(module, exports) { + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ -/** - * [description] - * - * @function Phaser.Math.SmoothStep - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * - * @return {number} [description] - */ -var SmoothStep = function (x, min, max) -{ - x = Math.max(0, Math.min(1, (x - min) / (max - min))); + /** + * A flag that indicates if the constraint should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ - return x * x * (3 - 2 * x); -}; + /** + * A `Number` that defines the line width to use when rendering the constraint outline. + * A value of `0` means no outline will be rendered. + * + * @property render.lineWidth + * @type number + * @default 2 + */ -module.exports = SmoothStep; + /** + * A `String` that defines the stroke style to use when rendering the constraint outline. + * It is the same as when using a canvas, so it accepts CSS style property values. + * + * @property render.strokeStyle + * @type string + * @default a random colour + */ + /** + * A `String` that defines the constraint rendering type. + * The possible values are 'line', 'pin', 'spring'. + * An appropriate render type will be automatically chosen unless one is given in options. + * + * @property render.type + * @type string + * @default 'line' + */ -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A `Boolean` that defines if the constraint's anchor points should be rendered. + * + * @property render.anchors + * @type boolean + * @default true + */ -/** + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + + /** + * A `Number` that specifies the damping of the constraint, + * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. + * Damping will only be apparent when the constraint also has a very low `stiffness`. + * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. + * A value of `0` means the constraint will apply no damping. + * + * @property damping + * @type number + * @default 0 + */ + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + +})(); + + +/***/ }), +/* 167 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 168 */ +/***/ (function(module, exports) { + +/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Frame = __webpack_require__(195); -var GetValue = __webpack_require__(4); - /** - * @classdesc - * A Frame based Animation. - * - * This consists of a key, some default values (like the frame rate) and a bunch of Frame objects. - * - * The Animation Manager creates these. Game Objects don't own an instance of these directly. - * Game Objects have the Animation Component, which are like playheads to global Animations (these objects) - * So multiple Game Objects can have playheads all pointing to this one Animation instance. + * This is a slightly modified version of jQuery.isPlainObject. + * A plain object is an object whose internal class property is [object Object]. * - * @class Animation - * @memberOf Phaser.Animations - * @constructor + * @function Phaser.Utils.Object.IsPlainObject * @since 3.0.0 * - * @param {Phaser.Animations.AnimationManager} manager - [description] - * @param {string} key - [description] - * @param {object} config - [description] + * @param {object} obj - The object to inspect. + * + * @return {boolean} `true` if the object is plain, otherwise `false`. */ -var Animation = new Class({ - - initialize: - - function Animation (manager, key, config) +var IsPlainObject = function (obj) +{ + // Not plain objects: + // - Any object or value whose internal [[Class]] property is not "[object Object]" + // - DOM nodes + // - window + if (typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) { - /** - * [description] - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; - - /** - * [description] - * - * @name Phaser.Animations.Animation#key - * @type {string} - * @since 3.0.0 - */ - this.key = key; - - /** - * A frame based animation (as opposed to a bone based animation) - * - * @name Phaser.Animations.Animation#type - * @type {string} - * @default frame - * @since 3.0.0 - */ - this.type = 'frame'; - - /** - * Extract all the frame data into the frames array - * - * @name Phaser.Animations.Animation#frames - * @type {array} - * @since 3.0.0 - */ - this.frames = this.getFrames( - manager.textureManager, - GetValue(config, 'frames', []), - GetValue(config, 'defaultTextureKey', null) - ); - - /** - * The frame rate of playback in frames per second (default 24 if duration is null) - * - * @name Phaser.Animations.Animation#frameRate - * @type {integer} - * @default 24 - * @since 3.0.0 - */ - this.frameRate = GetValue(config, 'frameRate', null); - - /** - * How long the animation should play for. - * If frameRate is set it overrides this value otherwise frameRate is derived from duration. - * - * @name Phaser.Animations.Animation#duration - * @type {integer} - * @since 3.0.0 - */ - this.duration = GetValue(config, 'duration', null); + return false; + } - if (this.duration === null && this.frameRate === null) - { - // No duration or frameRate given, use default frameRate of 24fps - this.frameRate = 24; - this.duration = this.frameRate / this.frames.length; - } - else if (this.duration && this.frameRate === null) - { - // Duration given but no frameRate, so set the frameRate based on duration - // I.e. 12 frames in the animation, duration = 4 (4000 ms) - // So frameRate is 12 / 4 = 3 fps - this.frameRate = this.frames.length / this.duration; - } - else + // Support: Firefox <20 + // The try/catch suppresses exceptions thrown when attempting to access + // the "constructor" property of certain host objects, ie. |window.location| + // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 + try + { + if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) { - // frameRate given, derive duration from it (even if duration also specified) - // I.e. 15 frames in the animation, frameRate = 30 fps - // So duration is 15 / 30 = 0.5 (half a second) - this.duration = this.frames.length / this.frameRate; + return false; } + } + catch (e) + { + return false; + } - /** - * ms per frame (without including frame specific modifiers) - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} - * @since 3.0.0 - */ - this.msPerFrame = 1000 / this.frameRate; + // If the function hasn't returned already, we're confident that + // |obj| is a plain object, created by {} or constructed with new Object + return true; +}; - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.Animations.Animation#skipMissedFrames - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); +module.exports = IsPlainObject; - /** - * Delay before starting playback (in seconds) - * - * @name Phaser.Animations.Animation#delay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.delay = GetValue(config, 'delay', 0); - /** - * Number of times to repeat the animation (-1 for infinity) - * - * @name Phaser.Animations.Animation#repeat - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Delay before the repeat starts (in seconds) - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Should the animation yoyo? (reverse back down to the start) before repeating? - * - * @name Phaser.Animations.Animation#yoyo - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.yoyo = GetValue(config, 'yoyo', false); +/** + * @namespace Phaser.Actions + */ - /** - * Should sprite.visible = true when the animation starts to play? - * - * @name Phaser.Animations.Animation#showOnStart - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.showOnStart = GetValue(config, 'showOnStart', false); +module.exports = { - /** - * Should sprite.visible = false when the animation finishes? - * - * @name Phaser.Animations.Animation#hideOnComplete - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.hideOnComplete = GetValue(config, 'hideOnComplete', false); + Angle: __webpack_require__(387), + Call: __webpack_require__(388), + GetFirst: __webpack_require__(389), + GridAlign: __webpack_require__(390), + IncAlpha: __webpack_require__(408), + IncX: __webpack_require__(409), + IncXY: __webpack_require__(410), + IncY: __webpack_require__(411), + PlaceOnCircle: __webpack_require__(412), + PlaceOnEllipse: __webpack_require__(413), + PlaceOnLine: __webpack_require__(414), + PlaceOnRectangle: __webpack_require__(415), + PlaceOnTriangle: __webpack_require__(416), + PlayAnimation: __webpack_require__(417), + RandomCircle: __webpack_require__(418), + RandomEllipse: __webpack_require__(419), + RandomLine: __webpack_require__(420), + RandomRectangle: __webpack_require__(421), + RandomTriangle: __webpack_require__(422), + Rotate: __webpack_require__(423), + RotateAround: __webpack_require__(424), + RotateAroundDistance: __webpack_require__(425), + ScaleX: __webpack_require__(426), + ScaleXY: __webpack_require__(427), + ScaleY: __webpack_require__(428), + SetAlpha: __webpack_require__(429), + SetBlendMode: __webpack_require__(430), + SetDepth: __webpack_require__(431), + SetHitArea: __webpack_require__(432), + SetOrigin: __webpack_require__(433), + SetRotation: __webpack_require__(434), + SetScale: __webpack_require__(435), + SetScaleX: __webpack_require__(436), + SetScaleY: __webpack_require__(437), + SetTint: __webpack_require__(438), + SetVisible: __webpack_require__(439), + SetX: __webpack_require__(440), + SetXY: __webpack_require__(441), + SetY: __webpack_require__(442), + ShiftPosition: __webpack_require__(443), + Shuffle: __webpack_require__(444), + SmootherStep: __webpack_require__(445), + SmoothStep: __webpack_require__(446), + Spread: __webpack_require__(447), + ToggleVisible: __webpack_require__(448) - /** - * [description] - * - * @name Phaser.Animations.Animation#callbackScope - * @type {object} - * @since 3.0.0 - */ - this.callbackScope = GetValue(config, 'callbackScope', this); +}; - /** - * [description] - * - * @name Phaser.Animations.Animation#onStart - * @type {function} - * @since 3.0.0 - */ - this.onStart = GetValue(config, 'onStart', false); - /** - * [description] - * - * @name Phaser.Animations.Animation#onStartParams - * @type {array} - * @since 3.0.0 - */ - this.onStartParams = GetValue(config, 'onStartParams', []); +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Animations.Animation#onRepeat - * @type {function} - * @since 3.0.0 - */ - this.onRepeat = GetValue(config, 'onRepeat', false); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Animations.Animation#onRepeatParams - * @type {array} - * @since 3.0.0 - */ - this.onRepeatParams = GetValue(config, 'onRepeatParams', []); +var ALIGN_CONST = __webpack_require__(171); - /** - * Called for EVERY frame of the animation. - * See AnimationFrame.onUpdate for a frame specific callback. - * - * @name Phaser.Animations.Animation#onUpdate - * @type {function} - * @since 3.0.0 - */ - this.onUpdate = GetValue(config, 'onUpdate', false); +var AlignInMap = []; - /** - * [description] - * - * @name Phaser.Animations.Animation#onUpdateParams - * @type {array} - * @since 3.0.0 - */ - this.onUpdateParams = GetValue(config, 'onUpdateParams', []); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(172); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(173); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(174); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(175); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(177); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(178); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(179); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(180); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(181); - /** - * [description] - * - * @name Phaser.Animations.Animation#onComplete - * @type {function} - * @since 3.0.0 - */ - this.onComplete = GetValue(config, 'onComplete', false); +/** + * Takes given Game Object and aligns it so that it is positioned relative to the other. + * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. + * + * @function Phaser.Display.Align.In.QuickSet + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var QuickSet = function (child, alignIn, position, offsetX, offsetY) +{ + return AlignInMap[position](child, alignIn, offsetX, offsetY); +}; - /** - * [description] - * - * @name Phaser.Animations.Animation#onCompleteParams - * @type {array} - * @since 3.0.0 - */ - this.onCompleteParams = GetValue(config, 'onCompleteParams', []); +module.exports = QuickSet; - /** - * Global pause, effects all Game Objects using this Animation instance - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - this.manager.on('pauseall', this.pause.bind(this)); - this.manager.on('resumeall', this.resume.bind(this)); - }, +/***/ }), +/* 171 */ +/***/ (function(module, exports) { - // config = Array of Animation config objects, like: - // [ - // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } - // ] +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Add frames to the end of the animation +var ALIGN_CONST = { /** - * [description] - * - * @method Phaser.Animations.Animation#addFrame - * @since 3.0.0 - * - * @param {[type]} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrame: function (config) - { - return this.addFrameAt(this.frames.length, config); - }, - - // config = Array of Animation config objects, like: - // [ - // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } - // ] - - // Add frame/s into the animation + * A constant representing a top-left alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_LEFT + * @since 3.0.0 + * @type {integer} + */ + TOP_LEFT: 0, /** - * [description] - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * @param {[type]} config - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - addFrameAt: function (index, config) - { - var newFrames = this.getFrames(this.manager.textureManager, config); - - if (newFrames.length > 0) - { - if (index === 0) - { - this.frames = newFrames.concat(this.frames); - } - else if (index === this.frames.length) - { - this.frames = this.frames.concat(newFrames); - } - else - { - var pre = this.frames.slice(0, index); - var post = this.frames.slice(index); - - this.frames = pre.concat(newFrames, post); - } + * A constant representing a top-center alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_CENTER + * @since 3.0.0 + * @type {integer} + */ + TOP_CENTER: 1, - this.updateFrameSequence(); - } + /** + * A constant representing a top-right alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_RIGHT + * @since 3.0.0 + * @type {integer} + */ + TOP_RIGHT: 2, - return this; - }, + /** + * A constant representing a left-top alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_TOP + * @since 3.0.0 + * @type {integer} + */ + LEFT_TOP: 3, /** - * [description] - * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {boolean} [description] - */ - checkFrame: function (index) - { - return (index < this.frames.length); - }, + * A constant representing a left-center alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_CENTER + * @since 3.0.0 + * @type {integer} + */ + LEFT_CENTER: 4, /** - * [description] - * - * @method Phaser.Animations.Animation#completeAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - completeAnimation: function (component) - { - if (this.hideOnComplete) - { - component.parent.visible = false; - } + * A constant representing a left-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_BOTTOM + * @since 3.0.0 + * @type {integer} + */ + LEFT_BOTTOM: 5, - component.stop(true); - }, + /** + * A constant representing a center alignment or position. + * @constant + * @name Phaser.Display.Align.CENTER + * @since 3.0.0 + * @type {integer} + */ + CENTER: 6, /** - * [description] - * - * @method Phaser.Animations.Animation#getFirstTick - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - * @param {boolean} [includeDelay=true] - [description] - */ - getFirstTick: function (component, includeDelay) - { - if (includeDelay === undefined) { includeDelay = true; } + * A constant representing a right-top alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_TOP + * @since 3.0.0 + * @type {integer} + */ + RIGHT_TOP: 7, - // When is the first update due? - component.accumulator = 0; - component.nextTick = component.msPerFrame + component.currentFrame.duration; + /** + * A constant representing a right-center alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_CENTER + * @since 3.0.0 + * @type {integer} + */ + RIGHT_CENTER: 8, - if (includeDelay) - { - component.nextTick += (component._delay * 1000); - } - }, + /** + * A constant representing a right-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_BOTTOM + * @since 3.0.0 + * @type {integer} + */ + RIGHT_BOTTOM: 9, /** - * [description] - * - * @method Phaser.Animations.Animation#getFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {Phaser.Animations.AnimationFrame} [description] - */ - getFrameAt: function (index) - { - return this.frames[index]; - }, + * A constant representing a bottom-left alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_LEFT + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_LEFT: 10, /** - * [description] - * - * @method Phaser.Animations.Animation#getFrames - * @since 3.0.0 - * - * @param {[type]} textureManager - [description] - * @param {[type]} frames - [description] - * - * @return {Phaser.Animations.AnimationFrame[]} [description] - */ - getFrames: function (textureManager, frames, defaultTextureKey) - { - // frames: [ - // { key: textureKey, frame: textureFrame }, - // { key: textureKey, frame: textureFrame, duration: float }, - // { key: textureKey, frame: textureFrame, onUpdate: function } - // { key: textureKey, frame: textureFrame, visible: boolean } - // ], + * A constant representing a bottom-center alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_CENTER + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_CENTER: 11, - var out = []; - var prev; - var animationFrame; - var index = 1; - var i; - var textureKey; + /** + * A constant representing a bottom-right alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_RIGHT + * @since 3.0.0 + * @type {integer} + */ + BOTTOM_RIGHT: 12 - // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet - if (typeof frames === 'string') - { - textureKey = frames; +}; - var texture = textureManager.get(textureKey); - var frameKeys = texture.getFrameNames(); +module.exports = ALIGN_CONST; - frames = []; - frameKeys.forEach(function (idx, value) - { - frames.push({ key: textureKey, frame: value }); - }); - } +/***/ }), +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { - if (!Array.isArray(frames) || frames.length === 0) - { - return out; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (i = 0; i < frames.length; i++) - { - var item = frames[i]; +var GetBottom = __webpack_require__(24); +var GetCenterX = __webpack_require__(46); +var SetBottom = __webpack_require__(25); +var SetCenterX = __webpack_require__(47); - var key = GetValue(item, 'key', defaultTextureKey); +/** + * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. + * + * @function Phaser.Display.Align.In.BottomCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - if (!key) - { - continue; - } + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - // Could be an integer or a string - var frame = GetValue(item, 'frame', 0); + return gameObject; +}; - // The actual texture frame - var textureFrame = textureManager.getFrame(key, frame); +module.exports = BottomCenter; - animationFrame = new Frame(key, frame, index, textureFrame); - animationFrame.duration = GetValue(item, 'duration', 0); - animationFrame.onUpdate = GetValue(item, 'onUpdate', null); +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { - animationFrame.isFirst = (!prev); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // The previously created animationFrame - if (prev) - { - prev.nextFrame = animationFrame; +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); - animationFrame.prevFrame = prev; - } +/** + * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. + * + * @function Phaser.Display.Align.In.BottomLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - out.push(animationFrame); + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - prev = animationFrame; + return gameObject; +}; - index++; - } +module.exports = BottomLeft; - if (out.length > 0) - { - animationFrame.isLast = true; - // Link them end-to-end, so they loop - animationFrame.nextFrame = out[0]; +/***/ }), +/* 174 */ +/***/ (function(module, exports, __webpack_require__) { - out[0].prevFrame = animationFrame; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Generate the progress data +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); - var slice = 1 / (out.length - 1); +/** + * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. + * + * @function Phaser.Display.Align.In.BottomRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - for (i = 0; i < out.length; i++) - { - out[i].progress = i * slice; - } - } + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - return out; - }, + return gameObject; +}; - /** - * [description] - * - * @method Phaser.Animations.Animation#getNextTick - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - getNextTick: function (component) - { - // accumulator += delta * _timeScale - // after a large delta surge (perf issue for example) we need to adjust for it here +module.exports = BottomRight; - // When is the next update due? - component.accumulator -= component.nextTick; - component.nextTick = component.msPerFrame + component.currentFrame.duration; - }, +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Animations.Animation#load - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - * @param {integer} startFrame - [description] - */ - load: function (component, startFrame) - { - if (startFrame >= this.frames.length) - { - startFrame = 0; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (component.currentAnim !== this) - { - component.currentAnim = this; +var CenterOn = __webpack_require__(176); +var GetCenterX = __webpack_require__(46); +var GetCenterY = __webpack_require__(49); - component._timeScale = 1; - component.frameRate = this.frameRate; - component.duration = this.duration; - component.msPerFrame = this.msPerFrame; - component.skipMissedFrames = this.skipMissedFrames; - component._delay = this.delay; - component._repeat = this.repeat; - component._repeatDelay = this.repeatDelay; - component._yoyo = this.yoyo; - component._callbackArgs[1] = this; - component._updateParams = component._callbackArgs.concat(this.onUpdateParams); - } +/** + * Takes given Game Object and aligns it so that it is positioned in the center of the other. + * + * @function Phaser.Display.Align.In.Center + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var Center = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - component.updateFrame(this.frames[startFrame]); - }, + CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); - /** - * [description] - * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - nextFrame: function (component) - { - var frame = component.currentFrame; + return gameObject; +}; - // TODO: Add frame skip support +module.exports = Center; - if (frame.isLast) - { - // We're at the end of the animation - // Yoyo? (happens before repeat) - if (this.yoyo) - { - component.forward = false; +/***/ }), +/* 176 */ +/***/ (function(module, exports, __webpack_require__) { - component.updateFrame(frame.prevFrame); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Delay for the current frame - this.getNextTick(component); - } - else if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - this.repeatAnimation(component); - } - else - { - this.completeAnimation(component); - } - } - else - { - component.updateFrame(frame.nextFrame); +var SetCenterX = __webpack_require__(47); +var SetCenterY = __webpack_require__(48); - this.getNextTick(component); - } - }, +/** + * Positions the Game Object so that it is centered on the given coordinates. + * + * @function Phaser.Display.Bounds.CenterOn + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} x - The horizontal coordinate to position the Game Object on. + * @param {number} y - The vertical coordinate to position the Game Object on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var CenterOn = function (gameObject, x, y) +{ + SetCenterX(gameObject, x); - /** - * [description] - * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - previousFrame: function (component) - { - var frame = component.currentFrame; + return SetCenterY(gameObject, y); +}; - // TODO: Add frame skip support +module.exports = CenterOn; - if (frame.isFirst) - { - // We're at the start of the animation - if (component.repeatCounter > 0) - { - // Repeat (happens before complete) - this.repeatAnimation(component); - } - else - { - this.completeAnimation(component); - } - } - else - { - component.updateFrame(frame.prevFrame); +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { - this.getNextTick(component); - } - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.Animation#removeFrame - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrame: function (frame) - { - var index = this.frames.indexOf(frame); +var GetCenterY = __webpack_require__(49); +var GetLeft = __webpack_require__(26); +var SetCenterY = __webpack_require__(48); +var SetLeft = __webpack_require__(27); - if (index !== -1) - { - this.removeFrameAt(index); - } +/** + * Takes given Game Object and aligns it so that it is positioned in the left center of the other. + * + * @function Phaser.Display.Align.In.LeftCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - return this; - }, + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - /** - * [description] - * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 - * - * @param {integer} index - [description] - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - removeFrameAt: function (index) - { - this.frames.splice(index, 1); + return gameObject; +}; - this.updateFrameSequence(); +module.exports = LeftCenter; - return this; - }, - /** - * [description] - * - * @method Phaser.Animations.Animation#repeatAnimation - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - repeatAnimation: function (component) - { - if (component._repeatDelay > 0 && component.pendingRepeat === false) - { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += (component._repeatDelay * 1000); - } - else - { - component.repeatCounter--; +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { - component.forward = true; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - component.updateFrame(component.currentFrame.nextFrame); +var GetCenterY = __webpack_require__(49); +var GetRight = __webpack_require__(28); +var SetCenterY = __webpack_require__(48); +var SetRight = __webpack_require__(29); - this.getNextTick(component); +/** + * Takes given Game Object and aligns it so that it is positioned in the right center of the other. + * + * @function Phaser.Display.Align.In.RightCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - component.pendingRepeat = false; + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - if (this.onRepeat) - { - this.onRepeat.apply(this.callbackScope, component._callbackArgs.concat(this.onRepeatParams)); - } - } - }, + return gameObject; +}; - /** - * [description] - * - * @method Phaser.Animations.Animation#setFrame - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.Animation} component - [description] - */ - setFrame: function (component) - { - // Work out which frame should be set next on the child, and set it - if (component.forward) - { - this.nextFrame(component); - } - else - { - this.previousFrame(component); - } - }, +module.exports = RightCenter; - /** - * [description] - * - * @method Phaser.Animations.Animation#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () - { - var output = { - key: this.key, - type: this.type, - frames: [], - frameRate: this.frameRate, - duration: this.duration, - skipMissedFrames: this.skipMissedFrames, - delay: this.delay, - repeat: this.repeat, - repeatDelay: this.repeatDelay, - yoyo: this.yoyo, - showOnStart: this.showOnStart, - hideOnComplete: this.hideOnComplete - }; - this.frames.forEach(function (frame) - { - output.frames.push(frame.toJSON()); - }); +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { - return output; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Animations.Animation#updateFrameSequence - * @since 3.0.0 - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - updateFrameSequence: function () - { - var len = this.frames.length; - var slice = 1 / (len - 1); +var GetCenterX = __webpack_require__(46); +var GetTop = __webpack_require__(30); +var SetCenterX = __webpack_require__(47); +var SetTop = __webpack_require__(31); - for (var i = 0; i < len; i++) - { - var frame = this.frames[i]; +/** + * Takes given Game Object and aligns it so that it is positioned in the top center of the other. + * + * @function Phaser.Display.Align.In.TopCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - frame.index = i + 1; - frame.isFirst = false; - frame.isLast = false; - frame.progress = i * slice; + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - if (i === 0) - { - frame.isFirst = true; - frame.isLast = (len === 1); - frame.prevFrame = this.frames[len - 1]; - frame.nextFrame = this.frames[i + 1]; - } - else if (i === len - 1) - { - frame.isLast = true; - frame.prevFrame = this.frames[len - 2]; - frame.nextFrame = this.frames[0]; - } - else if (len > 1) - { - frame.prevFrame = this.frames[i - 1]; - frame.nextFrame = this.frames[i + 1]; - } - } + return gameObject; +}; - return this; - }, +module.exports = TopCenter; - /** - * [description] - * - * @method Phaser.Animations.Animation#pause - * @since 3.0.0 - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - pause: function () - { - this.paused = true; - return this; - }, +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Animations.Animation#resume - * @since 3.0.0 - * - * @return {Phaser.Animations.Animation} This Animation object. - */ - resume: function () - { - this.paused = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); - /** - * [description] - * - * @method Phaser.Animations.Animation#destroy - * @since 3.0.0 - */ - destroy: function () +/** + * Takes given Game Object and aligns it so that it is positioned in the top left of the other. + * + * @function Phaser.Display.Align.In.TopLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); + + return gameObject; +}; + +module.exports = TopLeft; + + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); + +/** + * Takes given Game Object and aligns it so that it is positioned in the top right of the other. + * + * @function Phaser.Display.Align.In.TopRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); + + return gameObject; +}; + +module.exports = TopRight; + + +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CircumferencePoint = __webpack_require__(105); +var FromPercent = __webpack_require__(65); +var MATH_CONST = __webpack_require__(16); +var Point = __webpack_require__(5); + +/** + * Returns a Point object containing the coordinates of a point on the circumference of the Circle + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. + * + * @function Phaser.Geom.Circle.GetPoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. + * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. + * @param {Phaser.Geom.Point|object} [out] - An object to store the return values in. If not given a Point object will be created. + * + * @return {Phaser.Geom.Point|object} A Point, or point-like object, containing the coordinates of the point around the circle. + */ +var GetPoint = function (circle, position, out) +{ + if (out === undefined) { out = new Point(); } + + var angle = FromPercent(position, 0, MATH_CONST.PI2); + + return CircumferencePoint(circle, angle, out); +}; + +module.exports = GetPoint; + + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Circumference = __webpack_require__(184); +var CircumferencePoint = __webpack_require__(105); +var FromPercent = __webpack_require__(65); +var MATH_CONST = __webpack_require__(16); + +/** + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, + * based on the given quantity or stepRate values. + * + * @function Phaser.Geom.Circle.GetPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. + * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. + * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. + */ +var GetPoints = function (circle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity) { - // TODO + quantity = Circumference(circle) / stepRate; } -}); + for (var i = 0; i < quantity; i++) + { + var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); -module.exports = Animation; + out.push(CircumferencePoint(circle, angle)); + } + + return out; +}; + +module.exports = GetPoints; /***/ }), -/* 195 */ +/* 184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Returns the circumference of the given Circle. + * + * @function Phaser.Geom.Circle.Circumference + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. + * + * @return {number} The circumference of the Circle. + */ +var Circumference = function (circle) +{ + return 2 * (Math.PI * circle.radius); +}; + +module.exports = Circumference; + + +/***/ }), +/* 185 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -38822,184 +39545,219 @@ module.exports = Animation; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); +var GetPoint = __webpack_require__(107); +var Perimeter = __webpack_require__(78); + +// Return an array of points from the perimeter of the rectangle +// each spaced out based on the quantity or step required /** - * @classdesc - * A single frame in an Animation sequence. + * [description] * - * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other - * frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback - * and modify the animation timing. + * @function Phaser.Geom.Rectangle.GetPoints + * @since 3.0.0 * - * AnimationFrames are generated automatically by the Animation class. + * @param {Phaser.Geom.Rectangle} rectangle - [description] + * @param {number} step - [description] + * @param {integer} quantity - [description] + * @param {array} [out] - [description] * - * @class AnimationFrame - * @memberOf Phaser.Animations - * @constructor + * @return {Phaser.Geom.Point[]} [description] + */ +var GetPoints = function (rectangle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity) + { + quantity = Perimeter(rectangle) / stepRate; + } + + for (var i = 0; i < quantity; i++) + { + var position = i / quantity; + + out.push(GetPoint(rectangle, position)); + } + + return out; +}; + +module.exports = GetPoints; + + +/***/ }), +/* 186 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Math.RotateAround * @since 3.0.0 * - * @param {string} textureKey - The key of the Texture this AnimationFrame uses. - * @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. - * @param {integer} index - The index of this AnimationFrame within the Animation sequence. - * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {Phaser.Geom.Point|object} point - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} angle - [description] + * + * @return {Phaser.Geom.Point} [description] */ -var AnimationFrame = new Class({ +var RotateAround = function (point, x, y, angle) +{ + var c = Math.cos(angle); + var s = Math.sin(angle); - initialize: + var tx = point.x - x; + var ty = point.y - y; - function AnimationFrame (textureKey, textureFrame, index, frame) - { - /** - * The key of the Texture this AnimationFrame uses. - * - * @name Phaser.Animations.AnimationFrame#textureKey - * @type {string} - * @since 3.0.0 - */ - this.textureKey = textureKey; + point.x = tx * c - ty * s + x; + point.y = tx * s + ty * c + y; - /** - * The key of the Frame within the Texture that this AnimationFrame uses. - * - * @name Phaser.Animations.AnimationFrame#textureFrame - * @type {string|integer} - * @since 3.0.0 - */ - this.textureFrame = textureFrame; + return point; +}; - /** - * The index of this AnimationFrame within the Animation sequence. - * - * @name Phaser.Animations.AnimationFrame#index - * @type {integer} - * @since 3.0.0 - */ - this.index = index; +module.exports = RotateAround; - /** - * A reference to the Texture Frame this AnimationFrame uses for rendering. - * - * @name Phaser.Animations.AnimationFrame#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - this.frame = frame; - /** - * Is this the first frame in an animation sequence? - * - * @name Phaser.Animations.AnimationFrame#isFirst - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isFirst = false; +/***/ }), +/* 187 */ +/***/ (function(module, exports) { - /** - * Is this the last frame in an animation sequence? - * - * @name Phaser.Animations.AnimationFrame#isLast - * @type {boolean} - * @default false - * @readOnly - * @since 3.0.0 - */ - this.isLast = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * A reference to the AnimationFrame that comes before this one in the animation, if any. - * - * @name Phaser.Animations.AnimationFrame#prevFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readOnly - * @since 3.0.0 - */ - this.prevFrame = null; +/** + * Provides methods used for setting the WebGL rendering pipeline of a Game Object. + * + * @name Phaser.GameObjects.Components.Pipeline + * @webglOnly + * @since 3.0.0 + */ - /** - * A reference to the AnimationFrame that comes after this one in the animation, if any. - * - * @name Phaser.Animations.AnimationFrame#nextFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readOnly - * @since 3.0.0 - */ - this.nextFrame = null; +var Pipeline = { + + /** + * [description] + * + * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly + * @since 3.0.0 + */ + defaultPipeline: null, - /** - * Additional time (in ms) that this frame should appear for during playback. - * The value is added onto the msPerFrame set by the animation. - * - * @name Phaser.Animations.AnimationFrame#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; + /** + * [description] + * + * @name Phaser.GameObjects.Components.Pipeline#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly + * @since 3.0.0 + */ + pipeline: null, - /** - * What % through the animation does this frame come? - * This value is generated when the animation is created and cached here. - * - * @name Phaser.Animations.AnimationFrame#progress - * @type {number} - * @default 0 - * @readOnly - * @since 3.0.0 - */ - this.progress = 0; + /** + * Sets the initial WebGL Pipeline of this Game Object. + * This should only be called during the instantiation of the Game Object. + * + * @method Phaser.GameObjects.Components.Pipeline#initPipeline + * @webglOnly + * @since 3.0.0 + * + * @param {string} pipelineName - The name of the pipeline to set on this Game Object. + * + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + */ + initPipeline: function (pipelineName) + { + var renderer = this.scene.sys.game.renderer; - /** - * A frame specific callback, invoked if this frame gets displayed and the callback is set. - * - * @name Phaser.Animations.AnimationFrame#onUpdate - * @type {?function} - * @default null - * @since 3.0.0 - */ - this.onUpdate = null; + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) + { + this.defaultPipeline = renderer.getPipeline(pipelineName); + this.pipeline = this.defaultPipeline; + + return true; + } + + return false; }, /** - * Generates a JavaScript object suitable for converting to JSON. - * - * @method Phaser.Animations.AnimationFrame#toJSON + * Sets the active WebGL Pipeline of this Game Object. + * + * @method Phaser.GameObjects.Components.Pipeline#setPipeline + * @webglOnly * @since 3.0.0 + * + * @param {string} pipelineName - The name of the pipeline to set on this Game Object. * - * @return {object} The AnimationFrame data. + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - toJSON: function () + setPipeline: function (pipelineName) { - return { - key: this.textureKey, - frame: this.textureFrame, - duration: this.duration - }; + var renderer = this.scene.sys.game.renderer; + + if (renderer && renderer.gl && renderer.hasPipeline(pipelineName)) + { + this.pipeline = renderer.getPipeline(pipelineName); + + return true; + } + + return false; }, /** - * Destroys this object by removing references to external resources and callbacks. + * Resets the WebGL Pipeline of this Game Object back to the default it was created with. + * + * @method Phaser.GameObjects.Components.Pipeline#resetPipeline + * @webglOnly + * @since 3.0.0 * - * @method Phaser.Animations.AnimationFrame#destroy + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + */ + resetPipeline: function () + { + this.pipeline = this.defaultPipeline; + + return (this.pipeline !== null); + }, + + /** + * Gets the name of the WebGL Pipeline this Game Object is currently using. + * + * @method Phaser.GameObjects.Components.Pipeline#getPipelineName + * @webglOnly * @since 3.0.0 + * + * @return {string} The string-based name of the pipeline being used by this Game Object. */ - destroy: function () + getPipelineName: function () { - this.frame = undefined; - this.onUpdate = undefined; + return this.pipeline.name; } -}); +}; -module.exports = AnimationFrame; +module.exports = Pipeline; /***/ }), -/* 196 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39008,141 +39766,101 @@ module.exports = AnimationFrame; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Animation = __webpack_require__(194); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(113); -var EventEmitter = __webpack_require__(14); -var GetValue = __webpack_require__(4); -var Pad = __webpack_require__(197); /** * @classdesc - * The Animation Manager. - * - * Animations are managed by the global Animation Manager. This is a singleton class that is - * responsible for creating and delivering animations and their corresponding data to all Game Objects. - * Unlike plugins it is owned by the Game instance, not the Scene. - * - * Sprites and other Game Objects get the data they need from the AnimationManager. + * [description] * - * @class AnimationManager - * @extends EventEmitter - * @memberOf Phaser.Animations + * @class TransformMatrix + * @memberOf Phaser.GameObjects.Components * @constructor * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] + * + * @param {number} [a=1] - [description] + * @param {number} [b=0] - [description] + * @param {number} [c=0] - [description] + * @param {number} [d=1] - [description] + * @param {number} [tx=0] - [description] + * @param {number} [ty=0] - [description] */ -var AnimationManager = new Class({ - - Extends: EventEmitter, +var TransformMatrix = new Class({ initialize: - function AnimationManager (game) + function TransformMatrix (a, b, c, d, tx, ty) { - EventEmitter.call(this); - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#game - * @type {Phaser.Game} - * @protected - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#textureManager - * @type {Phaser.Textures.TextureManager} - * @protected - * @since 3.0.0 - */ - this.textureManager = null; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#globalTimeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.globalTimeScale = 1; - - /** - * [description] - * - * @name Phaser.Animations.AnimationManager#anims - * @type {Phaser.Structs.Map} - * @protected - * @since 3.0.0 - */ - this.anims = new CustomMap(); + if (a === undefined) { a = 1; } + if (b === undefined) { b = 0; } + if (c === undefined) { c = 0; } + if (d === undefined) { d = 1; } + if (tx === undefined) { tx = 0; } + if (ty === undefined) { ty = 0; } /** * [description] * - * @name Phaser.Animations.AnimationManager#paused - * @type {boolean} - * @default false + * @name Phaser.GameObjects.Components.TransformMatrix#matrix + * @type {Float32Array} * @since 3.0.0 */ - this.paused = false; + this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); /** * [description] * - * @name Phaser.Animations.AnimationManager#name - * @type {string} + * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix + * @type {object} * @since 3.0.0 */ - this.name = 'AnimationManager'; - - game.events.once('boot', this.boot, this); + this.decomposedMatrix = { + translateX: 0, + translateY: 0, + scaleX: 1, + scaleY: 1, + rotation: 0 + }; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#boot + * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity * @since 3.0.0 + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - boot: function () + loadIdentity: function () { - this.textureManager = this.game.textures; + var matrix = this.matrix; + + matrix[0] = 1; + matrix[1] = 0; + matrix[2] = 0; + matrix[3] = 1; + matrix[4] = 0; + matrix[5] = 0; - this.game.events.once('destroy', this.destroy, this); + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#add - * @fires AddAnimationEvent + * @method Phaser.GameObjects.Components.TransformMatrix#translate * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.Animations.Animation} animation - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - add: function (key, animation) + translate: function (x, y) { - if (this.anims.has(key)) - { - console.warn('Animation with key', key, 'already exists'); - return; - } - - animation.key = key; - - this.anims.set(key, animation); + var matrix = this.matrix; - this.emit('add', key, animation); + matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; + matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; return this; }, @@ -39150,313 +39868,177 @@ var AnimationManager = new Class({ /** * [description] * - * @method Phaser.Animations.AnimationManager#create - * @fires AddAnimationEvent + * @method Phaser.GameObjects.Components.TransformMatrix#scale * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.Animations.Animation} The Animation that was created. + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - create: function (config) + scale: function (x, y) { - var key = config.key; - - if (!key || this.anims.has(key)) - { - console.warn('Invalid Animation Key, or Key already in use: ' + key); - return; - } - - var anim = new Animation(this, key, config); - - this.anims.set(key, anim); + var matrix = this.matrix; - this.emit('add', key, anim); + matrix[0] *= x; + matrix[1] *= x; + matrix[2] *= y; + matrix[3] *= y; - return anim; + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#fromJSON + * @method Phaser.GameObjects.Components.TransformMatrix#rotate * @since 3.0.0 - * - * @param {string|object} data - [description] - * @param {boolean} [clearCurrentAnimations=false] - [description] - * - * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. + * + * @param {number} radian - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - fromJSON: function (data, clearCurrentAnimations) + rotate: function (radian) { - if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } - - if (clearCurrentAnimations) - { - this.anims.clear(); - } - - // Do we have a String (i.e. from JSON, or an Object?) - if (typeof data === 'string') - { - data = JSON.parse(data); - } - - var output = []; - - // Array of animations, or a single animation? - if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) - { - for (var i = 0; i < data.anims.length; i++) - { - output.push(this.create(data.anims[i])); - } - - if (data.hasOwnProperty('globalTimeScale')) - { - this.globalTimeScale = data.globalTimeScale; - } - } - else if (data.hasOwnProperty('key') && data.type === 'frame') - { - output.push(this.create(data)); - } + var radianSin = Math.sin(radian); + var radianCos = Math.cos(radian); - return output; + return this.transform(radianCos, radianSin, -radianSin, radianCos, 0, 0); }, /** * [description] * - * @method Phaser.Animations.AnimationManager#generateFrameNames + * @method Phaser.GameObjects.Components.TransformMatrix#multiply * @since 3.0.0 - * - * @param {string} key - [description] - * @param {object} config - [description] - * @param {string} [config.prefix=''] - [description] - * @param {integer} [config.start=0] - [description] - * @param {integer} [config.end=0] - [description] - * @param {string} [config.suffix=''] - [description] - * @param {integer} [config.zeroPad=0] - [description] - * @param {array} [config.outputArray=[]] - [description] - * @param {boolean} [config.frames=false] - [description] - * - * @return {object[]} [description] + * + * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - generateFrameNames: function (key, config) + multiply: function (rhs) { - var prefix = GetValue(config, 'prefix', ''); - var start = GetValue(config, 'start', 0); - var end = GetValue(config, 'end', 0); - var suffix = GetValue(config, 'suffix', ''); - var zeroPad = GetValue(config, 'zeroPad', 0); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); - - var texture = this.textureManager.get(key); - - if (!texture) - { - return out; - } - - var diff = (start < end) ? 1 : -1; - - // Adjust because we use i !== end in the for loop - end += diff; - - var i; - var frame; + var matrix = this.matrix; + var otherMatrix = rhs.matrix; - // Have they provided their own custom frame sequence array? - if (Array.isArray(frames)) - { - for (i = 0; i < frames.length; i++) - { - frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; - if (texture.has(frame)) - { - out.push({ key: key, frame: frame }); - } - } - } - else - { - for (i = start; i !== end; i += diff) - { - frame = prefix + Pad(i, zeroPad, '0', 1) + suffix; + var a1 = otherMatrix[0]; + var b1 = otherMatrix[1]; + var c1 = otherMatrix[2]; + var d1 = otherMatrix[3]; + var tx1 = otherMatrix[4]; + var ty1 = otherMatrix[5]; - if (texture.has(frame)) - { - out.push({ key: key, frame: frame }); - } - } - } + matrix[0] = a1 * a0 + b1 * c0; + matrix[1] = a1 * b0 + b1 * d0; + matrix[2] = c1 * a0 + d1 * c0; + matrix[3] = c1 * b0 + d1 * d0; + matrix[4] = tx1 * a0 + ty1 * c0 + tx0; + matrix[5] = tx1 * b0 + ty1 * d0 + ty0; - return out; + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#generateFrameNumbers + * @method Phaser.GameObjects.Components.TransformMatrix#transform * @since 3.0.0 - * - * @param {string} key - [description] - * @param {object} config - [description] - * @param {integer} [config.start=0] - [description] - * @param {integer} [config.end=-1] - [description] - * @param {boolean} [config.first=false] - [description] - * @param {array} [config.outputArray=[]] - [description] - * @param {boolean} [config.frames=false] - [description] - * - * @return {object[]} [description] + * + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - generateFrameNumbers: function (key, config) + transform: function (a, b, c, d, tx, ty) { - var startFrame = GetValue(config, 'start', 0); - var endFrame = GetValue(config, 'end', -1); - var firstFrame = GetValue(config, 'first', false); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); - - var texture = this.textureManager.get(key); - - if (!texture) - { - return out; - } - - if (firstFrame && texture.has(firstFrame)) - { - out.push({ key: key, frame: firstFrame }); - } - - var i; - - // Have they provided their own custom frame sequence array? - if (Array.isArray(frames)) - { - for (i = 0; i < frames.length; i++) - { - if (texture.has(frames[i])) - { - out.push({ key: key, frame: frames[i] }); - } - } - } - else - { - // No endFrame then see if we can get it + var matrix = this.matrix; - if (endFrame === -1) - { - endFrame = texture.frameTotal; - } + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; - for (i = startFrame; i <= endFrame; i++) - { - if (texture.has(i)) - { - out.push({ key: key, frame: i }); - } - } - } + matrix[0] = a * a0 + b * c0; + matrix[1] = a * b0 + b * d0; + matrix[2] = c * a0 + d * c0; + matrix[3] = c * b0 + d * d0; + matrix[4] = tx * a0 + ty * c0 + tx0; + matrix[5] = tx * b0 + ty * d0 + ty0; - return out; + return this; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#get + * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {Phaser.Animations.Animation} [description] - */ - get: function (key) - { - return this.anims.get(key); - }, - - /** - * Load an Animation into a Game Objects Animation Component. * - * @method Phaser.Animations.AnimationManager#load - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {string} key - [description] - * @param {string|integer} [startFrame] - [description] - * - * @return {Phaser.GameObjects.GameObject} [description] + * @param {number} x - [description] + * @param {number} y - [description] + * @param {Phaser.Geom.Point|Phaser.Math.Vec2|object} point - [description] + * + * @return {Phaser.Geom.Point|Phaser.Math.Vec2|object} [description] */ - load: function (child, key, startFrame) + transformPoint: function (x, y, point) { - var anim = this.get(key); - - if (anim) - { - anim.load(child, startFrame); - } + if (point === undefined) { point = { x: 0, y: 0 }; } - return child; - }, + var matrix = this.matrix; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#pauseAll - * @fires PauseAllAnimationEvent - * @since 3.0.0 - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. - */ - pauseAll: function () - { - if (!this.paused) - { - this.paused = true; + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; - this.emit('pauseall'); - } + point.x = x * a + y * c + tx; + point.y = x * b + y * d + ty; - return this; + return point; }, /** * [description] * - * @method Phaser.Animations.AnimationManager#play + * @method Phaser.GameObjects.Components.TransformMatrix#invert * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.GameObjects.GameObject} child - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - play: function (key, child) + invert: function () { - if (!Array.isArray(child)) - { - child = [ child ]; - } + var matrix = this.matrix; - var anim = this.get(key); + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; - if (!anim) - { - return; - } + var n = a * d - b * c; - for (var i = 0; i < child.length; i++) - { - child[i].anims.play(key); - } + matrix[0] = d / n; + matrix[1] = -b / n; + matrix[2] = -c / n; + matrix[3] = a / n; + matrix[4] = (c * ty - d * tx) / n; + matrix[5] = -(a * ty - b * tx) / n; return this; }, @@ -39464,45 +40046,28 @@ var AnimationManager = new Class({ /** * [description] * - * @method Phaser.Animations.AnimationManager#remove - * @fires RemoveAnimationEvent + * @method Phaser.GameObjects.Components.TransformMatrix#setTransform * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {Phaser.Animations.Animation} [description] - */ - remove: function (key) - { - var anim = this.get(key); - - if (anim) - { - this.emit('remove', key, anim); - - this.anims.delete(key); - } - - return anim; - }, - - /** - * [description] * - * @method Phaser.Animations.AnimationManager#resumeAll - * @fires ResumeAllAnimationEvent - * @since 3.0.0 - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - resumeAll: function () + setTransform: function (a, b, c, d, tx, ty) { - if (this.paused) - { - this.paused = false; + var matrix = this.matrix; - this.emit('resumeall'); - } + matrix[0] = a; + matrix[1] = b; + matrix[2] = c; + matrix[3] = d; + matrix[4] = tx; + matrix[5] = ty; return this; }, @@ -39510,94 +40075,83 @@ var AnimationManager = new Class({ /** * [description] * - * @method Phaser.Animations.AnimationManager#staggerPlay + * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix * @since 3.0.0 - * - * @param {string} key - [description] - * @param {Phaser.GameObjects.GameObject} child - [description] - * @param {number} [stagger=0] - [description] - * - * @return {Phaser.Animations.AnimationManager} This Animation Manager. + * + * @return {object} [description] */ - staggerPlay: function (key, child, stagger) + decomposeMatrix: function () { - if (stagger === undefined) { stagger = 0; } + var decomposedMatrix = this.decomposedMatrix; - if (!Array.isArray(child)) - { - child = [ child ]; - } + var matrix = this.matrix; - var anim = this.get(key); + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; - if (!anim) - { - return; - } + var a2 = a * a; + var b2 = b * b; + var c2 = c * c; + var d2 = d * d; - for (var i = 0; i < child.length; i++) - { - child[i].anims.delayedPlay(stagger * i, key); - } + var sx = Math.sqrt(a2 + c2); + var sy = Math.sqrt(b2 + d2); - return this; - }, + decomposedMatrix.translateX = matrix[4]; + decomposedMatrix.translateY = matrix[5]; - /** - * [description] - * - * @method Phaser.Animations.AnimationManager#toJSON - * @since 3.0.0 - * - * @param {string} key - [description] - * - * @return {object} [description] - */ - toJSON: function (key) - { - if (key !== undefined && key !== '') - { - return this.anims.get(key).toJSON(); - } - else - { - var output = { - anims: [], - globalTimeScale: this.globalTimeScale - }; + decomposedMatrix.scaleX = sx; + decomposedMatrix.scaleY = sy; - this.anims.each(function (animationKey, animation) - { - output.anims.push(animation.toJSON()); - }); + decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1); - return output; - } + return decomposedMatrix; }, /** - * [description] + * Identity + Translate + Rotate + Scale * - * @method Phaser.Animations.AnimationManager#destroy + * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} rotation - [description] + * @param {number} scaleX - [description] + * @param {number} scaleY - [description] + * + * @return {Phaser.GameObjects.Components.TransformMatrix} This TransformMatrix. */ - destroy: function () + applyITRS: function (x, y, rotation, scaleX, scaleY) { - this.anims.clear(); + var matrix = this.matrix; - this.textureManager = null; + var sr = Math.sin(rotation); + var cr = Math.cos(rotation); - this.game = null; + // Translate + matrix[4] = x; + matrix[5] = y; + + // Rotate and Scale + matrix[0] = cr * scaleX; + matrix[1] = -sr * scaleX; + matrix[2] = sr * scaleY; + matrix[3] = cr * scaleY; + + return this; } }); -module.exports = AnimationManager; +module.exports = TransformMatrix; /***/ }), -/* 197 */ -/***/ (function(module, exports) { +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -39605,75 +40159,117 @@ module.exports = AnimationManager; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Perimeter = __webpack_require__(78); +var Point = __webpack_require__(5); + +// Return an array of points from the perimeter of the rectangle +// each spaced out based on the quantity or step required + /** - * Takes the given string and pads it out, to the length required, using the character - * specified. For example if you need a string to be 6 characters long, you can call: - * - * `pad('bob', 6, '-', 2)` - * - * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. - * - * You can also use it to pad numbers (they are always returned as strings): - * - * `pad(512, 6, '0', 1)` - * - * Would return: `000512` with the string padded to the left. - * - * If you don't specify a direction it'll pad to both sides: - * - * `pad('c64', 7, '*')` - * - * Would return: `**c64**` + * [description] * - * @function Phaser.Utils.String.Pad + * @function Phaser.Geom.Rectangle.MarchingAnts * @since 3.0.0 * - * @param {string} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. - * @param {integer} [len=0] - The number of characters to be added. - * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). - * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). - * - * @return {string} The padded string. + * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {number} step - [description] + * @param {integer} quantity - [description] + * @param {array} [out] - [description] + * + * @return {Phaser.Geom.Point[]} [description] */ -var Pad = function (str, len, pad, dir) +var MarchingAnts = function (rect, step, quantity, out) { - if (len === undefined) { len = 0; } - if (pad === undefined) { pad = ' '; } - if (dir === undefined) { dir = 3; } + if (out === undefined) { out = []; } - str = str.toString(); + if (!step && !quantity) + { + // Bail out + return out; + } - var padlen = 0; + // If step is a falsey value (false, null, 0, undefined, etc) then we calculate + // it based on the quantity instead, otherwise we always use the step value + if (!step) + { + step = Perimeter(rect) / quantity; + } + else + { + quantity = Math.round(Perimeter(rect) / step); + } - if (len + 1 >= str.length) + var x = rect.x; + var y = rect.y; + var face = 0; + + // Loop across each face of the rectangle + + for (var i = 0; i < quantity; i++) { - switch (dir) + out.push(new Point(x, y)); + + switch (face) { + + // Top face + case 0: + x += step; + + if (x >= rect.right) + { + face = 1; + y += (x - rect.right); + x = rect.right; + } + break; + + // Right face case 1: - str = new Array(len + 1 - str.length).join(pad) + str; + y += step; + + if (y >= rect.bottom) + { + face = 2; + x -= (y - rect.bottom); + y = rect.bottom; + } break; - case 3: - var right = Math.ceil((padlen = len - str.length) / 2); - var left = padlen - right; - str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); + // Bottom face + case 2: + x -= step; + + if (x <= rect.left) + { + face = 3; + y -= (rect.left - x); + x = rect.left; + } break; - default: - str = str + new Array(len + 1 - str.length).join(pad); + // Left face + case 3: + y -= step; + + if (y <= rect.top) + { + face = 0; + y = rect.top; + } break; } } - return str; + return out; }; -module.exports = Pad; +module.exports = MarchingAnts; /***/ }), -/* 198 */ -/***/ (function(module, exports, __webpack_require__) { +/* 190 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -39681,175 +40277,215 @@ module.exports = Pad; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(113); -var EventEmitter = __webpack_require__(14); - /** - * @classdesc - * The BaseCache is a base Cache class that can be used for storing references to any kind of data. + * Moves the element at the start of the array to the end, shifting all items in the process. + * The "rotation" happens to the left. * - * Data can be added, retrieved and removed based on the given keys. + * @function Phaser.Utils.Array.RotateLeft + * @since 3.0.0 * - * Keys are string-based. + * @param {array} array - The array to shift to the left. This array is modified in place. + * @param {integer} [total=1] - The number of times to shift the array. * - * @class BaseCache - * @memberOf Phaser.Cache - * @constructor - * @since 3.0.0 + * @return {any} The most recently shifted element. */ -var BaseCache = new Class({ +var RotateLeft = function (array, total) +{ + if (total === undefined) { total = 1; } - initialize: + var element = null; - function BaseCache () + for (var i = 0; i < total; i++) { - /** - * The Map in which the cache objects are stored. - * - * You can query the Map directly or use the BaseCache methods. - * - * @name Phaser.Cache.BaseCache#entries - * @type {Phaser.Structs.Map} - * @since 3.0.0 - */ - this.entries = new CustomMap(); + element = array.shift(); + array.push(element); + } - /** - * An instance of EventEmitter used by the cache to emit related events. - * - * @name Phaser.Cache.BaseCache#events - * @type {EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); - }, + return element; +}; - /** - * Cache add event. - * - * This event is fired by the Cache each time a new object is added to it. - * - * @event Phaser.Cache.BaseCache#addEvent - * @param {Phaser.Cache.BaseCache} The BaseCache to which the object was added. - * @param {string} The key of the object added to the cache. - * @param {any} A reference to the object added to the cache. - */ +module.exports = RotateLeft; - /** - * Adds an item to this cache. The item is referenced by a unique string, which you are responsible - * for setting and keeping track of. The item can only be retrieved by using this string. - * - * @method Phaser.Cache.BaseCache#add - * @fires Phaser.Cache.BaseCache#addEvent - * @since 3.0.0 - * - * @param {string} key - The unique key by which the data added to the cache will be referenced. - * @param {any} data - The data to be stored in the cache. - * - * @return {Phaser.Cache.BaseCache} This BaseCache object. - */ - add: function (key, data) - { - this.entries.set(key, data); - this.events.emit('add', this, key, data); +/***/ }), +/* 191 */ +/***/ (function(module, exports) { - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Checks if this cache contains an item matching the given key. - * - * @method Phaser.Cache.BaseCache#has - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be checked in this cache. - * - * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. - */ - has: function (key) - { - return this.entries.has(key); - }, +/** + * Moves the element at the end of the array to the start, shifting all items in the process. + * The "rotation" happens to the right. + * + * @function Phaser.Utils.Array.RotateRight + * @since 3.0.0 + * + * @param {array} array - The array to shift to the right. This array is modified in place. + * @param {integer} [total=1] - The number of times to shift the array. + * + * @return {any} The most recently shifted element. + */ +var RotateRight = function (array, total) +{ + if (total === undefined) { total = 1; } - /** - * Gets an item from this cache based on the given key. - * - * @method Phaser.Cache.BaseCache#get - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be retrieved from this cache. - * - * @return {any} The item in the cache, or `null` if no item matching the given key was found. - */ - get: function (key) + var element = null; + + for (var i = 0; i < total; i++) { - return this.entries.get(key); - }, + element = array.pop(); + array.unshift(element); + } - /** - * Cache remove event. - * - * This event is fired by the Cache each time an object is removed from it. - * - * @event Phaser.Cache.BaseCache#removeEvent - * @param {Phaser.Cache.BaseCache} The BaseCache from which the object was removed. - * @param {string} The key of the object removed from the cache. - * @param {any} The object that was removed from the cache. - */ + return element; +}; - /** - * Removes and item from this cache based on the given key. - * - * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. - * No additional checks are done on the item removed. If other systems or parts of your game code - * are relying on this item, it is up to you to sever those relationships prior to removing the item. - * - * @method Phaser.Cache.BaseCache#remove - * @fires Phaser.Cache.BaseCache#removeEvent - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to remove from the cache. - * - * @return {Phaser.Cache.BaseCache} This BaseCache object. - */ - remove: function (key) +module.exports = RotateRight; + + +/***/ }), +/* 192 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Using Bresenham's line algorithm this will return an array of all coordinates on this line. + * The start and end points are rounded before this runs as the algorithm works on integers. + * + * @function Phaser.Geom.Line.BresenhamPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - [description] + * @param {integer} [stepRate=1] - [description] + * @param {array} [results] - [description] + * + * @return {array} [description] + */ +var BresenhamPoints = function (line, stepRate, results) +{ + if (stepRate === undefined) { stepRate = 1; } + if (results === undefined) { results = []; } + + var x1 = Math.round(line.x1); + var y1 = Math.round(line.y1); + var x2 = Math.round(line.x2); + var y2 = Math.round(line.y2); + + var dx = Math.abs(x2 - x1); + var dy = Math.abs(y2 - y1); + var sx = (x1 < x2) ? 1 : -1; + var sy = (y1 < y2) ? 1 : -1; + var err = dx - dy; + + results.push({ x: x1, y: y1 }); + + var i = 1; + + while (!((x1 === x2) && (y1 === y2))) { - var entry = this.get(key); + var e2 = err << 1; - if (entry) + if (e2 > -dy) { - this.entries.delete(key); - - this.events.emit('remove', this, key, entry.data); + err -= dy; + x1 += sx; } - return this; - }, + if (e2 < dx) + { + err += dx; + y1 += sy; + } - /** - * Destroys this cache and all items within it. - * - * @method Phaser.Cache.BaseCache#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.entries.clear(); - this.events.removeAllListeners(); + if (i % stepRate === 0) + { + results.push({ x: x1, y: y1 }); + } - this.entries = null; - this.events = null; + i++; } -}); + return results; +}; -module.exports = BaseCache; +module.exports = BresenhamPoints; /***/ }), -/* 199 */ +/* 193 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Math.SmootherStep + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * + * @return {number} [description] + */ +var SmootherStep = function (x, min, max) +{ + x = Math.max(0, Math.min(1, (x - min) / (max - min))); + + return x * x * x * (x * (x * 6 - 15) + 10); +}; + +module.exports = SmootherStep; + + +/***/ }), +/* 194 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Math.SmoothStep + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * + * @return {number} [description] + */ +var SmoothStep = function (x, min, max) +{ + x = Math.max(0, Math.min(1, (x - min) / (max - min))); + + return x * x * (3 - 2 * x); +}; + +module.exports = SmoothStep; + + +/***/ }), +/* 195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39858,735 +40494,355 @@ module.exports = BaseCache; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BaseCache = __webpack_require__(198); var Class = __webpack_require__(0); +var Frame = __webpack_require__(196); +var GetValue = __webpack_require__(4); /** * @classdesc - * The Cache Manager is the global cache owned and maintained by the Game instance. + * A Frame based Animation. * - * Various systems, such as the file Loader, rely on this cache in order to store the files - * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache - * instances, one per type of file. You can also add your own custom caches. + * This consists of a key, some default values (like the frame rate) and a bunch of Frame objects. + * + * The Animation Manager creates these. Game Objects don't own an instance of these directly. + * Game Objects have the Animation Component, which are like playheads to global Animations (these objects) + * So multiple Game Objects can have playheads all pointing to this one Animation instance. * - * @class CacheManager - * @memberOf Phaser.Cache + * @class Animation + * @memberOf Phaser.Animations * @constructor * @since 3.0.0 * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. + * @param {Phaser.Animations.AnimationManager} manager - [description] + * @param {string} key - [description] + * @param {object} config - [description] */ -var CacheManager = new Class({ +var Animation = new Class({ initialize: - function CacheManager (game) + function Animation (manager, key, config) { /** - * A reference to the Phaser.Game instance that owns this CacheManager. + * [description] * - * @name Phaser.Cache.CacheManager#game - * @type {Phaser.Game} - * @protected + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} * @since 3.0.0 */ - this.game = game; + this.manager = manager; /** - * A Cache storing all binary files, typically added via the Loader. + * [description] * - * @name Phaser.Cache.CacheManager#binary - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#key + * @type {string} * @since 3.0.0 */ - this.binary = new BaseCache(); + this.key = key; /** - * A Cache storing all bitmap font data files, typically added via the Loader. - * Only the font data is stored in this cache, the textures are part of the Texture Manager. + * A frame based animation (as opposed to a bone based animation) * - * @name Phaser.Cache.CacheManager#bitmapFont - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#type + * @type {string} + * @default frame * @since 3.0.0 */ - this.bitmapFont = new BaseCache(); + this.type = 'frame'; /** - * A Cache storing all JSON data files, typically added via the Loader. + * Extract all the frame data into the frames array * - * @name Phaser.Cache.CacheManager#json - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#frames + * @type {array} * @since 3.0.0 */ - this.json = new BaseCache(); + this.frames = this.getFrames( + manager.textureManager, + GetValue(config, 'frames', []), + GetValue(config, 'defaultTextureKey', null) + ); /** - * A Cache storing all physics data files, typically added via the Loader. + * The frame rate of playback in frames per second (default 24 if duration is null) * - * @name Phaser.Cache.CacheManager#physics - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#frameRate + * @type {integer} + * @default 24 * @since 3.0.0 */ - this.physics = new BaseCache(); + this.frameRate = GetValue(config, 'frameRate', null); /** - * A Cache storing all shader source files, typically added via the Loader. + * How long the animation should play for. + * If frameRate is set it overrides this value otherwise frameRate is derived from duration. * - * @name Phaser.Cache.CacheManager#shader - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#duration + * @type {integer} * @since 3.0.0 */ - this.shader = new BaseCache(); + this.duration = GetValue(config, 'duration', null); + + if (this.duration === null && this.frameRate === null) + { + // No duration or frameRate given, use default frameRate of 24fps + this.frameRate = 24; + this.duration = this.frameRate / this.frames.length; + } + else if (this.duration && this.frameRate === null) + { + // Duration given but no frameRate, so set the frameRate based on duration + // I.e. 12 frames in the animation, duration = 4 (4000 ms) + // So frameRate is 12 / 4 = 3 fps + this.frameRate = this.frames.length / this.duration; + } + else + { + // frameRate given, derive duration from it (even if duration also specified) + // I.e. 15 frames in the animation, frameRate = 30 fps + // So duration is 15 / 30 = 0.5 (half a second) + this.duration = this.frames.length / this.frameRate; + } /** - * A Cache storing all non-streaming audio files, typically added via the Loader. + * ms per frame (without including frame specific modifiers) * - * @name Phaser.Cache.CacheManager#audio - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#msPerFrame + * @type {integer} * @since 3.0.0 */ - this.audio = new BaseCache(); + this.msPerFrame = 1000 / this.frameRate; /** - * A Cache storing all text files, typically added via the Loader. + * Skip frames if the time lags, or always advanced anyway? * - * @name Phaser.Cache.CacheManager#text - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#skipMissedFrames + * @type {boolean} + * @default false * @since 3.0.0 */ - this.text = new BaseCache(); + this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); /** - * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * Delay before starting playback (in seconds) * - * @name Phaser.Cache.CacheManager#obj - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#delay + * @type {integer} + * @default 0 * @since 3.0.0 */ - this.obj = new BaseCache(); + this.delay = GetValue(config, 'delay', 0); /** - * A Cache storing all tilemap data files, typically added via the Loader. - * Only the data is stored in this cache, the textures are part of the Texture Manager. + * Number of times to repeat the animation (-1 for infinity) * - * @name Phaser.Cache.CacheManager#tilemap - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#repeat + * @type {integer} + * @default 0 * @since 3.0.0 */ - this.tilemap = new BaseCache(); + this.repeat = GetValue(config, 'repeat', 0); /** - * A Cache storing all xml data files, typically added via the Loader. + * Delay before the repeat starts (in seconds) * - * @name Phaser.Cache.CacheManager#xml - * @type {Phaser.Cache.BaseCache} - * @protected + * @name Phaser.Animations.Animation#repeatDelay + * @type {integer} + * @default 0 * @since 3.0.0 */ - this.xml = new BaseCache(); + this.repeatDelay = GetValue(config, 'repeatDelay', 0); /** - * An object that contains your own custom BaseCache entries. - * Add to this via the `addCustom` method. + * Should the animation yoyo? (reverse back down to the start) before repeating? * - * @name Phaser.Cache.CacheManager#custom - * @type {object.} - * @protected + * @name Phaser.Animations.Animation#yoyo + * @type {boolean} + * @default false * @since 3.0.0 */ - this.custom = {}; - - this.game.events.once('destroy', this.destroy, this); - }, - - /** - * Add your own custom Cache for storing your own files. - * The cache will be available under `Cache.custom.key`. - * The cache will only be created if the key is not already in use. - * - * @method Phaser.Cache.CacheManager#addCustom - * @since 3.0.0 - * - * @param {string} key - The unique key of your custom cache. - * - * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. - */ - addCustom: function (key) - { - if (!this.custom.hasOwnProperty(key)) - { - this.custom[key] = new BaseCache(); - } - - return this.custom[key]; - }, - - /** - * Removes all entries from all BaseCaches and destroys all custom caches. - * - * @method Phaser.Cache.CacheManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - var keys = [ - 'binary', - 'bitmapFont', - 'json', - 'physics', - 'shader', - 'audio', - 'text', - 'obj', - 'tilemap', - 'xml' - ]; - - for (var i = 0; i < keys.length; i++) - { - this[keys[i]].destroy(); - this[keys[i]] = null; - } - - for (var key in this.custom) - { - this.custom[key].destroy(); - } - - this.custom = null; - - this.game = null; - } - -}); - -module.exports = CacheManager; - - -/***/ }), -/* 200 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Color = __webpack_require__(36); - -/** - * Converts a hex string into a Phaser Color object. - * - * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. - * - * An alpha channel is _not_ supported. - * - * @function Phaser.Display.Color.HexStringToColor - * @since 3.0.0 - * - * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. - * - * @return {Phaser.Display.Color} A Color object populated by the values of the given string. - */ -var HexStringToColor = function (hex) -{ - var color = new Color(); - - // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) - { - return r + r + g + g + b + b; - }); - - var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); - - if (result) - { - var r = parseInt(result[1], 16); - var g = parseInt(result[2], 16); - var b = parseInt(result[3], 16); - - color.setTo(r, g, b); - } - - return color; -}; - -module.exports = HexStringToColor; - - -/***/ }), -/* 201 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Given an alpha and 3 color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor32 - * @since 3.0.0 - * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} alpha - The alpha color value. A number between 0 and 255. - * - * @return {number} The combined color value. - */ -var GetColor32 = function (red, green, blue, alpha) -{ - return alpha << 24 | red << 16 | green << 8 | blue; -}; - -module.exports = GetColor32; - - -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Color = __webpack_require__(36); -var IntegerToRGB = __webpack_require__(203); - -/** - * Converts the given color value into an instance of a Color object. - * - * @function Phaser.Display.Color.IntegerToColor - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {Phaser.Display.Color} A Color object. - */ -var IntegerToColor = function (input) -{ - var rgb = IntegerToRGB(input); - - return new Color(rgb.r, rgb.g, rgb.b, rgb.a); -}; - -module.exports = IntegerToColor; - - -/***/ }), -/* 203 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Return the component parts of a color as an Object with the properties alpha, red, green, blue. - * - * Alpha will only be set if it exists in the given color (0xAARRGGBB) - * - * @function Phaser.Display.Color.IntegerToRGB - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var IntegerToRGB = function (color) -{ - if (color > 16777215) - { - // The color value has an alpha component - return { - a: color >>> 24, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } - else - { - return { - a: 255, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } -}; - -module.exports = IntegerToRGB; - - -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Color = __webpack_require__(36); - -/** - * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. - * - * @function Phaser.Display.Color.ObjectToColor - * @since 3.0.0 - * - * @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. - * - * @return {Phaser.Display.Color} A Color object. - */ -var ObjectToColor = function (input) -{ - return new Color(input.r, input.g, input.b, input.a); -}; - -module.exports = ObjectToColor; - - -/***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Color = __webpack_require__(36); - -/** - * Converts a CSS 'web' string into a Phaser Color object. - * - * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. - * - * @function Phaser.Display.Color.RGBStringToColor - * @since 3.0.0 - * - * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. - * - * @return {Phaser.Display.Color} A Color object. - */ -var RGBStringToColor = function (rgb) -{ - var color = new Color(); - - var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); - - if (result) - { - var r = parseInt(result[1], 10); - var g = parseInt(result[2], 10); - var b = parseInt(result[3], 10); - var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; - - color.setTo(r, g, b, a * 255); - } - - return color; -}; - -module.exports = RGBStringToColor; - - -/***/ }), -/* 206 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -// Position Vector randomly in a spherical area defined by the given radius -/** - * [description] - * - * @function Phaser.Math.RandomXYZ - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec3 - [description] - * @param {number} [radius=1] - [description] - * - * @return {Phaser.Math.Vector3} [description] - */ -var RandomXYZ = function (vec3, radius) -{ - if (radius === undefined) { radius = 1; } - - var r = Math.random() * 2 * Math.PI; - var z = (Math.random() * 2) - 1; - var zScale = Math.sqrt(1 - z * z) * radius; - - vec3.x = Math.cos(r) * zScale; - vec3.y = Math.sin(r) * zScale; - vec3.z = z * radius; - - return vec3; -}; - -module.exports = RandomXYZ; - - -/***/ }), -/* 207 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - [description] - * @param {float} [scale=1] - [description] - * - * @return {Phaser.Math.Vector4} [description] - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } - - // Not spherical; should fix this for more uniform distribution - vec4.x = (Math.random() * 2 - 1) * scale; - vec4.y = (Math.random() * 2 - 1) * scale; - vec4.z = (Math.random() * 2 - 1) * scale; - vec4.w = (Math.random() * 2 - 1) * scale; - - return vec4; -}; - -module.exports = RandomXYZW; - - -/***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Vector3 = __webpack_require__(51); -var Matrix4 = __webpack_require__(118); -var Quaternion = __webpack_require__(209); - -var tmpMat4 = new Matrix4(); -var tmpQuat = new Quaternion(); -var tmpVec3 = new Vector3(); - -/** - * Rotates a vector in place by axis angle. - * - * This is the same as transforming a point by an - * axis-angle quaternion, but it has higher precision. - * - * @function Phaser.Math.RotateVec3 - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec - [description] - * @param {Phaser.Math.Vector3} axis - [description] - * @param {float} radians - [description] - * - * @return {Phaser.Math.Vector3} [description] - */ -var RotateVec3 = function (vec, axis, radians) -{ - // Set the quaternion to our axis angle - tmpQuat.setAxisAngle(axis, radians); - - // Create a rotation matrix from the axis angle - tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); - - // Multiply our vector by the rotation matrix - return vec.transformMat4(tmpMat4); -}; - -module.exports = RotateVec3; - - -/***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.yoyo = GetValue(config, 'yoyo', false); -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + /** + * Should sprite.visible = true when the animation starts to play? + * + * @name Phaser.Animations.Animation#showOnStart + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.showOnStart = GetValue(config, 'showOnStart', false); -var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(51); -var Matrix3 = __webpack_require__(210); + /** + * Should sprite.visible = false when the animation finishes? + * + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); -var EPSILON = 0.000001; + /** + * [description] + * + * @name Phaser.Animations.Animation#callbackScope + * @type {object} + * @since 3.0.0 + */ + this.callbackScope = GetValue(config, 'callbackScope', this); -// Some shared 'private' arrays -var siNext = new Int8Array([ 1, 2, 0 ]); -var tmp = new Float32Array([ 0, 0, 0 ]); + /** + * [description] + * + * @name Phaser.Animations.Animation#onStart + * @type {function} + * @since 3.0.0 + */ + this.onStart = GetValue(config, 'onStart', false); -var xUnitVec3 = new Vector3(1, 0, 0); -var yUnitVec3 = new Vector3(0, 1, 0); + /** + * [description] + * + * @name Phaser.Animations.Animation#onStartParams + * @type {array} + * @since 3.0.0 + */ + this.onStartParams = GetValue(config, 'onStartParams', []); -var tmpvec = new Vector3(); -var tmpMat3 = new Matrix3(); + /** + * [description] + * + * @name Phaser.Animations.Animation#onRepeat + * @type {function} + * @since 3.0.0 + */ + this.onRepeat = GetValue(config, 'onRepeat', false); -/** - * @classdesc - * [description] - * - * @class Quaternion - * @memberOf Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - [description] - * @param {number} [y] - [description] - * @param {number} [z] - [description] - * @param {number} [w] - [description] - */ -var Quaternion = new Class({ + /** + * [description] + * + * @name Phaser.Animations.Animation#onRepeatParams + * @type {array} + * @since 3.0.0 + */ + this.onRepeatParams = GetValue(config, 'onRepeatParams', []); - initialize: + /** + * Called for EVERY frame of the animation. + * See AnimationFrame.onUpdate for a frame specific callback. + * + * @name Phaser.Animations.Animation#onUpdate + * @type {function} + * @since 3.0.0 + */ + this.onUpdate = GetValue(config, 'onUpdate', false); - function Quaternion (x, y, z, w) - { /** - * The x component of this Quaternion. + * [description] * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 + * @name Phaser.Animations.Animation#onUpdateParams + * @type {array} * @since 3.0.0 */ + this.onUpdateParams = GetValue(config, 'onUpdateParams', []); /** - * The y component of this Quaternion. + * [description] * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 + * @name Phaser.Animations.Animation#onComplete + * @type {function} * @since 3.0.0 */ + this.onComplete = GetValue(config, 'onComplete', false); /** - * The z component of this Quaternion. + * [description] * - * @name Phaser.Math.Quaternion#z - * @type {number} - * @default 0 + * @name Phaser.Animations.Animation#onCompleteParams + * @type {array} * @since 3.0.0 */ + this.onCompleteParams = GetValue(config, 'onCompleteParams', []); /** - * The w component of this Quaternion. + * Global pause, effects all Game Objects using this Animation instance * - * @name Phaser.Math.Quaternion#w - * @type {number} - * @default 0 + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false * @since 3.0.0 */ + this.paused = false; - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + this.manager.on('pauseall', this.pause.bind(this)); + this.manager.on('resumeall', this.resume.bind(this)); }, + // config = Array of Animation config objects, like: + // [ + // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } + // ] + + // Add frames to the end of the animation + /** * [description] * - * @method Phaser.Math.Quaternion#copy + * @method Phaser.Animations.Animation#addFrame * @since 3.0.0 * - * @param {[type]} src - [description] + * @param {[type]} config - [description] * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - copy: function (src) + addFrame: function (config) { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; + return this.addFrameAt(this.frames.length, config); }, + // config = Array of Animation config objects, like: + // [ + // { key: 'gems', frame: 'diamond0001', [duration], [visible], [onUpdate] } + // ] + + // Add frame/s into the animation + /** * [description] * - * @method Phaser.Math.Quaternion#set + * @method Phaser.Animations.Animation#addFrameAt * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] - * @param {[type]} z - [description] - * @param {[type]} w - [description] + * @param {integer} index - [description] + * @param {[type]} config - [description] * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - set: function (x, y, z, w) + addFrameAt: function (index, config) { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else + var newFrames = this.getFrames(this.manager.textureManager, config); + + if (newFrames.length > 0) { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; + if (index === 0) + { + this.frames = newFrames.concat(this.frames); + } + else if (index === this.frames.length) + { + this.frames = this.frames.concat(newFrames); + } + else + { + var pre = this.frames.slice(0, index); + var post = this.frames.slice(index); + + this.frames = pre.concat(newFrames, post); + } + + this.updateFrameSequence(); } return this; @@ -40595,265 +40851,338 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#add + * @method Phaser.Animations.Animation#checkFrame * @since 3.0.0 * - * @param {[type]} v - [description] + * @param {integer} index - [description] * - * @return {[type]} [description] + * @return {boolean} [description] */ - add: function (v) + checkFrame: function (index) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - - return this; + return (index < this.frames.length); }, /** * [description] * - * @method Phaser.Math.Quaternion#subtract + * @method Phaser.Animations.Animation#completeAnimation * @since 3.0.0 * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - subtract: function (v) + completeAnimation: function (component) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; + if (this.hideOnComplete) + { + component.parent.visible = false; + } - return this; + component.stop(true); }, /** * [description] * - * @method Phaser.Math.Quaternion#scale + * @method Phaser.Animations.Animation#getFirstTick * @since 3.0.0 * - * @param {[type]} scale - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] + * @param {boolean} [includeDelay=true] - [description] */ - scale: function (scale) + getFirstTick: function (component, includeDelay) { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + if (includeDelay === undefined) { includeDelay = true; } - return this; + // When is the first update due? + component.accumulator = 0; + component.nextTick = component.msPerFrame + component.currentFrame.duration; + + if (includeDelay) + { + component.nextTick += (component._delay * 1000); + } }, /** * [description] * - * @method Phaser.Math.Quaternion#length + * @method Phaser.Animations.Animation#getFrameAt * @since 3.0.0 * - * @return {[type]} [description] + * @param {integer} index - [description] + * + * @return {Phaser.Animations.AnimationFrame} [description] */ - length: function () + getFrameAt: function (index) { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - - return Math.sqrt(x * x + y * y + z * z + w * w); + return this.frames[index]; }, /** * [description] * - * @method Phaser.Math.Quaternion#lengthSq + * @method Phaser.Animations.Animation#getFrames * @since 3.0.0 * - * @return {[type]} [description] + * @param {[type]} textureManager - [description] + * @param {[type]} frames - [description] + * + * @return {Phaser.Animations.AnimationFrame[]} [description] */ - lengthSq: function () + getFrames: function (textureManager, frames, defaultTextureKey) { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + // frames: [ + // { key: textureKey, frame: textureFrame }, + // { key: textureKey, frame: textureFrame, duration: float }, + // { key: textureKey, frame: textureFrame, onUpdate: function } + // { key: textureKey, frame: textureFrame, visible: boolean } + // ], - return x * x + y * y + z * z + w * w; + var out = []; + var prev; + var animationFrame; + var index = 1; + var i; + var textureKey; + + // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet + if (typeof frames === 'string') + { + textureKey = frames; + + var texture = textureManager.get(textureKey); + var frameKeys = texture.getFrameNames(); + + frames = []; + + frameKeys.forEach(function (idx, value) + { + frames.push({ key: textureKey, frame: value }); + }); + } + + if (!Array.isArray(frames) || frames.length === 0) + { + return out; + } + + for (i = 0; i < frames.length; i++) + { + var item = frames[i]; + + var key = GetValue(item, 'key', defaultTextureKey); + + if (!key) + { + continue; + } + + // Could be an integer or a string + var frame = GetValue(item, 'frame', 0); + + // The actual texture frame + var textureFrame = textureManager.getFrame(key, frame); + + animationFrame = new Frame(key, frame, index, textureFrame); + + animationFrame.duration = GetValue(item, 'duration', 0); + animationFrame.onUpdate = GetValue(item, 'onUpdate', null); + + animationFrame.isFirst = (!prev); + + // The previously created animationFrame + if (prev) + { + prev.nextFrame = animationFrame; + + animationFrame.prevFrame = prev; + } + + out.push(animationFrame); + + prev = animationFrame; + + index++; + } + + if (out.length > 0) + { + animationFrame.isLast = true; + + // Link them end-to-end, so they loop + animationFrame.nextFrame = out[0]; + + out[0].prevFrame = animationFrame; + + // Generate the progress data + + var slice = 1 / (out.length - 1); + + for (i = 0; i < out.length; i++) + { + out[i].progress = i * slice; + } + } + + return out; }, /** * [description] * - * @method Phaser.Math.Quaternion#normalize + * @method Phaser.Animations.Animation#getNextTick * @since 3.0.0 * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - normalize: function () + getNextTick: function (component) { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var len = x * x + y * y + z * z + w * w; - - if (len > 0) - { - len = 1 / Math.sqrt(len); + // accumulator += delta * _timeScale + // after a large delta surge (perf issue for example) we need to adjust for it here - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; - } + // When is the next update due? + component.accumulator -= component.nextTick; - return this; + component.nextTick = component.msPerFrame + component.currentFrame.duration; }, /** * [description] * - * @method Phaser.Math.Quaternion#dot + * @method Phaser.Animations.Animation#load * @since 3.0.0 * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] + * @param {integer} startFrame - [description] */ - dot: function (v) + load: function (component, startFrame) { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; + if (startFrame >= this.frames.length) + { + startFrame = 0; + } + + if (component.currentAnim !== this) + { + component.currentAnim = this; + + component._timeScale = 1; + component.frameRate = this.frameRate; + component.duration = this.duration; + component.msPerFrame = this.msPerFrame; + component.skipMissedFrames = this.skipMissedFrames; + component._delay = this.delay; + component._repeat = this.repeat; + component._repeatDelay = this.repeatDelay; + component._yoyo = this.yoyo; + component._callbackArgs[1] = this; + component._updateParams = component._callbackArgs.concat(this.onUpdateParams); + } + + component.updateFrame(this.frames[startFrame]); }, /** * [description] * - * @method Phaser.Math.Quaternion#lerp + * @method Phaser.Animations.Animation#nextFrame * @since 3.0.0 * - * @param {[type]} v - [description] - * @param {[type]} t - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - lerp: function (v, t) + nextFrame: function (component) { - if (t === undefined) { t = 0; } + var frame = component.currentFrame; - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + // TODO: Add frame skip support - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); + if (frame.isLast) + { + // We're at the end of the animation - return this; + // Yoyo? (happens before repeat) + if (this.yoyo) + { + component.forward = false; + + component.updateFrame(frame.prevFrame); + + // Delay for the current frame + this.getNextTick(component); + } + else if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + this.repeatAnimation(component); + } + else + { + this.completeAnimation(component); + } + } + else + { + component.updateFrame(frame.nextFrame); + + this.getNextTick(component); + } }, /** * [description] * - * @method Phaser.Math.Quaternion#rotationTo + * @method Phaser.Animations.Animation#previousFrame * @since 3.0.0 * - * @param {[type]} a - [description] - * @param {[type]} b - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - rotationTo: function (a, b) + previousFrame: function (component) { - var dot = a.x * b.x + a.y * b.y + a.z * b.z; - - if (dot < -0.999999) - { - if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) - { - tmpvec.copy(yUnitVec3).cross(a); - } - - tmpvec.normalize(); + var frame = component.currentFrame; - return this.setAxisAngle(tmpvec, Math.PI); + // TODO: Add frame skip support - } - else if (dot > 0.999999) + if (frame.isFirst) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; + // We're at the start of the animation - return this; + if (component.repeatCounter > 0) + { + // Repeat (happens before complete) + this.repeatAnimation(component); + } + else + { + this.completeAnimation(component); + } } else { - tmpvec.copy(a).cross(b); - - this.x = tmpvec.x; - this.y = tmpvec.y; - this.z = tmpvec.z; - this.w = 1 + dot; + component.updateFrame(frame.prevFrame); - return this.normalize(); + this.getNextTick(component); } }, /** * [description] * - * @method Phaser.Math.Quaternion#setAxes + * @method Phaser.Animations.Animation#removeFrame * @since 3.0.0 * - * @param {[type]} view - [description] - * @param {[type]} right - [description] - * @param {[type]} up - [description] + * @param {Phaser.Animations.AnimationFrame} frame - [description] * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - setAxes: function (view, right, up) + removeFrame: function (frame) { - var m = tmpMat3.val; + var index = this.frames.indexOf(frame); - m[0] = right.x; - m[3] = right.y; - m[6] = right.z; - - m[1] = up.x; - m[4] = up.y; - m[7] = up.z; - - m[2] = -view.x; - m[5] = -view.y; - m[8] = -view.z; - - return this.fromMat3(tmpMat3).normalize(); - }, - - /** - * [description] - * - * @method Phaser.Math.Quaternion#identity - * @since 3.0.0 - * - * @return {[type]} [description] - */ - identity: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; + if (index !== -1) + { + this.removeFrameAt(index); + } return this; }, @@ -40861,24 +41190,18 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#setAxisAngle + * @method Phaser.Animations.Animation#removeFrameAt * @since 3.0.0 * - * @param {[type]} axis - [description] - * @param {[type]} rad - [description] + * @param {integer} index - [description] * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - setAxisAngle: function (axis, rad) + removeFrameAt: function (index) { - rad = rad * 0.5; - - var s = Math.sin(rad); + this.frames.splice(index, 1); - this.x = s * axis.x; - this.y = s * axis.y; - this.z = s * axis.z; - this.w = Math.cos(rad); + this.updateFrameSequence(); return this; }, @@ -40886,137 +41209,133 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#multiply + * @method Phaser.Animations.Animation#repeatAnimation * @since 3.0.0 * - * @param {[type]} b - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - multiply: function (b) + repeatAnimation: function (component) { - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + if (component._repeatDelay > 0 && component.pendingRepeat === false) + { + component.pendingRepeat = true; + component.accumulator -= component.nextTick; + component.nextTick += (component._repeatDelay * 1000); + } + else + { + component.repeatCounter--; - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; + component.forward = true; - this.x = ax * bw + aw * bx + ay * bz - az * by; - this.y = ay * bw + aw * by + az * bx - ax * bz; - this.z = az * bw + aw * bz + ax * by - ay * bx; - this.w = aw * bw - ax * bx - ay * by - az * bz; + component.updateFrame(component.currentFrame.nextFrame); - return this; + this.getNextTick(component); + + component.pendingRepeat = false; + + if (this.onRepeat) + { + this.onRepeat.apply(this.callbackScope, component._callbackArgs.concat(this.onRepeatParams)); + } + } }, /** * [description] * - * @method Phaser.Math.Quaternion#slerp + * @method Phaser.Animations.Animation#setFrame * @since 3.0.0 * - * @param {[type]} b - [description] - * @param {[type]} t - [description] - * - * @return {[type]} [description] + * @param {Phaser.GameObjects.Components.Animation} component - [description] */ - slerp: function (b, t) + setFrame: function (component) { - // benchmarks: http://jsperf.com/quaternion-slerp-implementations - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; - - // calc cosine - var cosom = ax * bx + ay * by + az * bz + aw * bw; - - // adjust signs (if necessary) - if (cosom < 0) + // Work out which frame should be set next on the child, and set it + if (component.forward) { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; + this.nextFrame(component); } - - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - var scale0 = 1 - t; - var scale1 = t; - - // calculate coefficients - if ((1 - cosom) > EPSILON) + else { - // standard case (slerp) - var omega = Math.acos(cosom); - var sinom = Math.sin(omega); - - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; + this.previousFrame(component); } - - // calculate final values - this.x = scale0 * ax + scale1 * bx; - this.y = scale0 * ay + scale1 * by; - this.z = scale0 * az + scale1 * bz; - this.w = scale0 * aw + scale1 * bw; - - return this; }, /** * [description] * - * @method Phaser.Math.Quaternion#invert + * @method Phaser.Animations.Animation#toJSON * @since 3.0.0 * - * @return {[type]} [description] + * @return {object} [description] */ - invert: function () + toJSON: function () { - var a0 = this.x; - var a1 = this.y; - var a2 = this.z; - var a3 = this.w; - - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = (dot) ? 1 / dot : 0; - - // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 + var output = { + key: this.key, + type: this.type, + frames: [], + frameRate: this.frameRate, + duration: this.duration, + skipMissedFrames: this.skipMissedFrames, + delay: this.delay, + repeat: this.repeat, + repeatDelay: this.repeatDelay, + yoyo: this.yoyo, + showOnStart: this.showOnStart, + hideOnComplete: this.hideOnComplete + }; - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; + this.frames.forEach(function (frame) + { + output.frames.push(frame.toJSON()); + }); - return this; + return output; }, /** * [description] * - * @method Phaser.Math.Quaternion#conjugate + * @method Phaser.Animations.Animation#updateFrameSequence * @since 3.0.0 * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - conjugate: function () + updateFrameSequence: function () { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; + var len = this.frames.length; + var slice = 1 / (len - 1); + + for (var i = 0; i < len; i++) + { + var frame = this.frames[i]; + + frame.index = i + 1; + frame.isFirst = false; + frame.isLast = false; + frame.progress = i * slice; + + if (i === 0) + { + frame.isFirst = true; + frame.isLast = (len === 1); + frame.prevFrame = this.frames[len - 1]; + frame.nextFrame = this.frames[i + 1]; + } + else if (i === len - 1) + { + frame.isLast = true; + frame.prevFrame = this.frames[len - 2]; + frame.nextFrame = this.frames[0]; + } + else if (len > 1) + { + frame.prevFrame = this.frames[i - 1]; + frame.nextFrame = this.frames[i + 1]; + } + } return this; }, @@ -41024,29 +41343,14 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#rotateX + * @method Phaser.Animations.Animation#pause * @since 3.0.0 * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - rotateX: function (rad) + pause: function () { - rad *= 0.5; - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var bx = Math.sin(rad); - var bw = Math.cos(rad); - - this.x = ax * bw + aw * bx; - this.y = ay * bw + az * bx; - this.z = az * bw - ay * bx; - this.w = aw * bw - ax * bx; + this.paused = true; return this; }, @@ -41054,29 +41358,14 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#rotateY + * @method Phaser.Animations.Animation#resume * @since 3.0.0 * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * @return {Phaser.Animations.Animation} This Animation object. */ - rotateY: function (rad) + resume: function () { - rad *= 0.5; - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - var by = Math.sin(rad); - var bw = Math.cos(rad); - - this.x = ax * bw - az * by; - this.y = ay * bw + aw * by; - this.z = az * bw + ax * by; - this.w = aw * bw - ay * by; + this.paused = false; return this; }, @@ -41084,130 +41373,207 @@ var Quaternion = new Class({ /** * [description] * - * @method Phaser.Math.Quaternion#rotateZ + * @method Phaser.Animations.Animation#destroy * @since 3.0.0 - * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] */ - rotateZ: function (rad) + destroy: function () { - rad *= 0.5; + // TODO + } - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; +}); - var bz = Math.sin(rad); - var bw = Math.cos(rad); +module.exports = Animation; - this.x = ax * bw + ay * bz; - this.y = ay * bw - ax * bz; - this.z = az * bw + aw * bz; - this.w = aw * bw - az * bz; - return this; - }, +/***/ }), +/* 196 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Math.Quaternion#calculateW - * @since 3.0.0 - * - * @return {[type]} [description] - */ - calculateW: function () - { - var x = this.x; - var y = this.y; - var z = this.z; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.w = -Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); +var Class = __webpack_require__(0); - return this; - }, +/** + * @classdesc + * A single frame in an Animation sequence. + * + * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other + * frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback + * and modify the animation timing. + * + * AnimationFrames are generated automatically by the Animation class. + * + * @class AnimationFrame + * @memberOf Phaser.Animations + * @constructor + * @since 3.0.0 + * + * @param {string} textureKey - The key of the Texture this AnimationFrame uses. + * @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. + * @param {integer} index - The index of this AnimationFrame within the Animation sequence. + * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + */ +var AnimationFrame = new Class({ - /** - * [description] - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {[type]} mat - [description] - * - * @return {[type]} [description] - */ - fromMat3: function (mat) + initialize: + + function AnimationFrame (textureKey, textureFrame, index, frame) { - // benchmarks: - // http://jsperf.com/typed-array-access-speed - // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion + /** + * The key of the Texture this AnimationFrame uses. + * + * @name Phaser.Animations.AnimationFrame#textureKey + * @type {string} + * @since 3.0.0 + */ + this.textureKey = textureKey; - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var m = mat.val; - var fTrace = m[0] + m[4] + m[8]; - var fRoot; + /** + * The key of the Frame within the Texture that this AnimationFrame uses. + * + * @name Phaser.Animations.AnimationFrame#textureFrame + * @type {string|integer} + * @since 3.0.0 + */ + this.textureFrame = textureFrame; - if (fTrace > 0) - { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w + /** + * The index of this AnimationFrame within the Animation sequence. + * + * @name Phaser.Animations.AnimationFrame#index + * @type {integer} + * @since 3.0.0 + */ + this.index = index; - this.w = 0.5 * fRoot; + /** + * A reference to the Texture Frame this AnimationFrame uses for rendering. + * + * @name Phaser.Animations.AnimationFrame#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + this.frame = frame; - fRoot = 0.5 / fRoot; // 1/(4w) + /** + * Is this the first frame in an animation sequence? + * + * @name Phaser.Animations.AnimationFrame#isFirst + * @type {boolean} + * @default false + * @readOnly + * @since 3.0.0 + */ + this.isFirst = false; - this.x = (m[7] - m[5]) * fRoot; - this.y = (m[2] - m[6]) * fRoot; - this.z = (m[3] - m[1]) * fRoot; - } - else - { - // |w| <= 1/2 - var i = 0; + /** + * Is this the last frame in an animation sequence? + * + * @name Phaser.Animations.AnimationFrame#isLast + * @type {boolean} + * @default false + * @readOnly + * @since 3.0.0 + */ + this.isLast = false; - if (m[4] > m[0]) - { - i = 1; - } + /** + * A reference to the AnimationFrame that comes before this one in the animation, if any. + * + * @name Phaser.Animations.AnimationFrame#prevFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readOnly + * @since 3.0.0 + */ + this.prevFrame = null; - if (m[8] > m[i * 3 + i]) - { - i = 2; - } + /** + * A reference to the AnimationFrame that comes after this one in the animation, if any. + * + * @name Phaser.Animations.AnimationFrame#nextFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readOnly + * @since 3.0.0 + */ + this.nextFrame = null; - var j = siNext[i]; - var k = siNext[j]; - - // This isn't quite as clean without array access - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); - tmp[i] = 0.5 * fRoot; + /** + * Additional time (in ms) that this frame should appear for during playback. + * The value is added onto the msPerFrame set by the animation. + * + * @name Phaser.Animations.AnimationFrame#duration + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.duration = 0; - fRoot = 0.5 / fRoot; + /** + * What % through the animation does this frame come? + * This value is generated when the animation is created and cached here. + * + * @name Phaser.Animations.AnimationFrame#progress + * @type {number} + * @default 0 + * @readOnly + * @since 3.0.0 + */ + this.progress = 0; - tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + /** + * A frame specific callback, invoked if this frame gets displayed and the callback is set. + * + * @name Phaser.Animations.AnimationFrame#onUpdate + * @type {?function} + * @default null + * @since 3.0.0 + */ + this.onUpdate = null; + }, - this.x = tmp[0]; - this.y = tmp[1]; - this.z = tmp[2]; - this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; - } - - return this; + /** + * Generates a JavaScript object suitable for converting to JSON. + * + * @method Phaser.Animations.AnimationFrame#toJSON + * @since 3.0.0 + * + * @return {object} The AnimationFrame data. + */ + toJSON: function () + { + return { + key: this.textureKey, + frame: this.textureFrame, + duration: this.duration + }; + }, + + /** + * Destroys this object by removing references to external resources and callbacks. + * + * @method Phaser.Animations.AnimationFrame#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.frame = undefined; + this.onUpdate = undefined; } }); -module.exports = Quaternion; +module.exports = AnimationFrame; /***/ }), -/* 210 */ +/* 197 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41216,102 +41582,141 @@ module.exports = Quaternion; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - +var Animation = __webpack_require__(195); var Class = __webpack_require__(0); +var CustomMap = __webpack_require__(114); +var EventEmitter = __webpack_require__(14); +var GetValue = __webpack_require__(4); +var Pad = __webpack_require__(198); /** * @classdesc - * [description] + * The Animation Manager. + * + * Animations are managed by the global Animation Manager. This is a singleton class that is + * responsible for creating and delivering animations and their corresponding data to all Game Objects. + * Unlike plugins it is owned by the Game instance, not the Scene. + * + * Sprites and other Game Objects get the data they need from the AnimationManager. * - * @class Matrix3 - * @memberOf Phaser.Math + * @class AnimationManager + * @extends EventEmitter + * @memberOf Phaser.Animations * @constructor * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - [description] + * + * @param {Phaser.Game} game - [description] */ +var AnimationManager = new Class({ -var Matrix3 = new Class({ + Extends: EventEmitter, initialize: - function Matrix3 (m) + function AnimationManager (game) { + EventEmitter.call(this); + /** * [description] * - * @name Phaser.Math.Matrix3#val - * @type {Float32Array} + * @name Phaser.Animations.AnimationManager#game + * @type {Phaser.Game} + * @protected * @since 3.0.0 */ - this.val = new Float32Array(9); + this.game = game; - if (m) - { - // Assume Matrix3 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#textureManager + * @type {Phaser.Textures.TextureManager} + * @protected + * @since 3.0.0 + */ + this.textureManager = null; - /** - * [description] - * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 - * - * @return {[type]} [description] - */ - clone: function () - { - return new Matrix3(this); + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#globalTimeScale + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.globalTimeScale = 1; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#anims + * @type {Phaser.Structs.Map} + * @protected + * @since 3.0.0 + */ + this.anims = new CustomMap(); + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + /** + * [description] + * + * @name Phaser.Animations.AnimationManager#name + * @type {string} + * @since 3.0.0 + */ + this.name = 'AnimationManager'; + + game.events.once('boot', this.boot, this); }, /** * [description] * - * @method Phaser.Math.Matrix3#set + * @method Phaser.Animations.AnimationManager#boot * @since 3.0.0 - * - * @param {[type]} src - [description] - * - * @return {[type]} [description] */ - set: function (src) + boot: function () { - return this.copy(src); + this.textureManager = this.game.textures; + + this.game.events.once('destroy', this.destroy, this); }, /** * [description] * - * @method Phaser.Math.Matrix3#copy + * @method Phaser.Animations.AnimationManager#add + * @fires AddAnimationEvent * @since 3.0.0 - * - * @param {[type]} src - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.Animations.Animation} animation - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - copy: function (src) + add: function (key, animation) { - var out = this.val; - var a = src.val; + if (this.anims.has(key)) + { + console.warn('Animation with key', key, 'already exists'); + return; + } - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; + animation.key = key; + + this.anims.set(key, animation); + + this.emit('add', key, animation); return this; }, @@ -41319,264 +41724,313 @@ var Matrix3 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix3#fromMat4 + * @method Phaser.Animations.AnimationManager#create + * @fires AddAnimationEvent * @since 3.0.0 - * - * @param {[type]} m - [description] - * - * @return {[type]} [description] + * + * @param {object} config - [description] + * + * @return {Phaser.Animations.Animation} The Animation that was created. */ - fromMat4: function (m) + create: function (config) { - var a = m.val; - var out = this.val; + var key = config.key; - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; + if (!key || this.anims.has(key)) + { + console.warn('Invalid Animation Key, or Key already in use: ' + key); + return; + } - return this; - }, + var anim = new Animation(this, key, config); - /** - * [description] - * - * @method Phaser.Math.Matrix3#fromArray - * @since 3.0.0 - * - * @param {[type]} a - [description] - * - * @return {[type]} [description] - */ - fromArray: function (a) - { - var out = this.val; + this.anims.set(key, anim); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; + this.emit('add', key, anim); - return this; + return anim; }, /** * [description] * - * @method Phaser.Math.Matrix3#identity + * @method Phaser.Animations.AnimationManager#fromJSON * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string|object} data - [description] + * @param {boolean} [clearCurrentAnimations=false] - [description] + * + * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. */ - identity: function () + fromJSON: function (data, clearCurrentAnimations) { - var out = this.val; + if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; + if (clearCurrentAnimations) + { + this.anims.clear(); + } - return this; + // Do we have a String (i.e. from JSON, or an Object?) + if (typeof data === 'string') + { + data = JSON.parse(data); + } + + var output = []; + + // Array of animations, or a single animation? + if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) + { + for (var i = 0; i < data.anims.length; i++) + { + output.push(this.create(data.anims[i])); + } + + if (data.hasOwnProperty('globalTimeScale')) + { + this.globalTimeScale = data.globalTimeScale; + } + } + else if (data.hasOwnProperty('key') && data.type === 'frame') + { + output.push(this.create(data)); + } + + return output; }, /** * [description] * - * @method Phaser.Math.Matrix3#transpose + * @method Phaser.Animations.AnimationManager#generateFrameNames * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {object} config - [description] + * @param {string} [config.prefix=''] - [description] + * @param {integer} [config.start=0] - [description] + * @param {integer} [config.end=0] - [description] + * @param {string} [config.suffix=''] - [description] + * @param {integer} [config.zeroPad=0] - [description] + * @param {array} [config.outputArray=[]] - [description] + * @param {boolean} [config.frames=false] - [description] + * + * @return {object[]} [description] */ - transpose: function () + generateFrameNames: function (key, config) { - var a = this.val; - var a01 = a[1]; - var a02 = a[2]; - var a12 = a[5]; + var prefix = GetValue(config, 'prefix', ''); + var start = GetValue(config, 'start', 0); + var end = GetValue(config, 'end', 0); + var suffix = GetValue(config, 'suffix', ''); + var zeroPad = GetValue(config, 'zeroPad', 0); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - a[1] = a[3]; - a[2] = a[6]; - a[3] = a01; - a[5] = a[7]; - a[6] = a02; - a[7] = a12; + var texture = this.textureManager.get(key); - return this; + if (!texture) + { + return out; + } + + var diff = (start < end) ? 1 : -1; + + // Adjust because we use i !== end in the for loop + end += diff; + + var i; + var frame; + + // Have they provided their own custom frame sequence array? + if (Array.isArray(frames)) + { + for (i = 0; i < frames.length; i++) + { + frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; + + if (texture.has(frame)) + { + out.push({ key: key, frame: frame }); + } + } + } + else + { + for (i = start; i !== end; i += diff) + { + frame = prefix + Pad(i, zeroPad, '0', 1) + suffix; + + if (texture.has(frame)) + { + out.push({ key: key, frame: frame }); + } + } + } + + return out; }, /** * [description] * - * @method Phaser.Math.Matrix3#invert + * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {object} config - [description] + * @param {integer} [config.start=0] - [description] + * @param {integer} [config.end=-1] - [description] + * @param {boolean} [config.first=false] - [description] + * @param {array} [config.outputArray=[]] - [description] + * @param {boolean} [config.frames=false] - [description] + * + * @return {object[]} [description] */ - invert: function () + generateFrameNumbers: function (key, config) { - var a = this.val; + var startFrame = GetValue(config, 'start', 0); + var endFrame = GetValue(config, 'end', -1); + var firstFrame = GetValue(config, 'first', false); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + var texture = this.textureManager.get(key); - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; + if (!texture) + { + return out; + } - // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; + if (firstFrame && texture.has(firstFrame)) + { + out.push({ key: key, frame: firstFrame }); + } - if (!det) + var i; + + // Have they provided their own custom frame sequence array? + if (Array.isArray(frames)) { - return null; + for (i = 0; i < frames.length; i++) + { + if (texture.has(frames[i])) + { + out.push({ key: key, frame: frames[i] }); + } + } } + else + { + // No endFrame then see if we can get it - det = 1 / det; + if (endFrame === -1) + { + endFrame = texture.frameTotal; + } - a[0] = b01 * det; - a[1] = (-a22 * a01 + a02 * a21) * det; - a[2] = (a12 * a01 - a02 * a11) * det; - a[3] = b11 * det; - a[4] = (a22 * a00 - a02 * a20) * det; - a[5] = (-a12 * a00 + a02 * a10) * det; - a[6] = b21 * det; - a[7] = (-a21 * a00 + a01 * a20) * det; - a[8] = (a11 * a00 - a01 * a10) * det; + for (i = startFrame; i <= endFrame; i++) + { + if (texture.has(i)) + { + out.push({ key: key, frame: i }); + } + } + } - return this; + return out; }, /** * [description] * - * @method Phaser.Math.Matrix3#adjoint + * @method Phaser.Animations.AnimationManager#get * @since 3.0.0 - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {Phaser.Animations.Animation} [description] */ - adjoint: function () + get: function (key) { - var a = this.val; + return this.anims.get(key); + }, - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + /** + * Load an Animation into a Game Objects Animation Component. + * + * @method Phaser.Animations.AnimationManager#load + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {string} key - [description] + * @param {string|integer} [startFrame] - [description] + * + * @return {Phaser.GameObjects.GameObject} [description] + */ + load: function (child, key, startFrame) + { + var anim = this.get(key); - a[0] = (a11 * a22 - a12 * a21); - a[1] = (a02 * a21 - a01 * a22); - a[2] = (a01 * a12 - a02 * a11); - a[3] = (a12 * a20 - a10 * a22); - a[4] = (a00 * a22 - a02 * a20); - a[5] = (a02 * a10 - a00 * a12); - a[6] = (a10 * a21 - a11 * a20); - a[7] = (a01 * a20 - a00 * a21); - a[8] = (a00 * a11 - a01 * a10); + if (anim) + { + anim.load(child, startFrame); + } - return this; + return child; }, /** * [description] * - * @method Phaser.Math.Matrix3#determinant + * @method Phaser.Animations.AnimationManager#pauseAll + * @fires PauseAllAnimationEvent * @since 3.0.0 - * - * @return {[type]} [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - determinant: function () + pauseAll: function () { - var a = this.val; + if (!this.paused) + { + this.paused = true; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + this.emit('pauseall'); + } - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + return this; }, /** * [description] * - * @method Phaser.Math.Matrix3#multiply + * @method Phaser.Animations.AnimationManager#play * @since 3.0.0 - * - * @param {[type]} src - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - multiply: function (src) + play: function (key, child) { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; - - var b = src.val; - - var b00 = b[0]; - var b01 = b[1]; - var b02 = b[2]; - var b10 = b[3]; - var b11 = b[4]; - var b12 = b[5]; - var b20 = b[6]; - var b21 = b[7]; - var b22 = b[8]; + if (!Array.isArray(child)) + { + child = [ child ]; + } - a[0] = b00 * a00 + b01 * a10 + b02 * a20; - a[1] = b00 * a01 + b01 * a11 + b02 * a21; - a[2] = b00 * a02 + b01 * a12 + b02 * a22; + var anim = this.get(key); - a[3] = b10 * a00 + b11 * a10 + b12 * a20; - a[4] = b10 * a01 + b11 * a11 + b12 * a21; - a[5] = b10 * a02 + b11 * a12 + b12 * a22; + if (!anim) + { + return; + } - a[6] = b20 * a00 + b21 * a10 + b22 * a20; - a[7] = b20 * a01 + b21 * a11 + b22 * a21; - a[8] = b20 * a02 + b21 * a12 + b22 * a22; + for (var i = 0; i < child.length; i++) + { + child[i].anims.play(key); + } return this; }, @@ -41584,57 +42038,45 @@ var Matrix3 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix3#translate + * @method Phaser.Animations.AnimationManager#remove + * @fires RemoveAnimationEvent * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {Phaser.Animations.Animation} [description] */ - translate: function (v) + remove: function (key) { - var a = this.val; - var x = v.x; - var y = v.y; + var anim = this.get(key); - a[6] = x * a[0] + y * a[3] + a[6]; - a[7] = x * a[1] + y * a[4] + a[7]; - a[8] = x * a[2] + y * a[5] + a[8]; + if (anim) + { + this.emit('remove', key, anim); - return this; + this.anims.delete(key); + } + + return anim; }, /** * [description] * - * @method Phaser.Math.Matrix3#rotate + * @method Phaser.Animations.AnimationManager#resumeAll + * @fires ResumeAllAnimationEvent * @since 3.0.0 - * - * @param {[type]} rad - [description] - * - * @return {[type]} [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - rotate: function (rad) + resumeAll: function () { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - - var s = Math.sin(rad); - var c = Math.cos(rad); - - a[0] = c * a00 + s * a10; - a[1] = c * a01 + s * a11; - a[2] = c * a02 + s * a12; + if (this.paused) + { + this.paused = false; - a[3] = c * a10 - s * a00; - a[4] = c * a11 - s * a01; - a[5] = c * a12 - s * a02; + this.emit('resumeall'); + } return this; }, @@ -41642,26 +42084,35 @@ var Matrix3 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix3#scale + * @method Phaser.Animations.AnimationManager#staggerPlay * @since 3.0.0 - * - * @param {[type]} v - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * @param {Phaser.GameObjects.GameObject} child - [description] + * @param {number} [stagger=0] - [description] + * + * @return {Phaser.Animations.AnimationManager} This Animation Manager. */ - scale: function (v) + staggerPlay: function (key, child, stagger) { - var a = this.val; - var x = v.x; - var y = v.y; + if (stagger === undefined) { stagger = 0; } - a[0] = x * a[0]; - a[1] = x * a[1]; - a[2] = x * a[2]; + if (!Array.isArray(child)) + { + child = [ child ]; + } - a[3] = y * a[3]; - a[4] = y * a[4]; - a[5] = y * a[5]; + var anim = this.get(key); + + if (!anim) + { + return; + } + + for (var i = 0; i < child.length; i++) + { + child[i].anims.delayedPlay(stagger * i, key); + } return this; }, @@ -41669,135 +42120,133 @@ var Matrix3 = new Class({ /** * [description] * - * @method Phaser.Math.Matrix3#fromQuat + * @method Phaser.Animations.AnimationManager#toJSON * @since 3.0.0 - * - * @param {[type]} q - [description] - * - * @return {[type]} [description] + * + * @param {string} key - [description] + * + * @return {object} [description] */ - fromQuat: function (q) + toJSON: function (key) { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - var out = this.val; - - out[0] = 1 - (yy + zz); - out[3] = xy + wz; - out[6] = xz - wy; - - out[1] = xy - wz; - out[4] = 1 - (xx + zz); - out[7] = yz + wx; + if (key !== undefined && key !== '') + { + return this.anims.get(key).toJSON(); + } + else + { + var output = { + anims: [], + globalTimeScale: this.globalTimeScale + }; - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); + this.anims.each(function (animationKey, animation) + { + output.anims.push(animation.toJSON()); + }); - return this; + return output; + } }, /** * [description] * - * @method Phaser.Math.Matrix3#normalFromMat4 + * @method Phaser.Animations.AnimationManager#destroy * @since 3.0.0 - * - * @param {[type]} m - [description] - * - * @return {[type]} [description] */ - normalFromMat4: function (m) + destroy: function () { - var a = m.val; - var out = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + this.anims.clear(); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + this.textureManager = null; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + this.game = null; + } - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; +}); - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; +module.exports = AnimationManager; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; +/***/ }), +/* 198 */ +/***/ (function(module, exports) { - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (!det) - { - return null; - } +/** + * Takes the given string and pads it out, to the length required, using the character + * specified. For example if you need a string to be 6 characters long, you can call: + * + * `pad('bob', 6, '-', 2)` + * + * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. + * + * You can also use it to pad numbers (they are always returned as strings): + * + * `pad(512, 6, '0', 1)` + * + * Would return: `000512` with the string padded to the left. + * + * If you don't specify a direction it'll pad to both sides: + * + * `pad('c64', 7, '*')` + * + * Would return: `**c64**` + * + * @function Phaser.Utils.String.Pad + * @since 3.0.0 + * + * @param {string} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. + * @param {integer} [len=0] - The number of characters to be added. + * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). + * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). + * + * @return {string} The padded string. + */ +var Pad = function (str, len, pad, dir) +{ + if (len === undefined) { len = 0; } + if (pad === undefined) { pad = ' '; } + if (dir === undefined) { dir = 3; } - det = 1 / det; + str = str.toString(); - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + var padlen = 0; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + if (len + 1 >= str.length) + { + switch (dir) + { + case 1: + str = new Array(len + 1 - str.length).join(pad) + str; + break; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + case 3: + var right = Math.ceil((padlen = len - str.length) / 2); + var left = padlen - right; + str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); + break; - return this; + default: + str = str + new Array(len + 1 - str.length).join(pad); + break; + } } -}); + return str; +}; -module.exports = Matrix3; +module.exports = Pad; /***/ }), -/* 211 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41806,185 +42255,175 @@ module.exports = Matrix3; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(117); var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(51); - -// Local cache vars -var tmpVec3 = new Vector3(); +var CustomMap = __webpack_require__(114); +var EventEmitter = __webpack_require__(14); /** * @classdesc - * [description] + * The BaseCache is a base Cache class that can be used for storing references to any kind of data. * - * @class OrthographicCamera - * @extends Phaser.Cameras.Sprite3D.Camera - * @memberOf Phaser.Cameras.Sprite3D + * Data can be added, retrieved and removed based on the given keys. + * + * Keys are string-based. + * + * @class BaseCache + * @memberOf Phaser.Cache * @constructor * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {integer} viewportWidth - [description] - * @param {integer} viewportHeight - [description] */ -var OrthographicCamera = new Class({ - - Extends: Camera, +var BaseCache = new Class({ initialize: - function OrthographicCamera (scene, viewportWidth, viewportHeight) + function BaseCache () { - if (viewportWidth === undefined) { viewportWidth = 0; } - if (viewportHeight === undefined) { viewportHeight = 0; } - - Camera.call(this, scene); - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportWidth - * @type {integer} - * @since 3.0.0 - */ - this.viewportWidth = viewportWidth; - /** - * [description] + * The Map in which the cache objects are stored. * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportHeight - * @type {integer} - * @since 3.0.0 - */ - this.viewportHeight = viewportHeight; - - /** - * [description] + * You can query the Map directly or use the BaseCache methods. * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom - * @type {float} - * @private + * @name Phaser.Cache.BaseCache#entries + * @type {Phaser.Structs.Map} * @since 3.0.0 */ - this._zoom = 1.0; + this.entries = new CustomMap(); /** - * [description] + * An instance of EventEmitter used by the cache to emit related events. * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#near - * @type {number} - * @default 0 + * @name Phaser.Cache.BaseCache#events + * @type {EventEmitter} * @since 3.0.0 */ - this.near = 0; - - this.update(); + this.events = new EventEmitter(); }, /** - * [description] + * Cache add event. * - * @method Phaser.Cameras.Sprite3D.OrthographicCamera#setToOrtho + * This event is fired by the Cache each time a new object is added to it. + * + * @event Phaser.Cache.BaseCache#addEvent + * @param {Phaser.Cache.BaseCache} The BaseCache to which the object was added. + * @param {string} The key of the object added to the cache. + * @param {any} A reference to the object added to the cache. + */ + + /** + * Adds an item to this cache. The item is referenced by a unique string, which you are responsible + * for setting and keeping track of. The item can only be retrieved by using this string. + * + * @method Phaser.Cache.BaseCache#add + * @fires Phaser.Cache.BaseCache#addEvent * @since 3.0.0 * - * @param {[type]} yDown - [description] - * @param {[type]} viewportWidth - [description] - * @param {[type]} viewportHeight - [description] + * @param {string} key - The unique key by which the data added to the cache will be referenced. + * @param {any} data - The data to be stored in the cache. * - * @return {[type]} [description] + * @return {Phaser.Cache.BaseCache} This BaseCache object. */ - setToOrtho: function (yDown, viewportWidth, viewportHeight) + add: function (key, data) { - if (viewportWidth === undefined) { viewportWidth = this.viewportWidth; } - if (viewportHeight === undefined) { viewportHeight = this.viewportHeight; } - - var zoom = this.zoom; - - this.up.set(0, (yDown) ? -1 : 1, 0); - this.direction.set(0, 0, (yDown) ? 1 : -1); - this.position.set(zoom * viewportWidth / 2, zoom * viewportHeight / 2, 0); + this.entries.set(key, data); - this.viewportWidth = viewportWidth; - this.viewportHeight = viewportHeight; + this.events.emit('add', this, key, data); - return this.update(); + return this; }, /** - * [description] + * Checks if this cache contains an item matching the given key. * - * @method Phaser.Cameras.Sprite3D.OrthographicCamera#update + * @method Phaser.Cache.BaseCache#has * @since 3.0.0 * - * @return {[type]} [description] + * @param {string} key - The unique key of the item to be checked in this cache. + * + * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. */ - update: function () + has: function (key) { - var w = this.viewportWidth; - var h = this.viewportHeight; - var near = Math.abs(this.near); - var far = Math.abs(this.far); - var zoom = this.zoom; - - if (w === 0 || h === 0) - { - // What to do here... hmm? - return this; - } - - this.projection.ortho( - zoom * -w / 2, zoom * w / 2, - zoom * -h / 2, zoom * h / 2, - near, - far - ); - - // Build the view matrix - tmpVec3.copy(this.position).add(this.direction); + return this.entries.has(key); + }, - this.view.lookAt(this.position, tmpVec3, this.up); + /** + * Gets an item from this cache based on the given key. + * + * @method Phaser.Cache.BaseCache#get + * @since 3.0.0 + * + * @param {string} key - The unique key of the item to be retrieved from this cache. + * + * @return {any} The item in the cache, or `null` if no item matching the given key was found. + */ + get: function (key) + { + return this.entries.get(key); + }, - // Projection * view matrix - this.combined.copy(this.projection).multiply(this.view); + /** + * Cache remove event. + * + * This event is fired by the Cache each time an object is removed from it. + * + * @event Phaser.Cache.BaseCache#removeEvent + * @param {Phaser.Cache.BaseCache} The BaseCache from which the object was removed. + * @param {string} The key of the object removed from the cache. + * @param {any} The object that was removed from the cache. + */ - // Invert combined matrix, used for unproject - this.invProjectionView.copy(this.combined).invert(); + /** + * Removes and item from this cache based on the given key. + * + * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. + * No additional checks are done on the item removed. If other systems or parts of your game code + * are relying on this item, it is up to you to sever those relationships prior to removing the item. + * + * @method Phaser.Cache.BaseCache#remove + * @fires Phaser.Cache.BaseCache#removeEvent + * @since 3.0.0 + * + * @param {string} key - The unique key of the item to remove from the cache. + * + * @return {Phaser.Cache.BaseCache} This BaseCache object. + */ + remove: function (key) + { + var entry = this.get(key); - this.billboardMatrixDirty = true; + if (entry) + { + this.entries.delete(key); - this.updateChildren(); + this.events.emit('remove', this, key, entry.data); + } return this; }, /** - * [description] + * Destroys this cache and all items within it. * - * @name Phaser.Cameras.Sprite3D.OrthographicCamera#zoom - * @type {number} + * @method Phaser.Cache.BaseCache#destroy * @since 3.0.0 */ - zoom: { - - get: function () - { - return this._zoom; - }, + destroy: function () + { + this.entries.clear(); + this.events.removeAllListeners(); - set: function (value) - { - this._zoom = value; - this.update(); - } + this.entries = null; + this.events = null; } }); -module.exports = OrthographicCamera; +module.exports = BaseCache; /***/ }), -/* 212 */ +/* 200 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41993,138 +42432,222 @@ module.exports = OrthographicCamera; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(117); +var BaseCache = __webpack_require__(199); var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(51); - -// Local cache vars -var tmpVec3 = new Vector3(); /** * @classdesc - * [description] + * The Cache Manager is the global cache owned and maintained by the Game instance. + * + * Various systems, such as the file Loader, rely on this cache in order to store the files + * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache + * instances, one per type of file. You can also add your own custom caches. * - * @class PerspectiveCamera - * @extends Phaser.Cameras.Sprite3D.Camera - * @memberOf Phaser.Cameras.Sprite3D + * @class CacheManager + * @memberOf Phaser.Cache * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {integer} fieldOfView - [description] - * @param {integer} viewportWidth - [description] - * @param {integer} viewportHeight - [description] + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. */ -var PerspectiveCamera = new Class({ - - Extends: Camera, +var CacheManager = new Class({ - // FOV is converted to radians automatically initialize: - function PerspectiveCamera (scene, fieldOfView, viewportWidth, viewportHeight) + function CacheManager (game) { - if (fieldOfView === undefined) { fieldOfView = 80; } - if (viewportWidth === undefined) { viewportWidth = 0; } - if (viewportHeight === undefined) { viewportHeight = 0; } + /** + * A reference to the Phaser.Game instance that owns this CacheManager. + * + * @name Phaser.Cache.CacheManager#game + * @type {Phaser.Game} + * @protected + * @since 3.0.0 + */ + this.game = game; - Camera.call(this, scene); + /** + * A Cache storing all binary files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#binary + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.binary = new BaseCache(); /** - * [description] + * A Cache storing all bitmap font data files, typically added via the Loader. + * Only the font data is stored in this cache, the textures are part of the Texture Manager. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportWidth - * @type {integer} - * @default 0 + * @name Phaser.Cache.CacheManager#bitmapFont + * @type {Phaser.Cache.BaseCache} + * @protected * @since 3.0.0 */ - this.viewportWidth = viewportWidth; + this.bitmapFont = new BaseCache(); /** - * [description] + * A Cache storing all JSON data files, typically added via the Loader. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportHeight - * @type {integer} - * @default 0 + * @name Phaser.Cache.CacheManager#json + * @type {Phaser.Cache.BaseCache} + * @protected * @since 3.0.0 */ - this.viewportHeight = viewportHeight; + this.json = new BaseCache(); /** - * [description] + * A Cache storing all physics data files, typically added via the Loader. * - * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#fieldOfView - * @type {integer} - * @default 80 + * @name Phaser.Cache.CacheManager#physics + * @type {Phaser.Cache.BaseCache} + * @protected * @since 3.0.0 */ - this.fieldOfView = fieldOfView * Math.PI / 180; + this.physics = new BaseCache(); - this.update(); + /** + * A Cache storing all shader source files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#shader + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.shader = new BaseCache(); + + /** + * A Cache storing all non-streaming audio files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#audio + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.audio = new BaseCache(); + + /** + * A Cache storing all text files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#text + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.text = new BaseCache(); + + /** + * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#obj + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.obj = new BaseCache(); + + /** + * A Cache storing all tilemap data files, typically added via the Loader. + * Only the data is stored in this cache, the textures are part of the Texture Manager. + * + * @name Phaser.Cache.CacheManager#tilemap + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.tilemap = new BaseCache(); + + /** + * A Cache storing all xml data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#xml + * @type {Phaser.Cache.BaseCache} + * @protected + * @since 3.0.0 + */ + this.xml = new BaseCache(); + + /** + * An object that contains your own custom BaseCache entries. + * Add to this via the `addCustom` method. + * + * @name Phaser.Cache.CacheManager#custom + * @type {object.} + * @protected + * @since 3.0.0 + */ + this.custom = {}; + + this.game.events.once('destroy', this.destroy, this); }, /** - * [description] + * Add your own custom Cache for storing your own files. + * The cache will be available under `Cache.custom.key`. + * The cache will only be created if the key is not already in use. * - * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#setFOV + * @method Phaser.Cache.CacheManager#addCustom * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {string} key - The unique key of your custom cache. * - * @return {[type]} [description] + * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. */ - setFOV: function (value) + addCustom: function (key) { - this.fieldOfView = value * Math.PI / 180; + if (!this.custom.hasOwnProperty(key)) + { + this.custom[key] = new BaseCache(); + } - return this; + return this.custom[key]; }, /** - * [description] + * Removes all entries from all BaseCaches and destroys all custom caches. * - * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#update + * @method Phaser.Cache.CacheManager#destroy * @since 3.0.0 - * - * @return {[type]} [description] */ - update: function () + destroy: function () { - var aspect = this.viewportWidth / this.viewportHeight; - - // Create a perspective matrix for our camera - this.projection.perspective( - this.fieldOfView, - aspect, - Math.abs(this.near), - Math.abs(this.far) - ); - - // Build the view matrix - tmpVec3.copy(this.position).add(this.direction); - - this.view.lookAt(this.position, tmpVec3, this.up); - - // Projection * view matrix - this.combined.copy(this.projection).multiply(this.view); + var keys = [ + 'binary', + 'bitmapFont', + 'json', + 'physics', + 'shader', + 'audio', + 'text', + 'obj', + 'tilemap', + 'xml' + ]; - // Invert combined matrix, used for unproject - this.invProjectionView.copy(this.combined).invert(); + for (var i = 0; i < keys.length; i++) + { + this[keys[i]].destroy(); + this[keys[i]] = null; + } - this.billboardMatrixDirty = true; + for (var key in this.custom) + { + this.custom[key].destroy(); + } - this.updateChildren(); + this.custom = null; - return this; + this.game = null; } }); -module.exports = PerspectiveCamera; +module.exports = CacheManager; /***/ }), -/* 213 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -42133,92 +42656,51 @@ module.exports = PerspectiveCamera; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Arne16 = __webpack_require__(214); -var CanvasPool = __webpack_require__(21); -var GetValue = __webpack_require__(4); +var Color = __webpack_require__(36); /** - * [description] + * Converts a hex string into a Phaser Color object. + * + * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. * - * @function Phaser.Create.GenerateTexture + * An alpha channel is _not_ supported. + * + * @function Phaser.Display.Color.HexStringToColor * @since 3.0.0 * - * @param {object} config - [description] + * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. * - * @return {HTMLCanvasElement} [description] + * @return {Phaser.Display.Color} A Color object populated by the values of the given string. */ -var GenerateTexture = function (config) +var HexStringToColor = function (hex) { - var data = GetValue(config, 'data', []); - var canvas = GetValue(config, 'canvas', null); - var palette = GetValue(config, 'palette', Arne16); - var pixelWidth = GetValue(config, 'pixelWidth', 1); - var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); - var resizeCanvas = GetValue(config, 'resizeCanvas', true); - var clearCanvas = GetValue(config, 'clearCanvas', true); - var preRender = GetValue(config, 'preRender', null); - var postRender = GetValue(config, 'postRender', null); - - var width = Math.floor(Math.abs(data[0].length * pixelWidth)); - var height = Math.floor(Math.abs(data.length * pixelHeight)); - - if (!canvas) - { - canvas = CanvasPool.create2D(this, width, height); - resizeCanvas = false; - clearCanvas = false; - } - - if (resizeCanvas) - { - canvas.width = width; - canvas.height = height; - } - - var ctx = canvas.getContext('2d'); + var color = new Color(); - if (clearCanvas) + // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") + hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) { - ctx.clearRect(0, 0, width, height); - } + return r + r + g + g + b + b; + }); - // preRender Callback? - if (preRender) - { - preRender(canvas, ctx); - } + var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); - // Draw it - for (var y = 0; y < data.length; y++) + if (result) { - var row = data[y]; - - for (var x = 0; x < row.length; x++) - { - var d = row[x]; - - if (d !== '.' && d !== ' ') - { - ctx.fillStyle = palette[d]; - ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); - } - } - } + var r = parseInt(result[1], 16); + var g = parseInt(result[2], 16); + var b = parseInt(result[3], 16); - // postRender Callback? - if (postRender) - { - postRender(canvas, ctx); + color.setTo(r, g, b); } - return canvas; + return color; }; -module.exports = GenerateTexture; +module.exports = HexStringToColor; /***/ }), -/* 214 */ +/* 202 */ /***/ (function(module, exports) { /** @@ -42228,51 +42710,28 @@ module.exports = GenerateTexture; */ /** - * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.ARNE16 + * Given an alpha and 3 color values this will return an integer representation of it. + * + * @function Phaser.Display.Color.GetColor32 * @since 3.0.0 - * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. + * + * @param {integer} red - The red color value. A number between 0 and 255. + * @param {integer} green - The green color value. A number between 0 and 255. + * @param {integer} blue - The blue color value. A number between 0 and 255. + * @param {integer} alpha - The alpha color value. A number between 0 and 255. + * + * @return {number} The combined color value. */ -module.exports = { - 0: '#000', - 1: '#9D9D9D', - 2: '#FFF', - 3: '#BE2633', - 4: '#E06F8B', - 5: '#493C2B', - 6: '#A46422', - 7: '#EB8931', - 8: '#F7E26B', - 9: '#2F484E', - A: '#44891A', - B: '#A3CE27', - C: '#1B2632', - D: '#005784', - E: '#31A2F2', - F: '#B2DCEF' +var GetColor32 = function (red, green, blue, alpha) +{ + return alpha << 24 | red << 16 | green << 8 | blue; }; +module.exports = GetColor32; + /***/ }), -/* 215 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -42281,209 +42740,195 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var Class = __webpack_require__(0); -var CubicBezier = __webpack_require__(216); -var Curve = __webpack_require__(66); -var Vector2 = __webpack_require__(6); +var Color = __webpack_require__(36); +var IntegerToRGB = __webpack_require__(204); /** - * @classdesc - * [description] + * Converts the given color value into an instance of a Color object. * - * @class CubicBezierCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves - * @constructor + * @function Phaser.Display.Color.IntegerToColor * @since 3.0.0 * - * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. - * @param {Phaser.Math.Vector2} p1 - Control Point 1. - * @param {Phaser.Math.Vector2} p2 - Control Point 2. - * @param {Phaser.Math.Vector2} p3 - End Point. + * @param {integer} input - The color value to convert into a Color object. + * + * @return {Phaser.Display.Color} A Color object. */ -var CubicBezierCurve = new Class({ +var IntegerToColor = function (input) +{ + var rgb = IntegerToRGB(input); - Extends: Curve, + return new Color(rgb.r, rgb.g, rgb.b, rgb.a); +}; - initialize: +module.exports = IntegerToColor; - function CubicBezierCurve (p0, p1, p2, p3) - { - Curve.call(this, 'CubicBezierCurve'); - if (Array.isArray(p0)) - { - p3 = new Vector2(p0[6], p0[7]); - p2 = new Vector2(p0[4], p0[5]); - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } +/***/ }), +/* 204 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = p0; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p1 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p1 = p1; - - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p2 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p2 = p2; +/** + * Return the component parts of a color as an Object with the properties alpha, red, green, blue. + * + * Alpha will only be set if it exists in the given color (0xAARRGGBB) + * + * @function Phaser.Display.Color.IntegerToRGB + * @since 3.0.0 + * + * @param {integer} input - The color value to convert into a Color object. + * + * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. + */ +var IntegerToRGB = function (color) +{ + if (color > 16777215) + { + // The color value has an alpha component + return { + a: color >>> 24, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } + else + { + return { + a: 255, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } +}; - /** - * [description] - * - * @name Phaser.Curves.CubicBezierCurve#p3 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p3 = p3; - }, +module.exports = IntegerToRGB; - /** - * [description] - * - * @method Phaser.Curves.CubicBezierCurve#getStartPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} out - [description] - * - * @return {Phaser.Math.Vector2} [description] - */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - return out.copy(this.p0); - }, +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Curves.CubicBezierCurve#getResolution - * @since 3.0.0 - * - * @param {[type]} divisions - [description] - * - * @return {[type]} [description] - */ - getResolution: function (divisions) - { - return divisions; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.CubicBezierCurve#getPoint - * @since 3.0.0 - * - * @param {[type]} t - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } +var Color = __webpack_require__(36); - var p0 = this.p0; - var p1 = this.p1; - var p2 = this.p2; - var p3 = this.p3; +/** + * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. + * + * @function Phaser.Display.Color.ObjectToColor + * @since 3.0.0 + * + * @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. + * + * @return {Phaser.Display.Color} A Color object. + */ +var ObjectToColor = function (input) +{ + return new Color(input.r, input.g, input.b, input.a); +}; - return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); - }, +module.exports = ObjectToColor; - /** - * [description] - * - * @method Phaser.Curves.CubicBezierCurve#draw - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {integer} [pointsTotal=32] - [description] - * - * @return {Phaser.GameObjects.Graphics} [description] - */ - draw: function (graphics, pointsTotal) - { - if (pointsTotal === undefined) { pointsTotal = 32; } - var points = this.getPoints(pointsTotal); +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { - graphics.beginPath(); - graphics.moveTo(this.p0.x, this.p0.y); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (var i = 1; i < points.length; i++) - { - graphics.lineTo(points[i].x, points[i].y); - } +var Color = __webpack_require__(36); - graphics.strokePath(); +/** + * Converts a CSS 'web' string into a Phaser Color object. + * + * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. + * + * @function Phaser.Display.Color.RGBStringToColor + * @since 3.0.0 + * + * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. + * + * @return {Phaser.Display.Color} A Color object. + */ +var RGBStringToColor = function (rgb) +{ + var color = new Color(); - // So you can chain graphics calls - return graphics; - }, + var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); - /** - * [description] - * - * @method Phaser.Curves.CubicBezierCurve#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () + if (result) { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y, - this.p2.x, this.p2.y, - this.p3.x, this.p3.y - ] - }; + var r = parseInt(result[1], 10); + var g = parseInt(result[2], 10); + var b = parseInt(result[3], 10); + var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; + + color.setTo(r, g, b, a * 255); } -}); + return color; +}; -CubicBezierCurve.fromJSON = function (data) +module.exports = RGBStringToColor; + + +/***/ }), +/* 207 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// Position Vector randomly in a spherical area defined by the given radius +/** + * [description] + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - [description] + * @param {number} [radius=1] - [description] + * + * @return {Phaser.Math.Vector3} [description] + */ +var RandomXYZ = function (vec3, radius) { - var points = data.points; + if (radius === undefined) { radius = 1; } - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); - var p2 = new Vector2(points[4], points[5]); - var p3 = new Vector2(points[6], points[7]); + var r = Math.random() * 2 * Math.PI; + var z = (Math.random() * 2) - 1; + var zScale = Math.sqrt(1 - z * z) * radius; + + vec3.x = Math.cos(r) * zScale; + vec3.y = Math.sin(r) * zScale; + vec3.z = z * radius; - return new CubicBezierCurve(p0, p1, p2, p3); + return vec3; }; -module.exports = CubicBezierCurve; +module.exports = RandomXYZ; /***/ }), -/* 216 */ +/* 208 */ /***/ (function(module, exports) { /** @@ -42492,61 +42937,83 @@ module.exports = CubicBezierCurve; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -function P0 (t, p) +/** + * [description] + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - [description] + * @param {float} [scale=1] - [description] + * + * @return {Phaser.Math.Vector4} [description] + */ +var RandomXYZW = function (vec4, scale) { - var k = 1 - t; + if (scale === undefined) { scale = 1; } - return k * k * k * p; -} + // Not spherical; should fix this for more uniform distribution + vec4.x = (Math.random() * 2 - 1) * scale; + vec4.y = (Math.random() * 2 - 1) * scale; + vec4.z = (Math.random() * 2 - 1) * scale; + vec4.w = (Math.random() * 2 - 1) * scale; -function P1 (t, p) -{ - var k = 1 - t; + return vec4; +}; - return 3 * k * k * t * p; -} +module.exports = RandomXYZW; -function P2 (t, p) -{ - return 3 * (1 - t) * t * t * p; -} -function P3 (t, p) -{ - return t * t * t * p; -} +/***/ }), +/* 209 */ +/***/ (function(module, exports, __webpack_require__) { -// p0 = start point -// p1 = control point 1 -// p2 = control point 2 -// p3 = end point +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a +var Vector3 = __webpack_require__(51); +var Matrix4 = __webpack_require__(119); +var Quaternion = __webpack_require__(210); + +var tmpMat4 = new Matrix4(); +var tmpQuat = new Quaternion(); +var tmpVec3 = new Vector3(); /** - * [description] + * Rotates a vector in place by axis angle. * - * @function Phaser.Math.Interpolation.CubicBezier + * This is the same as transforming a point by an + * axis-angle quaternion, but it has higher precision. + * + * @function Phaser.Math.RotateVec3 * @since 3.0.0 * - * @param {float} t - [description] - * @param {number} p0 - [description] - * @param {number} p1 - [description] - * @param {number} p2 - [description] - * @param {number} p3 - [description] + * @param {Phaser.Math.Vector3} vec - [description] + * @param {Phaser.Math.Vector3} axis - [description] + * @param {float} radians - [description] * - * @return {number} [description] + * @return {Phaser.Math.Vector3} [description] */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) +var RotateVec3 = function (vec, axis, radians) { - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); + // Set the quaternion to our axis angle + tmpQuat.setAxisAngle(axis, radians); + + // Create a rotation matrix from the axis angle + tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); + + // Multiply our vector by the rotation matrix + return vec.transformMat4(tmpMat4); }; -module.exports = CubicBezierInterpolation; +module.exports = RotateVec3; /***/ }), -/* 217 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -42555,259 +43022,186 @@ module.exports = CubicBezierInterpolation; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var DegToRad = __webpack_require__(35); -var GetValue = __webpack_require__(4); -var RadToDeg = __webpack_require__(218); -var Vector2 = __webpack_require__(6); +var Vector3 = __webpack_require__(51); +var Matrix3 = __webpack_require__(211); + +var EPSILON = 0.000001; + +// Some shared 'private' arrays +var siNext = new Int8Array([ 1, 2, 0 ]); +var tmp = new Float32Array([ 0, 0, 0 ]); + +var xUnitVec3 = new Vector3(1, 0, 0); +var yUnitVec3 = new Vector3(0, 1, 0); + +var tmpvec = new Vector3(); +var tmpMat3 = new Matrix3(); /** * @classdesc * [description] * - * @class EllipseCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves + * @class Quaternion + * @memberOf Phaser.Math * @constructor * @since 3.0.0 * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] - * @param {number} [xRadius=0] - [description] - * @param {number} [yRadius=0] - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=360] - [description] - * @param {boolean} [clockwise=false] - [description] - * @param {number} [rotation=0] - [description] + * @param {number} [x] - [description] + * @param {number} [y] - [description] + * @param {number} [z] - [description] + * @param {number} [w] - [description] */ -var EllipseCurve = new Class({ - - Extends: Curve, +var Quaternion = new Class({ initialize: - function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + function Quaternion (x, y, z, w) { - if (typeof x === 'object') - { - var config = x; - - x = GetValue(config, 'x', 0); - y = GetValue(config, 'y', 0); - xRadius = GetValue(config, 'xRadius', 0); - yRadius = GetValue(config, 'yRadius', xRadius); - startAngle = GetValue(config, 'startAngle', 0); - endAngle = GetValue(config, 'endAngle', 360); - clockwise = GetValue(config, 'clockwise', false); - rotation = GetValue(config, 'rotation', 0); - } - else - { - if (yRadius === undefined) { yRadius = xRadius; } - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 360; } - if (clockwise === undefined) { clockwise = false; } - if (rotation === undefined) { rotation = 0; } - } - - Curve.call(this, 'EllipseCurve'); - - // Center point - - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.EllipseCurve#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = new Vector2(x, y); - /** - * [description] + * The x component of this Quaternion. * - * @name Phaser.Curves.EllipseCurve#_xRadius + * @name Phaser.Math.Quaternion#x * @type {number} - * @private + * @default 0 * @since 3.0.0 */ - this._xRadius = xRadius; /** - * [description] + * The y component of this Quaternion. * - * @name Phaser.Curves.EllipseCurve#_yRadius + * @name Phaser.Math.Quaternion#y * @type {number} - * @private + * @default 0 * @since 3.0.0 */ - this._yRadius = yRadius; - - // Radians /** - * [description] + * The z component of this Quaternion. * - * @name Phaser.Curves.EllipseCurve#_startAngle + * @name Phaser.Math.Quaternion#z * @type {number} - * @private + * @default 0 * @since 3.0.0 */ - this._startAngle = DegToRad(startAngle); /** - * [description] + * The w component of this Quaternion. * - * @name Phaser.Curves.EllipseCurve#_endAngle + * @name Phaser.Math.Quaternion#w * @type {number} - * @private - * @since 3.0.0 - */ - this._endAngle = DegToRad(endAngle); - - /** - * Anti-clockwise direction. - * - * @name Phaser.Curves.EllipseCurve#_clockwise - * @type {boolean} - * @private + * @default 0 * @since 3.0.0 */ - this._clockwise = clockwise; - /** - * The rotation of the arc. - * - * @name Phaser.Curves.EllipseCurve#_rotation - * @type {number} - * @private - * @since 3.0.0 - */ - this._rotation = DegToRad(rotation); + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getStartPoint + * @method Phaser.Math.Quaternion#copy * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + copy: function (src) { - if (out === undefined) { out = new Vector2(); } + this.x = src.x; + this.y = src.y; + this.z = src.z; + this.w = src.w; - return this.getPoint(0, out); + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getResolution + * @method Phaser.Math.Quaternion#set * @since 3.0.0 * - * @param {[type]} divisions - [description] + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * @param {[type]} z - [description] + * @param {[type]} w - [description] * * @return {[type]} [description] */ - getResolution: function (divisions) + set: function (x, y, z, w) { - return divisions * 2; + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } + + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#getPoint + * @method Phaser.Math.Quaternion#add * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] + * @param {[type]} v - [description] * * @return {[type]} [description] */ - getPoint: function (t, out) + add: function (v) { - if (out === undefined) { out = new Vector2(); } - - var twoPi = Math.PI * 2; - var deltaAngle = this._endAngle - this._startAngle; - var samePoints = Math.abs(deltaAngle) < Number.EPSILON; - - // ensures that deltaAngle is 0 .. 2 PI - while (deltaAngle < 0) - { - deltaAngle += twoPi; - } - - while (deltaAngle > twoPi) - { - deltaAngle -= twoPi; - } - - if (deltaAngle < Number.EPSILON) - { - if (samePoints) - { - deltaAngle = 0; - } - else - { - deltaAngle = twoPi; - } - } - - if (this._clockwise && !samePoints) - { - if (deltaAngle === twoPi) - { - deltaAngle = - twoPi; - } - else - { - deltaAngle = deltaAngle - twoPi; - } - } - - var angle = this._startAngle + t * deltaAngle; - var x = this.p0.x + this._xRadius * Math.cos(angle); - var y = this.p0.y + this._yRadius * Math.sin(angle); - - if (this._rotation !== 0) - { - var cos = Math.cos(this._rotation); - var sin = Math.sin(this._rotation); - - var tx = x - this.p0.x; - var ty = y - this.p0.y; - - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.p0.x; - y = tx * sin + ty * cos + this.p0.y; - } + this.x += v.x; + this.y += v.y; + this.z += v.z; + this.w += v.w; - return out.set(x, y); + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setXRadius + * @method Phaser.Math.Quaternion#subtract * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} v - [description] * * @return {[type]} [description] */ - setXRadius: function (value) + subtract: function (v) { - this.xRadius = value; + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + this.w -= v.w; return this; }, @@ -42815,16 +43209,19 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setYRadius + * @method Phaser.Math.Quaternion#scale * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} scale - [description] * * @return {[type]} [description] */ - setYRadius: function (value) + scale: function (scale) { - this.yRadius = value; + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; return this; }, @@ -42832,50 +43229,64 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setWidth + * @method Phaser.Math.Quaternion#length * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setWidth: function (value) + length: function () { - this.xRadius = value * 2; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - return this; + return Math.sqrt(x * x + y * y + z * z + w * w); }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setHeight + * @method Phaser.Math.Quaternion#lengthSq * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setHeight: function (value) + lengthSq: function () { - this.yRadius = value * 2; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - return this; + return x * x + y * y + z * z + w * w; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setStartAngle + * @method Phaser.Math.Quaternion#normalize * @since 3.0.0 * - * @param {[type]} value - [description] - * * @return {[type]} [description] */ - setStartAngle: function (value) + normalize: function () { - this.startAngle = value; + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var len = x * x + y * y + z * z + w * w; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + this.w = w * len; + } return this; }, @@ -42883,33 +43294,42 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setEndAngle + * @method Phaser.Math.Quaternion#dot * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} v - [description] * * @return {[type]} [description] */ - setEndAngle: function (value) + dot: function (v) { - this.endAngle = value; - - return this; + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#setClockwise + * @method Phaser.Math.Quaternion#lerp * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} v - [description] + * @param {[type]} t - [description] * * @return {[type]} [description] */ - setClockwise: function (value) + lerp: function (v, t) { - this.clockwise = value; + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + this.w = aw + t * (v.w - aw); return this; }, @@ -42917,253 +43337,451 @@ var EllipseCurve = new Class({ /** * [description] * - * @method Phaser.Curves.EllipseCurve#setRotation + * @method Phaser.Math.Quaternion#rotationTo * @since 3.0.0 * - * @param {[type]} value - [description] + * @param {[type]} a - [description] + * @param {[type]} b - [description] * * @return {[type]} [description] */ - setRotation: function (value) + rotationTo: function (a, b) { - this.rotation = value; + var dot = a.x * b.x + a.y * b.y + a.z * b.z; - return this; + if (dot < -0.999999) + { + if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) + { + tmpvec.copy(yUnitVec3).cross(a); + } + + tmpvec.normalize(); + + return this.setAxisAngle(tmpvec, Math.PI); + + } + else if (dot > 0.999999) + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + + return this; + } + else + { + tmpvec.copy(a).cross(b); + + this.x = tmpvec.x; + this.y = tmpvec.y; + this.z = tmpvec.z; + this.w = 1 + dot; + + return this.normalize(); + } }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#x - * @type {number} + * @method Phaser.Math.Quaternion#setAxes * @since 3.0.0 + * + * @param {[type]} view - [description] + * @param {[type]} right - [description] + * @param {[type]} up - [description] + * + * @return {[type]} [description] */ - x: { + setAxes: function (view, right, up) + { + var m = tmpMat3.val; - get: function () - { - return this.p0.x; - }, + m[0] = right.x; + m[3] = right.y; + m[6] = right.z; - set: function (value) - { - this.p0.x = value; - } + m[1] = up.x; + m[4] = up.y; + m[7] = up.z; + + m[2] = -view.x; + m[5] = -view.y; + m[8] = -view.z; + return this.fromMat3(tmpMat3).normalize(); }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#y - * @type {number} + * @method Phaser.Math.Quaternion#identity * @since 3.0.0 + * + * @return {[type]} [description] */ - y: { - - get: function () - { - return this.p0.y; - }, - - set: function (value) - { - this.p0.y = value; - } + identity: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#xRadius - * @type {number} + * @method Phaser.Math.Quaternion#setAxisAngle * @since 3.0.0 + * + * @param {[type]} axis - [description] + * @param {[type]} rad - [description] + * + * @return {[type]} [description] */ - xRadius: { + setAxisAngle: function (axis, rad) + { + rad = rad * 0.5; - get: function () - { - return this._xRadius; - }, + var s = Math.sin(rad); - set: function (value) - { - this._xRadius = value; - } + this.x = s * axis.x; + this.y = s * axis.y; + this.z = s * axis.z; + this.w = Math.cos(rad); + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#yRadius - * @type {number} + * @method Phaser.Math.Quaternion#multiply * @since 3.0.0 + * + * @param {[type]} b - [description] + * + * @return {[type]} [description] */ - yRadius: { + multiply: function (b) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - get: function () - { - return this._yRadius; - }, + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; - set: function (value) - { - this._yRadius = value; - } + this.x = ax * bw + aw * bx + ay * bz - az * by; + this.y = ay * bw + aw * by + az * bx - ax * bz; + this.z = az * bw + aw * bz + ax * by - ay * bx; + this.w = aw * bw - ax * bx - ay * by - az * bz; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#startAngle - * @type {number} + * @method Phaser.Math.Quaternion#slerp * @since 3.0.0 + * + * @param {[type]} b - [description] + * @param {[type]} t - [description] + * + * @return {[type]} [description] */ - startAngle: { + slerp: function (b, t) + { + // benchmarks: http://jsperf.com/quaternion-slerp-implementations - get: function () + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; + + // calc cosine + var cosom = ax * bx + ay * by + az * bz + aw * bw; + + // adjust signs (if necessary) + if (cosom < 0) { - return RadToDeg(this._startAngle); - }, + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; + } - set: function (value) + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + var scale0 = 1 - t; + var scale1 = t; + + // calculate coefficients + if ((1 - cosom) > EPSILON) { - this._startAngle = DegToRad(value); + // standard case (slerp) + var omega = Math.acos(cosom); + var sinom = Math.sin(omega); + + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; } + // calculate final values + this.x = scale0 * ax + scale1 * bx; + this.y = scale0 * ay + scale1 * by; + this.z = scale0 * az + scale1 * bz; + this.w = scale0 * aw + scale1 * bw; + + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#endAngle - * @type {number} + * @method Phaser.Math.Quaternion#invert * @since 3.0.0 + * + * @return {[type]} [description] */ - endAngle: { + invert: function () + { + var a0 = this.x; + var a1 = this.y; + var a2 = this.z; + var a3 = this.w; - get: function () - { - return RadToDeg(this._endAngle); - }, + var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + var invDot = (dot) ? 1 / dot : 0; + + // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - set: function (value) - { - this._endAngle = DegToRad(value); - } + this.x = -a0 * invDot; + this.y = -a1 * invDot; + this.z = -a2 * invDot; + this.w = a3 * invDot; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#clockwise - * @type {number} + * @method Phaser.Math.Quaternion#conjugate * @since 3.0.0 + * + * @return {[type]} [description] */ - clockwise: { - - get: function () - { - return this._clockwise; - }, - - set: function (value) - { - this._clockwise = value; - } + conjugate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + return this; }, /** * [description] * - * @name Phaser.Curves.EllipseCurve#rotation - * @type {number} + * @method Phaser.Math.Quaternion#rotateX * @since 3.0.0 + * + * @param {[type]} rad - [description] + * + * @return {[type]} [description] */ - rotation: { + rotateX: function (rad) + { + rad *= 0.5; - get: function () - { - return this._rotation; - }, + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - set: function (value) - { - this._rotation = DegToRad(value); - } + var bx = Math.sin(rad); + var bw = Math.cos(rad); + + this.x = ax * bw + aw * bx; + this.y = ay * bw + az * bx; + this.z = az * bw - ay * bx; + this.w = aw * bw - ax * bx; + return this; }, /** * [description] * - * @method Phaser.Curves.EllipseCurve#toJSON + * @method Phaser.Math.Quaternion#rotateY * @since 3.0.0 * - * @return {object} [description] + * @param {[type]} rad - [description] + * + * @return {[type]} [description] */ - toJSON: function () + rotateY: function (rad) { - return { - type: this.type, - x: this.p0.x, - y: this.p0.y, - xRadius: this._xRadius, - yRadius: this._yRadius, - startAngle: RadToDeg(this._startAngle), - endAngle: RadToDeg(this._endAngle), - clockwise: this._clockwise, - rotation: RadToDeg(this._rotation) - }; - } + rad *= 0.5; -}); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; -EllipseCurve.fromJSON = function (data) -{ - return new EllipseCurve(data); -}; + var by = Math.sin(rad); + var bw = Math.cos(rad); -module.exports = EllipseCurve; + this.x = ax * bw - az * by; + this.y = ay * bw + aw * by; + this.z = az * bw + ax * by; + this.w = aw * bw - ay * by; + return this; + }, -/***/ }), -/* 218 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Math.Quaternion#rotateZ + * @since 3.0.0 + * + * @param {[type]} rad - [description] + * + * @return {[type]} [description] + */ + rotateZ: function (rad) + { + rad *= 0.5; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; -var CONST = __webpack_require__(16); + var bz = Math.sin(rad); + var bw = Math.cos(rad); -/** - * [description] - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {float} radians - [description] - * - * @return {integer} [description] - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; + this.x = ax * bw + ay * bz; + this.y = ay * bw - ax * bz; + this.z = az * bw + aw * bz; + this.w = aw * bw - az * bz; -module.exports = RadToDeg; + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#calculateW + * @since 3.0.0 + * + * @return {[type]} [description] + */ + calculateW: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + this.w = -Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); + + return this; + }, + + /** + * [description] + * + * @method Phaser.Math.Quaternion#fromMat3 + * @since 3.0.0 + * + * @param {[type]} mat - [description] + * + * @return {[type]} [description] + */ + fromMat3: function (mat) + { + // benchmarks: + // http://jsperf.com/typed-array-access-speed + // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion + + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var m = mat.val; + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + + if (fTrace > 0) + { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w + + this.w = 0.5 * fRoot; + + fRoot = 0.5 / fRoot; // 1/(4w) + + this.x = (m[7] - m[5]) * fRoot; + this.y = (m[2] - m[6]) * fRoot; + this.z = (m[3] - m[1]) * fRoot; + } + else + { + // |w| <= 1/2 + var i = 0; + + if (m[4] > m[0]) + { + i = 1; + } + + if (m[8] > m[i * 3 + i]) + { + i = 2; + } + + var j = siNext[i]; + var k = siNext[j]; + + // This isn't quite as clean without array access + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + tmp[i] = 0.5 * fRoot; + + fRoot = 0.5 / fRoot; + + tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + + this.x = tmp[0]; + this.y = tmp[1]; + this.z = tmp[2]; + this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; + } + + return this; + } + +}); + +module.exports = Quaternion; /***/ }), -/* 219 */ +/* 211 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43172,312 +43790,367 @@ module.exports = RadToDeg; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var FromPoints = __webpack_require__(121); -var Rectangle = __webpack_require__(8); -var Vector2 = __webpack_require__(6); - -var tmpVec2 = new Vector2(); /** * @classdesc * [description] * - * @class LineCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves + * @class Matrix3 + * @memberOf Phaser.Math * @constructor * @since 3.0.0 * - * @param {Phaser.Math.Vector2} p0 - [description] - * @param {Phaser.Math.Vector2} p1 - [description] + * @param {Phaser.Math.Matrix3} [m] - [description] */ -var LineCurve = new Class({ - Extends: Curve, +var Matrix3 = new Class({ initialize: - // vec2s or array - function LineCurve (p0, p1) + function Matrix3 (m) { - Curve.call(this, 'LineCurve'); - - if (Array.isArray(p0)) - { - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } - /** * [description] * - * @name Phaser.Curves.LineCurve#p0 - * @type {Phaser.Math.Vector2} + * @name Phaser.Math.Matrix3#val + * @type {Float32Array} * @since 3.0.0 */ - this.p0 = p0; + this.val = new Float32Array(9); - /** - * [description] - * - * @property Phaser.Curves.LineCurve#p1 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p1 = p1; + if (m) + { + // Assume Matrix3 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } }, /** * [description] * - * @method Phaser.Curves.LineCurve#getBounds + * @method Phaser.Math.Matrix3#clone * @since 3.0.0 * - * @param {[type]} out - [description] - * * @return {[type]} [description] */ - getBounds: function (out) + clone: function () { - if (out === undefined) { out = new Rectangle(); } - - return FromPoints([ this.p0, this.p1 ], out); + return new Matrix3(this); }, /** * [description] * - * @method Phaser.Curves.LineCurve#getStartPoint + * @method Phaser.Math.Matrix3#set * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + set: function (src) { - if (out === undefined) { out = new Vector2(); } - - return out.copy(this.p0); + return this.copy(src); }, /** * [description] * - * @method Phaser.Curves.LineCurve#getResolution + * @method Phaser.Math.Matrix3#copy * @since 3.0.0 * - * @return {integer} [description] + * @param {[type]} src - [description] + * + * @return {[type]} [description] */ - getResolution: function () + copy: function (src) { - return 1; + var out = this.val; + var a = src.val; + + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + + return this; }, /** * [description] * - * @method Phaser.Curves.LineCurve#getPoint + * @method Phaser.Math.Matrix3#fromMat4 * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] + * @param {[type]} m - [description] * * @return {[type]} [description] */ - getPoint: function (t, out) + fromMat4: function (m) { - if (out === undefined) { out = new Vector2(); } - - if (t === 1) - { - return out.copy(this.p1); - } + var a = m.val; + var out = this.val; - out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; - return out; + return this; }, - // Line curve is linear, so we can overwrite default getPointAt /** * [description] * - * @method Phaser.Curves.LineCurve#getPointAt + * @method Phaser.Math.Matrix3#fromArray * @since 3.0.0 * - * @param {[type]} u - [description] - * @param {[type]} out - [description] + * @param {[type]} a - [description] * * @return {[type]} [description] */ - getPointAt: function (u, out) + fromArray: function (a) { - return this.getPoint(u, out); + var out = this.val; + + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + + return this; }, /** * [description] * - * @method Phaser.Curves.LineCurve#getTangent + * @method Phaser.Math.Matrix3#identity * @since 3.0.0 * * @return {[type]} [description] */ - getTangent: function () + identity: function () { - var tangent = tmpVec2.copy(this.p1).subtract(this.p0); + var out = this.val; - return tangent.normalize(); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + + return this; }, - // Override default Curve.draw because this is better than calling getPoints on a line! /** * [description] * - * @method Phaser.Curves.LineCurve#draw + * @method Phaser.Math.Matrix3#transpose * @since 3.0.0 * - * @param {[type]} graphics - [description] - * * @return {[type]} [description] */ - draw: function (graphics) + transpose: function () { - graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); + var a = this.val; + var a01 = a[1]; + var a02 = a[2]; + var a12 = a[5]; - // So you can chain graphics calls - return graphics; + a[1] = a[3]; + a[2] = a[6]; + a[3] = a01; + a[5] = a[7]; + a[6] = a02; + a[7] = a12; + + return this; }, /** * [description] * - * @method Phaser.Curves.LineCurve#toJSON + * @method Phaser.Math.Matrix3#invert * @since 3.0.0 * * @return {[type]} [description] */ - toJSON: function () + invert: function () { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y - ] - }; - } - -}); - -LineCurve.fromJSON = function (data) -{ - var points = data.points; + var a = this.val; - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - return new LineCurve(p0, p1); -}; + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; -module.exports = LineCurve; + // Calculate the determinant + var det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) + { + return null; + } -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { + det = 1 / det; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + a[0] = b01 * det; + a[1] = (-a22 * a01 + a02 * a21) * det; + a[2] = (a12 * a01 - a02 * a11) * det; + a[3] = b11 * det; + a[4] = (a22 * a00 - a02 * a20) * det; + a[5] = (-a12 * a00 + a02 * a10) * det; + a[6] = b21 * det; + a[7] = (-a21 * a00 + a01 * a20) * det; + a[8] = (a11 * a00 - a01 * a10) * det; -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + return this; + }, -var CatmullRom = __webpack_require__(122); -var Class = __webpack_require__(0); -var Curve = __webpack_require__(66); -var Vector2 = __webpack_require__(6); + /** + * [description] + * + * @method Phaser.Math.Matrix3#adjoint + * @since 3.0.0 + * + * @return {[type]} [description] + */ + adjoint: function () + { + var a = this.val; -/** - * @classdesc - * [description] - * - * @class SplineCurve - * @extends Phaser.Curves.Curve - * @memberOf Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2[]} [points] - [description] - */ -var SplineCurve = new Class({ + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - Extends: Curve, + a[0] = (a11 * a22 - a12 * a21); + a[1] = (a02 * a21 - a01 * a22); + a[2] = (a01 * a12 - a02 * a11); + a[3] = (a12 * a20 - a10 * a22); + a[4] = (a00 * a22 - a02 * a20); + a[5] = (a02 * a10 - a00 * a12); + a[6] = (a10 * a21 - a11 * a20); + a[7] = (a01 * a20 - a00 * a21); + a[8] = (a00 * a11 - a01 * a10); - initialize: + return this; + }, - function SplineCurve (points) + /** + * [description] + * + * @method Phaser.Math.Matrix3#determinant + * @since 3.0.0 + * + * @return {[type]} [description] + */ + determinant: function () { - if (points === undefined) { points = []; } - - Curve.call(this, 'SplineCurve'); + var a = this.val; - /** - * [description] - * - * @name Phaser.Curves.SplineCurve#points - * @type {Phaser.Math.Vector2[]} - * @default [] - * @since 3.0.0 - */ - this.points = []; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - this.addPoints(points); + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); }, /** * [description] * - * @method Phaser.Curves.SplineCurve#addPoints + * @method Phaser.Math.Matrix3#multiply * @since 3.0.0 * - * @param {[type]} points - [description] + * @param {[type]} src - [description] * * @return {[type]} [description] */ - addPoints: function (points) + multiply: function (src) { - for (var i = 0; i < points.length; i++) - { - var p = new Vector2(); + var a = this.val; - if (typeof points[i] === 'number') - { - p.x = points[i]; - p.y = points[i + 1]; - i++; - } - else if (Array.isArray(points[i])) - { - // An array of arrays? - p.x = points[i][0]; - p.y = points[i][1]; - } - else - { - p.x = points[i].x; - p.y = points[i].y; - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - this.points.push(p); - } + var b = src.val; + + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b10 = b[3]; + var b11 = b[4]; + var b12 = b[5]; + var b20 = b[6]; + var b21 = b[7]; + var b22 = b[8]; + + a[0] = b00 * a00 + b01 * a10 + b02 * a20; + a[1] = b00 * a01 + b01 * a11 + b02 * a21; + a[2] = b00 * a02 + b01 * a12 + b02 * a22; + + a[3] = b10 * a00 + b11 * a10 + b12 * a20; + a[4] = b10 * a01 + b11 * a11 + b12 * a21; + a[5] = b10 * a02 + b11 * a12 + b12 * a22; + + a[6] = b20 * a00 + b21 * a10 + b22 * a20; + a[7] = b20 * a01 + b21 * a11 + b22 * a21; + a[8] = b20 * a02 + b21 * a12 + b22 * a22; return this; }, @@ -43485,123 +44158,221 @@ var SplineCurve = new Class({ /** * [description] * - * @method Phaser.Curves.SplineCurve#addPoint + * @method Phaser.Math.Matrix3#translate * @since 3.0.0 * - * @param {[type]} x - [description] - * @param {[type]} y - [description] + * @param {[type]} v - [description] * * @return {[type]} [description] */ - addPoint: function (x, y) + translate: function (v) { - var vec = new Vector2(x, y); + var a = this.val; + var x = v.x; + var y = v.y; - this.points.push(vec); + a[6] = x * a[0] + y * a[3] + a[6]; + a[7] = x * a[1] + y * a[4] + a[7]; + a[8] = x * a[2] + y * a[5] + a[8]; - return vec; + return this; }, /** * [description] * - * @method Phaser.Curves.SplineCurve#getStartPoint + * @method Phaser.Math.Matrix3#rotate * @since 3.0.0 * - * @param {[type]} out - [description] + * @param {[type]} rad - [description] * * @return {[type]} [description] */ - getStartPoint: function (out) + rotate: function (rad) { - if (out === undefined) { out = new Vector2(); } + var a = this.val; - return out.copy(this.points[0]); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + + var s = Math.sin(rad); + var c = Math.cos(rad); + + a[0] = c * a00 + s * a10; + a[1] = c * a01 + s * a11; + a[2] = c * a02 + s * a12; + + a[3] = c * a10 - s * a00; + a[4] = c * a11 - s * a01; + a[5] = c * a12 - s * a02; + + return this; }, /** * [description] * - * @method Phaser.Curves.SplineCurve#getResolution + * @method Phaser.Math.Matrix3#scale * @since 3.0.0 * - * @param {[type]} divisions - [description] + * @param {[type]} v - [description] * * @return {[type]} [description] */ - getResolution: function (divisions) + scale: function (v) { - return divisions * this.points.length; + var a = this.val; + var x = v.x; + var y = v.y; + + a[0] = x * a[0]; + a[1] = x * a[1]; + a[2] = x * a[2]; + + a[3] = y * a[3]; + a[4] = y * a[4]; + a[5] = y * a[5]; + + return this; }, /** * [description] * - * @method Phaser.Curves.SplineCurve#getPoint + * @method Phaser.Math.Matrix3#fromQuat * @since 3.0.0 * - * @param {[type]} t - [description] - * @param {[type]} out - [description] + * @param {[type]} q - [description] * * @return {[type]} [description] */ - getPoint: function (t, out) + fromQuat: function (q) { - if (out === undefined) { out = new Vector2(); } + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - var points = this.points; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - var point = (points.length - 1) * t; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; - var intPoint = Math.floor(point); + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; - var weight = point - intPoint; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; - var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; - var p1 = points[intPoint]; - var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; - var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; + var out = this.val; - return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); + out[0] = 1 - (yy + zz); + out[3] = xy + wz; + out[6] = xz - wy; + + out[1] = xy - wz; + out[4] = 1 - (xx + zz); + out[7] = yz + wx; + + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); + + return this; }, /** * [description] * - * @method Phaser.Curves.SplineCurve#toJSON + * @method Phaser.Math.Matrix3#normalFromMat4 * @since 3.0.0 * - * @return {object} [description] + * @param {[type]} m - [description] + * + * @return {[type]} [description] */ - toJSON: function () + normalFromMat4: function (m) { - var points = []; + var a = m.val; + var out = this.val; - for (var i = 0; i < this.points.length; i++) + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { - points.push(this.points[i].x); - points.push(this.points[i].y); + return null; } - return { - type: this.type, - points: points - }; + det = 1 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + + return this; } }); -SplineCurve.fromJSON = function (data) -{ - return new SplineCurve(data.points); -}; - -module.exports = SplineCurve; +module.exports = Matrix3; /***/ }), -/* 221 */ -/***/ (function(module, exports) { +/* 212 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -43609,270 +44380,325 @@ module.exports = SplineCurve; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Camera = __webpack_require__(118); +var Class = __webpack_require__(0); +var Vector3 = __webpack_require__(51); + +// Local cache vars +var tmpVec3 = new Vector3(); + /** - * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @classdesc + * [description] + * + * @class OrthographicCamera + * @extends Phaser.Cameras.Sprite3D.Camera + * @memberOf Phaser.Cameras.Sprite3D + * @constructor * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {integer} viewportWidth - [description] + * @param {integer} viewportHeight - [description] */ -var CanvasInterpolation = { +var OrthographicCamera = new Class({ + + Extends: Camera, + + initialize: + + function OrthographicCamera (scene, viewportWidth, viewportHeight) + { + if (viewportWidth === undefined) { viewportWidth = 0; } + if (viewportHeight === undefined) { viewportHeight = 0; } + + Camera.call(this, scene); + + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportWidth + * @type {integer} + * @since 3.0.0 + */ + this.viewportWidth = viewportWidth; + + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#viewportHeight + * @type {integer} + * @since 3.0.0 + */ + this.viewportHeight = viewportHeight; + + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom + * @type {float} + * @private + * @since 3.0.0 + */ + this._zoom = 1.0; + + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#near + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.near = 0; + + this.update(); + }, /** - * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). + * [description] * - * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp + * @method Phaser.Cameras.Sprite3D.OrthographicCamera#setToOrtho * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. + * + * @param {[type]} yDown - [description] + * @param {[type]} viewportWidth - [description] + * @param {[type]} viewportHeight - [description] + * + * @return {[type]} [description] */ - setCrisp: function (canvas) + setToOrtho: function (yDown, viewportWidth, viewportHeight) { - var types = [ 'optimizeSpeed', 'crisp-edges', '-moz-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'pixelated' ]; + if (viewportWidth === undefined) { viewportWidth = this.viewportWidth; } + if (viewportHeight === undefined) { viewportHeight = this.viewportHeight; } - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); + var zoom = this.zoom; - canvas.style.msInterpolationMode = 'nearest-neighbor'; + this.up.set(0, (yDown) ? -1 : 1, 0); + this.direction.set(0, 0, (yDown) ? 1 : -1); + this.position.set(zoom * viewportWidth / 2, zoom * viewportHeight / 2, 0); - return canvas; + this.viewportWidth = viewportWidth; + this.viewportHeight = viewportHeight; + + return this.update(); }, /** - * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). + * [description] * - * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic + * @method Phaser.Cameras.Sprite3D.OrthographicCamera#update * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. + * + * @return {[type]} [description] */ - setBicubic: function (canvas) + update: function () { - canvas.style['image-rendering'] = 'auto'; - canvas.style.msInterpolationMode = 'bicubic'; - - return canvas; - } - -}; + var w = this.viewportWidth; + var h = this.viewportHeight; + var near = Math.abs(this.near); + var far = Math.abs(this.far); + var zoom = this.zoom; -module.exports = CanvasInterpolation; + if (w === 0 || h === 0) + { + // What to do here... hmm? + return this; + } + this.projection.ortho( + zoom * -w / 2, zoom * w / 2, + zoom * -h / 2, zoom * h / 2, + near, + far + ); -/***/ }), -/* 222 */ -/***/ (function(module, exports, __webpack_require__) { + // Build the view matrix + tmpVec3.copy(this.position).add(this.direction); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.view.lookAt(this.position, tmpVec3, this.up); -/** - * @namespace Phaser.Display.Color - */ + // Projection * view matrix + this.combined.copy(this.projection).multiply(this.view); -var Color = __webpack_require__(36); + // Invert combined matrix, used for unproject + this.invProjectionView.copy(this.combined).invert(); -Color.ColorToRGBA = __webpack_require__(484); -Color.ComponentToHex = __webpack_require__(223); -Color.GetColor = __webpack_require__(116); -Color.GetColor32 = __webpack_require__(201); -Color.HexStringToColor = __webpack_require__(200); -Color.HSLToColor = __webpack_require__(485); -Color.HSVColorWheel = __webpack_require__(487); -Color.HSVToRGB = __webpack_require__(225); -Color.HueToComponent = __webpack_require__(224); -Color.IntegerToColor = __webpack_require__(202); -Color.IntegerToRGB = __webpack_require__(203); -Color.Interpolate = __webpack_require__(488); -Color.ObjectToColor = __webpack_require__(204); -Color.RandomRGB = __webpack_require__(489); -Color.RGBStringToColor = __webpack_require__(205); -Color.RGBToHSV = __webpack_require__(490); -Color.RGBToString = __webpack_require__(491); -Color.ValueToColor = __webpack_require__(115); + this.billboardMatrixDirty = true; -module.exports = Color; + this.updateChildren(); + return this; + }, -/***/ }), -/* 223 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.OrthographicCamera#zoom + * @type {number} + * @since 3.0.0 + */ + zoom: { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + get: function () + { + return this._zoom; + }, -/** - * Returns a string containing a hex representation of the given color component. - * - * @function Phaser.Display.Color.ComponentToHex - * @since 3.0.0 - * - * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. - * - * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. - */ -var ComponentToHex = function (color) -{ - var hex = color.toString(16); + set: function (value) + { + this._zoom = value; + this.update(); + } + } - return (hex.length === 1) ? '0' + hex : hex; -}; +}); -module.exports = ComponentToHex; +module.exports = OrthographicCamera; /***/ }), -/* 224 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(module) {/** +/** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Camera = __webpack_require__(118); +var Class = __webpack_require__(0); +var Vector3 = __webpack_require__(51); + +// Local cache vars +var tmpVec3 = new Vector3(); + /** - * Converts a hue to an RGB color. - * Based on code by Michael Jackson (https://github.com/mjijackson) + * @classdesc + * [description] * - * @function Phaser.Display.Color.HueToComponent + * @class PerspectiveCamera + * @extends Phaser.Cameras.Sprite3D.Camera + * @memberOf Phaser.Cameras.Sprite3D + * @constructor * @since 3.0.0 * - * @param {number} p - * @param {number} q - * @param {number} t - * - * @return {number} The combined color value. + * @param {Phaser.Scene} scene - [description] + * @param {integer} fieldOfView - [description] + * @param {integer} viewportWidth - [description] + * @param {integer} viewportHeight - [description] */ -var HueToComponent = function (p, q, t) -{ - if (t < 0) - { - t += 1; - } - - if (t > 1) - { - t -= 1; - } +var PerspectiveCamera = new Class({ - if (t < 1 / 6) - { - return p + (q - p) * 6 * t; - } + Extends: Camera, - if (t < 1 / 2) - { - return q; - } + // FOV is converted to radians automatically + initialize: - if (t < 2 / 3) + function PerspectiveCamera (scene, fieldOfView, viewportWidth, viewportHeight) { - return p + (q - p) * (2 / 3 - t) * 6; - } + if (fieldOfView === undefined) { fieldOfView = 80; } + if (viewportWidth === undefined) { viewportWidth = 0; } + if (viewportHeight === undefined) { viewportHeight = 0; } - return p; -}; + Camera.call(this, scene); -module.export = HueToComponent; + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportWidth + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.viewportWidth = viewportWidth; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(486)(module))) + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#viewportHeight + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + this.viewportHeight = viewportHeight; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @name Phaser.Cameras.Sprite3D.PerspectiveCamera#fieldOfView + * @type {integer} + * @default 80 + * @since 3.0.0 + */ + this.fieldOfView = fieldOfView * Math.PI / 180; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.update(); + }, -var GetColor = __webpack_require__(116); + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#setFOV + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setFOV: function (value) + { + this.fieldOfView = value * Math.PI / 180; -/** - * Converts an HSV (hue, saturation and value) color value to RGB. - * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes HSV values are contained in the set [0, 1]. - * Based on code by Michael Jackson (https://github.com/mjijackson) - * - * @function Phaser.Display.Color.HSVToRGB - * @since 3.0.0 - * - * @param {number} h - The hue, in the range 0 - 1. - * @param {number} s - The saturation, in the range 0 - 1. - * @param {number} v - The value, in the range 0 - 1. - * - * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var HSVToRGB = function (h, s, v) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + return this; + }, - var i = Math.floor(h * 6); - var f = h * 6 - i; + /** + * [description] + * + * @method Phaser.Cameras.Sprite3D.PerspectiveCamera#update + * @since 3.0.0 + * + * @return {[type]} [description] + */ + update: function () + { + var aspect = this.viewportWidth / this.viewportHeight; - var p = Math.floor((v * (1 - s)) * 255); - var q = Math.floor((v * (1 - f * s)) * 255); - var t = Math.floor((v * (1 - (1 - f) * s)) * 255); + // Create a perspective matrix for our camera + this.projection.perspective( + this.fieldOfView, + aspect, + Math.abs(this.near), + Math.abs(this.far) + ); - v = Math.floor(v *= 255); + // Build the view matrix + tmpVec3.copy(this.position).add(this.direction); - var output = { r: v, g: v, b: v, color: 0 }; + this.view.lookAt(this.position, tmpVec3, this.up); - var r = i % 6; + // Projection * view matrix + this.combined.copy(this.projection).multiply(this.view); - if (r === 0) - { - output.g = t; - output.b = p; - } - else if (r === 1) - { - output.r = q; - output.b = p; - } - else if (r === 2) - { - output.r = p; - output.b = t; - } - else if (r === 3) - { - output.r = p; - output.g = q; - } - else if (r === 4) - { - output.r = t; - output.g = p; - } - else if (r === 5) - { - output.g = p; - output.b = q; - } + // Invert combined matrix, used for unproject + this.invProjectionView.copy(this.combined).invert(); - output.color = GetColor(output.r, output.g, output.b); + this.billboardMatrixDirty = true; - return output; -}; + this.updateChildren(); -module.exports = HSVToRGB; + return this; + } + +}); + +module.exports = PerspectiveCamera; /***/ }), -/* 226 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43881,73 +44707,92 @@ module.exports = HSVToRGB; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Linear = __webpack_require__(227); +var Arne16 = __webpack_require__(215); +var CanvasPool = __webpack_require__(19); +var GetValue = __webpack_require__(4); /** * [description] * - * @function Phaser.Math.Interpolation.Linear + * @function Phaser.Create.GenerateTexture * @since 3.0.0 * - * @param {float} v - [description] - * @param {number} k - [description] + * @param {object} config - [description] * - * @return {number} [description] + * @return {HTMLCanvasElement} [description] */ -var LinearInterpolation = function (v, k) +var GenerateTexture = function (config) { - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); + var data = GetValue(config, 'data', []); + var canvas = GetValue(config, 'canvas', null); + var palette = GetValue(config, 'palette', Arne16); + var pixelWidth = GetValue(config, 'pixelWidth', 1); + var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); + var resizeCanvas = GetValue(config, 'resizeCanvas', true); + var clearCanvas = GetValue(config, 'clearCanvas', true); + var preRender = GetValue(config, 'preRender', null); + var postRender = GetValue(config, 'postRender', null); - if (k < 0) + var width = Math.floor(Math.abs(data[0].length * pixelWidth)); + var height = Math.floor(Math.abs(data.length * pixelHeight)); + + if (!canvas) { - return Linear(v[0], v[1], f); + canvas = CanvasPool.create2D(this, width, height); + resizeCanvas = false; + clearCanvas = false; } - if (k > 1) + if (resizeCanvas) { - return Linear(v[m], v[m - 1], m - f); + canvas.width = width; + canvas.height = height; } - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); -}; + var ctx = canvas.getContext('2d'); -module.exports = LinearInterpolation; + if (clearCanvas) + { + ctx.clearRect(0, 0, width, height); + } + // preRender Callback? + if (preRender) + { + preRender(canvas, ctx); + } -/***/ }), -/* 227 */ -/***/ (function(module, exports) { + // Draw it + for (var y = 0; y < data.length; y++) + { + var row = data[y]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var x = 0; x < row.length; x++) + { + var d = row[x]; -/** - * [description] - * - * @function Phaser.Math.Linear - * @since 3.0.0 - * - * @param {number} p0 - [description] - * @param {number} p1 - [description] - * @param {float} t - [description] - * - * @return {number} [description] - */ -var Linear = function (p0, p1, t) -{ - return (p1 - p0) * t + p0; + if (d !== '.' && d !== ' ') + { + ctx.fillStyle = palette[d]; + ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); + } + } + } + + // postRender Callback? + if (postRender) + { + postRender(canvas, ctx); + } + + return canvas; }; -module.exports = Linear; +module.exports = GenerateTexture; /***/ }), -/* 228 */ +/* 215 */ /***/ (function(module, exports) { /** @@ -43957,26 +44802,51 @@ module.exports = Linear; */ /** - * [description] - * - * @function Phaser.Math.Between + * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.ARNE16 * @since 3.0.0 - * - * @param {integer} min - [description] - * @param {integer} max - [description] - * - * @return {integer} [description] + * + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); +module.exports = { + 0: '#000', + 1: '#9D9D9D', + 2: '#FFF', + 3: '#BE2633', + 4: '#E06F8B', + 5: '#493C2B', + 6: '#A46422', + 7: '#EB8931', + 8: '#F7E26B', + 9: '#2F484E', + A: '#44891A', + B: '#A3CE27', + C: '#1B2632', + D: '#005784', + E: '#31A2F2', + F: '#B2DCEF' }; -module.exports = Between; - /***/ }), -/* 229 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43985,114 +44855,209 @@ module.exports = Between; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var OS = __webpack_require__(67); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(0); +var CubicBezier = __webpack_require__(217); +var Curve = __webpack_require__(52); +var Vector2 = __webpack_require__(6); /** - * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. - * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. - * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. + * @classdesc + * [description] * - * @function Phaser.DOM.DOMContentLoaded + * @class CubicBezierCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor * @since 3.0.0 * - * @param {function} callback - The callback to be invoked when the device is ready and the DOM content is loaded. + * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. + * @param {Phaser.Math.Vector2} p3 - End Point. */ -var DOMContentLoaded = function (callback) -{ - if (document.readyState === 'complete' || document.readyState === 'interactive') - { - callback(); +var CubicBezierCurve = new Class({ - return; - } + Extends: Curve, - var check = function () + initialize: + + function CubicBezierCurve (p0, p1, p2, p3) { - document.removeEventListener('deviceready', check, true); - document.removeEventListener('DOMContentLoaded', check, true); - window.removeEventListener('load', check, true); + Curve.call(this, 'CubicBezierCurve'); - callback(); - }; + if (Array.isArray(p0)) + { + p3 = new Vector2(p0[6], p0[7]); + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } - if (!document.body) + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; + + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; + + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p2 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p2 = p2; + + /** + * [description] + * + * @name Phaser.Curves.CubicBezierCurve#p3 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p3 = p3; + }, + + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getStartPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} out - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getStartPoint: function (out) { - window.setTimeout(check, 20); - } - else if (OS.cordova && !OS.cocoonJS) + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) { - // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready - document.addEventListener('deviceready', check, false); - } - else + return divisions; + }, + + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) { - document.addEventListener('DOMContentLoaded', check, true); - window.addEventListener('load', check, true); - } -}; + if (out === undefined) { out = new Vector2(); } -module.exports = DOMContentLoaded; + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; + var p3 = this.p3; + return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); + }, -/***/ }), -/* 230 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#draw + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] + */ + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var points = this.getPoints(pointsTotal); -/** - * Takes the given data string and parses it as XML. - * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. - * The parsed XML object is returned, or `null` if there was an error while parsing the data. - * - * @function Phaser.DOM.ParseXML - * @since 3.0.0 - * - * @param {string} data - The XML source stored in a string. - * - * @return {any} The parsed XML data, or `null` if the data could not be parsed. - */ -var ParseXML = function (data) -{ - var xml = ''; + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); - try - { - if (window['DOMParser']) - { - var domparser = new DOMParser(); - xml = domparser.parseFromString(data, 'text/xml'); - } - else + for (var i = 1; i < points.length; i++) { - xml = new ActiveXObject('Microsoft.XMLDOM'); - xml.loadXML(data); + graphics.lineTo(points[i].x, points[i].y); } - } - catch (e) - { - xml = null; - } - if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) - { - return null; - } - else + graphics.strokePath(); + + // So you can chain graphics calls + return graphics; + }, + + /** + * [description] + * + * @method Phaser.Curves.CubicBezierCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () { - return xml; + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y, + this.p3.x, this.p3.y + ] + }; } + +}); + +CubicBezierCurve.fromJSON = function (data) +{ + var points = data.points; + + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); + var p3 = new Vector2(points[6], points[7]); + + return new CubicBezierCurve(p0, p1, p2, p3); }; -module.exports = ParseXML; +module.exports = CubicBezierCurve; /***/ }), -/* 231 */ +/* 217 */ /***/ (function(module, exports) { /** @@ -44101,27 +45066,61 @@ module.exports = ParseXML; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +function P0 (t, p) +{ + var k = 1 - t; + + return k * k * k * p; +} + +function P1 (t, p) +{ + var k = 1 - t; + + return 3 * k * k * t * p; +} + +function P2 (t, p) +{ + return 3 * (1 - t) * t * t * p; +} + +function P3 (t, p) +{ + return t * t * t * p; +} + +// p0 = start point +// p1 = control point 1 +// p2 = control point 2 +// p3 = end point + +// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a + /** - * Attempts to remove the element from its parentNode in the DOM. + * [description] * - * @function Phaser.DOM.RemoveFromDOM + * @function Phaser.Math.Interpolation.CubicBezier * @since 3.0.0 * - * @param {any} element - The DOM element to remove from its parent node. + * @param {float} t - [description] + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {number} p2 - [description] + * @param {number} p3 - [description] + * + * @return {number} [description] */ -var RemoveFromDOM = function (element) +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) { - if (element.parentNode) - { - element.parentNode.removeChild(element); - } + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); }; -module.exports = RemoveFromDOM; +module.exports = CubicBezierInterpolation; /***/ }), -/* 232 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44130,1079 +45129,1405 @@ module.exports = RemoveFromDOM; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + var Class = __webpack_require__(0); -var NOOP = __webpack_require__(3); +var Curve = __webpack_require__(52); +var DegToRad = __webpack_require__(35); +var GetValue = __webpack_require__(4); +var RadToDeg = __webpack_require__(219); +var Vector2 = __webpack_require__(6); /** * @classdesc - * Abstracts away the use of RAF or setTimeOut for the core game update loop. - * This is invoked automatically by the Phaser.Game instance. + * [description] * - * @class RequestAnimationFrame - * @memberOf Phaser.DOM + * @class EllipseCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves * @constructor * @since 3.0.0 + * + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] + * @param {number} [xRadius=0] - [description] + * @param {number} [yRadius=0] - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=360] - [description] + * @param {boolean} [clockwise=false] - [description] + * @param {number} [rotation=0] - [description] */ -var RequestAnimationFrame = new Class({ +var EllipseCurve = new Class({ + + Extends: Curve, initialize: - function RequestAnimationFrame () + function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) { - /** - * True if RequestAnimationFrame is running, otherwise false. - * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isRunning = false; + if (typeof x === 'object') + { + var config = x; + + x = GetValue(config, 'x', 0); + y = GetValue(config, 'y', 0); + xRadius = GetValue(config, 'xRadius', 0); + yRadius = GetValue(config, 'yRadius', xRadius); + startAngle = GetValue(config, 'startAngle', 0); + endAngle = GetValue(config, 'endAngle', 360); + clockwise = GetValue(config, 'clockwise', false); + rotation = GetValue(config, 'rotation', 0); + } + else + { + if (yRadius === undefined) { yRadius = xRadius; } + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 360; } + if (clockwise === undefined) { clockwise = false; } + if (rotation === undefined) { rotation = 0; } + } + + Curve.call(this, 'EllipseCurve'); + + // Center point /** - * The callback to be invoked each step. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {function} + * @name {Phaser.MathPhaser.Curves.EllipseCurve#p0 + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.callback = NOOP; + this.p0 = new Vector2(x, y); /** - * The most recent timestamp. Either a DOMHighResTimeStamp under RAF or `Date.now` under SetTimeout. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#tick - * @type {DOMHighResTimeStamp|number} - * @default 0 + * @name Phaser.Curves.EllipseCurve#_xRadius + * @type {number} + * @private * @since 3.0.0 */ - this.tick = 0; + this._xRadius = xRadius; /** - * True if the step is using setTimeout instead of RAF. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut - * @type {boolean} - * @default false + * @name Phaser.Curves.EllipseCurve#_yRadius + * @type {number} + * @private * @since 3.0.0 */ - this.isSetTimeOut = false; + this._yRadius = yRadius; + + // Radians /** - * The setTimeout or RAF callback ID used when canceling them. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#timeOutID - * @type {?number} - * @default null + * @name Phaser.Curves.EllipseCurve#_startAngle + * @type {number} + * @private * @since 3.0.0 */ - this.timeOutID = null; + this._startAngle = DegToRad(startAngle); /** - * The previous time the step was called. + * [description] * - * @name Phaser.DOM.RequestAnimationFrame#lastTime + * @name Phaser.Curves.EllipseCurve#_endAngle * @type {number} - * @default 0 + * @private * @since 3.0.0 */ - this.lastTime = 0; - - var _this = this; + this._endAngle = DegToRad(endAngle); /** - * The RAF step function. - * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. + * Anti-clockwise direction. * - * @name Phaser.DOM.RequestAnimationFrame#step - * @type {function} + * @name Phaser.Curves.EllipseCurve#_clockwise + * @type {boolean} + * @private * @since 3.0.0 */ - this.step = function step (timestamp) - { - // DOMHighResTimeStamp - _this.lastTime = _this.tick; - - _this.tick = timestamp; - - _this.callback(timestamp); - - _this.timeOutID = window.requestAnimationFrame(step); - }; + this._clockwise = clockwise; /** - * The SetTimeout step function. - * Updates the local tick value, invokes the callback and schedules another call to setTimeout. + * The rotation of the arc. * - * @name Phaser.DOM.RequestAnimationFrame#stepTimeout - * @type {function} + * @name Phaser.Curves.EllipseCurve#_rotation + * @type {number} + * @private * @since 3.0.0 */ - this.stepTimeout = function stepTimeout () - { - var d = Date.now(); - - var delay = Math.max(16 + _this.lastTime - d, 0); - - _this.lastTime = _this.tick; + this._rotation = DegToRad(rotation); + }, - _this.tick = d; + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - _this.callback(d); + return this.getPoint(0, out); + }, - _this.timeOutID = window.setTimeout(stepTimeout, delay); - }; + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) + { + return divisions * 2; }, /** - * Starts the requestAnimationFrame or setTimeout process running. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#start + * @method Phaser.Curves.EllipseCurve#getPoint * @since 3.0.0 * - * @param {function} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] */ - start: function (callback, forceSetTimeOut) + getPoint: function (t, out) { - if (this.isRunning) + if (out === undefined) { out = new Vector2(); } + + var twoPi = Math.PI * 2; + var deltaAngle = this._endAngle - this._startAngle; + var samePoints = Math.abs(deltaAngle) < Number.EPSILON; + + // ensures that deltaAngle is 0 .. 2 PI + while (deltaAngle < 0) { - return; + deltaAngle += twoPi; } - this.callback = callback; + while (deltaAngle > twoPi) + { + deltaAngle -= twoPi; + } - this.isSetTimeOut = forceSetTimeOut; + if (deltaAngle < Number.EPSILON) + { + if (samePoints) + { + deltaAngle = 0; + } + else + { + deltaAngle = twoPi; + } + } - this.isRunning = true; + if (this._clockwise && !samePoints) + { + if (deltaAngle === twoPi) + { + deltaAngle = - twoPi; + } + else + { + deltaAngle = deltaAngle - twoPi; + } + } - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + var angle = this._startAngle + t * deltaAngle; + var x = this.p0.x + this._xRadius * Math.cos(angle); + var y = this.p0.y + this._yRadius * Math.sin(angle); + + if (this._rotation !== 0) + { + var cos = Math.cos(this._rotation); + var sin = Math.sin(this._rotation); + + var tx = x - this.p0.x; + var ty = y - this.p0.y; + + // Rotate the point about the center of the ellipse. + x = tx * cos - ty * sin + this.p0.x; + y = tx * sin + ty * cos + this.p0.y; + } + + return out.set(x, y); }, /** - * Stops the requestAnimationFrame or setTimeout from running. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#stop + * @method Phaser.Curves.EllipseCurve#setXRadius * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - stop: function () + setXRadius: function (value) { - this.isRunning = false; + this.xRadius = value; - if (this.isSetTimeOut) - { - clearTimeout(this.timeOutID); - } - else - { - window.cancelAnimationFrame(this.timeOutID); - } + return this; }, /** - * Stops the step from running and clears the callback reference. + * [description] * - * @method Phaser.DOM.RequestAnimationFrame#destroy + * @method Phaser.Curves.EllipseCurve#setYRadius * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - destroy: function () + setYRadius: function (value) { - this.stop(); + this.yRadius = value; - this.callback = NOOP; - } + return this; + }, -}); + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setWidth + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setWidth: function (value) + { + this.xRadius = value * 2; -module.exports = RequestAnimationFrame; + return this; + }, + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setHeight + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setHeight: function (value) + { + this.yRadius = value * 2; -/***/ }), -/* 233 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setStartAngle + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setStartAngle: function (value) + { + this.startAngle = value; -/** - * @namespace Phaser.Plugins - */ -var Plugins = { + return this; + }, /** - * These are the Global Managers that are created by the Phaser.Game instance. - * They are referenced from Scene.Systems so that plugins can use them. - * - * @name Phaser.Plugins.Global - * @type {array} + * [description] + * + * @method Phaser.Curves.EllipseCurve#setEndAngle * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - Global: [ - - 'anims', - 'cache', - 'registry', - 'sound', - 'textures' + setEndAngle: function (value) + { + this.endAngle = value; - ], + return this; + }, /** - * These are the core plugins that are installed into every Scene.Systems instance, no matter what. - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are created in the order in which they appear in this array and EventEmitter is always first. - * - * @name Phaser.Plugins.CoreScene - * @type {array} + * [description] + * + * @method Phaser.Curves.EllipseCurve#setClockwise * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - CoreScene: [ + setClockwise: function (value) + { + this.clockwise = value; - 'EventEmitter', + return this; + }, - 'CameraManager', - 'GameObjectCreator', - 'GameObjectFactory', - 'ScenePlugin', - 'DisplayList', - 'UpdateList' + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#setRotation + * @since 3.0.0 + * + * @param {[type]} value - [description] + * + * @return {[type]} [description] + */ + setRotation: function (value) + { + this.rotation = value; - ], + return this; + }, /** - * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. - * - * You can elect not to have these plugins by either creating a DefaultPlugins object as part - * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array - * and building your own bundle. - * - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are always created in the order in which they appear in the array. - * - * @name Phaser.Plugins.DefaultScene - * @type {array} + * [description] + * + * @name Phaser.Curves.EllipseCurve#x + * @type {number} * @since 3.0.0 */ - DefaultScene: [ + x: { - 'CameraManager3D', - 'Clock', - 'DataManagerPlugin', - 'InputPlugin', - 'Loader', - 'TweenManager', - 'LightsPlugin' - - ] - -}; + get: function () + { + return this.p0.x; + }, -/* - * "Sometimes, the elegant implementation is just a function. - * Not a method. Not a class. Not a framework. Just a function." - * -- John Carmack - */ + set: function (value) + { + this.p0.x = value; + } -module.exports = Plugins; + }, + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#y + * @type {number} + * @since 3.0.0 + */ + y: { -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this.p0.y; + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + set: function (value) + { + this.p0.y = value; + } -var CanvasPool = __webpack_require__(21); + }, -/** - * Determines the canvas features of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.canvasFeatures` from within any Scene. - * - * @name Phaser.Device.CanvasFeatures - * @since 3.0.0 - * - * @type {object} - * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. - * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. - */ -var CanvasFeatures = { + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#xRadius + * @type {number} + * @since 3.0.0 + */ + xRadius: { - supportInverseAlpha: false, - supportNewBlendModes: false + get: function () + { + return this._xRadius; + }, -}; + set: function (value) + { + this._xRadius = value; + } -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + }, - var magenta = new Image(); + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#yRadius + * @type {number} + * @since 3.0.0 + */ + yRadius: { - magenta.onload = function () - { - var yellow = new Image(); + get: function () + { + return this._yRadius; + }, - yellow.onload = function () + set: function (value) { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); + this._yRadius = value; + } - context.globalCompositeOperation = 'multiply'; + }, - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#startAngle + * @type {number} + * @since 3.0.0 + */ + startAngle: { - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } + get: function () + { + return RadToDeg(this._startAngle); + }, - var data = context.getImageData(2, 0, 1, 1).data; + set: function (value) + { + this._startAngle = DegToRad(value); + } - CanvasPool.remove(yellow); + }, - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#endAngle + * @type {number} + * @since 3.0.0 + */ + endAngle: { - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; + get: function () + { + return RadToDeg(this._endAngle); + }, - magenta.src = pngHead + 'AP804Oa6' + pngEnd; + set: function (value) + { + this._endAngle = DegToRad(value); + } - return false; -} + }, -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#clockwise + * @type {number} + * @since 3.0.0 + */ + clockwise: { - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + get: function () + { + return this._clockwise; + }, - // Draw a single pixel - context.fillRect(0, 0, 1, 1); + set: function (value) + { + this._clockwise = value; + } - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); + }, - if (s1 === null) - { - return false; - } + /** + * [description] + * + * @name Phaser.Curves.EllipseCurve#rotation + * @type {number} + * @since 3.0.0 + */ + rotation: { - // Plot them to x2 - context.putImageData(s1, 1, 0); + get: function () + { + return this._rotation; + }, - // Get those values - var s2 = context.getImageData(1, 0, 1, 1); + set: function (value) + { + this._rotation = DegToRad(value); + } - // Compare and return - return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); -} + }, -function init () -{ - if (document !== undefined) + /** + * [description] + * + * @method Phaser.Curves.EllipseCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + return { + type: this.type, + x: this.p0.x, + y: this.p0.y, + xRadius: this._xRadius, + yRadius: this._yRadius, + startAngle: RadToDeg(this._startAngle), + endAngle: RadToDeg(this._endAngle), + clockwise: this._clockwise, + rotation: RadToDeg(this._rotation) + }; } - return CanvasFeatures; -} +}); -module.exports = init(); +EllipseCurve.fromJSON = function (data) +{ + return new EllipseCurve(data); +}; + +module.exports = EllipseCurve; /***/ }), -/* 235 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// 2.1.1 (Mar 17, 2016) +var CONST = __webpack_require__(16); -/* -ISC License +/** + * [description] + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {float} radians - [description] + * + * @return {integer} [description] + */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; -Copyright (c) 2016, Mapbox +module.exports = RadToDeg; -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var FromPoints = __webpack_require__(122); +var Rectangle = __webpack_require__(8); +var Vector2 = __webpack_require__(6); -module.exports = earcut; +var tmpVec2 = new Vector2(); -/* -vertices is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]. -holes is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11). -dimensions is the number of coordinates per vertice in the input array (2 by default). -Each group of three vertice indices in the resulting array forms a triangle. +/** + * @classdesc + * [description] + * + * @class LineCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} p0 - [description] + * @param {Phaser.Math.Vector2} p1 - [description] */ +var LineCurve = new Class({ -function earcut(data, holeIndices, dim) { + Extends: Curve, - dim = dim || 2; + initialize: - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; + // vec2s or array + function LineCurve (p0, p1) + { + Curve.call(this, 'LineCurve'); - if (!outerNode) return triangles; + if (Array.isArray(p0)) + { + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } - var minX, minY, maxX, maxY, x, y, size; + /** + * [description] + * + * @name Phaser.Curves.LineCurve#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + /** + * [description] + * + * @property Phaser.Curves.LineCurve#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; + }, - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getBounds + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - } + return FromPoints([ this.p0, this.p1 ], out); + }, - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); - } + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - earcutLinked(outerNode, triangles, dim, minX, minY, size); + return out.copy(this.p0); + }, - return triangles; -} + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getResolution + * @since 3.0.0 + * + * @return {integer} [description] + */ + getResolution: function () + { + return 1; + }, -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList(data, start, end, dim, clockwise) { - var i, last; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } + if (t === 1) + { + return out.copy(this.p1); + } - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } + out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); - return last; -} + return out; + }, -// eliminate colinear or duplicate points -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; + // Line curve is linear, so we can overwrite default getPointAt + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getPointAt + * @since 3.0.0 + * + * @param {[type]} u - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, - var p = start, - again; - do { - again = false; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#getTangent + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getTangent: function () + { + var tangent = tmpVec2.copy(this.p1).subtract(this.p0); - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) return null; - again = true; + return tangent.normalize(); + }, - } else { - p = p.next; - } - } while (again || p !== end); + // Override default Curve.draw because this is better than calling getPoints on a line! + /** + * [description] + * + * @method Phaser.Curves.LineCurve#draw + * @since 3.0.0 + * + * @param {[type]} graphics - [description] + * + * @return {[type]} [description] + */ + draw: function (graphics) + { + graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); - return end; -} + // So you can chain graphics calls + return graphics; + }, -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { - if (!ear) return; + /** + * [description] + * + * @method Phaser.Curves.LineCurve#toJSON + * @since 3.0.0 + * + * @return {[type]} [description] + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y + ] + }; + } - // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); +}); - var stop = ear, - prev, next; +LineCurve.fromJSON = function (data) +{ + var points = data.points; - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); + return new LineCurve(p0, p1); +}; - removeNode(ear); +module.exports = LineCurve; - // skipping the next vertice leads to less sliver triangles - ear = next.next; - stop = next.next; - continue; - } +/***/ }), +/* 221 */ +/***/ (function(module, exports, __webpack_require__) { - ear = next; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var QuadraticBezierInterpolation = __webpack_require__(222); +var Vector2 = __webpack_require__(6); - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(ear, triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, size, 2); +/** + * @classdesc + * [description] + * + * @class QuadraticBezier + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.2.0 + * + * @param {Phaser.Math.Vector2|Phaser.Math.Vector2[]} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. + */ +var QuadraticBezier = new Class({ - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); - } + Extends: Curve, - break; - } - } -} + initialize: -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; + function QuadraticBezier (p0, p1, p2) + { + Curve.call(this, 'QuadraticBezier'); - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + if (Array.isArray(p0)) + { + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p0 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p0 = p0; - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p1 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p1 = p1; - return true; -} + /** + * [description] + * + * @name Phaser.Curves.QuadraticBezier#p2 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p2 = p2; + }, -function isEarHashed(ear, minX, minY, size) { - var a = ear.prev, - b = ear, - c = ear.next; + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getStartPoint + * @since 3.2.0 + * + * @param {Phaser.Math.Vector2} out - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + return out.copy(this.p0); + }, - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getResolution + * @since 3.2.0 + * + * @param {number} divisions - [description] + * + * @return {number} [description] + */ + getResolution: function (divisions) + { + return divisions; + }, - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, size), - maxZ = zOrder(maxTX, maxTY, minX, minY, size); + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#getPoint + * @since 3.2.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; - while (p && p.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.nextZ; - } + return out.set( + QuadraticBezierInterpolation(t, p0.x, p1.x, p2.x), + QuadraticBezierInterpolation(t, p0.y, p1.y, p2.y) + ); + }, - // then look for points in decreasing z-order - p = ear.prevZ; + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#draw + * @since 3.2.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] + */ + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } + var points = this.getPoints(pointsTotal); - return true; -} + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; + for (var i = 1; i < points.length; i++) + { + graphics.lineTo(points[i].x, points[i].y); + } - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + graphics.strokePath(); - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); + // So you can chain graphics calls + return graphics; + }, - // remove two nodes involved - removeNode(p); - removeNode(p.next); + /** + * [description] + * + * @method Phaser.Curves.QuadraticBezier#toJSON + * @since 3.2.0 + * + * @return {object} [description] + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y + ] + }; + } - p = start = b; - } - p = p.next; - } while (p !== start); +}); - return p; -} +QuadraticBezier.fromJSON = function (data) +{ + var points = data.points; -// try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); + return new QuadraticBezier(p0, p1, p2); +}; - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} +module.exports = QuadraticBezier; -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } +/***/ }), +/* 222 */ +/***/ (function(module, exports) { - queue.sort(compareX); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } +function P0 (t, p) +{ + var k = 1 - t; - return outerNode; + return k * k * p; } -function compareX(a, b) { - return a.x - b.x; +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; } -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - filterPoints(b, b.next); - } +function P2 (t, p) +{ + return t * t * p; } -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; +// p0 = start point +// p1 = control point 1 +// p2 = end point - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) return p; - if (hy === p.next.y) return p.next; - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - if (!m) return null; +/** + * [description] + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {float} t - [description] + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {number} p2 - [description] + * + * @return {number} [description] + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; - if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint +module.exports = QuadraticBezierInterpolation; - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; +/***/ }), +/* 223 */ +/***/ (function(module, exports, __webpack_require__) { - p = m.next; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - while (p !== stop) { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential +var CatmullRom = __webpack_require__(123); +var Class = __webpack_require__(0); +var Curve = __webpack_require__(52); +var Vector2 = __webpack_require__(6); - if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { - m = p; - tanMin = tan; - } - } +/** + * @classdesc + * [description] + * + * @class SplineCurve + * @extends Phaser.Curves.Curve + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} [points] - [description] + */ +var SplineCurve = new Class({ - p = p.next; - } + Extends: Curve, - return m; -} + initialize: -// interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { - var p = start; - do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); + function SplineCurve (points) + { + if (points === undefined) { points = []; } - p.prevZ.nextZ = null; - p.prevZ = null; + Curve.call(this, 'SplineCurve'); - sortLinked(p); -} + /** + * [description] + * + * @name Phaser.Curves.SplineCurve#points + * @type {Phaser.Math.Vector2[]} + * @default [] + * @since 3.0.0 + */ + this.points = []; -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; + this.addPoints(points); + }, - do { - p = list; - list = null; - tail = null; - numMerges = 0; + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#addPoints + * @since 3.0.0 + * + * @param {[type]} points - [description] + * + * @return {[type]} [description] + */ + addPoints: function (points) + { + for (var i = 0; i < points.length; i++) + { + var p = new Vector2(); - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; + if (typeof points[i] === 'number') + { + p.x = points[i]; + p.y = points[i + 1]; + i++; + } + else if (Array.isArray(points[i])) + { + // An array of arrays? + p.x = points[i][0]; + p.y = points[i][1]; + } + else + { + p.x = points[i].x; + p.y = points[i].y; } - qSize = inSize; - - while (pSize > 0 || (qSize > 0 && q)) { - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } + this.points.push(p); + } - if (tail) tail.nextZ = e; - else list = e; + return this; + }, - e.prevZ = tail; - tail = e; - } - - p = q; - } + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#addPoint + * @since 3.0.0 + * + * @param {[type]} x - [description] + * @param {[type]} y - [description] + * + * @return {[type]} [description] + */ + addPoint: function (x, y) + { + var vec = new Vector2(x, y); - tail.nextZ = null; - inSize *= 2; + this.points.push(vec); - } while (numMerges > 1); + return vec; + }, - return list; -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getStartPoint + * @since 3.0.0 + * + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; + return out.copy(this.points[0]); + }, - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getResolution + * @since 3.0.0 + * + * @param {[type]} divisions - [description] + * + * @return {[type]} [description] + */ + getResolution: function (divisions) + { + return divisions * this.points.length; + }, - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - return x | (y << 1); -} + var points = this.points; -// find the leftmost node of a polygon ring -function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x) leftmost = p; - p = p.next; - } while (p !== start); + var point = (points.length - 1) * t; - return leftmost; -} + var intPoint = Math.floor(point); -// check if a point lies within a convex triangle -function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} + var weight = point - intPoint; -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); -} + var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; + var p1 = points[intPoint]; + var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; + var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; -// signed area of a triangle -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} + return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); + }, -// check if two points are equal -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} + /** + * [description] + * + * @method Phaser.Curves.SplineCurve#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () + { + var points = []; -// check if two segments intersect -function intersects(p1, q1, p2, q2) { - if ((equals(p1, q1) && equals(p2, q2)) || - (equals(p1, q2) && equals(p2, q1))) return true; - return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && - area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; -} + for (var i = 0; i < this.points.length; i++) + { + points.push(this.points[i].x); + points.push(this.points[i].y); + } -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); + return { + type: this.type, + points: points + }; + } - return false; -} +}); -// check if a polygon diagonal is locally inside the polygon -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} +SplineCurve.fromJSON = function (data) +{ + return new SplineCurve(data.points); +}; -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - inside = !inside; - p = p.next; - } while (p !== a); +module.exports = SplineCurve; - return inside; -} -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; +/***/ }), +/* 224 */ +/***/ (function(module, exports) { - a.next = b; - b.prev = a; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - a2.next = an; - an.prev = a2; +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { - b2.next = a2; - a2.prev = b2; + /** + * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setCrisp: function (canvas) + { + var types = [ 'optimizeSpeed', 'crisp-edges', '-moz-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'pixelated' ]; - bp.next = b2; - b2.prev = bp; + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); - return b2; -} + canvas.style.msInterpolationMode = 'nearest-neighbor'; -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode(i, x, y, last) { - var p = new Node(i, x, y); + return canvas; + }, - if (!last) { - p.prev = p; - p.next = p; + /** + * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setBicubic: function (canvas) + { + canvas.style['image-rendering'] = 'auto'; + canvas.style.msInterpolationMode = 'bicubic'; - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; + return canvas; } - return p; -} - -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} - -function Node(i, x, y) { - // vertice index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertice nodes in a polygon ring - this.prev = null; - this.next = null; - // z-order curve value - this.z = null; +}; - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; +module.exports = CanvasInterpolation; - // indicates whether this is a steiner point - this.steiner = false; -} -// return a percentage difference between the polygon area and its triangulation area; -// used to verify correctness of triangulation -earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; +/***/ }), +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } +/** + * @namespace Phaser.Display.Color + */ - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); -}; +var Color = __webpack_require__(36); -function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} +Color.ColorToRGBA = __webpack_require__(495); +Color.ComponentToHex = __webpack_require__(226); +Color.GetColor = __webpack_require__(117); +Color.GetColor32 = __webpack_require__(202); +Color.HexStringToColor = __webpack_require__(201); +Color.HSLToColor = __webpack_require__(496); +Color.HSVColorWheel = __webpack_require__(498); +Color.HSVToRGB = __webpack_require__(228); +Color.HueToComponent = __webpack_require__(227); +Color.IntegerToColor = __webpack_require__(203); +Color.IntegerToRGB = __webpack_require__(204); +Color.Interpolate = __webpack_require__(499); +Color.ObjectToColor = __webpack_require__(205); +Color.RandomRGB = __webpack_require__(500); +Color.RGBStringToColor = __webpack_require__(206); +Color.RGBToHSV = __webpack_require__(501); +Color.RGBToString = __webpack_require__(502); +Color.ValueToColor = __webpack_require__(116); -// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts -earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; +module.exports = Color; - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - return result; -}; /***/ }), -/* 236 */ +/* 226 */ /***/ (function(module, exports) { /** @@ -45211,502 +46536,245 @@ earcut.flatten = function (data) { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ModelViewProjection = { - - modelMatrixDirty: false, - viewMatrixDirty: false, - projectionMatrixDirty: false, - modelMatrix: null, - viewMatrix: null, - projectionMatrix: null, +/** + * Returns a string containing a hex representation of the given color component. + * + * @function Phaser.Display.Color.ComponentToHex + * @since 3.0.0 + * + * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. + * + * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. + */ +var ComponentToHex = function (color) +{ + var hex = color.toString(16); - mvpInit: function () - { - this.modelMatrixDirty = true; - this.viewMatrixDirty = true; - this.projectionMatrixDirty = true; - - this.modelMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.viewMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.projectionMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - return this; - }, + return (hex.length === 1) ? '0' + hex : hex; +}; - mvpUpdate: function () - { - var program = this.program; +module.exports = ComponentToHex; - if (this.modelMatrixDirty) - { - this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); - this.modelMatrixDirty = false; - } - - if (this.viewMatrixDirty) - { - this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - this.viewMatrixDirty = false; - } - if (this.projectionMatrixDirty) - { - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - this.projectionMatrixDirty = false; - } +/***/ }), +/* 227 */ +/***/ (function(module, exports, __webpack_require__) { - return this; - }, +/* WEBPACK VAR INJECTION */(function(module) {/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - modelIdentity: function () +/** + * Converts a hue to an RGB color. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.HueToComponent + * @since 3.0.0 + * + * @param {number} p + * @param {number} q + * @param {number} t + * + * @return {number} The combined color value. + */ +var HueToComponent = function (p, q, t) +{ + if (t < 0) { - var modelMatrix = this.modelMatrix; - - modelMatrix[0] = 1; - modelMatrix[1] = 0; - modelMatrix[2] = 0; - modelMatrix[3] = 0; - modelMatrix[4] = 0; - modelMatrix[5] = 1; - modelMatrix[6] = 0; - modelMatrix[7] = 0; - modelMatrix[8] = 0; - modelMatrix[9] = 0; - modelMatrix[10] = 1; - modelMatrix[11] = 0; - modelMatrix[12] = 0; - modelMatrix[13] = 0; - modelMatrix[14] = 0; - modelMatrix[15] = 1; - - this.modelMatrixDirty = true; - - return this; - }, + t += 1; + } - modelScale: function (x, y, z) + if (t > 1) { - var modelMatrix = this.modelMatrix; - - modelMatrix[0] = modelMatrix[0] * x; - modelMatrix[1] = modelMatrix[1] * x; - modelMatrix[2] = modelMatrix[2] * x; - modelMatrix[3] = modelMatrix[3] * x; - modelMatrix[4] = modelMatrix[4] * y; - modelMatrix[5] = modelMatrix[5] * y; - modelMatrix[6] = modelMatrix[6] * y; - modelMatrix[7] = modelMatrix[7] * y; - modelMatrix[8] = modelMatrix[8] * z; - modelMatrix[9] = modelMatrix[9] * z; - modelMatrix[10] = modelMatrix[10] * z; - modelMatrix[11] = modelMatrix[11] * z; - - this.modelMatrixDirty = true; - - return this; - }, + t -= 1; + } - modelTranslate: function (x, y, z) + if (t < 1 / 6) { - var modelMatrix = this.modelMatrix; - - modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; - modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; - modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; - modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - - this.modelMatrixDirty = true; + return p + (q - p) * 6 * t; + } - return this; - }, + if (t < 1 / 2) + { + return q; + } - modelRotateX: function (radians) + if (t < 2 / 3) { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a10 = modelMatrix[4]; - var a11 = modelMatrix[5]; - var a12 = modelMatrix[6]; - var a13 = modelMatrix[7]; - var a20 = modelMatrix[8]; - var a21 = modelMatrix[9]; - var a22 = modelMatrix[10]; - var a23 = modelMatrix[11]; + return p + (q - p) * (2 / 3 - t) * 6; + } - modelMatrix[4] = a10 * c + a20 * s; - modelMatrix[5] = a11 * c + a21 * s; - modelMatrix[6] = a12 * c + a22 * s; - modelMatrix[7] = a13 * c + a23 * s; - modelMatrix[8] = a20 * c - a10 * s; - modelMatrix[9] = a21 * c - a11 * s; - modelMatrix[10] = a22 * c - a12 * s; - modelMatrix[11] = a23 * c - a13 * s; + return p; +}; - this.modelMatrixDirty = true; +module.export = HueToComponent; - return this; - }, +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(497)(module))) - modelRotateY: function (radians) - { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = modelMatrix[0]; - var a01 = modelMatrix[1]; - var a02 = modelMatrix[2]; - var a03 = modelMatrix[3]; - var a20 = modelMatrix[8]; - var a21 = modelMatrix[9]; - var a22 = modelMatrix[10]; - var a23 = modelMatrix[11]; +/***/ }), +/* 228 */ +/***/ (function(module, exports, __webpack_require__) { - modelMatrix[0] = a00 * c - a20 * s; - modelMatrix[1] = a01 * c - a21 * s; - modelMatrix[2] = a02 * c - a22 * s; - modelMatrix[3] = a03 * c - a23 * s; - modelMatrix[8] = a00 * s + a20 * c; - modelMatrix[9] = a01 * s + a21 * c; - modelMatrix[10] = a02 * s + a22 * c; - modelMatrix[11] = a03 * s + a23 * c; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.modelMatrixDirty = true; - - return this; - }, +var GetColor = __webpack_require__(117); - modelRotateZ: function (radians) - { - var modelMatrix = this.modelMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = modelMatrix[0]; - var a01 = modelMatrix[1]; - var a02 = modelMatrix[2]; - var a03 = modelMatrix[3]; - var a10 = modelMatrix[4]; - var a11 = modelMatrix[5]; - var a12 = modelMatrix[6]; - var a13 = modelMatrix[7]; +/** + * Converts an HSV (hue, saturation and value) color value to RGB. + * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes HSV values are contained in the set [0, 1]. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.HSVToRGB + * @since 3.0.0 + * + * @param {number} h - The hue, in the range 0 - 1. + * @param {number} s - The saturation, in the range 0 - 1. + * @param {number} v - The value, in the range 0 - 1. + * + * @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties. + */ +var HSVToRGB = function (h, s, v) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } - modelMatrix[0] = a00 * c + a10 * s; - modelMatrix[1] = a01 * c + a11 * s; - modelMatrix[2] = a02 * c + a12 * s; - modelMatrix[3] = a03 * c + a13 * s; - modelMatrix[4] = a10 * c - a00 * s; - modelMatrix[5] = a11 * c - a01 * s; - modelMatrix[6] = a12 * c - a02 * s; - modelMatrix[7] = a13 * c - a03 * s; + var i = Math.floor(h * 6); + var f = h * 6 - i; - this.modelMatrixDirty = true; + var p = Math.floor((v * (1 - s)) * 255); + var q = Math.floor((v * (1 - f * s)) * 255); + var t = Math.floor((v * (1 - (1 - f) * s)) * 255); - return this; - }, + v = Math.floor(v *= 255); - viewIdentity: function () - { - var viewMatrix = this.viewMatrix; - - viewMatrix[0] = 1; - viewMatrix[1] = 0; - viewMatrix[2] = 0; - viewMatrix[3] = 0; - viewMatrix[4] = 0; - viewMatrix[5] = 1; - viewMatrix[6] = 0; - viewMatrix[7] = 0; - viewMatrix[8] = 0; - viewMatrix[9] = 0; - viewMatrix[10] = 1; - viewMatrix[11] = 0; - viewMatrix[12] = 0; - viewMatrix[13] = 0; - viewMatrix[14] = 0; - viewMatrix[15] = 1; + var output = { r: v, g: v, b: v, color: 0 }; - this.viewMatrixDirty = true; - - return this; - }, + var r = i % 6; - viewScale: function (x, y, z) + if (r === 0) { - var viewMatrix = this.viewMatrix; - - viewMatrix[0] = viewMatrix[0] * x; - viewMatrix[1] = viewMatrix[1] * x; - viewMatrix[2] = viewMatrix[2] * x; - viewMatrix[3] = viewMatrix[3] * x; - viewMatrix[4] = viewMatrix[4] * y; - viewMatrix[5] = viewMatrix[5] * y; - viewMatrix[6] = viewMatrix[6] * y; - viewMatrix[7] = viewMatrix[7] * y; - viewMatrix[8] = viewMatrix[8] * z; - viewMatrix[9] = viewMatrix[9] * z; - viewMatrix[10] = viewMatrix[10] * z; - viewMatrix[11] = viewMatrix[11] * z; - - this.viewMatrixDirty = true; - - return this; - }, - - viewTranslate: function (x, y, z) + output.g = t; + output.b = p; + } + else if (r === 1) { - var viewMatrix = this.viewMatrix; - - viewMatrix[12] = viewMatrix[0] * x + viewMatrix[4] * y + viewMatrix[8] * z + viewMatrix[12]; - viewMatrix[13] = viewMatrix[1] * x + viewMatrix[5] * y + viewMatrix[9] * z + viewMatrix[13]; - viewMatrix[14] = viewMatrix[2] * x + viewMatrix[6] * y + viewMatrix[10] * z + viewMatrix[14]; - viewMatrix[15] = viewMatrix[3] * x + viewMatrix[7] * y + viewMatrix[11] * z + viewMatrix[15]; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateX: function (radians) + output.r = q; + output.b = p; + } + else if (r === 2) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a10 = viewMatrix[4]; - var a11 = viewMatrix[5]; - var a12 = viewMatrix[6]; - var a13 = viewMatrix[7]; - var a20 = viewMatrix[8]; - var a21 = viewMatrix[9]; - var a22 = viewMatrix[10]; - var a23 = viewMatrix[11]; - - viewMatrix[4] = a10 * c + a20 * s; - viewMatrix[5] = a11 * c + a21 * s; - viewMatrix[6] = a12 * c + a22 * s; - viewMatrix[7] = a13 * c + a23 * s; - viewMatrix[8] = a20 * c - a10 * s; - viewMatrix[9] = a21 * c - a11 * s; - viewMatrix[10] = a22 * c - a12 * s; - viewMatrix[11] = a23 * c - a13 * s; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateY: function (radians) + output.r = p; + output.b = t; + } + else if (r === 3) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = viewMatrix[0]; - var a01 = viewMatrix[1]; - var a02 = viewMatrix[2]; - var a03 = viewMatrix[3]; - var a20 = viewMatrix[8]; - var a21 = viewMatrix[9]; - var a22 = viewMatrix[10]; - var a23 = viewMatrix[11]; - - viewMatrix[0] = a00 * c - a20 * s; - viewMatrix[1] = a01 * c - a21 * s; - viewMatrix[2] = a02 * c - a22 * s; - viewMatrix[3] = a03 * c - a23 * s; - viewMatrix[8] = a00 * s + a20 * c; - viewMatrix[9] = a01 * s + a21 * c; - viewMatrix[10] = a02 * s + a22 * c; - viewMatrix[11] = a03 * s + a23 * c; - - this.viewMatrixDirty = true; - - return this; - }, - - viewRotateZ: function (radians) + output.r = p; + output.g = q; + } + else if (r === 4) { - var viewMatrix = this.viewMatrix; - var s = Math.sin(radians); - var c = Math.cos(radians); - var a00 = viewMatrix[0]; - var a01 = viewMatrix[1]; - var a02 = viewMatrix[2]; - var a03 = viewMatrix[3]; - var a10 = viewMatrix[4]; - var a11 = viewMatrix[5]; - var a12 = viewMatrix[6]; - var a13 = viewMatrix[7]; - - viewMatrix[0] = a00 * c + a10 * s; - viewMatrix[1] = a01 * c + a11 * s; - viewMatrix[2] = a02 * c + a12 * s; - viewMatrix[3] = a03 * c + a13 * s; - viewMatrix[4] = a10 * c - a00 * s; - viewMatrix[5] = a11 * c - a01 * s; - viewMatrix[6] = a12 * c - a02 * s; - viewMatrix[7] = a13 * c - a03 * s; - - this.viewMatrixDirty = true; + output.r = t; + output.g = p; + } + else if (r === 5) + { + output.g = p; + output.b = q; + } - return this; - }, + output.color = GetColor(output.r, output.g, output.b); - viewLoad2D: function (matrix2D) - { - var vm = this.viewMatrix; + return output; +}; - vm[0] = matrix2D[0]; - vm[1] = matrix2D[1]; - vm[2] = 0.0; - vm[3] = 0.0; - vm[4] = matrix2D[2]; - vm[5] = matrix2D[3]; - vm[6] = 0.0; - vm[7] = 0.0; - vm[8] = matrix2D[4]; - vm[9] = matrix2D[5]; - vm[10] = 1.0; - vm[11] = 0.0; - vm[12] = 0.0; - vm[13] = 0.0; - vm[14] = 0.0; - vm[15] = 1.0; +module.exports = HSVToRGB; - this.viewMatrixDirty = true; - return this; - }, +/***/ }), +/* 229 */ +/***/ (function(module, exports, __webpack_require__) { - viewLoad: function (matrix) - { - var vm = this.viewMatrix; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - vm[0] = matrix[0]; - vm[1] = matrix[1]; - vm[2] = matrix[2]; - vm[3] = matrix[3]; - vm[4] = matrix[4]; - vm[5] = matrix[5]; - vm[6] = matrix[6]; - vm[7] = matrix[7]; - vm[8] = matrix[8]; - vm[9] = matrix[9]; - vm[10] = matrix[10]; - vm[11] = matrix[11]; - vm[12] = matrix[12]; - vm[13] = matrix[13]; - vm[14] = matrix[14]; - vm[15] = matrix[15]; +var Linear = __webpack_require__(230); - this.viewMatrixDirty = true; +/** + * [description] + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * + * @param {float} v - [description] + * @param {number} k - [description] + * + * @return {number} [description] + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); - return this; - }, + if (k < 0) + { + return Linear(v[0], v[1], f); + } - projIdentity: function () + if (k > 1) { - var projectionMatrix = this.projectionMatrix; - - projectionMatrix[0] = 1; - projectionMatrix[1] = 0; - projectionMatrix[2] = 0; - projectionMatrix[3] = 0; - projectionMatrix[4] = 0; - projectionMatrix[5] = 1; - projectionMatrix[6] = 0; - projectionMatrix[7] = 0; - projectionMatrix[8] = 0; - projectionMatrix[9] = 0; - projectionMatrix[10] = 1; - projectionMatrix[11] = 0; - projectionMatrix[12] = 0; - projectionMatrix[13] = 0; - projectionMatrix[14] = 0; - projectionMatrix[15] = 1; + return Linear(v[m], v[m - 1], m - f); + } - this.projectionMatrixDirty = true; + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); +}; - return this; - }, +module.exports = LinearInterpolation; - projOrtho: function (left, right, bottom, top, near, far) - { - var projectionMatrix = this.projectionMatrix; - var leftRight = 1.0 / (left - right); - var bottomTop = 1.0 / (bottom - top); - var nearFar = 1.0 / (near - far); - projectionMatrix[0] = -2.0 * leftRight; - projectionMatrix[1] = 0.0; - projectionMatrix[2] = 0.0; - projectionMatrix[3] = 0.0; - projectionMatrix[4] = 0.0; - projectionMatrix[5] = -2.0 * bottomTop; - projectionMatrix[6] = 0.0; - projectionMatrix[7] = 0.0; - projectionMatrix[8] = 0.0; - projectionMatrix[9] = 0.0; - projectionMatrix[10] = 2.0 * nearFar; - projectionMatrix[11] = 0.0; - projectionMatrix[12] = (left + right) * leftRight; - projectionMatrix[13] = (top + bottom) * bottomTop; - projectionMatrix[14] = (far + near) * nearFar; - projectionMatrix[15] = 1.0; +/***/ }), +/* 230 */ +/***/ (function(module, exports) { - this.projectionMatrixDirty = true; - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - projPersp: function (fovy, aspectRatio, near, far) - { - var projectionMatrix = this.projectionMatrix; - var fov = 1.0 / Math.tan(fovy / 2.0); - var nearFar = 1.0 / (near - far); - - projectionMatrix[0] = fov / aspectRatio; - projectionMatrix[1] = 0.0; - projectionMatrix[2] = 0.0; - projectionMatrix[3] = 0.0; - projectionMatrix[4] = 0.0; - projectionMatrix[5] = fov; - projectionMatrix[6] = 0.0; - projectionMatrix[7] = 0.0; - projectionMatrix[8] = 0.0; - projectionMatrix[9] = 0.0; - projectionMatrix[10] = (far + near) * nearFar; - projectionMatrix[11] = -1.0; - projectionMatrix[12] = 0.0; - projectionMatrix[13] = 0.0; - projectionMatrix[14] = (2.0 * far * near) * nearFar; - projectionMatrix[15] = 0.0; - - this.projectionMatrixDirty = true; - return this; - } +/** + * [description] + * + * @function Phaser.Math.Linear + * @since 3.0.0 + * + * @param {number} p0 - [description] + * @param {number} p1 - [description] + * @param {float} t - [description] + * + * @return {number} [description] + */ +var Linear = function (p0, p1, t) +{ + return (p1 - p0) * t + p0; }; -module.exports = ModelViewProjection; +module.exports = Linear; /***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { +/* 231 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -45714,395 +46782,463 @@ module.exports = ModelViewProjection; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var ShaderSourceFS = __webpack_require__(514); -var TextureTintPipeline = __webpack_require__(238); - -var LIGHT_COUNT = 10; - /** - * @classdesc * [description] * - * @class ForwardDiffuseLightPipeline - * @extends Phaser.Renderer.WebGL.TextureTintPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor + * @function Phaser.Math.Between * @since 3.0.0 * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] + * @param {integer} min - [description] + * @param {integer} max - [description] + * + * @return {integer} [description] */ -var ForwardDiffuseLightPipeline = new Class({ +var Between = function (min, max) +{ + return Math.floor(Math.random() * (max - min + 1) + min); +}; - Extends: TextureTintPipeline, +module.exports = Between; - initialize: - function ForwardDiffuseLightPipeline (game, gl, renderer) - { - TextureTintPipeline.call(this, game, gl, renderer, ShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString())); - }, +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] - */ - onBind: function () - { - TextureTintPipeline.prototype.onBind.call(this); - - var renderer = this.renderer; - var program = this.program; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.mvpUpdate(); +var OS = __webpack_require__(67); - renderer.setInt1(program, 'uNormSampler', 1); - renderer.setFloat2(program, 'uResolution', this.width, this.height); +/** + * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. + * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. + * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. + * + * @function Phaser.DOM.DOMContentLoaded + * @since 3.0.0 + * + * @param {function} callback - The callback to be invoked when the device is ready and the DOM content is loaded. + */ +var DOMContentLoaded = function (callback) +{ + if (document.readyState === 'complete' || document.readyState === 'interactive') + { + callback(); - return this; - }, + return; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline} [description] - */ - onRender: function (scene, camera) + var check = function () { - var lightManager = scene.lights; + document.removeEventListener('deviceready', check, true); + document.removeEventListener('DOMContentLoaded', check, true); + window.removeEventListener('load', check, true); - lightManager.culledLights.length = 0; + callback(); + }; - if (lightManager.lights.length <= 0 || !lightManager.active) - { - return this; // If not visible lights just passthrough - } + if (!document.body) + { + window.setTimeout(check, 20); + } + else if (OS.cordova && !OS.cocoonJS) + { + // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready + document.addEventListener('deviceready', check, false); + } + else + { + document.addEventListener('DOMContentLoaded', check, true); + window.addEventListener('load', check, true); + } +}; - var renderer = this.renderer; - var program = this.program; - var lights = scene.lights.cull(camera); - var lightCount = Math.min(lights.length, LIGHT_COUNT); - var cameraMatrix = camera.matrix; - var point = {x: 0, y: 0}; - var height = renderer.height; - var index; +module.exports = DOMContentLoaded; - for (index = 0; index < LIGHT_COUNT; ++index) - { - renderer.setFloat1(program, 'uLights[' + index + '].radius', 0); // reset lights - } - if (lightCount <= 0) { return this; } +/***/ }), +/* 233 */ +/***/ (function(module, exports) { - renderer.setFloat4(program, 'uCamera', camera.x, camera.y, camera.rotation, camera.zoom); - renderer.setFloat3(program, 'uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - for (index = 0; index < lightCount; ++index) - { - var light = lights[index]; - var lightName = 'uLights[' + index + '].'; - cameraMatrix.transformPoint(light.x, light.y, point); - renderer.setFloat2(program, lightName + 'position', point.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (point.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); - renderer.setFloat3(program, lightName + 'color', light.r, light.g, light.b); - renderer.setFloat1(program, lightName + 'intensity', light.intensity); - renderer.setFloat1(program, lightName + 'radius', light.radius); - } - - return this; - }, +/** + * Takes the given data string and parses it as XML. + * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. + * The parsed XML object is returned, or `null` if there was an error while parsing the data. + * + * @function Phaser.DOM.ParseXML + * @since 3.0.0 + * + * @param {string} data - The XML source stored in a string. + * + * @return {any} The parsed XML data, or `null` if the data could not be parsed. + */ +var ParseXML = function (data) +{ + var xml = ''; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawStaticTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawStaticTilemapLayer: function (tilemap, camera) + try { - var normalTexture = tilemap.texture.dataSource[0]; - - if (normalTexture) + if (window['DOMParser']) { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawStaticTilemapLayer.call(this, tilemap, camera); + var domparser = new DOMParser(); + xml = domparser.parseFromString(data, 'text/xml'); } else { - console.warn('Normal map texture missing for using Light2D pipeline. StaticTilemapLayer rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawStaticTilemapLayer(tilemap, camera); + xml = new ActiveXObject('Microsoft.XMLDOM'); + xml.loadXML(data); } - }, + } + catch (e) + { + xml = null; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawEmitterManager - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawEmitterManager: function (emitterManager, camera) + if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) { - var normalTexture = emitterManager.texture.dataSource[0]; + return null; + } + else + { + return xml; + } +}; - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawEmitterManager.call(this, emitterManager, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. EmitterManager rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawEmitterManager(emitterManager, camera); - } - }, +module.exports = ParseXML; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#drawBlitter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - drawBlitter: function (blitter, camera) + +/***/ }), +/* 234 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Attempts to remove the element from its parentNode in the DOM. + * + * @function Phaser.DOM.RemoveFromDOM + * @since 3.0.0 + * + * @param {any} element - The DOM element to remove from its parent node. + */ +var RemoveFromDOM = function (element) +{ + if (element.parentNode) { - var normalTexture = blitter.texture.dataSource[0]; + element.parentNode.removeChild(element); + } +}; - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.drawBlitter.call(this, blitter, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Blitter rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.drawBlitter(blitter, camera); - } - }, +module.exports = RemoveFromDOM; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - */ - batchSprite: function (sprite, camera) + +/***/ }), +/* 235 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(3); + +/** + * @classdesc + * Abstracts away the use of RAF or setTimeOut for the core game update loop. + * This is invoked automatically by the Phaser.Game instance. + * + * @class RequestAnimationFrame + * @memberOf Phaser.DOM + * @constructor + * @since 3.0.0 + */ +var RequestAnimationFrame = new Class({ + + initialize: + + function RequestAnimationFrame () { - var normalTexture = sprite.texture.dataSource[0]; + /** + * True if RequestAnimationFrame is running, otherwise false. + * + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isRunning = false; - if (normalTexture) + /** + * The callback to be invoked each step. + * + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {function} + * @since 3.0.0 + */ + this.callback = NOOP; + + /** + * The most recent timestamp. Either a DOMHighResTimeStamp under RAF or `Date.now` under SetTimeout. + * + * @name Phaser.DOM.RequestAnimationFrame#tick + * @type {DOMHighResTimeStamp|number} + * @default 0 + * @since 3.0.0 + */ + this.tick = 0; + + /** + * True if the step is using setTimeout instead of RAF. + * + * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isSetTimeOut = false; + + /** + * The setTimeout or RAF callback ID used when canceling them. + * + * @name Phaser.DOM.RequestAnimationFrame#timeOutID + * @type {?number} + * @default null + * @since 3.0.0 + */ + this.timeOutID = null; + + /** + * The previous time the step was called. + * + * @name Phaser.DOM.RequestAnimationFrame#lastTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; + + var _this = this; + + /** + * The RAF step function. + * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. + * + * @name Phaser.DOM.RequestAnimationFrame#step + * @type {function} + * @since 3.0.0 + */ + this.step = function step (timestamp) { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchSprite.call(this, sprite, camera); - } - else + // DOMHighResTimeStamp + _this.lastTime = _this.tick; + + _this.tick = timestamp; + + _this.callback(timestamp); + + _this.timeOutID = window.requestAnimationFrame(step); + }; + + /** + * The SetTimeout step function. + * Updates the local tick value, invokes the callback and schedules another call to setTimeout. + * + * @name Phaser.DOM.RequestAnimationFrame#stepTimeout + * @type {function} + * @since 3.0.0 + */ + this.stepTimeout = function stepTimeout () { - console.warn('Normal map texture missing for using Light2D pipeline. Sprite rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchSprite(sprite, camera); - } + var d = Date.now(); + + var delay = Math.max(16 + _this.lastTime - d, 0); + + _this.lastTime = _this.tick; + + _this.tick = d; + + _this.callback(d); + + _this.timeOutID = window.setTimeout(stepTimeout, delay); + }; }, /** - * [description] + * Starts the requestAnimationFrame or setTimeout process running. * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchMesh + * @method Phaser.DOM.RequestAnimationFrame#start * @since 3.0.0 * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * + * @param {function} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? */ - batchMesh: function (mesh, camera) + start: function (callback, forceSetTimeOut) { - var normalTexture = mesh.texture.dataSource[0]; - - if (normalTexture) + if (this.isRunning) { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchMesh.call(this, mesh, camera); + return; } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Mesh rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchMesh(mesh, camera); - } + this.callback = callback; + + this.isSetTimeOut = forceSetTimeOut; + + this.isRunning = true; + + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); }, /** - * [description] + * Stops the requestAnimationFrame or setTimeout from running. * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchBitmapText + * @method Phaser.DOM.RequestAnimationFrame#stop * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * */ - batchBitmapText: function (bitmapText, camera) + stop: function () { - var normalTexture = bitmapText.texture.dataSource[0]; + this.isRunning = false; - if (normalTexture) + if (this.isSetTimeOut) { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchBitmapText.call(this, bitmapText, camera); + clearTimeout(this.timeOutID); } else { - console.warn('Normal map texture missing for using Light2D pipeline. BitmapText rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchBitmapText(bitmapText, camera); + window.cancelAnimationFrame(this.timeOutID); } }, /** - * [description] + * Stops the step from running and clears the callback reference. * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicBitmapText + * @method Phaser.DOM.RequestAnimationFrame#destroy * @since 3.0.0 - * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * */ - batchDynamicBitmapText: function (bitmapText, camera) + destroy: function () { - var normalTexture = bitmapText.texture.dataSource[0]; + this.stop(); - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchDynamicBitmapText.call(this, bitmapText, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. DynamicBitmapText rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchDynamicBitmapText(bitmapText, camera); - } - }, + this.callback = NOOP; + } + +}); + +module.exports = RequestAnimationFrame; + + +/***/ }), +/* 236 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Plugins + */ +var Plugins = { /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchText + * These are the Global Managers that are created by the Phaser.Game instance. + * They are referenced from Scene.Systems so that plugins can use them. + * + * @name Phaser.Plugins.Global + * @type {array} * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * */ - batchText: function (text, camera) - { - var normalTexture = text.texture.dataSource[0]; + Global: [ - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchText.call(this, text, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. Text rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchText(text, camera); - } - }, + 'anims', + 'cache', + 'registry', + 'sound', + 'textures' + + ], /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchDynamicTilemapLayer + * These are the core plugins that are installed into every Scene.Systems instance, no matter what. + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are created in the order in which they appear in this array and EventEmitter is always first. + * + * @name Phaser.Plugins.CoreScene + * @type {array} * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * */ - batchDynamicTilemapLayer: function (tilemapLayer, camera) - { - var normalTexture = tilemapLayer.texture.dataSource[0]; + CoreScene: [ - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchDynamicTilemapLayer.call(this, tilemapLayer, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. DynamicTilemapLayer rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchDynamicTilemapLayer(tilemapLayer, camera); - } - }, + 'EventEmitter', + + 'CameraManager', + 'GameObjectCreator', + 'GameObjectFactory', + 'ScenePlugin', + 'DisplayList', + 'UpdateList' + + ], /** - * [description] - * - * @method Phaser.Renderer.WebGL.ForwardDiffuseLightPipeline#batchTileSprite + * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. + * + * You can elect not to have these plugins by either creating a DefaultPlugins object as part + * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array + * and building your own bundle. + * + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are always created in the order in which they appear in the array. + * + * @name Phaser.Plugins.DefaultScene + * @type {array} * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * */ - batchTileSprite: function (tileSprite, camera) - { - var normalTexture = tileSprite.texture.dataSource[0]; + DefaultScene: [ - if (normalTexture) - { - this.renderer.setPipeline(this); - this.setTexture2D(normalTexture.glTexture, 1); - TextureTintPipeline.prototype.batchTileSprite.call(this, tileSprite, camera); - } - else - { - console.warn('Normal map texture missing for using Light2D pipeline. TileSprite rendered with default pipeline.'); - this.renderer.pipelines.TextureTintPipeline.batchTileSprite(tileSprite, camera); - } - } + 'CameraManager3D', + 'Clock', + 'DataManagerPlugin', + 'InputPlugin', + 'Loader', + 'TweenManager', + 'LightsPlugin' -}); + ] -ForwardDiffuseLightPipeline.LIGHT_COUNT = LIGHT_COUNT; +}; -module.exports = ForwardDiffuseLightPipeline; +/* + * "Sometimes, the elegant implementation is just a function. + * Not a method. Not a class. Not a framework. Just a function." + * -- John Carmack + */ + +module.exports = Plugins; /***/ }), -/* 238 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -46111,1723 +47247,1291 @@ module.exports = ForwardDiffuseLightPipeline; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var ModelViewProjection = __webpack_require__(236); -var ShaderSourceFS = __webpack_require__(515); -var ShaderSourceVS = __webpack_require__(516); -var Utils = __webpack_require__(42); -var WebGLPipeline = __webpack_require__(126); +var CanvasPool = __webpack_require__(19); /** - * @classdesc - * [description] - * - * @class TextureTintPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor + * Determines the canvas features of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.canvasFeatures` from within any Scene. + * + * @name Phaser.Device.CanvasFeatures * @since 3.0.0 * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] - * @param {boolean} overrideFragmentShader - [description] + * @type {object} + * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. + * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. */ -var TextureTintPipeline = new Class({ +var CanvasFeatures = { - Extends: WebGLPipeline, + supportInverseAlpha: false, + supportNewBlendModes: false - Mixins: [ - ModelViewProjection - ], +}; - initialize: +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - function TextureTintPipeline (game, gl, renderer, overrideFragmentShader) + var magenta = new Image(); + + magenta.onload = function () { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: (overrideFragmentShader ? overrideFragmentShader : ShaderSourceFS), - vertexCapacity: 6 * 2000, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2 + - Float32Array.BYTES_PER_ELEMENT * 2 + - Uint8Array.BYTES_PER_ELEMENT * 4, + var yellow = new Image(); - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: Float32Array.BYTES_PER_ELEMENT * 2 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: Float32Array.BYTES_PER_ELEMENT * 4 - } - ] - }); + yellow.onload = function () + { + var canvas = CanvasPool.create(yellow, 6, 1); + var context = canvas.getContext('2d'); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); + context.globalCompositeOperation = 'multiply'; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#vertexViewU32 - * @type {Uint32Array} - * @since 3.0.0 - */ - this.vertexViewU32 = new Uint32Array(this.vertexData); + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#maxQuads - * @type {integer} - * @default 2000 - * @since 3.0.0 - */ - this.maxQuads = 2000; + if (!context.getImageData(2, 0, 1, 1)) + { + return false; + } - /** - * [description] - * - * @name Phaser.Renderer.WebGL.TextureTintPipeline#batches - * @type {array} - * @since 3.1.0 - */ - this.batches = []; + var data = context.getImageData(2, 0, 1, 1).data; - this.mvpInit(); - }, + CanvasPool.remove(yellow); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#setTexture2D - * @since 3.1.0 - * - * @param {WebGLTexture} texture - [description] - * @param {integer} textureUnit - [description] - * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] - */ - setTexture2D: function (texture, unit) - { - if (!texture) - { - return this; - } + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; - var batches = this.batches; + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; - if (batches.length === 0) - { - this.pushBatch(); - } + magenta.src = pngHead + 'AP804Oa6' + pngEnd; - var batch = batches[batches.length - 1]; + return false; +} - if (unit > 0) - { - if (batch.textures[unit - 1] && - batch.textures[unit - 1] !== texture) - { - this.pushBatch(); - } +function checkInverseAlpha () +{ + var canvas = CanvasPool.create(this, 2, 1); + var context = canvas.getContext('2d'); - batches[batches.length - 1].textures[unit - 1] = texture; - } - else - { - if (batch.texture !== null && - batch.texture !== texture) - { - this.pushBatch(); - } + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; - batches[batches.length - 1].texture = texture; - } + // Draw a single pixel + context.fillRect(0, 0, 1, 1); - return this; - }, + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#pushBatch - * @since 3.1.0 - */ - pushBatch: function () + if (s1 === null) { - var batch = { - first: this.vertexCount, - texture: null, - textures: [] - }; + return false; + } - this.batches.push(batch); - }, + // Plot them to x2 + context.putImageData(s1, 1, 0); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#flush - * @since 3.1.0 - */ - flush: function () + // Get those values + var s2 = context.getImageData(1, 0, 1, 1); + + // Compare and return + return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); +} + +function init () +{ + if (document !== undefined) { - if (this.flushLocked) - { - return this; - } + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } - this.flushLocked = true; + return CanvasFeatures; +} - var gl = this.gl; - var renderer = this.renderer; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - var batches = this.batches; - var batchCount = batches.length; - var batchVertexCount = 0; - var batch = null; - var batchNext; - var textureIndex; - var nTexture; +module.exports = init(); - if (batchCount === 0 || vertexCount === 0) - { - this.flushLocked = false; - return this; - } - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); +/***/ }), +/* 238 */ +/***/ (function(module, exports, __webpack_require__) { - for (var index = 0; index < batches.length - 1; ++index) - { - batch = batches[index]; - batchNext = batches[index + 1]; +"use strict"; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (batch.textures.length > 0) - { - for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) - { - nTexture = batch.textures[textureIndex]; +// 2.1.1 (Mar 17, 2016) - if (nTexture) - { - renderer.setTexture2D(nTexture, 1 + textureIndex); - } - } +/* +ISC License - gl.activeTexture(gl.TEXTURE0); - } +Copyright (c) 2016, Mapbox - batchVertexCount = batchNext.first - batch.first; +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. - if (batch.texture === null || batchVertexCount <= 0) { continue; } +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + */ - renderer.setTexture2D(batch.texture, 0); - gl.drawArrays(topology, batch.first, batchVertexCount); - } - // Left over data - batch = batches[batches.length - 1]; - if (batch.textures.length > 0) - { - for (textureIndex = 0; textureIndex < batch.textures.length; ++textureIndex) - { - nTexture = batch.textures[textureIndex]; +module.exports = earcut; - if (nTexture) - { - renderer.setTexture2D(nTexture, 1 + textureIndex); - } - } +/* +vertices is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]. +holes is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11). +dimensions is the number of coordinates per vertice in the input array (2 by default). +Each group of three vertice indices in the resulting array forms a triangle. + */ - gl.activeTexture(gl.TEXTURE0); - } +function earcut(data, holeIndices, dim) { - batchVertexCount = vertexCount - batch.first; + dim = dim || 2; - if (batch.texture && batchVertexCount > 0) - { - renderer.setTexture2D(batch.texture, 0); - gl.drawArrays(topology, batch.first, batchVertexCount); - } + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; - this.vertexCount = 0; - batches.length = 0; - this.pushBatch(); - this.flushLocked = false; + if (!outerNode) return triangles; - return this; - }, + var minX, minY, maxX, maxY, x, y, size; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] - */ - onBind: function () - { - WebGLPipeline.prototype.onBind.call(this); - this.mvpUpdate(); + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - if (this.batches.length === 0) - { - this.pushBatch(); + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; } - return this; - }, + // minX, minY and size are later used to transform coords into integers for z-order calculation + size = Math.max(maxX - minX, maxY - minY); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.TextureTintPipeline} [description] - */ - resize: function (width, height, resolution) - { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); - return this; - }, + earcutLinked(outerNode, triangles, dim, minX, minY, size); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawStaticTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawStaticTilemapLayer: function (tilemap) - { - if (tilemap.vertexCount > 0) - { - var pipelineVertexBuffer = this.vertexBuffer; - var gl = this.gl; - var renderer = this.renderer; - var frame = tilemap.tileset.image.get(); + return triangles; +} - if (renderer.currentPipeline && - renderer.currentPipeline.vertexCount > 0) - { - renderer.flush(); - } +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; - this.vertexBuffer = tilemap.vertexBuffer; - renderer.setPipeline(this); - renderer.setTexture2D(frame.source.glTexture, 0); - gl.drawArrays(this.topology, 0, tilemap.vertexCount); - this.vertexBuffer = pipelineVertexBuffer; - } + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } - this.viewIdentity(); - this.modelIdentity(); - }, + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawEmitterManager - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawEmitterManager: function (emitterManager, camera) - { - this.renderer.setPipeline(this); + return last; +} - var emitters = emitterManager.emitters.list; - var emitterCount = emitters.length; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var maxQuads = this.maxQuads; - var cameraScrollX = camera.scrollX; - var cameraScrollY = camera.scrollY; - var cameraMatrix = camera.matrix.matrix; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var sin = Math.sin; - var cos = Math.cos; - var vertexComponentCount = this.vertexComponentCount; - var vertexCapacity = this.vertexCapacity; - var texture = emitterManager.defaultFrame.source.glTexture; +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; - this.setTexture2D(texture, 0); - - for (var emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex) - { - var emitter = emitters[emitterIndex]; - var particles = emitter.alive; - var aliveLength = particles.length; - var batchCount = Math.ceil(aliveLength / maxQuads); - var particleOffset = 0; - var scrollX = cameraScrollX * emitter.scrollFactorX; - var scrollY = cameraScrollY * emitter.scrollFactorY; + var p = start, + again; + do { + again = false; - if (!emitter.visible || aliveLength === 0) - { - continue; - } + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) return null; + again = true; - renderer.setBlendMode(emitter.blendMode); + } else { + p = p.next; + } + } while (again || p !== end); - if (this.vertexCount >= vertexCapacity) - { - this.flush(); - this.setTexture2D(texture, 0); + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && size) indexCurve(ear, minX, minY, size); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertice leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, size, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, size); } - for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) - { - var batchSize = Math.min(aliveLength, maxQuads); + break; + } + } +} - for (var index = 0; index < batchSize; ++index) - { - var particle = particles[particleOffset + index]; +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; - if (particle.alpha <= 0) - { - continue; - } + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - var frame = particle.frame; - var uvs = frame.uvs; - var x = -(frame.halfWidth); - var y = -(frame.halfHeight); - var color = particle.color; - var xw = x + frame.width; - var yh = y + frame.height; - var sr = sin(particle.rotation); - var cr = cos(particle.rotation); - var sra = cr * particle.scaleX; - var srb = -sr * particle.scaleX; - var src = sr * particle.scaleY; - var srd = cr * particle.scaleY; - var sre = particle.x - scrollX * particle.scrollFactorX; - var srf = particle.y - scrollY * particle.scrollFactorY; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = this.vertexCount * vertexComponentCount; + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = color; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = color; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = color; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = color; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = color; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = color; + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } - this.vertexCount += 6; - } + return true; +} - particleOffset += batchSize; - aliveLength -= batchSize; +function isEarHashed(ear, minX, minY, size) { + var a = ear.prev, + b = ear, + c = ear.next; - if (this.vertexCount >= vertexCapacity) - { - this.flush(); - this.setTexture2D(texture, 0); - } + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, size), + maxZ = zOrder(maxTX, maxTY, minX, minY, size); + + // first look for points inside the triangle in increasing z-order + var p = ear.nextZ; + + while (p && p.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.nextZ; + } + + // then look for points in decreasing z-order + p = ear.prevZ; + + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, size) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, size); + earcutLinked(c, triangles, dim, minX, minY, size); + return; } + b = b.next; } - - this.setTexture2D(texture, 0); - }, + a = a.next; + } while (a !== start); +} - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#drawBlitter - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - drawBlitter: function (blitter, camera) - { - this.renderer.setPipeline(this); +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var list = blitter.getRenderList(); - var length = list.length; - var cameraMatrix = camera.matrix.matrix; - var a = cameraMatrix[0]; - var b = cameraMatrix[1]; - var c = cameraMatrix[2]; - var d = cameraMatrix[3]; - var e = cameraMatrix[4]; - var f = cameraMatrix[5]; - var cameraScrollX = camera.scrollX * blitter.scrollFactorX; - var cameraScrollY = camera.scrollY * blitter.scrollFactorY; - var batchCount = Math.ceil(length / this.maxQuads); - var batchOffset = 0; - var blitterX = blitter.x - cameraScrollX; - var blitterY = blitter.y - cameraScrollY; + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } - for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex) - { - var batchSize = Math.min(length, this.maxQuads); + queue.sort(compareX); - for (var index = 0; index < batchSize; ++index) - { - var bob = list[batchOffset + index]; - var frame = bob.frame; - var alpha = bob.alpha; - var tint = getTint(0xffffff, alpha); - var uvs = frame.uvs; - var flipX = bob.flipX; - var flipY = bob.flipY; - var width = frame.width * (flipX ? -1.0 : 1.0); - var height = frame.height * (flipY ? -1.0 : 1.0); - var x = blitterX + bob.x + frame.x + (frame.width * ((flipX) ? 1.0 : 0.0)); - var y = blitterY + bob.y + frame.y + (frame.height * ((flipY) ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var tx0 = x * a + y * c + e; - var ty0 = x * b + y * d + f; - var tx1 = xw * a + yh * c + e; - var ty1 = xw * b + yh * d + f; - - // Bind Texture if texture wasn't bound. - // This needs to be here because of multiple - // texture atlas. - this.setTexture2D(frame.texture.source[frame.sourceIndex].glTexture, 0); + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } - var vertexOffset = this.vertexCount * this.vertexComponentCount; - - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = tint; - vertexViewF32[vertexOffset + 5] = tx0; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = tint; - vertexViewF32[vertexOffset + 10] = tx1; - vertexViewF32[vertexOffset + 11] = ty1; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = tint; - vertexViewF32[vertexOffset + 20] = tx1; - vertexViewF32[vertexOffset + 21] = ty1; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = tint; - vertexViewF32[vertexOffset + 25] = tx1; - vertexViewF32[vertexOffset + 26] = ty0; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = tint; + return outerNode; +} - this.vertexCount += 6; +function compareX(a, b) { + return a.x - b.x; +} - if (this.vertexCount >= this.vertexCapacity) - { - this.flush(); +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; } + m = p.x < p.next.x ? p : p.next; } + } + p = p.next; + } while (p !== outerNode); - batchOffset += batchSize; - length -= batchSize; + if (!m) return null; - if (this.vertexCount >= this.vertexCapacity) - { - this.flush(); + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; } } - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchSprite: function (sprite, camera) - { - this.renderer.setPipeline(this); + p = p.next; + } - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + return m; +} - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = sprite.frame; - var texture = frame.texture.source[frame.sourceIndex].glTexture; - var forceFlipY = (texture.isRenderTexture ? true : false); - var flipX = sprite.flipX; - var flipY = sprite.flipY ^ forceFlipY; - var uvs = frame.uvs; - var width = frame.width * (flipX ? -1.0 : 1.0); - var height = frame.height * (flipY ? -1.0 : 1.0); - var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0)); - var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var translateX = sprite.x - camera.scrollX * sprite.scrollFactorX; - var translateY = sprite.y - camera.scrollY * sprite.scrollFactorY; - var scaleX = sprite.scaleX; - var scaleY = sprite.scaleY; - var rotation = -sprite.rotation; - var alphaTL = sprite._alphaTL; - var alphaTR = sprite._alphaTR; - var alphaBL = sprite._alphaBL; - var alphaBR = sprite._alphaBR; - var tintTL = sprite._tintTL; - var tintTR = sprite._tintTR; - var tintBL = sprite._tintBL; - var tintBR = sprite._tintBR; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vTintTL = getTint(tintTL, alphaTL); - var vTintTR = getTint(tintTR, alphaTR); - var vTintBL = getTint(tintBL, alphaBL); - var vTintBR = getTint(tintBR, alphaBR); - var vertexOffset = 0; +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, size) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); - this.setTexture2D(texture, 0); + p.prevZ.nextZ = null; + p.prevZ = null; - vertexOffset = this.vertexCount * this.vertexComponentCount; + sortLinked(p); +} - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = uvs.x0; - vertexViewF32[vertexOffset + 3] = uvs.y0; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = uvs.x1; - vertexViewF32[vertexOffset + 8] = uvs.y1; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = uvs.x2; - vertexViewF32[vertexOffset + 13] = uvs.y2; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = uvs.x0; - vertexViewF32[vertexOffset + 18] = uvs.y0; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = uvs.x2; - vertexViewF32[vertexOffset + 23] = uvs.y2; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = uvs.x3; - vertexViewF32[vertexOffset + 28] = uvs.y3; - vertexViewU32[vertexOffset + 29] = vTintTR; +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; - this.vertexCount += 6; - }, + do { + p = list; + list = null; + tail = null; + numMerges = 0; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchMesh - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchMesh: function (mesh, camera) - { - var vertices = mesh.vertices; - var length = vertices.length; - var vertexCount = (length / 2)|0; + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + qSize = inSize; - this.renderer.setPipeline(this); + while (pSize > 0 || (qSize > 0 && q)) { - if (this.vertexCount + vertexCount > this.vertexCapacity) - { - this.flush(); + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; } - var getTint = Utils.getTintAppendFloatAlpha; - var uvs = mesh.uv; - var colors = mesh.colors; - var alphas = mesh.alphas; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = mesh.frame; - var texture = mesh.texture.source[frame.sourceIndex].glTexture; - var translateX = mesh.x - camera.scrollX * mesh.scrollFactorX; - var translateY = mesh.y - camera.scrollY * mesh.scrollFactorY; - var scaleX = mesh.scaleX; - var scaleY = mesh.scaleY; - var rotation = -mesh.rotation; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var vertexOffset = 0; + tail.nextZ = null; + inSize *= 2; - this.setTexture2D(texture, 0); + } while (numMerges > 1); - vertexOffset = this.vertexCount * this.vertexComponentCount; + return list; +} - for (var index = 0, index0 = 0; index < length; index += 2) - { - var x = vertices[index + 0]; - var y = vertices[index + 1]; - var tx = x * mva + y * mvc + mve; - var ty = x * mvb + y * mvd + mvf; +// z-order of a point given coords and size of the data bounding box +function zOrder(x, y, minX, minY, size) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) / size; + y = 32767 * (y - minY) / size; - vertexViewF32[vertexOffset + 0] = tx; - vertexViewF32[vertexOffset + 1] = ty; - vertexViewF32[vertexOffset + 2] = uvs[index + 0]; - vertexViewF32[vertexOffset + 3] = uvs[index + 1]; - vertexViewU32[vertexOffset + 4] = getTint(colors[index0], alphas[index0]); + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; - vertexOffset += 5; - index0 += 1; - } + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; - this.vertexCount += vertexCount; - }, + return x | (y << 1); +} - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchBitmapText: function (bitmapText, camera) - { - this.renderer.setPipeline(this); +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + return leftmost; +} - var text = bitmapText.text; - var textLength = text.length; - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var cameraWidth = camera.width + 50; - var cameraHeight = camera.height + 50; - var cameraX = -50; - var cameraY = -50; - var frame = bitmapText.frame; - var textureSource = bitmapText.texture.source[frame.sourceIndex]; - var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; - var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; - var fontData = bitmapText.fontData; - var lineHeight = fontData.lineHeight; - var scale = (bitmapText.fontSize / fontData.size); - var chars = fontData.chars; - var alpha = bitmapText.alpha; - var vTintTL = getTint(bitmapText._tintTL, alpha); - var vTintTR = getTint(bitmapText._tintTR, alpha); - var vTintBL = getTint(bitmapText._tintBL, alpha); - var vTintBR = getTint(bitmapText._tintBR, alpha); - var srcX = bitmapText.x; - var srcY = bitmapText.y; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = textureSource.width; - var textureHeight = textureSource.height; - var texture = textureSource.glTexture; - var xAdvance = 0; - var yAdvance = 0; - var indexCount = 0; - var charCode = 0; - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - var x = 0; - var y = 0; - var xw = 0; - var yh = 0; +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; +} - var tx0; - var ty0; - var tx1; - var ty1; - var tx2; - var ty2; - var tx3; - var ty3; +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); +} - var umin = 0; - var umax = 0; - var vmin = 0; - var vmax = 0; - var lastGlyph = null; - var lastCharCode = 0; - var translateX = (srcX - cameraScrollX) + frame.x; - var translateY = (srcY - cameraScrollY) + frame.y; - var rotation = -bitmapText.rotation; - var scaleX = bitmapText.scaleX; - var scaleY = bitmapText.scaleY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var vertexOffset = 0; +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} - this.setTexture2D(texture, 0); +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} - for (var index = 0; index < textLength; ++index) - { - charCode = text.charCodeAt(index); +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; +} - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; - } +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); - glyph = chars[charCode]; + return false; +} - if (!glyph) - { - continue; - } +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); - glyphW = glyph.width; - glyphH = glyph.height; + return inside; +} - x = (indexCount + glyph.xOffset + xAdvance) * scale; - y = (glyph.yOffset + yAdvance) * scale; +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } + a.next = b; + b.prev = a; - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; + a2.next = an; + an.prev = a2; - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } + b2.next = a2; + a2.prev = b2; - x -= bitmapText.displayOriginX; - y -= bitmapText.displayOriginY; + bp.next = b2; + b2.prev = bp; - xw = x + glyphW * scale; - yh = y + glyphH * scale; - tx0 = x * mva + y * mvc + mve; - ty0 = x * mvb + y * mvd + mvf; - tx1 = x * mva + yh * mvc + mve; - ty1 = x * mvb + yh * mvd + mvf; - tx2 = xw * mva + yh * mvc + mve; - ty2 = xw * mvb + yh * mvd + mvf; - tx3 = xw * mva + y * mvc + mve; - ty3 = xw * mvb + y * mvd + mvf; + return b2; +} - umin = glyphX / textureWidth; - umax = (glyphX + glyphW) / textureWidth; - vmin = glyphY / textureHeight; - vmax = (glyphY + glyphH) / textureHeight; +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); - if ((tx0 < cameraX || tx0 > cameraWidth || ty0 < cameraY || ty0 > cameraHeight) && - (tx1 < cameraX || tx1 > cameraWidth || ty1 < cameraY || ty1 > cameraHeight) && - (tx2 < cameraX || tx2 > cameraWidth || ty2 < cameraY || ty2 > cameraHeight) && - (tx3 < cameraX || tx3 > cameraWidth || ty3 < cameraY || ty3 > cameraHeight)) - { - continue; - } + if (!last) { + p.prev = p; + p.next = p; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - vertexOffset = this.vertexCount * this.vertexComponentCount; + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = umin; - vertexViewF32[vertexOffset + 3] = vmin; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = umin; - vertexViewF32[vertexOffset + 8] = vmax; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = umax; - vertexViewF32[vertexOffset + 13] = vmax; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = umin; - vertexViewF32[vertexOffset + 18] = vmin; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = umax; - vertexViewF32[vertexOffset + 23] = vmax; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = umax; - vertexViewF32[vertexOffset + 28] = vmin; - vertexViewU32[vertexOffset + 29] = vTintTR; - - this.vertexCount += 6; +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertice index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertice nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); } - }, + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicBitmapText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicBitmapText: function (bitmapText, camera) - { - this.renderer.setPipeline(this); + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); } + } + return result; +}; - var displayCallback = bitmapText.displayCallback; - var text = bitmapText.text; - var textLength = text.length; - var getTint = Utils.getTintAppendFloatAlpha; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var frame = bitmapText.frame; - var textureSource = bitmapText.texture.source[frame.sourceIndex]; - var cameraScrollX = camera.scrollX * bitmapText.scrollFactorX; - var cameraScrollY = camera.scrollY * bitmapText.scrollFactorY; - var scrollX = bitmapText.scrollX; - var scrollY = bitmapText.scrollY; - var fontData = bitmapText.fontData; - var lineHeight = fontData.lineHeight; - var scale = (bitmapText.fontSize / fontData.size); - var chars = fontData.chars; - var alpha = bitmapText.alpha; - var vTintTL = getTint(bitmapText._tintTL, alpha); - var vTintTR = getTint(bitmapText._tintTR, alpha); - var vTintBL = getTint(bitmapText._tintBL, alpha); - var vTintBR = getTint(bitmapText._tintBR, alpha); - var srcX = bitmapText.x; - var srcY = bitmapText.y; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = textureSource.width; - var textureHeight = textureSource.height; - var texture = textureSource.glTexture; - var xAdvance = 0; - var yAdvance = 0; - var indexCount = 0; - var charCode = 0; - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - var x = 0; - var y = 0; - var xw = 0; - var tx0; - var ty0; - var tx1; - var ty1; - var tx2; - var ty2; - var tx3; - var ty3; - var yh = 0; - var umin = 0; - var umax = 0; - var vmin = 0; - var vmax = 0; - var lastGlyph = null; - var lastCharCode = 0; - var translateX = srcX + frame.x; - var translateY = srcY + frame.y; - var rotation = -bitmapText.rotation; - var scaleX = bitmapText.scaleX; - var scaleY = bitmapText.scaleY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var crop = (bitmapText.cropWidth > 0 || bitmapText.cropHeight > 0); - var uta, utb, utc, utd, ute, utf; - var vertexOffset = 0; +/***/ }), +/* 239 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var ModelViewProjection = { + + modelMatrixDirty: false, + viewMatrixDirty: false, + projectionMatrixDirty: false, + modelMatrix: null, + viewMatrix: null, + projectionMatrix: null, + + mvpInit: function () + { + this.modelMatrixDirty = true; + this.viewMatrixDirty = true; + this.projectionMatrixDirty = true; + + this.modelMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + this.viewMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + this.projectionMatrix = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + + return this; + }, - this.setTexture2D(texture, 0); + mvpUpdate: function () + { + var program = this.program; - if (crop) + if (this.modelMatrixDirty) { - renderer.pushScissor( - bitmapText.x, - bitmapText.y, - bitmapText.cropWidth * bitmapText.scaleX, - bitmapText.cropHeight * bitmapText.scaleY - ); + this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); + this.modelMatrixDirty = false; + } + + if (this.viewMatrixDirty) + { + this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); + this.viewMatrixDirty = false; } - for (var index = 0; index < textLength; ++index) + if (this.projectionMatrixDirty) { - scale = (bitmapText.fontSize / bitmapText.fontData.size); - rotation = 0; + this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); + this.projectionMatrixDirty = false; + } - charCode = text.charCodeAt(index); + return this; + }, - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; - } + modelIdentity: function () + { + var modelMatrix = this.modelMatrix; + + modelMatrix[0] = 1; + modelMatrix[1] = 0; + modelMatrix[2] = 0; + modelMatrix[3] = 0; + modelMatrix[4] = 0; + modelMatrix[5] = 1; + modelMatrix[6] = 0; + modelMatrix[7] = 0; + modelMatrix[8] = 0; + modelMatrix[9] = 0; + modelMatrix[10] = 1; + modelMatrix[11] = 0; + modelMatrix[12] = 0; + modelMatrix[13] = 0; + modelMatrix[14] = 0; + modelMatrix[15] = 1; - glyph = chars[charCode]; + this.modelMatrixDirty = true; + + return this; + }, - if (!glyph) - { - continue; - } + modelScale: function (x, y, z) + { + var modelMatrix = this.modelMatrix; - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; + modelMatrix[0] = modelMatrix[0] * x; + modelMatrix[1] = modelMatrix[1] * x; + modelMatrix[2] = modelMatrix[2] * x; + modelMatrix[3] = modelMatrix[3] * x; + modelMatrix[4] = modelMatrix[4] * y; + modelMatrix[5] = modelMatrix[5] * y; + modelMatrix[6] = modelMatrix[6] * y; + modelMatrix[7] = modelMatrix[7] * y; + modelMatrix[8] = modelMatrix[8] * z; + modelMatrix[9] = modelMatrix[9] * z; + modelMatrix[10] = modelMatrix[10] * z; + modelMatrix[11] = modelMatrix[11] * z; + + this.modelMatrixDirty = true; - glyphW = glyph.width; - glyphH = glyph.height; - - x = (indexCount + glyph.xOffset + xAdvance) - scrollX; - y = (glyph.yOffset + yAdvance) - scrollY; + return this; + }, - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } + modelTranslate: function (x, y, z) + { + var modelMatrix = this.modelMatrix; - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; + modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; + modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; + modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; + modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } + this.modelMatrixDirty = true; - if (displayCallback) - { - var output = displayCallback({ - color: 0, - tint: { - topLeft: vTintTL, - topRight: vTintTR, - bottomLeft: vTintBL, - bottomRight: vTintBR - }, - index: index, - charCode: charCode, - x: x, - y: y, - scale: scale, - rotation: 0, - data: glyph.data - }); + return this; + }, - x = output.x; - y = output.y; - scale = output.scale; - rotation = output.rotation; + modelRotateX: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a10 = modelMatrix[4]; + var a11 = modelMatrix[5]; + var a12 = modelMatrix[6]; + var a13 = modelMatrix[7]; + var a20 = modelMatrix[8]; + var a21 = modelMatrix[9]; + var a22 = modelMatrix[10]; + var a23 = modelMatrix[11]; - if (output.color) - { - vTintTL = output.color; - vTintTR = output.color; - vTintBL = output.color; - vTintBR = output.color; - } - else - { - vTintTL = output.tint.topLeft; - vTintTR = output.tint.topRight; - vTintBL = output.tint.bottomLeft; - vTintBR = output.tint.bottomRight; - } + modelMatrix[4] = a10 * c + a20 * s; + modelMatrix[5] = a11 * c + a21 * s; + modelMatrix[6] = a12 * c + a22 * s; + modelMatrix[7] = a13 * c + a23 * s; + modelMatrix[8] = a20 * c - a10 * s; + modelMatrix[9] = a21 * c - a11 * s; + modelMatrix[10] = a22 * c - a12 * s; + modelMatrix[11] = a23 * c - a13 * s; - vTintTL = getTint(vTintTL, alpha); - vTintTR = getTint(vTintTR, alpha); - vTintBL = getTint(vTintBL, alpha); - vTintBR = getTint(vTintBR, alpha); - } + this.modelMatrixDirty = true; - x -= bitmapText.displayOriginX; - y -= bitmapText.displayOriginY; - x *= scale; - y *= scale; - x -= cameraScrollX; - y -= cameraScrollY; + return this; + }, - sr = Math.sin(-rotation); - cr = Math.cos(-rotation); - uta = cr * scale; - utb = -sr * scale; - utc = sr * scale; - utd = cr * scale; - ute = x; - utf = y; + modelRotateY: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = modelMatrix[0]; + var a01 = modelMatrix[1]; + var a02 = modelMatrix[2]; + var a03 = modelMatrix[3]; + var a20 = modelMatrix[8]; + var a21 = modelMatrix[9]; + var a22 = modelMatrix[10]; + var a23 = modelMatrix[11]; - sra = uta * mva + utb * mvc; - srb = uta * mvb + utb * mvd; - src = utc * mva + utd * mvc; - srd = utc * mvb + utd * mvd; - sre = ute * mva + utf * mvc + mve; - srf = ute * mvb + utf * mvd + mvf; + modelMatrix[0] = a00 * c - a20 * s; + modelMatrix[1] = a01 * c - a21 * s; + modelMatrix[2] = a02 * c - a22 * s; + modelMatrix[3] = a03 * c - a23 * s; + modelMatrix[8] = a00 * s + a20 * c; + modelMatrix[9] = a01 * s + a21 * c; + modelMatrix[10] = a02 * s + a22 * c; + modelMatrix[11] = a03 * s + a23 * c; - xw = glyphW; - yh = glyphH; - tx0 = sre; - ty0 = srf; - tx1 = yh * src + sre; - ty1 = yh * srd + srf; - tx2 = xw * sra + yh * src + sre; - ty2 = xw * srb + yh * srd + srf; - tx3 = xw * sra + sre; - ty3 = xw * srb + srf; + this.modelMatrixDirty = true; + + return this; + }, - umin = glyphX / textureWidth; - umax = (glyphX + glyphW) / textureWidth; - vmin = glyphY / textureHeight; - vmax = (glyphY + glyphH) / textureHeight; + modelRotateZ: function (radians) + { + var modelMatrix = this.modelMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = modelMatrix[0]; + var a01 = modelMatrix[1]; + var a02 = modelMatrix[2]; + var a03 = modelMatrix[3]; + var a10 = modelMatrix[4]; + var a11 = modelMatrix[5]; + var a12 = modelMatrix[6]; + var a13 = modelMatrix[7]; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - vertexOffset = this.vertexCount * this.vertexComponentCount; + modelMatrix[0] = a00 * c + a10 * s; + modelMatrix[1] = a01 * c + a11 * s; + modelMatrix[2] = a02 * c + a12 * s; + modelMatrix[3] = a03 * c + a13 * s; + modelMatrix[4] = a10 * c - a00 * s; + modelMatrix[5] = a11 * c - a01 * s; + modelMatrix[6] = a12 * c - a02 * s; + modelMatrix[7] = a13 * c - a03 * s; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = umin; - vertexViewF32[vertexOffset + 3] = vmin; - vertexViewU32[vertexOffset + 4] = vTintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = umin; - vertexViewF32[vertexOffset + 8] = vmax; - vertexViewU32[vertexOffset + 9] = vTintBL; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = umax; - vertexViewF32[vertexOffset + 13] = vmax; - vertexViewU32[vertexOffset + 14] = vTintBR; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = umin; - vertexViewF32[vertexOffset + 18] = vmin; - vertexViewU32[vertexOffset + 19] = vTintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = umax; - vertexViewF32[vertexOffset + 23] = vmax; - vertexViewU32[vertexOffset + 24] = vTintBR; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = umax; - vertexViewF32[vertexOffset + 28] = vmin; - vertexViewU32[vertexOffset + 29] = vTintTR; + this.modelMatrixDirty = true; + + return this; + }, + + viewIdentity: function () + { + var viewMatrix = this.viewMatrix; - this.vertexCount += 6; - } + viewMatrix[0] = 1; + viewMatrix[1] = 0; + viewMatrix[2] = 0; + viewMatrix[3] = 0; + viewMatrix[4] = 0; + viewMatrix[5] = 1; + viewMatrix[6] = 0; + viewMatrix[7] = 0; + viewMatrix[8] = 0; + viewMatrix[9] = 0; + viewMatrix[10] = 1; + viewMatrix[11] = 0; + viewMatrix[12] = 0; + viewMatrix[13] = 0; + viewMatrix[14] = 0; + viewMatrix[15] = 1; - if (crop) - { - renderer.popScissor(); - } + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchText: function (text, camera) + viewScale: function (x, y, z) { - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; - this.batchTexture( - text, - text.canvasTexture, - text.canvasTexture.width, text.canvasTexture.height, - text.x, text.y, - text.canvasTexture.width, text.canvasTexture.height, - text.scaleX, text.scaleY, - text.rotation, - text.flipX, text.flipY, - text.scrollFactorX, text.scrollFactorY, - text.displayOriginX, text.displayOriginY, - 0, 0, text.canvasTexture.width, text.canvasTexture.height, - getTint(text._tintTL, text._alphaTL), - getTint(text._tintTR, text._alphaTR), - getTint(text._tintBL, text._alphaBL), - getTint(text._tintBR, text._alphaBR), - 0, 0, - camera - ); + viewMatrix[0] = viewMatrix[0] * x; + viewMatrix[1] = viewMatrix[1] * x; + viewMatrix[2] = viewMatrix[2] * x; + viewMatrix[3] = viewMatrix[3] * x; + viewMatrix[4] = viewMatrix[4] * y; + viewMatrix[5] = viewMatrix[5] * y; + viewMatrix[6] = viewMatrix[6] * y; + viewMatrix[7] = viewMatrix[7] * y; + viewMatrix[8] = viewMatrix[8] * z; + viewMatrix[9] = viewMatrix[9] * z; + viewMatrix[10] = viewMatrix[10] * z; + viewMatrix[11] = viewMatrix[11] * z; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchDynamicTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchDynamicTilemapLayer: function (tilemapLayer, camera) + viewTranslate: function (x, y, z) { - var renderTiles = tilemapLayer.culledTiles; - var length = renderTiles.length; - var texture = tilemapLayer.tileset.image.get().source.glTexture; - var tileset = tilemapLayer.tileset; - var scrollFactorX = tilemapLayer.scrollFactorX; - var scrollFactorY = tilemapLayer.scrollFactorY; - var alpha = tilemapLayer.alpha; - var x = tilemapLayer.x; - var y = tilemapLayer.y; - var sx = tilemapLayer.scaleX; - var sy = tilemapLayer.scaleY; - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; - for (var index = 0; index < length; ++index) - { - var tile = renderTiles[index]; + viewMatrix[12] = viewMatrix[0] * x + viewMatrix[4] * y + viewMatrix[8] * z + viewMatrix[12]; + viewMatrix[13] = viewMatrix[1] * x + viewMatrix[5] * y + viewMatrix[9] * z + viewMatrix[13]; + viewMatrix[14] = viewMatrix[2] * x + viewMatrix[6] * y + viewMatrix[10] * z + viewMatrix[14]; + viewMatrix[15] = viewMatrix[3] * x + viewMatrix[7] * y + viewMatrix[11] * z + viewMatrix[15]; - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); - if (tileTexCoords === null) { continue; } + this.viewMatrixDirty = true; - var frameWidth = tile.width; - var frameHeight = tile.height; - var frameX = tileTexCoords.x; - var frameY = tileTexCoords.y; - var tint = getTint(tile.tint, alpha * tile.alpha); + return this; + }, - this.batchTexture( - tilemapLayer, - texture, - texture.width, texture.height, - (tile.width / 2) + x + tile.pixelX * sx, (tile.height / 2) + y + tile.pixelY * sy, - tile.width * sx, tile.height * sy, - 1, 1, - tile.rotation, - tile.flipX, tile.flipY, - scrollFactorX, scrollFactorY, - (tile.width / 2), (tile.height / 2), - frameX, frameY, frameWidth, frameHeight, - tint, tint, tint, tint, - 0, 0, - camera - ); - } + viewRotateX: function (radians) + { + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a10 = viewMatrix[4]; + var a11 = viewMatrix[5]; + var a12 = viewMatrix[6]; + var a13 = viewMatrix[7]; + var a20 = viewMatrix[8]; + var a21 = viewMatrix[9]; + var a22 = viewMatrix[10]; + var a23 = viewMatrix[11]; + + viewMatrix[4] = a10 * c + a20 * s; + viewMatrix[5] = a11 * c + a21 * s; + viewMatrix[6] = a12 * c + a22 * s; + viewMatrix[7] = a13 * c + a23 * s; + viewMatrix[8] = a20 * c - a10 * s; + viewMatrix[9] = a21 * c - a11 * s; + viewMatrix[10] = a22 * c - a12 * s; + viewMatrix[11] = a23 * c - a13 * s; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTileSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTileSprite: function (tileSprite, camera) + viewRotateY: function (radians) { - var getTint = Utils.getTintAppendFloatAlpha; + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = viewMatrix[0]; + var a01 = viewMatrix[1]; + var a02 = viewMatrix[2]; + var a03 = viewMatrix[3]; + var a20 = viewMatrix[8]; + var a21 = viewMatrix[9]; + var a22 = viewMatrix[10]; + var a23 = viewMatrix[11]; - this.batchTexture( - tileSprite, - tileSprite.tileTexture, - tileSprite.frame.width, tileSprite.frame.height, - tileSprite.x, tileSprite.y, - tileSprite.width, tileSprite.height, - tileSprite.scaleX, tileSprite.scaleY, - tileSprite.rotation, - tileSprite.flipX, tileSprite.flipY, - tileSprite.scrollFactorX, tileSprite.scrollFactorY, - tileSprite.originX * tileSprite.width, tileSprite.originY * tileSprite.height, - 0, 0, tileSprite.width, tileSprite.height, - getTint(tileSprite._tintTL, tileSprite._alphaTL), - getTint(tileSprite._tintTR, tileSprite._alphaTR), - getTint(tileSprite._tintBL, tileSprite._alphaBL), - getTint(tileSprite._tintBR, tileSprite._alphaBR), - tileSprite.tilePositionX / tileSprite.frame.width, - tileSprite.tilePositionY / tileSprite.frame.height, - camera - ); + viewMatrix[0] = a00 * c - a20 * s; + viewMatrix[1] = a01 * c - a21 * s; + viewMatrix[2] = a02 * c - a22 * s; + viewMatrix[3] = a03 * c - a23 * s; + viewMatrix[8] = a00 * s + a20 * c; + viewMatrix[9] = a01 * s + a21 * c; + viewMatrix[10] = a02 * s + a22 * c; + viewMatrix[11] = a03 * s + a23 * c; + + this.viewMatrixDirty = true; + + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchTexture - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - [description] - * @param {WebGLTexture} texture - [description] - * @param {integer} textureWidth - [description] - * @param {integer} textureHeight - [description] - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcWidth - [description] - * @param {float} srcHeight - [description] - * @param {float} scaleX - [description] - * @param {float} scaleY - [description] - * @param {float} rotation - [description] - * @param {boolean} flipX - [description] - * @param {boolean} flipY - [description] - * @param {float} scrollFactorX - [description] - * @param {float} scrollFactorY - [description] - * @param {float} displayOriginX - [description] - * @param {float} displayOriginY - [description] - * @param {float} frameX - [description] - * @param {float} frameY - [description] - * @param {float} frameWidth - [description] - * @param {float} frameHeight - [description] - * @param {integer} tintTL - [description] - * @param {integer} tintTR - [description] - * @param {integer} tintBL - [description] - * @param {integer} tintBR - [description] - * @param {float} uOffset - [description] - * @param {float} vOffset - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, - uOffset, vOffset, - camera) + viewRotateZ: function (radians) { - this.renderer.setPipeline(this); + var viewMatrix = this.viewMatrix; + var s = Math.sin(radians); + var c = Math.cos(radians); + var a00 = viewMatrix[0]; + var a01 = viewMatrix[1]; + var a02 = viewMatrix[2]; + var a03 = viewMatrix[3]; + var a10 = viewMatrix[4]; + var a11 = viewMatrix[5]; + var a12 = viewMatrix[6]; + var a13 = viewMatrix[7]; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + viewMatrix[0] = a00 * c + a10 * s; + viewMatrix[1] = a01 * c + a11 * s; + viewMatrix[2] = a02 * c + a12 * s; + viewMatrix[3] = a03 * c + a13 * s; + viewMatrix[4] = a10 * c - a00 * s; + viewMatrix[5] = a11 * c - a01 * s; + viewMatrix[6] = a12 * c - a02 * s; + viewMatrix[7] = a13 * c - a03 * s; - flipY = flipY ^ (texture.isRenderTexture ? 1 : 0); - rotation = -rotation; + this.viewMatrixDirty = true; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var cameraMatrix = camera.matrix.matrix; - var width = srcWidth * (flipX ? -1.0 : 1.0); - var height = srcHeight * (flipY ? -1.0 : 1.0); - var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0)); - var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0)); - var xw = x + width; - var yh = y + height; - var translateX = srcX - camera.scrollX * scrollFactorX; - var translateY = srcY - camera.scrollY * scrollFactorY; - var sr = Math.sin(rotation); - var cr = Math.cos(rotation); - var sra = cr * scaleX; - var srb = -sr * scaleX; - var src = sr * scaleY; - var srd = cr * scaleY; - var sre = translateX; - var srf = translateY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = 0; - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; - - this.setTexture2D(texture, 0); + return this; + }, - vertexOffset = this.vertexCount * this.vertexComponentCount; + viewLoad2D: function (matrix2D) + { + var vm = this.viewMatrix; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = u0; - vertexViewF32[vertexOffset + 3] = v0; - vertexViewU32[vertexOffset + 4] = tintTL; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = u0; - vertexViewF32[vertexOffset + 8] = v1; - vertexViewU32[vertexOffset + 9] = tintTR; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = u1; - vertexViewF32[vertexOffset + 13] = v1; - vertexViewU32[vertexOffset + 14] = tintBL; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = u0; - vertexViewF32[vertexOffset + 18] = v0; - vertexViewU32[vertexOffset + 19] = tintTL; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = u1; - vertexViewF32[vertexOffset + 23] = v1; - vertexViewU32[vertexOffset + 24] = tintBL; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = u1; - vertexViewF32[vertexOffset + 28] = v0; - vertexViewU32[vertexOffset + 29] = tintBR; + vm[0] = matrix2D[0]; + vm[1] = matrix2D[1]; + vm[2] = 0.0; + vm[3] = 0.0; + vm[4] = matrix2D[2]; + vm[5] = matrix2D[3]; + vm[6] = 0.0; + vm[7] = 0.0; + vm[8] = matrix2D[4]; + vm[9] = matrix2D[5]; + vm[10] = 1.0; + vm[11] = 0.0; + vm[12] = 0.0; + vm[13] = 0.0; + vm[14] = 0.0; + vm[15] = 1.0; - this.vertexCount += 6; + this.viewMatrixDirty = true; + + return this; }, - drawTexture: function ( - texture, - srcX, srcY, - frameX, frameY, frameWidth, frameHeight, - transformMatrix - ) + viewLoad: function (matrix) { - this.renderer.setPipeline(this); + var vm = this.viewMatrix; - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + vm[0] = matrix[0]; + vm[1] = matrix[1]; + vm[2] = matrix[2]; + vm[3] = matrix[3]; + vm[4] = matrix[4]; + vm[5] = matrix[5]; + vm[6] = matrix[6]; + vm[7] = matrix[7]; + vm[8] = matrix[8]; + vm[9] = matrix[9]; + vm[10] = matrix[10]; + vm[11] = matrix[11]; + vm[12] = matrix[12]; + vm[13] = matrix[13]; + vm[14] = matrix[14]; + vm[15] = matrix[15]; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var renderer = this.renderer; - var width = frameWidth; - var height = frameHeight; - var x = srcX; - var y = srcY; - var xw = x + width; - var yh = y + height; - var mva = transformMatrix[0]; - var mvb = transformMatrix[1]; - var mvc = transformMatrix[2]; - var mvd = transformMatrix[3]; - var mve = transformMatrix[4]; - var mvf = transformMatrix[5]; - var tx0 = x * mva + y * mvc + mve; - var ty0 = x * mvb + y * mvd + mvf; - var tx1 = x * mva + yh * mvc + mve; - var ty1 = x * mvb + yh * mvd + mvf; - var tx2 = xw * mva + yh * mvc + mve; - var ty2 = xw * mvb + yh * mvd + mvf; - var tx3 = xw * mva + y * mvc + mve; - var ty3 = xw * mvb + y * mvd + mvf; - var vertexOffset = 0; - var textureWidth = texture.width; - var textureHeight = texture.height; - var u0 = (frameX / textureWidth); - var v0 = (frameY / textureHeight); - var u1 = (frameX + frameWidth) / textureWidth; - var v1 = (frameY + frameHeight) / textureHeight; - var tint = 0xffffffff; + this.viewMatrixDirty = true; + + return this; + }, + + projIdentity: function () + { + var projectionMatrix = this.projectionMatrix; - this.setTexture2D(texture, 0); + projectionMatrix[0] = 1; + projectionMatrix[1] = 0; + projectionMatrix[2] = 0; + projectionMatrix[3] = 0; + projectionMatrix[4] = 0; + projectionMatrix[5] = 1; + projectionMatrix[6] = 0; + projectionMatrix[7] = 0; + projectionMatrix[8] = 0; + projectionMatrix[9] = 0; + projectionMatrix[10] = 1; + projectionMatrix[11] = 0; + projectionMatrix[12] = 0; + projectionMatrix[13] = 0; + projectionMatrix[14] = 0; + projectionMatrix[15] = 1; - vertexOffset = this.vertexCount * this.vertexComponentCount; + this.projectionMatrixDirty = true; - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewF32[vertexOffset + 2] = u0; - vertexViewF32[vertexOffset + 3] = v0; - vertexViewU32[vertexOffset + 4] = tint; - vertexViewF32[vertexOffset + 5] = tx1; - vertexViewF32[vertexOffset + 6] = ty1; - vertexViewF32[vertexOffset + 7] = u0; - vertexViewF32[vertexOffset + 8] = v1; - vertexViewU32[vertexOffset + 9] = tint; - vertexViewF32[vertexOffset + 10] = tx2; - vertexViewF32[vertexOffset + 11] = ty2; - vertexViewF32[vertexOffset + 12] = u1; - vertexViewF32[vertexOffset + 13] = v1; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx0; - vertexViewF32[vertexOffset + 16] = ty0; - vertexViewF32[vertexOffset + 17] = u0; - vertexViewF32[vertexOffset + 18] = v0; - vertexViewU32[vertexOffset + 19] = tint; - vertexViewF32[vertexOffset + 20] = tx2; - vertexViewF32[vertexOffset + 21] = ty2; - vertexViewF32[vertexOffset + 22] = u1; - vertexViewF32[vertexOffset + 23] = v1; - vertexViewU32[vertexOffset + 24] = tint; - vertexViewF32[vertexOffset + 25] = tx3; - vertexViewF32[vertexOffset + 26] = ty3; - vertexViewF32[vertexOffset + 27] = u1; - vertexViewF32[vertexOffset + 28] = v0; - vertexViewU32[vertexOffset + 29] = tint; + return this; + }, - this.vertexCount += 6; + projOrtho: function (left, right, bottom, top, near, far) + { + var projectionMatrix = this.projectionMatrix; + var leftRight = 1.0 / (left - right); + var bottomTop = 1.0 / (bottom - top); + var nearFar = 1.0 / (near - far); - // Force an immediate draw - this.flush(); + projectionMatrix[0] = -2.0 * leftRight; + projectionMatrix[1] = 0.0; + projectionMatrix[2] = 0.0; + projectionMatrix[3] = 0.0; + projectionMatrix[4] = 0.0; + projectionMatrix[5] = -2.0 * bottomTop; + projectionMatrix[6] = 0.0; + projectionMatrix[7] = 0.0; + projectionMatrix[8] = 0.0; + projectionMatrix[9] = 0.0; + projectionMatrix[10] = 2.0 * nearFar; + projectionMatrix[11] = 0.0; + projectionMatrix[12] = (left + right) * leftRight; + projectionMatrix[13] = (top + bottom) * bottomTop; + projectionMatrix[14] = (far + near) * nearFar; + projectionMatrix[15] = 1.0; + + this.projectionMatrixDirty = true; + return this; }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.TextureTintPipeline#batchGraphics - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchGraphics: function () + projPersp: function (fovy, aspectRatio, near, far) { - // Stub + var projectionMatrix = this.projectionMatrix; + var fov = 1.0 / Math.tan(fovy / 2.0); + var nearFar = 1.0 / (near - far); + + projectionMatrix[0] = fov / aspectRatio; + projectionMatrix[1] = 0.0; + projectionMatrix[2] = 0.0; + projectionMatrix[3] = 0.0; + projectionMatrix[4] = 0.0; + projectionMatrix[5] = fov; + projectionMatrix[6] = 0.0; + projectionMatrix[7] = 0.0; + projectionMatrix[8] = 0.0; + projectionMatrix[9] = 0.0; + projectionMatrix[10] = (far + near) * nearFar; + projectionMatrix[11] = -1.0; + projectionMatrix[12] = 0.0; + projectionMatrix[13] = 0.0; + projectionMatrix[14] = (2.0 * far * near) * nearFar; + projectionMatrix[15] = 0.0; + + this.projectionMatrixDirty = true; + return this; } +}; -}); - -module.exports = TextureTintPipeline; +module.exports = ModelViewProjection; /***/ }), -/* 239 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47838,13 +48542,13 @@ module.exports = TextureTintPipeline; var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var Gamepad = __webpack_require__(240); -var Keyboard = __webpack_require__(244); -var Mouse = __webpack_require__(247); -var Pointer = __webpack_require__(248); +var Gamepad = __webpack_require__(241); +var Keyboard = __webpack_require__(245); +var Mouse = __webpack_require__(248); +var Pointer = __webpack_require__(249); var Rectangle = __webpack_require__(8); -var Touch = __webpack_require__(249); -var TransformXY = __webpack_require__(250); +var Touch = __webpack_require__(250); +var TransformXY = __webpack_require__(251); /** * @classdesc @@ -48059,15 +48763,39 @@ var InputManager = new Class({ */ updateBounds: function () { - var clientRect = this.canvas.getBoundingClientRect(); var bounds = this.bounds; - bounds.left = clientRect.left + window.pageXOffset; - bounds.top = clientRect.top + window.pageYOffset; + var clientRect = this.canvas.getBoundingClientRect(); + + bounds.x = clientRect.left + window.pageXOffset - document.documentElement.clientLeft; + bounds.y = clientRect.top + window.pageYOffset - document.documentElement.clientTop; bounds.width = clientRect.width; bounds.height = clientRect.height; }, + /** + * [description] + * + * @method Phaser.Input.InputManager#resize + * @since 3.2.0 + */ + resize: function () + { + this.updateBounds(); + + // Game config size + var gw = this.game.config.width; + var gh = this.game.config.height; + + // Actual canvas size + var bw = this.bounds.width; + var bh = this.bounds.height; + + // Scale factor + this.scale.x = gw / bw; + this.scale.y = gh / bh; + }, + /** * [description] * @@ -48386,7 +49114,7 @@ module.exports = InputManager; /***/ }), -/* 240 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48396,7 +49124,7 @@ module.exports = InputManager; */ var Class = __webpack_require__(0); -var Gamepad = __webpack_require__(241); +var Gamepad = __webpack_require__(242); // https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API // https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API @@ -48779,7 +49507,7 @@ module.exports = GamepadManager; /***/ }), -/* 241 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48788,8 +49516,8 @@ module.exports = GamepadManager; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Axis = __webpack_require__(242); -var Button = __webpack_require__(243); +var Axis = __webpack_require__(243); +var Button = __webpack_require__(244); var Class = __webpack_require__(0); /** @@ -48938,7 +49666,7 @@ module.exports = Gamepad; /***/ }), -/* 242 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49046,7 +49774,7 @@ module.exports = Axis; /***/ }), -/* 243 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49166,7 +49894,7 @@ module.exports = Button; /***/ }), -/* 244 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49177,12 +49905,12 @@ module.exports = Button; var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var Key = __webpack_require__(245); +var Key = __webpack_require__(246); var KeyCodes = __webpack_require__(128); -var KeyCombo = __webpack_require__(246); -var KeyMap = __webpack_require__(526); -var ProcessKeyDown = __webpack_require__(527); -var ProcessKeyUp = __webpack_require__(528); +var KeyCombo = __webpack_require__(247); +var KeyMap = __webpack_require__(528); +var ProcessKeyDown = __webpack_require__(529); +var ProcessKeyUp = __webpack_require__(530); /** * @classdesc @@ -49533,13 +50261,13 @@ var KeyboardManager = new Class({ var event = queue[i]; var code = event.keyCode; - // Will emit a keyboard or keyup event - this.emit(event.type, event); - if (event.type === 'keydown') { - if (KeyMap[code]) + if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false)) { + // Will emit a keyboard or keyup event + this.emit(event.type, event); + this.emit('keydown_' + KeyMap[code], event); } @@ -49550,6 +50278,9 @@ var KeyboardManager = new Class({ } else { + // Will emit a keyboard or keyup event + this.emit(event.type, event); + this.emit('keyup_' + KeyMap[code], event); if (keys[code]) @@ -49598,7 +50329,7 @@ module.exports = KeyboardManager; /***/ }), -/* 245 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49796,7 +50527,7 @@ module.exports = Key; /***/ }), -/* 246 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49807,8 +50538,8 @@ module.exports = Key; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(523); -var ResetKeyCombo = __webpack_require__(525); +var ProcessKeyCombo = __webpack_require__(525); +var ResetKeyCombo = __webpack_require__(527); /** * @classdesc @@ -50066,7 +50797,7 @@ module.exports = KeyCombo; /***/ }), -/* 247 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -50076,7 +50807,7 @@ module.exports = KeyCombo; */ var Class = __webpack_require__(0); -var Features = __webpack_require__(124); +var Features = __webpack_require__(125); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md @@ -50372,7 +51103,7 @@ module.exports = MouseManager; /***/ }), -/* 248 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51011,7 +51742,7 @@ module.exports = Pointer; /***/ }), -/* 249 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51208,7 +51939,7 @@ module.exports = TouchManager; /***/ }), -/* 250 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51274,7 +52005,7 @@ module.exports = TransformXY; /***/ }), -/* 251 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51287,7 +52018,7 @@ var Class = __webpack_require__(0); var CONST = __webpack_require__(83); var GetValue = __webpack_require__(4); var NOOP = __webpack_require__(3); -var Scene = __webpack_require__(252); +var Scene = __webpack_require__(253); var Systems = __webpack_require__(129); /** @@ -51398,8 +52129,71 @@ var SceneManager = new Class({ } // Only need to wait for the boot event if we've scenes to actually boot - game.events.once('ready', this.processQueue, this); + game.events.once('ready', this.bootQueue, this); + } + }, + + /** + * Internal first-time Scene boot handler. + * + * @method Phaser.Scenes.SceneManager#bootQueue + * @private + * @since 3.2.0 + */ + bootQueue: function () + { + var i; + var entry; + var key; + var sceneConfig; + + for (i = 0; i < this._pending.length; i++) + { + entry = this._pending[i]; + + key = entry.key; + sceneConfig = entry.scene; + + var newScene; + + if (sceneConfig instanceof Scene) + { + newScene = this.createSceneFromInstance(key, sceneConfig); + } + else if (typeof sceneConfig === 'object') + { + newScene = this.createSceneFromObject(key, sceneConfig); + } + else if (typeof sceneConfig === 'function') + { + newScene = this.createSceneFromFunction(key, sceneConfig); + } + + // Replace key in case the scene changed it + key = newScene.sys.settings.key; + + this.keys[key] = newScene; + + this.scenes.push(newScene); + + if (entry.autoStart || newScene.sys.settings.active) + { + this._start.push(key); + } } + + // Clear the pending lists + this._pending.length = 0; + + // _start might have been populated by the above + for (i = 0; i < this._start.length; i++) + { + entry = this._start[i]; + + this.start(entry); + } + + this._start.length = 0; }, /** @@ -51445,13 +52239,13 @@ var SceneManager = new Class({ return; } - for (i = 0; i < queueLength; i++) + for (i = 0; i < this._queue.length; i++) { entry = this._queue[i]; this[entry.op](entry.keyA, entry.keyB); } - + this._queue.length = 0; }, @@ -51536,6 +52330,58 @@ var SceneManager = new Class({ return newScene; }, + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it wil + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.SceneManager#remove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} scene - The Scene to be removed. + * + * @return {Phaser.Scenes.SceneManager} This SceneManager. + */ + remove: function (key) + { + if (this._processing) + { + this._queue.push({ op: 'remove', keyA: key, keyB: null }); + } + else + { + var sceneToRemove = this.getScene(key); + + if (!sceneToRemove) + { + return this; + } + + var index = this.scenes.indexOf(sceneToRemove); + var sceneKey = sceneToRemove.sys.settings.key; + + if (index > -1) + { + this.keys[sceneKey] = undefined; + this.scenes.splice(index, 1); + + if (this._start.indexOf(sceneKey) > -1) + { + index = this._start.indexOf(sceneKey); + this._start.splice(index, 1); + } + + sceneToRemove.sys.destroy(); + } + } + + return this; + }, + /** * [description] * @@ -51557,7 +52403,7 @@ var SceneManager = new Class({ if (scene.sys.load) { loader = scene.sys.load; - + loader.reset(); } @@ -51644,6 +52490,26 @@ var SceneManager = new Class({ } }, + /** + * [description] + * + * @method Phaser.Scenes.SceneManager#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + */ + resize: function (width, height) + { + // Loop through the scenes in forward order + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; + + sys.resize(width, height); + } + }, + /** * [description] * @@ -51659,7 +52525,7 @@ var SceneManager = new Class({ { var sys = this.scenes[i].sys; - if (sys.settings.visible) + if (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) { sys.render(renderer); } @@ -52131,7 +52997,7 @@ var SceneManager = new Class({ return this; } } - + this.bootScene(scene); } @@ -52231,7 +53097,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#bringToTop * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -52263,7 +53129,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#sendToBack * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -52295,7 +53161,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#moveDown * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -52329,7 +53195,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#moveUp * @since 3.0.0 * - * @param {string|Phaser.Scene} scene - [description] + * @param {string|Phaser.Scene} key - [description] * * @return {Phaser.Scenes.SceneManager} [description] */ @@ -52357,6 +53223,92 @@ var SceneManager = new Class({ return this; }, + /** + * Moves a Scene so it is immediately above another Scene in the Scenes list. + * This means it will render over the top of the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveAbove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} keyA - The Scene that Scene B will be moved above. + * @param {string|Phaser.Scene} keyB - The Scene to be moved. + * + * @return {Phaser.Scenes.SceneManager} [description] + */ + moveAbove: function (keyA, keyB) + { + if (keyA === keyB) + { + return this; + } + + if (this._processing) + { + this._queue.push({ op: 'moveAbove', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); + + if (indexA > indexB && indexA !== -1 && indexB !== -1) + { + var tempScene = this.getAt(indexB); + + // Remove + this.scenes.splice(indexB, 1); + + // Add in new location + this.scenes.splice(indexA, 0, tempScene); + } + } + + return this; + }, + + /** + * Moves a Scene so it is immediately below another Scene in the Scenes list. + * This means it will render behind the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveBelow + * @since 3.2.0 + * + * @param {string|Phaser.Scene} keyA - The Scene that Scene B will be moved above. + * @param {string|Phaser.Scene} keyB - The Scene to be moved. + * + * @return {Phaser.Scenes.SceneManager} [description] + */ + moveBelow: function (keyA, keyB) + { + if (keyA === keyB) + { + return this; + } + + if (this._processing) + { + this._queue.push({ op: 'moveBelow', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); + + if (indexA < indexB && indexA !== -1 && indexB !== -1) + { + var tempScene = this.getAt(indexB); + + // Remove + this.scenes.splice(indexB, 1); + + // Add in new location + this.scenes.splice(indexA, 0, tempScene); + } + } + + return this; + }, + queueOp: function (op, keyA, keyB) { this._queue.push({ op: op, keyA: keyA, keyB: keyB }); @@ -52403,6 +53355,24 @@ var SceneManager = new Class({ return this; }, + dump: function () + { + var out = []; + var map = [ 'pending', 'init', 'start', 'loading', 'creating', 'running', 'paused', 'sleeping', 'shutdown', 'destroyed' ]; + + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; + + var key = (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) ? '[*] ' : '[-] '; + key += sys.settings.key + ' (' + map[sys.settings.status] + ')'; + + out.push(key); + } + + console.log(out.join('\n')); + }, + /** * [description] * @@ -52433,7 +53403,7 @@ module.exports = SceneManager; /***/ }), -/* 252 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52489,7 +53459,7 @@ module.exports = Scene; /***/ }), -/* 253 */ +/* 254 */ /***/ (function(module, exports) { /** @@ -52517,7 +53487,7 @@ module.exports = UppercaseFirst; /***/ }), -/* 254 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52528,7 +53498,7 @@ module.exports = UppercaseFirst; var CONST = __webpack_require__(83); var GetValue = __webpack_require__(4); -var InjectionMap = __webpack_require__(531); +var InjectionMap = __webpack_require__(533); /** * Takes a Scene configuration object and returns a fully formed Systems object. @@ -52599,7 +53569,7 @@ module.exports = Settings; /***/ }), -/* 255 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52608,9 +53578,9 @@ module.exports = Settings; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(256); -var NoAudioSoundManager = __webpack_require__(258); -var WebAudioSoundManager = __webpack_require__(260); +var HTML5AudioSoundManager = __webpack_require__(257); +var NoAudioSoundManager = __webpack_require__(259); +var WebAudioSoundManager = __webpack_require__(261); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -52647,7 +53617,7 @@ module.exports = SoundManagerCreator; /***/ }), -/* 256 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52655,9 +53625,10 @@ module.exports = SoundManagerCreator; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); + var BaseSoundManager = __webpack_require__(84); -var HTML5AudioSound = __webpack_require__(257); +var Class = __webpack_require__(0); +var HTML5AudioSound = __webpack_require__(258); /** * HTML5 Audio implementation of the sound manager. @@ -52672,8 +53643,12 @@ var HTML5AudioSound = __webpack_require__(257); * @param {Phaser.Game} game - Reference to the current game instance. */ var HTML5AudioSoundManager = new Class({ + Extends: BaseSoundManager, - initialize: function HTML5AudioSoundManager (game) + + initialize: + + function HTML5AudioSoundManager (game) { /** * Flag indicating whether if there are no idle instances of HTML5 Audio tag, @@ -52729,6 +53704,7 @@ var HTML5AudioSoundManager = new Class({ * @since 3.0.0 */ this.onBlurPausedSounds = []; + this.locked = 'ontouchstart' in window; /** @@ -52767,6 +53743,7 @@ var HTML5AudioSoundManager = new Class({ * @since 3.0.0 */ this._volume = 1; + BaseSoundManager.call(this, game); }, @@ -52784,7 +53761,9 @@ var HTML5AudioSoundManager = new Class({ add: function (key, config) { var sound = new HTML5AudioSound(this, key, config); + this.sounds.push(sound); + return sound; }, @@ -52799,21 +53778,32 @@ var HTML5AudioSoundManager = new Class({ unlock: function () { var _this = this; + var moved = false; + var detectMove = function () { moved = true; }; + var unlock = function () { + if (!_this.game.cache.audio.entries.size) + { + return; + } + if (moved) { moved = false; return; } + document.body.removeEventListener('touchmove', detectMove); document.body.removeEventListener('touchend', unlock); + var allTags = []; + _this.game.cache.audio.entries.each(function (key, tags) { for (var i = 0; i < tags.length; i++) @@ -52822,25 +53812,30 @@ var HTML5AudioSoundManager = new Class({ } return true; }); + var lastTag = allTags[allTags.length - 1]; + lastTag.oncanplaythrough = function () { lastTag.oncanplaythrough = null; _this.unlocked = true; }; + allTags.forEach(function (tag) { tag.load(); }); }; + this.once('unlocked', function () { - _this.forEachActiveSound(function (sound) + this.forEachActiveSound(function (sound) { sound.duration = sound.tags[0].duration; sound.totalDuration = sound.tags[0].duration; }); - _this.lockedActionsQueue.forEach(function (lockedAction) + + this.lockedActionsQueue.forEach(function (lockedAction) { if (lockedAction.sound[lockedAction.prop].apply) { @@ -52851,9 +53846,11 @@ var HTML5AudioSoundManager = new Class({ lockedAction.sound[lockedAction.prop] = lockedAction.value; } }); - _this.lockedActionsQueue.length = 0; - _this.lockedActionsQueue = null; - }); + + this.lockedActionsQueue.length = 0; + this.lockedActionsQueue = null; + }, this); + document.body.addEventListener('touchmove', detectMove, false); document.body.addEventListener('touchend', unlock, false); }, @@ -52892,6 +53889,7 @@ var HTML5AudioSoundManager = new Class({ { sound.onFocus(); }); + this.onBlurPausedSounds.length = 0; }, @@ -52905,6 +53903,7 @@ var HTML5AudioSoundManager = new Class({ destroy: function () { BaseSoundManager.prototype.destroy.call(this); + this.onBlurPausedSounds.length = 0; this.onBlurPausedSounds = null; }, @@ -52933,58 +53932,86 @@ var HTML5AudioSoundManager = new Class({ prop: prop, value: value }); + return true; } + return false; - } -}); -Object.defineProperty(HTML5AudioSoundManager.prototype, 'mute', { - get: function () - { - return this._mute; }, - set: function (value) - { - this._mute = value; - this.forEachActiveSound(function (sound) + + /** + * @event Phaser.Sound.HTML5AudioSoundManager#MuteEvent + * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#mute property. + */ + + /** + * @name Phaser.Sound.HTML5AudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.HTML5AudioSoundManager#MuteEvent + * @since 3.0.0 + */ + mute: { + + get: function () { - sound.setMute(); - }); + return this._mute; + }, + + set: function (value) + { + this._mute = value; + + this.forEachActiveSound(function (sound) + { + sound.setMute(); + }); + + this.emit('mute', this, value); + } - /** - * @event Phaser.Sound.HTML5AudioSoundManager#mute - * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#mute property. - */ - this.emit('mute', this, value); - } -}); -Object.defineProperty(HTML5AudioSoundManager.prototype, 'volume', { - get: function () - { - return this._volume; }, - set: function (value) - { - this._volume = value; - this.forEachActiveSound(function (sound) + + /** + * @event Phaser.Sound.HTML5AudioSoundManager#VolumeEvent + * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#volume property. + */ + + /** + * @name Phaser.Sound.HTML5AudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.HTML5AudioSoundManager#VolumeEvent + * @since 3.0.0 + */ + volume: { + + get: function () { - sound.setVolume(); - }); + return this._volume; + }, + + set: function (value) + { + this._volume = value; + + this.forEachActiveSound(function (sound) + { + sound.setVolume(); + }); + + this.emit('volume', this, value); + } - /** - * @event Phaser.Sound.HTML5AudioSoundManager#volume - * @param {Phaser.Sound.HTML5AudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.HTML5AudioSoundManager#volume property. - */ - this.emit('volume', this, value); } + }); + module.exports = HTML5AudioSoundManager; /***/ }), -/* 257 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53330,7 +54357,10 @@ var HTML5AudioSound = new Class({ if (playPromise) { // eslint-disable-next-line no-unused-vars - playPromise.catch(function (reason) { }); + playPromise.catch(function (reason) + { + console.warn(reason); + }); } }, @@ -53682,7 +54712,7 @@ module.exports = HTML5AudioSound; /***/ }), -/* 258 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53693,7 +54723,7 @@ module.exports = HTML5AudioSound; var BaseSoundManager = __webpack_require__(84); var Class = __webpack_require__(0); var EventEmitter = __webpack_require__(14); -var NoAudioSound = __webpack_require__(259); +var NoAudioSound = __webpack_require__(260); var NOOP = __webpack_require__(3); /** @@ -53775,7 +54805,7 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 259 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53883,7 +54913,7 @@ module.exports = NoAudioSound; /***/ }), -/* 260 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53891,9 +54921,10 @@ module.exports = NoAudioSound; * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); + var BaseSoundManager = __webpack_require__(84); -var WebAudioSound = __webpack_require__(261); +var Class = __webpack_require__(0); +var WebAudioSound = __webpack_require__(262); /** * @classdesc @@ -53909,8 +54940,12 @@ var WebAudioSound = __webpack_require__(261); * @param {Phaser.Game} game - Reference to the current game instance. */ var WebAudioSoundManager = new Class({ + Extends: BaseSoundManager, - initialize: function WebAudioSoundManager (game) + + initialize: + + function WebAudioSoundManager (game) { /** * The AudioContext being used for playback. @@ -53941,7 +54976,9 @@ var WebAudioSoundManager = new Class({ * @since 3.0.0 */ this.masterVolumeNode = this.context.createGain(); + this.masterMuteNode.connect(this.masterVolumeNode); + this.masterVolumeNode.connect(this.context.destination); /** @@ -53953,7 +54990,9 @@ var WebAudioSoundManager = new Class({ * @since 3.0.0 */ this.destination = this.masterMuteNode; + this.locked = this.context.state === 'suspended' && 'ontouchstart' in window; + BaseSoundManager.call(this, game); }, @@ -53975,11 +55014,13 @@ var WebAudioSoundManager = new Class({ createAudioContext: function (game) { var audioConfig = game.config.audio; + if (audioConfig && audioConfig.context) { audioConfig.context.resume(); return audioConfig.context; } + return new AudioContext(); }, @@ -53996,8 +55037,11 @@ var WebAudioSoundManager = new Class({ */ add: function (key, config) { + var sound = new WebAudioSound(this, key, config); + this.sounds.push(sound); + return sound; }, @@ -54013,6 +55057,7 @@ var WebAudioSoundManager = new Class({ unlock: function () { var _this = this; + var unlock = function () { _this.context.resume().then(function () @@ -54022,6 +55067,7 @@ var WebAudioSoundManager = new Class({ _this.unlocked = true; }); }; + document.body.addEventListener('touchstart', unlock, false); document.body.addEventListener('touchend', unlock, false); }, @@ -54066,6 +55112,7 @@ var WebAudioSoundManager = new Class({ this.masterVolumeNode = null; this.masterMuteNode.disconnect(); this.masterMuteNode = null; + if (this.game.config.audio && this.game.config.audio.context) { this.context.suspend(); @@ -54074,49 +55121,75 @@ var WebAudioSoundManager = new Class({ { this.context.close(); } + this.context = null; + BaseSoundManager.prototype.destroy.call(this); - } -}); -Object.defineProperty(WebAudioSoundManager.prototype, 'mute', { - get: function () - { - return this.masterMuteNode.gain.value === 0; }, - set: function (value) - { - this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - /** - * @event Phaser.Sound.WebAudioSoundManager#mute - * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSoundManager#mute property. - */ - this.emit('mute', this, value); - } -}); -Object.defineProperty(WebAudioSoundManager.prototype, 'volume', { - get: function () - { - return this.masterVolumeNode.gain.value; + /** + * @event Phaser.Sound.WebAudioSoundManager#MuteEvent + * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {boolean} value - An updated value of Phaser.Sound.WebAudioSoundManager#mute property. + */ + + /** + * @name Phaser.Sound.WebAudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.WebAudioSoundManager#MuteEvent + * @since 3.0.0 + */ + mute: { + + get: function () + { + return (this.masterMuteNode.gain.value === 0); + }, + + set: function (value) + { + this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); + + this.emit('mute', this, value); + } + }, - set: function (value) - { - this.masterVolumeNode.gain.setValueAtTime(value, 0); - /** - * @event Phaser.Sound.WebAudioSoundManager#volume - * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. - * @param {number} value - An updated value of Phaser.Sound.WebAudioSoundManager#volume property. - */ - this.emit('volume', this, value); + /** + * @event Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @param {Phaser.Sound.WebAudioSoundManager} soundManager - Reference to the sound manager that emitted event. + * @param {number} value - An updated value of Phaser.Sound.WebAudioSoundManager#volume property. + */ + + /** + * @name Phaser.Sound.WebAudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.WebAudioSoundManager#VolumeEvent + * @since 3.0.0 + */ + volume: { + + get: function () + { + return this.masterVolumeNode.gain.value; + }, + + set: function (value) + { + this.masterVolumeNode.gain.setValueAtTime(value, 0); + + this.emit('volume', this, value); + } + } + }); + module.exports = WebAudioSoundManager; /***/ }), -/* 261 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54786,7 +55859,7 @@ module.exports = WebAudioSound; /***/ }), -/* 262 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54795,14 +55868,14 @@ module.exports = WebAudioSound; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); var Class = __webpack_require__(0); var Color = __webpack_require__(36); var EventEmitter = __webpack_require__(14); -var GenerateTexture = __webpack_require__(213); +var GenerateTexture = __webpack_require__(214); var GetValue = __webpack_require__(4); -var Parser = __webpack_require__(263); -var Texture = __webpack_require__(264); +var Parser = __webpack_require__(264); +var Texture = __webpack_require__(265); /** * @classdesc @@ -55105,9 +56178,11 @@ var TextureManager = new Class({ if (Array.isArray(data)) { - for (var i = 0; i < data.length; i++) + var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images + for (var i = 0; i < texture.source.length; i++) { - Parser.JSONArray(texture, i, data[i]); + var atlasData = singleAtlasFile ? data[0] : data[i]; + Parser.JSONArray(texture, i, atlasData); } } else @@ -55572,7 +56647,7 @@ module.exports = TextureManager; /***/ }), -/* 263 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55587,21 +56662,21 @@ module.exports = TextureManager; module.exports = { - Canvas: __webpack_require__(532), - Image: __webpack_require__(533), - JSONArray: __webpack_require__(534), - JSONHash: __webpack_require__(535), - Pyxel: __webpack_require__(536), - SpriteSheet: __webpack_require__(537), - SpriteSheetFromAtlas: __webpack_require__(538), - StarlingXML: __webpack_require__(539), - UnityYAML: __webpack_require__(540) + Canvas: __webpack_require__(534), + Image: __webpack_require__(535), + JSONArray: __webpack_require__(536), + JSONHash: __webpack_require__(537), + Pyxel: __webpack_require__(538), + SpriteSheet: __webpack_require__(539), + SpriteSheetFromAtlas: __webpack_require__(540), + StarlingXML: __webpack_require__(541), + UnityYAML: __webpack_require__(542) }; /***/ }), -/* 264 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55612,7 +56687,7 @@ module.exports = { var Class = __webpack_require__(0); var Frame = __webpack_require__(130); -var TextureSource = __webpack_require__(265); +var TextureSource = __webpack_require__(266); /** * @classdesc @@ -55799,9 +56874,10 @@ var Texture = new Class({ */ get: function (name) { - if (name === undefined || name === null || (typeof name !== 'string' && typeof name !== 'number')) + // null, undefined, empty string, zero + if (!name) { - name = (this.frameTotal === 1) ? '__BASE' : this.firstFrame; + name = this.firstFrame; } var frame = this.frames[name]; @@ -55809,13 +56885,11 @@ var Texture = new Class({ if (!frame) { console.warn('No Texture.frame found with name ' + name); - - return this.frames['__BASE']; - } - else - { - return frame; + + frame = this.frames[this.firstFrame]; } + + return frame; }, /** @@ -56034,7 +57108,7 @@ module.exports = Texture; /***/ }), -/* 265 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56045,8 +57119,8 @@ module.exports = Texture; var Class = __webpack_require__(0); var CONST = __webpack_require__(22); -var IsSizePowerOfTwo = __webpack_require__(125); -var ScaleModes = __webpack_require__(62); +var IsSizePowerOfTwo = __webpack_require__(126); +var ScaleModes = __webpack_require__(63); /** * @classdesc @@ -56234,7 +57308,7 @@ module.exports = TextureSource; /***/ }), -/* 266 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56356,7 +57430,7 @@ else { })(); /***/ }), -/* 267 */ +/* 268 */ /***/ (function(module, exports) { /** @@ -56495,7 +57569,7 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 268 */ +/* 269 */ /***/ (function(module, exports) { /** @@ -56610,7 +57684,7 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 269 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56621,27 +57695,27 @@ module.exports = ParseXMLBitmapFont; var Ellipse = __webpack_require__(135); -Ellipse.Area = __webpack_require__(558); -Ellipse.Circumference = __webpack_require__(272); +Ellipse.Area = __webpack_require__(560); +Ellipse.Circumference = __webpack_require__(273); Ellipse.CircumferencePoint = __webpack_require__(136); -Ellipse.Clone = __webpack_require__(559); +Ellipse.Clone = __webpack_require__(561); Ellipse.Contains = __webpack_require__(68); -Ellipse.ContainsPoint = __webpack_require__(560); -Ellipse.ContainsRect = __webpack_require__(561); -Ellipse.CopyFrom = __webpack_require__(562); -Ellipse.Equals = __webpack_require__(563); -Ellipse.GetBounds = __webpack_require__(564); -Ellipse.GetPoint = __webpack_require__(270); -Ellipse.GetPoints = __webpack_require__(271); -Ellipse.Offset = __webpack_require__(565); -Ellipse.OffsetPoint = __webpack_require__(566); -Ellipse.Random = __webpack_require__(109); +Ellipse.ContainsPoint = __webpack_require__(562); +Ellipse.ContainsRect = __webpack_require__(563); +Ellipse.CopyFrom = __webpack_require__(564); +Ellipse.Equals = __webpack_require__(565); +Ellipse.GetBounds = __webpack_require__(566); +Ellipse.GetPoint = __webpack_require__(271); +Ellipse.GetPoints = __webpack_require__(272); +Ellipse.Offset = __webpack_require__(567); +Ellipse.OffsetPoint = __webpack_require__(568); +Ellipse.Random = __webpack_require__(110); module.exports = Ellipse; /***/ }), -/* 270 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56651,7 +57725,7 @@ module.exports = Ellipse; */ var CircumferencePoint = __webpack_require__(136); -var FromPercent = __webpack_require__(64); +var FromPercent = __webpack_require__(65); var MATH_CONST = __webpack_require__(16); var Point = __webpack_require__(5); @@ -56682,7 +57756,7 @@ module.exports = GetPoint; /***/ }), -/* 271 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56691,9 +57765,9 @@ module.exports = GetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circumference = __webpack_require__(272); +var Circumference = __webpack_require__(273); var CircumferencePoint = __webpack_require__(136); -var FromPercent = __webpack_require__(64); +var FromPercent = __webpack_require__(65); var MATH_CONST = __webpack_require__(16); /** @@ -56734,7 +57808,7 @@ module.exports = GetPoints; /***/ }), -/* 272 */ +/* 273 */ /***/ (function(module, exports) { /** @@ -56766,7 +57840,7 @@ module.exports = Circumference; /***/ }), -/* 273 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57032,7 +58106,7 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 274 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57172,7 +58246,7 @@ module.exports = Range; /***/ }), -/* 275 */ +/* 276 */ /***/ (function(module, exports) { /** @@ -57201,7 +58275,7 @@ module.exports = FloatBetween; /***/ }), -/* 276 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57214,15 +58288,15 @@ module.exports = FloatBetween; module.exports = { - In: __webpack_require__(578), - Out: __webpack_require__(579), - InOut: __webpack_require__(580) + In: __webpack_require__(580), + Out: __webpack_require__(581), + InOut: __webpack_require__(582) }; /***/ }), -/* 277 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57235,15 +58309,15 @@ module.exports = { module.exports = { - In: __webpack_require__(581), - Out: __webpack_require__(582), - InOut: __webpack_require__(583) + In: __webpack_require__(583), + Out: __webpack_require__(584), + InOut: __webpack_require__(585) }; /***/ }), -/* 278 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57256,15 +58330,15 @@ module.exports = { module.exports = { - In: __webpack_require__(584), - Out: __webpack_require__(585), - InOut: __webpack_require__(586) + In: __webpack_require__(586), + Out: __webpack_require__(587), + InOut: __webpack_require__(588) }; /***/ }), -/* 279 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57277,15 +58351,15 @@ module.exports = { module.exports = { - In: __webpack_require__(587), - Out: __webpack_require__(588), - InOut: __webpack_require__(589) + In: __webpack_require__(589), + Out: __webpack_require__(590), + InOut: __webpack_require__(591) }; /***/ }), -/* 280 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57298,15 +58372,15 @@ module.exports = { module.exports = { - In: __webpack_require__(590), - Out: __webpack_require__(591), - InOut: __webpack_require__(592) + In: __webpack_require__(592), + Out: __webpack_require__(593), + InOut: __webpack_require__(594) }; /***/ }), -/* 281 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57319,15 +58393,15 @@ module.exports = { module.exports = { - In: __webpack_require__(593), - Out: __webpack_require__(594), - InOut: __webpack_require__(595) + In: __webpack_require__(595), + Out: __webpack_require__(596), + InOut: __webpack_require__(597) }; /***/ }), -/* 282 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57338,11 +58412,11 @@ module.exports = { // Phaser.Math.Easing.Linear -module.exports = __webpack_require__(596); +module.exports = __webpack_require__(598); /***/ }), -/* 283 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57355,15 +58429,15 @@ module.exports = __webpack_require__(596); module.exports = { - In: __webpack_require__(597), - Out: __webpack_require__(598), - InOut: __webpack_require__(599) + In: __webpack_require__(599), + Out: __webpack_require__(600), + InOut: __webpack_require__(601) }; /***/ }), -/* 284 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57376,15 +58450,15 @@ module.exports = { module.exports = { - In: __webpack_require__(600), - Out: __webpack_require__(601), - InOut: __webpack_require__(602) + In: __webpack_require__(602), + Out: __webpack_require__(603), + InOut: __webpack_require__(604) }; /***/ }), -/* 285 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57397,15 +58471,15 @@ module.exports = { module.exports = { - In: __webpack_require__(603), - Out: __webpack_require__(604), - InOut: __webpack_require__(605) + In: __webpack_require__(605), + Out: __webpack_require__(606), + InOut: __webpack_require__(607) }; /***/ }), -/* 286 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57418,15 +58492,15 @@ module.exports = { module.exports = { - In: __webpack_require__(606), - Out: __webpack_require__(607), - InOut: __webpack_require__(608) + In: __webpack_require__(608), + Out: __webpack_require__(609), + InOut: __webpack_require__(610) }; /***/ }), -/* 287 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57437,11 +58511,11 @@ module.exports = { // Phaser.Math.Easing.Stepped -module.exports = __webpack_require__(609); +module.exports = __webpack_require__(611); /***/ }), -/* 288 */ +/* 289 */ /***/ (function(module, exports) { /** @@ -57478,7 +58552,7 @@ module.exports = HasAny; /***/ }), -/* 289 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57900,7 +58974,7 @@ module.exports = PathFollower; /***/ }), -/* 290 */ +/* 291 */ /***/ (function(module, exports) { /** @@ -57931,7 +59005,96 @@ module.exports = GetPowerOfTwo; /***/ }), -/* 291 */ +/* 292 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetAdvancedValue = __webpack_require__(10); + +/** + * Adds an Animation component to a Sprite and populates it based on the given config. + * + * @function Phaser.Gameobjects.BuildGameObjectAnimation + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.Sprite} The updated Sprite. + */ +var BuildGameObjectAnimation = function (sprite, config) +{ + var animConfig = GetAdvancedValue(config, 'anims', null); + + if (animConfig === null) + { + return sprite; + } + + if (typeof animConfig === 'string') + { + // { anims: 'key' } + sprite.anims.play(animConfig); + } + else if (typeof animConfig === 'object') + { + // { anims: { + // key: string + // startFrame: [string|integer] + // delay: [float] + // repeat: [integer] + // repeatDelay: [float] + // yoyo: [boolean] + // play: [boolean] + // delayedPlay: [boolean] + // } + // } + + var anims = sprite.anims; + + var key = GetAdvancedValue(animConfig, 'key', undefined); + var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); + + var delay = GetAdvancedValue(animConfig, 'delay', 0); + var repeat = GetAdvancedValue(animConfig, 'repeat', 0); + var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); + var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); + + var play = GetAdvancedValue(animConfig, 'play', false); + var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); + + anims.delay(delay); + anims.repeat(repeat); + anims.repeatDelay(repeatDelay); + anims.yoyo(yoyo); + + if (play) + { + anims.play(key, startFrame); + } + else if (delayedPlay > 0) + { + anims.delayedPlay(delayedPlay, key, startFrame); + } + else + { + anims.load(key); + } + } + + return sprite; +}; + +module.exports = BuildGameObjectAnimation; + + +/***/ }), +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57941,7 +59104,7 @@ module.exports = GetPowerOfTwo; */ var Class = __webpack_require__(0); -var Utils = __webpack_require__(42); +var Utils = __webpack_require__(41); /** * @classdesc @@ -58185,7 +59348,7 @@ module.exports = Light; /***/ }), -/* 292 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58195,9 +59358,9 @@ module.exports = Light; */ var Class = __webpack_require__(0); -var Light = __webpack_require__(291); -var LightPipeline = __webpack_require__(237); -var Utils = __webpack_require__(42); +var Light = __webpack_require__(293); +var LightPipeline = __webpack_require__(163); +var Utils = __webpack_require__(41); /** * @classdesc @@ -58515,7 +59678,7 @@ module.exports = LightsManager; /***/ }), -/* 293 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58530,20 +59693,20 @@ module.exports = LightsManager; module.exports = { - Circle: __webpack_require__(663), - Ellipse: __webpack_require__(269), - Intersects: __webpack_require__(294), - Line: __webpack_require__(683), - Point: __webpack_require__(701), - Polygon: __webpack_require__(715), - Rectangle: __webpack_require__(306), - Triangle: __webpack_require__(744) + Circle: __webpack_require__(666), + Ellipse: __webpack_require__(270), + Intersects: __webpack_require__(296), + Line: __webpack_require__(686), + Point: __webpack_require__(704), + Polygon: __webpack_require__(718), + Rectangle: __webpack_require__(308), + Triangle: __webpack_require__(747) }; /***/ }), -/* 294 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58558,26 +59721,26 @@ module.exports = { module.exports = { - CircleToCircle: __webpack_require__(673), - CircleToRectangle: __webpack_require__(674), - GetRectangleIntersection: __webpack_require__(675), - LineToCircle: __webpack_require__(296), + CircleToCircle: __webpack_require__(676), + CircleToRectangle: __webpack_require__(677), + GetRectangleIntersection: __webpack_require__(678), + LineToCircle: __webpack_require__(298), LineToLine: __webpack_require__(89), - LineToRectangle: __webpack_require__(676), - PointToLine: __webpack_require__(297), - PointToLineSegment: __webpack_require__(677), - RectangleToRectangle: __webpack_require__(295), - RectangleToTriangle: __webpack_require__(678), - RectangleToValues: __webpack_require__(679), - TriangleToCircle: __webpack_require__(680), - TriangleToLine: __webpack_require__(681), - TriangleToTriangle: __webpack_require__(682) + LineToRectangle: __webpack_require__(679), + PointToLine: __webpack_require__(299), + PointToLineSegment: __webpack_require__(680), + RectangleToRectangle: __webpack_require__(297), + RectangleToTriangle: __webpack_require__(681), + RectangleToValues: __webpack_require__(682), + TriangleToCircle: __webpack_require__(683), + TriangleToLine: __webpack_require__(684), + TriangleToTriangle: __webpack_require__(685) }; /***/ }), -/* 295 */ +/* 297 */ /***/ (function(module, exports) { /** @@ -58611,7 +59774,7 @@ module.exports = RectangleToRectangle; /***/ }), -/* 296 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58696,7 +59859,7 @@ module.exports = LineToCircle; /***/ }), -/* 297 */ +/* 299 */ /***/ (function(module, exports) { /** @@ -58725,7 +59888,7 @@ module.exports = PointToLine; /***/ }), -/* 298 */ +/* 300 */ /***/ (function(module, exports) { /** @@ -58761,7 +59924,7 @@ module.exports = Decompose; /***/ }), -/* 299 */ +/* 301 */ /***/ (function(module, exports) { /** @@ -58796,7 +59959,7 @@ module.exports = Decompose; /***/ }), -/* 300 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58806,9 +59969,9 @@ module.exports = Decompose; */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(301); -var GetPoints = __webpack_require__(108); -var Random = __webpack_require__(110); +var GetPoint = __webpack_require__(303); +var GetPoints = __webpack_require__(109); +var Random = __webpack_require__(111); /** * @classdesc @@ -59093,7 +60256,7 @@ module.exports = Line; /***/ }), -/* 301 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59133,7 +60296,7 @@ module.exports = GetPoint; /***/ }), -/* 302 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59144,7 +60307,7 @@ module.exports = GetPoint; var MATH_CONST = __webpack_require__(16); var Wrap = __webpack_require__(50); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -59167,7 +60330,7 @@ module.exports = NormalAngle; /***/ }), -/* 303 */ +/* 305 */ /***/ (function(module, exports) { /** @@ -59195,7 +60358,7 @@ module.exports = GetMagnitude; /***/ }), -/* 304 */ +/* 306 */ /***/ (function(module, exports) { /** @@ -59223,7 +60386,7 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 305 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59233,7 +60396,7 @@ module.exports = GetMagnitudeSq; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(146); +var Contains = __webpack_require__(145); /** * @classdesc @@ -59408,7 +60571,7 @@ module.exports = Polygon; /***/ }), -/* 306 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59419,46 +60582,46 @@ module.exports = Polygon; var Rectangle = __webpack_require__(8); -Rectangle.Area = __webpack_require__(720); -Rectangle.Ceil = __webpack_require__(721); -Rectangle.CeilAll = __webpack_require__(722); -Rectangle.CenterOn = __webpack_require__(307); -Rectangle.Clone = __webpack_require__(723); +Rectangle.Area = __webpack_require__(723); +Rectangle.Ceil = __webpack_require__(724); +Rectangle.CeilAll = __webpack_require__(725); +Rectangle.CenterOn = __webpack_require__(309); +Rectangle.Clone = __webpack_require__(726); Rectangle.Contains = __webpack_require__(33); -Rectangle.ContainsPoint = __webpack_require__(724); -Rectangle.ContainsRect = __webpack_require__(725); -Rectangle.CopyFrom = __webpack_require__(726); -Rectangle.Decompose = __webpack_require__(298); -Rectangle.Equals = __webpack_require__(727); -Rectangle.FitInside = __webpack_require__(728); -Rectangle.FitOutside = __webpack_require__(729); -Rectangle.Floor = __webpack_require__(730); -Rectangle.FloorAll = __webpack_require__(731); -Rectangle.FromPoints = __webpack_require__(121); -Rectangle.GetAspectRatio = __webpack_require__(147); -Rectangle.GetCenter = __webpack_require__(732); -Rectangle.GetPoint = __webpack_require__(106); -Rectangle.GetPoints = __webpack_require__(184); -Rectangle.GetSize = __webpack_require__(733); -Rectangle.Inflate = __webpack_require__(734); -Rectangle.MarchingAnts = __webpack_require__(188); -Rectangle.MergePoints = __webpack_require__(735); -Rectangle.MergeRect = __webpack_require__(736); -Rectangle.MergeXY = __webpack_require__(737); -Rectangle.Offset = __webpack_require__(738); -Rectangle.OffsetPoint = __webpack_require__(739); -Rectangle.Overlaps = __webpack_require__(740); +Rectangle.ContainsPoint = __webpack_require__(727); +Rectangle.ContainsRect = __webpack_require__(728); +Rectangle.CopyFrom = __webpack_require__(729); +Rectangle.Decompose = __webpack_require__(300); +Rectangle.Equals = __webpack_require__(730); +Rectangle.FitInside = __webpack_require__(731); +Rectangle.FitOutside = __webpack_require__(732); +Rectangle.Floor = __webpack_require__(733); +Rectangle.FloorAll = __webpack_require__(734); +Rectangle.FromPoints = __webpack_require__(122); +Rectangle.GetAspectRatio = __webpack_require__(146); +Rectangle.GetCenter = __webpack_require__(735); +Rectangle.GetPoint = __webpack_require__(107); +Rectangle.GetPoints = __webpack_require__(185); +Rectangle.GetSize = __webpack_require__(736); +Rectangle.Inflate = __webpack_require__(737); +Rectangle.MarchingAnts = __webpack_require__(189); +Rectangle.MergePoints = __webpack_require__(738); +Rectangle.MergeRect = __webpack_require__(739); +Rectangle.MergeXY = __webpack_require__(740); +Rectangle.Offset = __webpack_require__(741); +Rectangle.OffsetPoint = __webpack_require__(742); +Rectangle.Overlaps = __webpack_require__(743); Rectangle.Perimeter = __webpack_require__(78); -Rectangle.PerimeterPoint = __webpack_require__(741); -Rectangle.Random = __webpack_require__(107); -Rectangle.Scale = __webpack_require__(742); -Rectangle.Union = __webpack_require__(743); +Rectangle.PerimeterPoint = __webpack_require__(744); +Rectangle.Random = __webpack_require__(108); +Rectangle.Scale = __webpack_require__(745); +Rectangle.Union = __webpack_require__(746); module.exports = Rectangle; /***/ }), -/* 307 */ +/* 309 */ /***/ (function(module, exports) { /** @@ -59493,7 +60656,7 @@ module.exports = CenterOn; /***/ }), -/* 308 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59503,7 +60666,7 @@ module.exports = CenterOn; */ var Point = __webpack_require__(5); -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); // Position is a value between 0 and 1 /** @@ -59579,7 +60742,7 @@ module.exports = GetPoint; /***/ }), -/* 309 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59588,7 +60751,7 @@ module.exports = GetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); var Point = __webpack_require__(5); /** @@ -59670,7 +60833,7 @@ module.exports = GetPoints; /***/ }), -/* 310 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59710,7 +60873,7 @@ module.exports = Centroid; /***/ }), -/* 311 */ +/* 313 */ /***/ (function(module, exports) { /** @@ -59749,7 +60912,7 @@ module.exports = Offset; /***/ }), -/* 312 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59812,7 +60975,7 @@ module.exports = InCenter; /***/ }), -/* 313 */ +/* 315 */ /***/ (function(module, exports) { /** @@ -59861,7 +61024,7 @@ module.exports = InteractiveObject; /***/ }), -/* 314 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59870,7 +61033,7 @@ module.exports = InteractiveObject; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MergeXHRSettings = __webpack_require__(150); +var MergeXHRSettings = __webpack_require__(149); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -59924,7 +61087,7 @@ module.exports = XHRLoader; /***/ }), -/* 315 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59938,7 +61101,7 @@ var CONST = __webpack_require__(22); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(316); +var HTML5AudioFile = __webpack_require__(318); /** * @classdesc @@ -60164,7 +61327,7 @@ module.exports = AudioFile; /***/ }), -/* 316 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60176,7 +61339,7 @@ module.exports = AudioFile; var Class = __webpack_require__(0); var File = __webpack_require__(18); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(149); +var GetURL = __webpack_require__(148); /** * @classdesc @@ -60312,7 +61475,7 @@ module.exports = HTML5AudioFile; /***/ }), -/* 317 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60326,7 +61489,7 @@ var CONST = __webpack_require__(17); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ParseXML = __webpack_require__(230); +var ParseXML = __webpack_require__(233); /** * @classdesc @@ -60424,7 +61587,7 @@ module.exports = XMLFile; /***/ }), -/* 318 */ +/* 320 */ /***/ (function(module, exports) { /** @@ -60488,7 +61651,7 @@ module.exports = NumberArray; /***/ }), -/* 319 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60591,7 +61754,7 @@ module.exports = TextFile; /***/ }), -/* 320 */ +/* 322 */ /***/ (function(module, exports) { /** @@ -60628,7 +61791,7 @@ module.exports = Normalize; /***/ }), -/* 321 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60637,7 +61800,7 @@ module.exports = Normalize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Factorial = __webpack_require__(322); +var Factorial = __webpack_require__(324); /** * [description] @@ -60659,7 +61822,7 @@ module.exports = Bernstein; /***/ }), -/* 322 */ +/* 324 */ /***/ (function(module, exports) { /** @@ -60699,7 +61862,7 @@ module.exports = Factorial; /***/ }), -/* 323 */ +/* 325 */ /***/ (function(module, exports) { /** @@ -60734,7 +61897,7 @@ module.exports = Rotate; /***/ }), -/* 324 */ +/* 326 */ /***/ (function(module, exports) { /** @@ -60763,7 +61926,7 @@ module.exports = RoundAwayFromZero; /***/ }), -/* 325 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60772,12 +61935,12 @@ module.exports = RoundAwayFromZero; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArcadeImage = __webpack_require__(326); +var ArcadeImage = __webpack_require__(328); var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); -var PhysicsGroup = __webpack_require__(328); -var StaticPhysicsGroup = __webpack_require__(329); +var CONST = __webpack_require__(59); +var PhysicsGroup = __webpack_require__(330); +var StaticPhysicsGroup = __webpack_require__(331); /** * @classdesc @@ -61021,7 +62184,7 @@ module.exports = Factory; /***/ }), -/* 326 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61031,7 +62194,7 @@ module.exports = Factory; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(327); +var Components = __webpack_require__(329); var Image = __webpack_require__(70); /** @@ -61114,7 +62277,7 @@ module.exports = ArcadeImage; /***/ }), -/* 327 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61127,24 +62290,24 @@ module.exports = ArcadeImage; module.exports = { - Acceleration: __webpack_require__(835), - Angular: __webpack_require__(836), - Bounce: __webpack_require__(837), - Debug: __webpack_require__(838), - Drag: __webpack_require__(839), - Enable: __webpack_require__(840), - Friction: __webpack_require__(841), - Gravity: __webpack_require__(842), - Immovable: __webpack_require__(843), - Mass: __webpack_require__(844), - Size: __webpack_require__(845), - Velocity: __webpack_require__(846) + Acceleration: __webpack_require__(838), + Angular: __webpack_require__(839), + Bounce: __webpack_require__(840), + Debug: __webpack_require__(841), + Drag: __webpack_require__(842), + Enable: __webpack_require__(843), + Friction: __webpack_require__(844), + Gravity: __webpack_require__(845), + Immovable: __webpack_require__(846), + Mass: __webpack_require__(847), + Size: __webpack_require__(848), + Velocity: __webpack_require__(849) }; /***/ }), -/* 328 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61155,7 +62318,7 @@ module.exports = { var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); var Group = __webpack_require__(69); @@ -61369,7 +62532,7 @@ module.exports = PhysicsGroup; /***/ }), -/* 329 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61382,7 +62545,7 @@ module.exports = PhysicsGroup; var ArcadeSprite = __webpack_require__(91); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var Group = __webpack_require__(69); /** @@ -61516,7 +62679,7 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 330 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61525,26 +62688,26 @@ module.exports = StaticPhysicsGroup; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(331); -var Clamp = __webpack_require__(60); +var Body = __webpack_require__(333); +var Clamp = __webpack_require__(61); var Class = __webpack_require__(0); -var Collider = __webpack_require__(332); -var CONST = __webpack_require__(58); -var DistanceBetween = __webpack_require__(41); +var Collider = __webpack_require__(334); +var CONST = __webpack_require__(59); +var DistanceBetween = __webpack_require__(42); var EventEmitter = __webpack_require__(14); -var GetOverlapX = __webpack_require__(333); -var GetOverlapY = __webpack_require__(334); +var GetOverlapX = __webpack_require__(335); +var GetOverlapY = __webpack_require__(336); var GetValue = __webpack_require__(4); -var ProcessQueue = __webpack_require__(335); -var ProcessTileCallbacks = __webpack_require__(847); +var ProcessQueue = __webpack_require__(337); +var ProcessTileCallbacks = __webpack_require__(850); var Rectangle = __webpack_require__(8); -var RTree = __webpack_require__(336); -var SeparateTile = __webpack_require__(848); -var SeparateX = __webpack_require__(853); -var SeparateY = __webpack_require__(854); -var Set = __webpack_require__(61); -var StaticBody = __webpack_require__(339); -var TileIntersectsBody = __webpack_require__(338); +var RTree = __webpack_require__(338); +var SeparateTile = __webpack_require__(851); +var SeparateX = __webpack_require__(856); +var SeparateY = __webpack_require__(857); +var Set = __webpack_require__(62); +var StaticBody = __webpack_require__(341); +var TileIntersectsBody = __webpack_require__(340); var Vector2 = __webpack_require__(6); /** @@ -62825,6 +63988,8 @@ var World = new Class({ collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) { var i; + object1 = object1.isParent && typeof(object1.physicsType) === 'undefined' ? object1.children.entries : object1; + object2 = object2.isParent && typeof(object2.physicsType) === 'undefined' ? object2.children.entries : object2; var object1isArray = Array.isArray(object1); var object2isArray = Array.isArray(object2); @@ -62883,10 +64048,11 @@ var World = new Class({ */ collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) { + // Collide Group with Self // Only collide valid objects if (object2 === undefined && object1.isParent) { - return this.collideGroupVsSelf(object1, collideCallback, processCallback, callbackContext, overlapOnly); + return this.collideGroupVsGroup(object1, object1, collideCallback, processCallback, callbackContext, overlapOnly); } // If neither of the objects are set then bail out @@ -63244,7 +64410,7 @@ module.exports = World; /***/ }), -/* 331 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63255,7 +64421,7 @@ module.exports = World; var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var Rectangle = __webpack_require__(8); var RectangleContains = __webpack_require__(33); var Vector2 = __webpack_require__(6); @@ -63573,7 +64739,7 @@ var Body = new Class({ // If true this Body will dispatch events /** - * [description] + * Emit a `worldbounds` event when this body collides with the world bounds (and `collideWorldBounds` is also true). * * @name Phaser.Physics.Arcade.Body#onWorldBounds * @type {boolean} @@ -64037,8 +65203,8 @@ var Body = new Class({ var sprite = this.gameObject; - this.position.x = sprite.x - sprite.displayOriginX + (sprite.scaleX * this.offset.x); - this.position.y = sprite.y - sprite.displayOriginY + (sprite.scaleY * this.offset.y); + this.position.x = sprite.x + sprite.scaleX * (this.offset.x - sprite.displayOriginX); + this.position.y = sprite.y + sprite.scaleY * (this.offset.y - sprite.displayOriginY); this.updateCenter(); @@ -64101,29 +65267,29 @@ var Body = new Class({ this.dirty = false; - if (this.deltaX() < 0) + this._dx = this.deltaX(); + this._dy = this.deltaY(); + + if (this._dx < 0) { this.facing = CONST.FACING_LEFT; } - else if (this.deltaX() > 0) + else if (this._dx > 0) { this.facing = CONST.FACING_RIGHT; } - if (this.deltaY() < 0) + if (this._dy < 0) { this.facing = CONST.FACING_UP; } - else if (this.deltaY() > 0) + else if (this._dy > 0) { this.facing = CONST.FACING_DOWN; } if (this.moves) { - this._dx = this.deltaX(); - this._dy = this.deltaY(); - if (this.deltaMax.x !== 0 && this._dx !== 0) { if (this._dx < 0 && this._dx < -this.deltaMax.x) @@ -64251,6 +65417,8 @@ var Body = new Class({ { if (center === undefined) { center = true; } + var gameObject = this.gameObject; + this.sourceWidth = width; this.sourceHeight = height; @@ -64262,10 +65430,8 @@ var Body = new Class({ this.updateCenter(); - if (center && this.gameObject.getCenter) + if (center && gameObject.getCenter) { - var gameObject = this.gameObject; - var ox = gameObject.displayWidth / 2; var oy = gameObject.displayHeight / 2; @@ -65100,7 +66266,7 @@ module.exports = Body; /***/ }), -/* 332 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65280,7 +66446,7 @@ module.exports = Collider; /***/ }), -/* 333 */ +/* 335 */ /***/ (function(module, exports) { /** @@ -65359,7 +66525,7 @@ module.exports = GetOverlapX; /***/ }), -/* 334 */ +/* 336 */ /***/ (function(module, exports) { /** @@ -65438,7 +66604,7 @@ module.exports = GetOverlapY; /***/ }), -/* 335 */ +/* 337 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65636,7 +66802,7 @@ module.exports = ProcessQueue; /***/ }), -/* 336 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65645,7 +66811,7 @@ module.exports = ProcessQueue; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var quickselect = __webpack_require__(337); +var quickselect = __webpack_require__(339); /** * @classdesc @@ -66245,7 +67411,7 @@ module.exports = rbush; /***/ }), -/* 337 */ +/* 339 */ /***/ (function(module, exports) { /** @@ -66363,7 +67529,7 @@ module.exports = QuickSelect; /***/ }), -/* 338 */ +/* 340 */ /***/ (function(module, exports) { /** @@ -66400,7 +67566,7 @@ module.exports = TileIntersectsBody; /***/ }), -/* 339 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -66411,7 +67577,7 @@ module.exports = TileIntersectsBody; var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var CONST = __webpack_require__(58); +var CONST = __webpack_require__(59); var RectangleContains = __webpack_require__(33); var Vector2 = __webpack_require__(6); @@ -67256,7 +68422,7 @@ module.exports = StaticBody; /***/ }), -/* 340 */ +/* 342 */ /***/ (function(module, exports) { /** @@ -67328,7 +68494,7 @@ module.exports = { /***/ }), -/* 341 */ +/* 343 */ /***/ (function(module, exports) { /** @@ -67391,7 +68557,7 @@ module.exports = { /***/ }), -/* 342 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67404,7 +68570,7 @@ var Sleeping = {}; module.exports = Sleeping; -var Events = __webpack_require__(164); +var Events = __webpack_require__(165); (function() { @@ -67526,7 +68692,7 @@ var Events = __webpack_require__(164); /***/ }), -/* 343 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67569,7 +68735,7 @@ module.exports = ReplaceByIndex; /***/ }), -/* 344 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67611,7 +68777,7 @@ module.exports = HasTileAt; /***/ }), -/* 345 */ +/* 347 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67622,7 +68788,7 @@ module.exports = HasTileAt; var Tile = __webpack_require__(44); var IsInLayerBounds = __webpack_require__(74); -var CalculateFacesAt = __webpack_require__(152); +var CalculateFacesAt = __webpack_require__(151); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -67672,7 +68838,7 @@ module.exports = RemoveTileAt; /***/ }), -/* 346 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67681,11 +68847,11 @@ module.exports = RemoveTileAt; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); -var Parse2DArray = __webpack_require__(155); -var ParseCSV = __webpack_require__(347); -var ParseJSONTiled = __webpack_require__(348); -var ParseWeltmeister = __webpack_require__(353); +var Formats = __webpack_require__(21); +var Parse2DArray = __webpack_require__(154); +var ParseCSV = __webpack_require__(349); +var ParseJSONTiled = __webpack_require__(350); +var ParseWeltmeister = __webpack_require__(355); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -67742,7 +68908,7 @@ module.exports = Parse; /***/ }), -/* 347 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67751,8 +68917,8 @@ module.exports = Parse; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); -var Parse2DArray = __webpack_require__(155); +var Formats = __webpack_require__(21); +var Parse2DArray = __webpack_require__(154); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -67790,7 +68956,7 @@ module.exports = ParseCSV; /***/ }), -/* 348 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67799,14 +68965,14 @@ module.exports = ParseCSV; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var ParseTileLayers = __webpack_require__(901); -var ParseImageLayers = __webpack_require__(903); -var ParseTilesets = __webpack_require__(904); -var ParseObjectLayers = __webpack_require__(906); -var BuildTilesetIndex = __webpack_require__(907); -var AssignTileProperties = __webpack_require__(908); +var ParseTileLayers = __webpack_require__(904); +var ParseImageLayers = __webpack_require__(906); +var ParseTilesets = __webpack_require__(907); +var ParseObjectLayers = __webpack_require__(909); +var BuildTilesetIndex = __webpack_require__(910); +var AssignTileProperties = __webpack_require__(911); /** * Parses a Tiled JSON object into a new MapData object. @@ -67866,7 +69032,7 @@ module.exports = ParseJSONTiled; /***/ }), -/* 349 */ +/* 351 */ /***/ (function(module, exports) { /** @@ -67956,7 +69122,7 @@ module.exports = ParseGID; /***/ }), -/* 350 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68128,7 +69294,7 @@ module.exports = ImageCollection; /***/ }), -/* 351 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68137,8 +69303,8 @@ module.exports = ImageCollection; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Pick = __webpack_require__(905); -var ParseGID = __webpack_require__(349); +var Pick = __webpack_require__(908); +var ParseGID = __webpack_require__(351); var copyPoints = function (p) { return { x: p.x, y: p.y }; }; @@ -68210,7 +69376,7 @@ module.exports = ParseObject; /***/ }), -/* 352 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68316,7 +69482,7 @@ module.exports = ObjectLayer; /***/ }), -/* 353 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68325,10 +69491,10 @@ module.exports = ObjectLayer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var MapData = __webpack_require__(76); -var ParseTileLayers = __webpack_require__(909); -var ParseTilesets = __webpack_require__(910); +var ParseTileLayers = __webpack_require__(912); +var ParseTilesets = __webpack_require__(913); /** * Parses a Weltmeister JSON object into a new MapData object. @@ -68383,7 +69549,7 @@ module.exports = ParseWeltmeister; /***/ }), -/* 354 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68394,12 +69560,12 @@ module.exports = ParseWeltmeister; var Class = __webpack_require__(0); var DegToRad = __webpack_require__(35); -var DynamicTilemapLayer = __webpack_require__(355); +var DynamicTilemapLayer = __webpack_require__(357); var Extend = __webpack_require__(23); -var Formats = __webpack_require__(20); +var Formats = __webpack_require__(21); var LayerData = __webpack_require__(75); -var Rotate = __webpack_require__(323); -var StaticTilemapLayer = __webpack_require__(356); +var Rotate = __webpack_require__(325); +var StaticTilemapLayer = __webpack_require__(358); var Tile = __webpack_require__(44); var TilemapComponents = __webpack_require__(96); var Tileset = __webpack_require__(100); @@ -70642,7 +71808,7 @@ module.exports = Tilemap; /***/ }), -/* 355 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70653,7 +71819,7 @@ module.exports = Tilemap; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DynamicTilemapLayerRender = __webpack_require__(911); +var DynamicTilemapLayerRender = __webpack_require__(914); var GameObject = __webpack_require__(1); var TilemapComponents = __webpack_require__(96); @@ -71761,7 +72927,7 @@ module.exports = DynamicTilemapLayer; /***/ }), -/* 356 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71773,9 +72939,9 @@ module.exports = DynamicTilemapLayer; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(1); -var StaticTilemapLayerRender = __webpack_require__(914); +var StaticTilemapLayerRender = __webpack_require__(917); var TilemapComponents = __webpack_require__(96); -var Utils = __webpack_require__(42); +var Utils = __webpack_require__(41); /** * @classdesc @@ -72798,7 +73964,7 @@ module.exports = StaticTilemapLayer; /***/ }), -/* 357 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73101,7 +74267,7 @@ module.exports = TimerEvent; /***/ }), -/* 358 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73110,7 +74276,7 @@ module.exports = TimerEvent; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RESERVED = __webpack_require__(923); +var RESERVED = __webpack_require__(926); /** * [description] @@ -73159,7 +74325,7 @@ module.exports = GetProps; /***/ }), -/* 359 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73205,7 +74371,7 @@ module.exports = GetTweens; /***/ }), -/* 360 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73214,15 +74380,15 @@ module.exports = GetTweens; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Defaults = __webpack_require__(159); +var Defaults = __webpack_require__(158); var GetAdvancedValue = __webpack_require__(10); var GetBoolean = __webpack_require__(73); var GetEaseFunction = __webpack_require__(71); var GetNewValue = __webpack_require__(101); var GetValue = __webpack_require__(4); -var GetValueOp = __webpack_require__(158); -var Tween = __webpack_require__(160); -var TweenData = __webpack_require__(161); +var GetValueOp = __webpack_require__(157); +var Tween = __webpack_require__(159); +var TweenData = __webpack_require__(160); /** * [description] @@ -73333,7 +74499,7 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 361 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73342,16 +74508,16 @@ module.exports = NumberTweenBuilder; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); -var Defaults = __webpack_require__(159); +var Clone = __webpack_require__(53); +var Defaults = __webpack_require__(158); var GetAdvancedValue = __webpack_require__(10); var GetBoolean = __webpack_require__(73); var GetEaseFunction = __webpack_require__(71); var GetNewValue = __webpack_require__(101); -var GetTargets = __webpack_require__(157); -var GetTweens = __webpack_require__(359); +var GetTargets = __webpack_require__(156); +var GetTweens = __webpack_require__(361); var GetValue = __webpack_require__(4); -var Timeline = __webpack_require__(362); +var Timeline = __webpack_require__(364); var TweenBuilder = __webpack_require__(102); /** @@ -73407,982 +74573,81 @@ var TimelineBuilder = function (manager, config) // Create the Tweens for (var i = 0; i < tweens.length; i++) - { - timeline.queue(TweenBuilder(timeline, tweens[i], defaults)); - } - - timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - timeline.paused = GetBoolean(config, 'paused', false); - timeline.useFrames = GetBoolean(config, 'useFrames', false); - - // Callbacks - - var scope = GetValue(config, 'callbackScope', timeline); - - var timelineArray = [ timeline ]; - - var onStart = GetValue(config, 'onStart', false); - - // The Start of the Timeline - if (onStart) - { - var onStartScope = GetValue(config, 'onStartScope', scope); - var onStartParams = GetValue(config, 'onStartParams', []); - - timeline.setCallback('onStart', onStart, timelineArray.concat(onStartParams), onStartScope); - } - - var onUpdate = GetValue(config, 'onUpdate', false); - - // Every time the Timeline updates (regardless which Tweens are running) - if (onUpdate) - { - var onUpdateScope = GetValue(config, 'onUpdateScope', scope); - var onUpdateParams = GetValue(config, 'onUpdateParams', []); - - timeline.setCallback('onUpdate', onUpdate, timelineArray.concat(onUpdateParams), onUpdateScope); - } - - var onLoop = GetValue(config, 'onLoop', false); - - // Called when the whole Timeline loops - if (onLoop) - { - var onLoopScope = GetValue(config, 'onLoopScope', scope); - var onLoopParams = GetValue(config, 'onLoopParams', []); - - timeline.setCallback('onLoop', onLoop, timelineArray.concat(onLoopParams), onLoopScope); - } - - var onYoyo = GetValue(config, 'onYoyo', false); - - // Called when a Timeline yoyos - if (onYoyo) - { - var onYoyoScope = GetValue(config, 'onYoyoScope', scope); - var onYoyoParams = GetValue(config, 'onYoyoParams', []); - - timeline.setCallback('onYoyo', onYoyo, timelineArray.concat(null, onYoyoParams), onYoyoScope); - } - - var onComplete = GetValue(config, 'onComplete', false); - - // Called when the Timeline completes, after the completeDelay, etc. - if (onComplete) - { - var onCompleteScope = GetValue(config, 'onCompleteScope', scope); - var onCompleteParams = GetValue(config, 'onCompleteParams', []); - - timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope); - } - - return timeline; -}; - -module.exports = TimelineBuilder; - - -/***/ }), -/* 362 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(14); -var TweenBuilder = __webpack_require__(102); -var TWEEN_CONST = __webpack_require__(87); - -/** - * @classdesc - * [description] - * - * @class Timeline - * @memberOf Phaser.Tweens - * @extends EventEmitter - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Tweens.TweenManager} manager - [description] - */ -var Timeline = new Class({ - - Extends: EventEmitter, - - initialize: - - function Timeline (manager) - { - EventEmitter.call(this); - - /** - * [description] - * - * @name Phaser.Tweens.Timeline#manager - * @type {Phaser.Tweens.TweenManager} - * @since 3.0.0 - */ - this.manager = manager; - - /** - * [description] - * - * @name Phaser.Tweens.Timeline#isTimeline - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.isTimeline = true; - - /** - * An array of Tween objects, each containing a unique property and target being tweened. - * - * @name Phaser.Tweens.Timeline#data - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.data = []; - - /** - * data array doesn't usually change, so we can cache the length - * - * @name Phaser.Tweens.Timeline#totalData - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalData = 0; - - /** - * If true then duration, delay, etc values are all frame totals. - * - * @name Phaser.Tweens.Timeline#useFrames - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useFrames = false; - - /** - * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. - * Value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. - * - * @name Phaser.Tweens.Timeline#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * Loop this tween? Can be -1 for an infinite loop, or an integer. - * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD) - * - * @name Phaser.Tweens.Timeline#loop - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loop = 0; - - /** - * Time in ms/frames before the tween loops. - * - * @name Phaser.Tweens.Timeline#loopDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopDelay = 0; - - /** - * How many loops are left to run? - * - * @name Phaser.Tweens.Timeline#loopCounter - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopCounter = 0; - - /** - * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes) - * - * @name Phaser.Tweens.Timeline#completeDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.completeDelay = 0; - - /** - * Countdown timer (used by loopDelay and completeDelay) - * - * @name Phaser.Tweens.Timeline#countdown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.countdown = 0; - - /** - * The current state of the tween - * - * @name Phaser.Tweens.Timeline#state - * @type {integer} - * @since 3.0.0 - */ - this.state = TWEEN_CONST.PENDING_ADD; - - /** - * The state of the tween when it was paused (used by Resume) - * - * @name Phaser.Tweens.Timeline#_pausedState - * @type {integer} - * @private - * @since 3.0.0 - */ - this._pausedState = TWEEN_CONST.PENDING_ADD; - - /** - * Does the Tween start off paused? (if so it needs to be started with Tween.play) - * - * @name Phaser.Tweens.Timeline#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - /** - * Elapsed time in ms/frames of this run through the Tween. - * - * @name Phaser.Tweens.Timeline#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; - - /** - * Total elapsed time in ms/frames of the entire Tween, including looping. - * - * @name Phaser.Tweens.Timeline#totalElapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalElapsed = 0; - - /** - * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays. - * - * @name Phaser.Tweens.Timeline#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; - - /** - * Value between 0 and 1. The amount through the Tween, excluding loops. - * - * @name Phaser.Tweens.Timeline#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; - - /** - * Time in ms/frames for all Tweens to complete (including looping) - * - * @name Phaser.Tweens.Timeline#totalDuration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalDuration = 0; - - /** - * Value between 0 and 1. The amount through the entire Tween, including looping. - * - * @name Phaser.Tweens.Timeline#totalProgress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalProgress = 0; - - this.callbacks = { - onComplete: null, - onLoop: null, - onStart: null, - onUpdate: null, - onYoyo: null - }; - - this.callbackScope; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#setTimeScale - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - setTimeScale: function (value) - { - this.timeScale = value; - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#getTimeScale - * @since 3.0.0 - * - * @return {number} [description] - */ - getTimeScale: function () - { - return this.timeScale; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isPlaying - * @since 3.0.0 - * - * @return {boolean} [description] - */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#add - * @since 3.0.0 - * - * @param {[type]} config - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - add: function (config) - { - return this.queue(TweenBuilder(this, config)); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#queue - * @since 3.0.0 - * - * @param {[type]} tween - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - queue: function (tween) - { - if (!this.isPlaying()) - { - tween.parent = this; - tween.parentIsTimeline = true; - - this.data.push(tween); - - this.totalData = this.data.length; - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#hasOffset - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - [description] - * - * @return {boolean} [description] - */ - hasOffset: function (tween) - { - return (tween.offset !== null); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isOffsetAbsolute - * @since 3.0.0 - * - * @param {number} value - [description] - * - * @return {boolean} [description] - */ - isOffsetAbsolute: function (value) - { - return (typeof(value) === 'number'); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#isOffsetRelative - * @since 3.0.0 - * - * @param {string} value - [description] - * - * @return {boolean} [description] - */ - isOffsetRelative: function (value) - { - var t = typeof(value); - - if (t === 'string') - { - var op = value[0]; - - if (op === '-' || op === '+') - { - return true; - } - } - - return false; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#getRelativeOffset - * @since 3.0.0 - * - * @param {string} value - [description] - * @param {number} base - [description] - * - * @return {number} [description] - */ - getRelativeOffset: function (value, base) - { - var op = value[0]; - var num = parseFloat(value.substr(2)); - var result = base; - - switch (op) - { - case '+': - result += num; - break; - - case '-': - result -= num; - break; - } - - // Cannot ever be < 0 - return Math.max(0, result); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#calcDuration - * @since 3.0.0 - */ - calcDuration: function () - { - var prevEnd = 0; - var totalDuration = 0; - var offsetDuration = 0; - - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; - - tween.init(); - - if (this.hasOffset(tween)) - { - if (this.isOffsetAbsolute(tween.offset)) - { - // An actual number, so it defines the start point from the beginning of the timeline - tween.calculatedOffset = tween.offset; - - if (tween.offset === 0) - { - offsetDuration = 0; - } - } - else if (this.isOffsetRelative(tween.offset)) - { - // A relative offset (i.e. '-=1000', so starts at 'offset' ms relative to the PREVIOUS Tweens ending time) - tween.calculatedOffset = this.getRelativeOffset(tween.offset, prevEnd); - } - } - else - { - // Sequential - tween.calculatedOffset = offsetDuration; - } - - prevEnd = tween.totalDuration + tween.calculatedOffset; - - totalDuration += tween.totalDuration; - offsetDuration += tween.totalDuration; - } - - // Excludes loop values - this.duration = totalDuration; - - this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; - - if (this.loopCounter > 0) - { - this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); - } - else - { - this.totalDuration = this.duration + this.completeDelay; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#init - * @since 3.0.0 - * - * @return {boolean} [description] - */ - init: function () - { - this.calcDuration(); - - this.progress = 0; - this.totalProgress = 0; - - if (this.paused) - { - this.state = TWEEN_CONST.PAUSED; - - return false; - } - else - { - return true; - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#resetTweens - * @since 3.0.0 - * - * @param {boolean} resetFromLoop - [description] - */ - resetTweens: function (resetFromLoop) - { - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; - - tween.play(resetFromLoop); - } - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#setCallback - * @since 3.0.0 - * - * @param {string} type - [description] - * @param {function} callback - [description] - * @param {array} [params] - [description] - * @param {object} [scope] - [description] - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - setCallback: function (type, callback, params, scope) - { - if (Timeline.TYPES.indexOf(type) !== -1) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#play - * @since 3.0.0 - */ - play: function () - { - if (this.state === TWEEN_CONST.ACTIVE) - { - return; - } - - if (this.paused) - { - this.paused = false; - - this.manager.makeActive(this); - - return; - } - else - { - this.resetTweens(false); - - this.state = TWEEN_CONST.ACTIVE; - } - - var onStart = this.callbacks.onStart; - - if (onStart) - { - onStart.func.apply(onStart.scope, onStart.params); - } - - this.emit('start', this); - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#nextState - * @since 3.0.0 - */ - nextState: function () - { - if (this.loopCounter > 0) - { - // Reset the elapsed time - // TODO: Probably ought to be set to the remainder from elapsed - duration - // as the tweens nearly always over-run by a few ms due to rAf - - this.elapsed = 0; - this.progress = 0; - - this.loopCounter--; - - var onLoop = this.callbacks.onLoop; - - if (onLoop) - { - onLoop.func.apply(onLoop.scope, onLoop.params); - } - - this.emit('loop', this, this.loopCounter); - - this.resetTweens(true); - - if (this.loopDelay > 0) - { - this.countdown = this.loopDelay; - this.state = TWEEN_CONST.LOOP_DELAY; - } - else - { - this.state = TWEEN_CONST.ACTIVE; - } - } - else if (this.completeDelay > 0) - { - this.countdown = this.completeDelay; - this.state = TWEEN_CONST.COMPLETE_DELAY; - } - else - { - var onComplete = this.callbacks.onComplete; - - if (onComplete) - { - onComplete.func.apply(onComplete.scope, onComplete.params); - } - - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - }, - - /** - * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager. - * Otherwise, returns false. - * - * @method Phaser.Tweens.Timeline#update - * @since 3.0.0 - * - * @param {number} timestamp - [description] - * @param {number} delta - [description] - * - * @return {boolean} Returns `true` if this Timeline has finished and should be removed from the Tween Manager. - */ - update: function (timestamp, delta) - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - - var rawDelta = delta; - - if (this.useFrames) - { - delta = 1 * this.manager.timeScale; - } - - delta *= this.timeScale; - - this.elapsed += delta; - this.progress = Math.min(this.elapsed / this.duration, 1); - - this.totalElapsed += delta; - this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); - - switch (this.state) - { - case TWEEN_CONST.ACTIVE: - - var stillRunning = this.totalData; - - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; - - if (tween.update(timestamp, rawDelta)) - { - stillRunning--; - } - } - - var onUpdate = this.callbacks.onUpdate; - - if (onUpdate) - { - onUpdate.func.apply(onUpdate.scope, onUpdate.params); - } - - this.emit('update', this); - - // Anything still running? If not, we're done - if (stillRunning === 0) - { - this.nextState(); - } - - break; - - case TWEEN_CONST.LOOP_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - } - - break; - - case TWEEN_CONST.COMPLETE_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - var onComplete = this.callbacks.onComplete; - - if (onComplete) - { - onComplete.func.apply(onComplete.scope, onComplete.params); - } - - this.emit('complete', this); - - this.state = TWEEN_CONST.PENDING_REMOVE; - } - - break; - } - - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, - - /** - * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. - * - * @method Phaser.Tweens.Timeline#stop - * @since 3.0.0 - */ - stop: function () - { - this.state = TWEEN_CONST.PENDING_REMOVE; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#pause - * @since 3.0.0 - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - - this.paused = true; - - this._pausedState = this.state; - - this.state = TWEEN_CONST.PAUSED; - - this.emit('pause', this); - - return this; - }, - - /** - * [description] - * - * @method Phaser.Tweens.Timeline#resume - * @since 3.0.0 - * - * @return {Phaser.Tweens.Timeline} This Timeline object. - */ - resume: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - this.paused = false; + { + timeline.queue(TweenBuilder(timeline, tweens[i], defaults)); + } - this.state = this._pausedState; - } + timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + timeline.paused = GetBoolean(config, 'paused', false); + timeline.useFrames = GetBoolean(config, 'useFrames', false); - this.emit('resume', this); + // Callbacks - return this; - }, + var scope = GetValue(config, 'callbackScope', timeline); - /** - * [description] - * - * @method Phaser.Tweens.Timeline#hasTarget - * @since 3.0.0 - * - * @param {object} target - [description] - * - * @return {boolean} [description] - */ - hasTarget: function (target) - { - for (var i = 0; i < this.data.length; i++) - { - if (this.data[i].hasTarget(target)) - { - return true; - } - } - - return false; - }, + var timelineArray = [ timeline ]; - /** - * [description] - * - * @method Phaser.Tweens.Timeline#destroy - * @since 3.0.0 - */ - destroy: function () + var onStart = GetValue(config, 'onStart', false); + + // The Start of the Timeline + if (onStart) { - for (var i = 0; i < this.data.length; i++) - { - this.data[i].destroy(); - } + var onStartScope = GetValue(config, 'onStartScope', scope); + var onStartParams = GetValue(config, 'onStartParams', []); + timeline.setCallback('onStart', onStart, timelineArray.concat(onStartParams), onStartScope); } -}); -Timeline.TYPES = [ 'onStart', 'onUpdate', 'onLoop', 'onComplete', 'onYoyo' ]; + var onUpdate = GetValue(config, 'onUpdate', false); -module.exports = Timeline; + // Every time the Timeline updates (regardless which Tweens are running) + if (onUpdate) + { + var onUpdateScope = GetValue(config, 'onUpdateScope', scope); + var onUpdateParams = GetValue(config, 'onUpdateParams', []); + timeline.setCallback('onUpdate', onUpdate, timelineArray.concat(onUpdateParams), onUpdateScope); + } -/***/ }), -/* 363 */ -/***/ (function(module, exports) { + var onLoop = GetValue(config, 'onLoop', false); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // Called when the whole Timeline loops + if (onLoop) + { + var onLoopScope = GetValue(config, 'onLoopScope', scope); + var onLoopParams = GetValue(config, 'onLoopParams', []); -// Based on code by Mike Reinstein + timeline.setCallback('onLoop', onLoop, timelineArray.concat(onLoopParams), onLoopScope); + } -/** - * Removes a single item from an array and returns it without creating gc (like the native splice does) - * - * @function Phaser.Utils.Array.SpliceOne - * @since 3.0.0 - * - * @param {array} array - [description] - * @param {integer} index - [description] - * - * @return {any} [description] - */ -var SpliceOne = function (array, index) -{ - if (index >= array.length) + var onYoyo = GetValue(config, 'onYoyo', false); + + // Called when a Timeline yoyos + if (onYoyo) { - return; - } + var onYoyoScope = GetValue(config, 'onYoyoScope', scope); + var onYoyoParams = GetValue(config, 'onYoyoParams', []); - var len = array.length - 1; + timeline.setCallback('onYoyo', onYoyo, timelineArray.concat(null, onYoyoParams), onYoyoScope); + } - var item = array[index]; + var onComplete = GetValue(config, 'onComplete', false); - for (var i = index; i < len; i++) + // Called when the Timeline completes, after the completeDelay, etc. + if (onComplete) { - array[i] = array[i + 1]; - } + var onCompleteScope = GetValue(config, 'onCompleteScope', scope); + var onCompleteParams = GetValue(config, 'onCompleteParams', []); - array.length = len; + timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope); + } - return item; + return timeline; }; -module.exports = SpliceOne; +module.exports = TimelineBuilder; /***/ }), @@ -74396,1524 +74661,851 @@ module.exports = SpliceOne; */ var Class = __webpack_require__(0); +var EventEmitter = __webpack_require__(14); +var TweenBuilder = __webpack_require__(102); +var TWEEN_CONST = __webpack_require__(87); /** * @classdesc - * A Game Object Animation Controller. - * - * This controller lives as an instance within a Game Object, accessible as `sprite.anims`. + * [description] * - * @class Animation - * @memberOf Phaser.GameObjects.Components + * @class Timeline + * @memberOf Phaser.Tweens + * @extends EventEmitter * @constructor * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation controller belongs. + * @param {Phaser.Tweens.TweenManager} manager - [description] */ -var Animation = new Class({ +var Timeline = new Class({ + + Extends: EventEmitter, initialize: - function Animation (parent) + function Timeline (manager) { + EventEmitter.call(this); + /** - * The Game Object to which this animation controller belongs. + * [description] * - * @name Phaser.GameObjects.Components.Animation#parent - * @type {Phaser.GameObjects.GameObject} + * @name Phaser.Tweens.Timeline#manager + * @type {Phaser.Tweens.TweenManager} * @since 3.0.0 */ - this.parent = parent; + this.manager = manager; /** - * A reference to the global Animation Manager. + * [description] * - * @name Phaser.GameObjects.Components.Animation#animationManager - * @type {Phaser.Animations.AnimationManager} + * @name Phaser.Tweens.Timeline#isTimeline + * @type {boolean} + * @default true * @since 3.0.0 */ - this.animationManager = parent.scene.sys.anims; - - this.animationManager.once('remove', this.remove, this); + this.isTimeline = true; /** - * Is an animation currently playing or not? + * An array of Tween objects, each containing a unique property and target being tweened. * - * @name Phaser.GameObjects.Components.Animation#isPlaying - * @type {boolean} - * @default false + * @name Phaser.Tweens.Timeline#data + * @type {array} + * @default [] * @since 3.0.0 */ - this.isPlaying = false; - - // Reference to the Phaser.Animation object + this.data = []; /** - * The current Animation loaded into this Animation Controller. + * data array doesn't usually change, so we can cache the length * - * @name Phaser.GameObjects.Components.Animation#currentAnim - * @type {?Phaser.Animations.Animation} - * @default null + * @name Phaser.Tweens.Timeline#totalData + * @type {number} + * @default 0 * @since 3.0.0 */ - this.currentAnim = null; + this.totalData = 0; /** - * The current AnimationFrame being displayed by this Animation Controller. + * If true then duration, delay, etc values are all frame totals. * - * @name Phaser.GameObjects.Components.Animation#currentFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null + * @name Phaser.Tweens.Timeline#useFrames + * @type {boolean} + * @default false * @since 3.0.0 */ - this.currentFrame = null; + this.useFrames = false; /** - * Time scale factor. + * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. + * Value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. * - * @name Phaser.GameObjects.Components.Animation#_timeScale + * @name Phaser.Tweens.Timeline#timeScale * @type {number} - * @private * @default 1 * @since 3.0.0 */ - this._timeScale = 1; + this.timeScale = 1; /** - * The frame rate of playback in frames per second. - * The default is 24 if the `duration` property is `null`. + * Loop this tween? Can be -1 for an infinite loop, or an integer. + * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD) * - * @name Phaser.GameObjects.Components.Animation#frameRate + * @name Phaser.Tweens.Timeline#loop * @type {number} * @default 0 * @since 3.0.0 */ - this.frameRate = 0; + this.loop = 0; /** - * How long the animation should play for. - * If the `frameRate` property has been set then it overrides this value, - * otherwise frameRate is derived from `duration`. + * Time in ms/frames before the tween loops. * - * @name Phaser.GameObjects.Components.Animation#duration + * @name Phaser.Tweens.Timeline#loopDelay * @type {number} * @default 0 * @since 3.0.0 */ - this.duration = 0; + this.loopDelay = 0; /** - * ms per frame, not including frame specific modifiers that may be present in the Animation data. + * How many loops are left to run? * - * @name Phaser.GameObjects.Components.Animation#msPerFrame + * @name Phaser.Tweens.Timeline#loopCounter * @type {number} * @default 0 * @since 3.0.0 */ - this.msPerFrame = 0; - - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.GameObjects.Components.Animation#skipMissedFrames - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.skipMissedFrames = true; + this.loopCounter = 0; /** - * A delay before starting playback, in seconds. + * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes) * - * @name Phaser.GameObjects.Components.Animation#_delay + * @name Phaser.Tweens.Timeline#completeDelay * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._delay = 0; + this.completeDelay = 0; /** - * Number of times to repeat the animation (-1 for infinity) + * Countdown timer (used by loopDelay and completeDelay) * - * @name Phaser.GameObjects.Components.Animation#_repeat + * @name Phaser.Tweens.Timeline#countdown * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._repeat = 0; + this.countdown = 0; /** - * Delay before the repeat starts, in seconds. + * The current state of the tween * - * @name Phaser.GameObjects.Components.Animation#_repeatDelay - * @type {number} - * @private - * @default 0 + * @name Phaser.Tweens.Timeline#state + * @type {integer} * @since 3.0.0 */ - this._repeatDelay = 0; + this.state = TWEEN_CONST.PENDING_ADD; /** - * Should the animation yoyo? (reverse back down to the start) before repeating? + * The state of the tween when it was paused (used by Resume) * - * @name Phaser.GameObjects.Components.Animation#_yoyo - * @type {boolean} + * @name Phaser.Tweens.Timeline#_pausedState + * @type {integer} * @private - * @default false * @since 3.0.0 */ - this._yoyo = false; + this._pausedState = TWEEN_CONST.PENDING_ADD; /** - * Will the playhead move forwards (`true`) or in reverse (`false`) + * Does the Tween start off paused? (if so it needs to be started with Tween.play) * - * @name Phaser.GameObjects.Components.Animation#forward + * @name Phaser.Tweens.Timeline#paused * @type {boolean} - * @default true + * @default false * @since 3.0.0 */ - this.forward = true; + this.paused = false; /** - * Internal time overflow accumulator. + * Elapsed time in ms/frames of this run through the Tween. * - * @name Phaser.GameObjects.Components.Animation#accumulator + * @name Phaser.Tweens.Timeline#elapsed * @type {number} * @default 0 * @since 3.0.0 */ - this.accumulator = 0; + this.elapsed = 0; /** - * The time point at which the next animation frame will change. + * Total elapsed time in ms/frames of the entire Tween, including looping. * - * @name Phaser.GameObjects.Components.Animation#nextTick + * @name Phaser.Tweens.Timeline#totalElapsed * @type {number} * @default 0 * @since 3.0.0 */ - this.nextTick = 0; + this.totalElapsed = 0; /** - * An internal counter keeping track of how many repeats are left to play. + * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays. * - * @name Phaser.GameObjects.Components.Animation#repeatCounter + * @name Phaser.Tweens.Timeline#duration * @type {number} * @default 0 * @since 3.0.0 */ - this.repeatCounter = 0; - - /** - * An internal flag keeping track of pending repeats. - * - * @name Phaser.GameObjects.Components.Animation#pendingRepeat - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.pendingRepeat = false; - - /** - * Is the Animation paused? - * - * @name Phaser.GameObjects.Components.Animation#_paused - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._paused = false; + this.duration = 0; /** - * Was the animation previously playing before being paused? + * Value between 0 and 1. The amount through the Tween, excluding loops. * - * @name Phaser.GameObjects.Components.Animation#_wasPlaying - * @type {boolean} - * @private - * @default false + * @name Phaser.Tweens.Timeline#progress + * @type {number} + * @default 0 * @since 3.0.0 */ - this._wasPlaying = false; + this.progress = 0; /** - * Container for the callback arguments. + * Time in ms/frames for all Tweens to complete (including looping) * - * @name Phaser.GameObjects.Components.Animation#_callbackArgs - * @type {array} - * @private + * @name Phaser.Tweens.Timeline#totalDuration + * @type {number} + * @default 0 * @since 3.0.0 */ - this._callbackArgs = [ parent, null ]; + this.totalDuration = 0; /** - * Container for the update arguments. + * Value between 0 and 1. The amount through the entire Tween, including looping. * - * @name Phaser.GameObjects.Components.Animation#_updateParams - * @type {array} - * @private + * @name Phaser.Tweens.Timeline#totalProgress + * @type {number} + * @default 0 * @since 3.0.0 */ - this._updateParams = []; - }, - - /** - * Sets the amount of time, in seconds that the animation will be delayed before starting playback. - * - * @method Phaser.GameObjects.Components.Animation#delay - * @since 3.0.0 - * - * @param {number} value - The amount of time, in seconds, to wait before starting playback. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - delay: function (value) - { - if (value === undefined) - { - return this._delay; - } - else - { - this._delay = value; - - return this; - } - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#delayedPlay - * @since 3.0.0 - * - * @param {[type]} delay - [description] - * @param {[type]} key - [description] - * @param {[type]} startFrame - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - delayedPlay: function (delay, key, startFrame) - { - this.play(key, true, startFrame); - - this.nextTick += (delay * 1000); - - return this; - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#getCurrentKey - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getCurrentKey: function () - { - if (this.currentAnim) - { - return this.currentAnim.key; - } - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#load - * @since 3.0.0 - * - * @param {[type]} key - [description] - * @param {[type]} startFrame - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - load: function (key, startFrame) - { - if (startFrame === undefined) { startFrame = 0; } - - if (this.isPlaying) - { - this.stop(); - } - - // Load the new animation in - this.animationManager.load(this, key, startFrame); - - return this; - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#pause - * @since 3.0.0 - * - * @param {[type]} atFrame - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - pause: function (atFrame) - { - if (!this._paused) - { - this._paused = true; - this._wasPlaying = this.isPlaying; - this.isPlaying = false; - } + this.totalProgress = 0; - if (atFrame !== undefined) - { - this.updateFrame(atFrame); - } - - return this; - }, + this.callbacks = { + onComplete: null, + onLoop: null, + onStart: null, + onUpdate: null, + onYoyo: null + }; - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#paused - * @since 3.0.0 - * - * @param {[type]} value - [description] - * - * @return {[type]} [description] - */ - paused: function (value) - { - if (value !== undefined) - { - // Setter - if (value) - { - return this.pause(); - } - else - { - return this.resume(); - } - } - else - { - return this._paused; - } + this.callbackScope; }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#play + * @method Phaser.Tweens.Timeline#setTimeScale * @since 3.0.0 * - * @param {[type]} key - [description] - * @param {[type]} ignoreIfPlaying - [description] - * @param {[type]} startFrame - [description] + * @param {number} value - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - play: function (key, ignoreIfPlaying, startFrame) + setTimeScale: function (value) { - if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } - if (startFrame === undefined) { startFrame = 0; } - - if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) - { - return this; - } - - this.load(key, startFrame); - - var anim = this.currentAnim; - - // Should give us 9,007,199,254,740,991 safe repeats - this.repeatCounter = (this._repeat === -1) ? Number.MAX_VALUE : this._repeat; - - anim.getFirstTick(this); - - this.forward = true; - this.isPlaying = true; - this.pendingRepeat = false; - - if (anim.showOnStart) - { - this.parent.visible = true; - } - - if (anim.onStart) - { - anim.onStart.apply(anim.callbackScope, this._callbackArgs.concat(anim.onStartParams)); - } + this.timeScale = value; return this; }, - // Value between 0 and 1. How far this animation is through, ignoring repeats and yoyos. - // If the animation has a non-zero repeat defined, progress and totalProgress will be different - // because progress doesn't include any repeats or repeatDelays whereas totalProgress does. - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#progress - * @since 3.0.0 - * - * @param {[type]} value - [description] - * - * @return {[type]} [description] - */ - progress: function (value) - { - if (value === undefined) - { - var p = this.currentFrame.progress; - - if (!this.forward) - { - p = 1 - p; - } - - return p; - } - else - { - // TODO: Set progress - - return this; - } - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#remove - * @since 3.0.0 - * - * @param {[type]} event - [description] - */ - remove: function (event) - { - if (event === undefined) { event = this.currentAnim; } - - if (this.isPlaying && event.key === this.currentAnim.key) - { - this.stop(); - - var sprite = this.parent; - var frame = this.currentAnim.frames[0]; - - this.currentFrame = frame; - - sprite.texture = frame.frame.texture; - sprite.frame = frame.frame; - } - }, - - // Gets or sets the number of times that the animation should repeat - // after its first iteration. For example, if repeat is 1, the animation will - // play a total of twice (the initial play plus 1 repeat). - // To repeat indefinitely, use -1. repeat should always be an integer. - /** * [description] * - * @method Phaser.GameObjects.Components.Animation#repeat + * @method Phaser.Tweens.Timeline#getTimeScale * @since 3.0.0 * - * @param {[type]} value - [description] - * - * @return {[type]} [description] + * @return {number} [description] */ - repeat: function (value) + getTimeScale: function () { - if (value === undefined) - { - return this._repeat; - } - else - { - this._repeat = value; - this.repeatCounter = 0; - - return this; - } + return this.timeScale; }, - // Gets or sets the amount of time in seconds between repeats. - // For example, if repeat is 2 and repeatDelay is 1, the animation will play initially, - // then wait for 1 second before it repeats, then play again, then wait 1 second again - // before doing its final repeat. - /** * [description] * - * @method Phaser.GameObjects.Components.Animation#repeatDelay + * @method Phaser.Tweens.Timeline#isPlaying * @since 3.0.0 * - * @param {[type]} value - [description] - * - * @return {[type]} [description] + * @return {boolean} [description] */ - repeatDelay: function (value) + isPlaying: function () { - if (value === undefined) - { - return this._repeatDelay; - } - else - { - this._repeatDelay = value; - - return this; - } + return (this.state === TWEEN_CONST.ACTIVE); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#restart + * @method Phaser.Tweens.Timeline#add * @since 3.0.0 * - * @param {[type]} includeDelay - [description] + * @param {[type]} config - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - restart: function (includeDelay) + add: function (config) { - if (includeDelay === undefined) { includeDelay = false; } - - this.currentAnim.getFirstTick(this, includeDelay); - - this.forward = true; - this.isPlaying = true; - this.pendingRepeat = false; - this._paused = false; - - // Set frame - this.updateFrame(this.currentAnim.frames[0]); - - return this; + return this.queue(TweenBuilder(this, config)); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#resume + * @method Phaser.Tweens.Timeline#queue * @since 3.0.0 * - * @param {[type]} fromFrame - [description] + * @param {[type]} tween - [description] * - * @return {Phaser.GameObjects.GameObject} This Game Object. + * @return {Phaser.Tweens.Timeline} This Timeline object. */ - resume: function (fromFrame) + queue: function (tween) { - if (this._paused) - { - this._paused = false; - this.isPlaying = this._wasPlaying; - } - - if (fromFrame !== undefined) + if (!this.isPlaying()) { - this.updateFrame(fromFrame); - } - - return this; - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#stop - * @since 3.0.0 - * - * @param {[type]} dispatchCallbacks - [description] - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - stop: function (dispatchCallbacks) - { - if (dispatchCallbacks === undefined) { dispatchCallbacks = false; } - - this.isPlaying = false; + tween.parent = this; + tween.parentIsTimeline = true; - var anim = this.currentAnim; + this.data.push(tween); - if (dispatchCallbacks && anim.onComplete) - { - anim.onComplete.apply(anim.callbackScope, this._callbackArgs.concat(anim.onCompleteParams)); + this.totalData = this.data.length; } return this; }, - // Scale the time (make it go faster / slower) - // Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc. - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#timeScale - * @since 3.0.0 - * - * @param {[type]} value - [description] - * - * @return {[type]} [description] - */ - timeScale: function (value) - { - if (value === undefined) - { - return this._timeScale; - } - else - { - this._timeScale = value; - - return this; - } - }, - /** * [description] * - * @method Phaser.GameObjects.Components.Animation#totalFrames + * @method Phaser.Tweens.Timeline#hasOffset * @since 3.0.0 * - * @return {[type]} [description] - */ - totalFrames: function () - { - return this.currentAnim.frames.length; - }, - - // Value between 0 and 1. How far this animation is through, including things like delays - // repeats, custom frame durations, etc. If the animation is set to repeat -1 it can never - // have a duration, therefore this will return -1. - /** - * [description] + * @param {Phaser.Tweens.Tween} tween - [description] * - * @method Phaser.GameObjects.Components.Animation#totalProgres - * @since 3.0.0 + * @return {boolean} [description] */ - totalProgres: function () + hasOffset: function (tween) { - // TODO + return (tween.offset !== null); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#update + * @method Phaser.Tweens.Timeline#isOffsetAbsolute * @since 3.0.0 * - * @param {[type]} timestamp - [description] - * @param {[type]} delta - [description] - */ - update: function (timestamp, delta) - { - if (!this.isPlaying || this.currentAnim.paused) - { - return; - } - - this.accumulator += delta * this._timeScale; - - if (this.accumulator >= this.nextTick) - { - this.currentAnim.setFrame(this); - } - }, - - /** - * [description] - * - * @method Phaser.GameObjects.Components.Animation#updateFrame - * @since 3.0.0 + * @param {number} value - [description] * - * @param {[type]} animationFrame - [description] + * @return {boolean} [description] */ - updateFrame: function (animationFrame) + isOffsetAbsolute: function (value) { - var sprite = this.parent; - - this.currentFrame = animationFrame; - - sprite.texture = animationFrame.frame.texture; - sprite.frame = animationFrame.frame; - - if (this.isPlaying) - { - if (animationFrame.setAlpha) - { - sprite.alpha = animationFrame.alpha; - } - - var anim = this.currentAnim; - - if (anim.onUpdate) - { - anim.onUpdate.apply(anim.callbackScope, this._updateParams); - } - - if (animationFrame.onUpdate) - { - animationFrame.onUpdate(sprite, animationFrame); - } - } + return (typeof(value) === 'number'); }, /** * [description] * - * @method Phaser.GameObjects.Components.Animation#yoyo + * @method Phaser.Tweens.Timeline#isOffsetRelative * @since 3.0.0 * - * @param {[type]} value - [description] - * - * @return {[type]} [description] - */ - yoyo: function (value) - { - if (value === undefined) - { - return this._yoyo; - } - else - { - this._yoyo = value; - - return this; - } - }, - - /** - * [description] + * @param {string} value - [description] * - * @method Phaser.GameObjects.Components.Animation#destroy - * @since 3.0.0 - */ - destroy: function () - { - // TODO - } - -}); - -module.exports = Animation; - - -/***/ }), -/* 365 */ -/***/ (function(module, exports) { - -/** -* The `Matter.Pair` module contains methods for creating and manipulating collision pairs. -* -* @class Pair -*/ - -var Pair = {}; - -module.exports = Pair; - -(function() { - - /** - * Creates a pair. - * @method create - * @param {collision} collision - * @param {number} timestamp - * @return {pair} A new pair - */ - Pair.create = function(collision, timestamp) { - var bodyA = collision.bodyA, - bodyB = collision.bodyB; - - var pair = { - id: Pair.id(bodyA, bodyB), - bodyA: bodyA, - bodyB: bodyB, - activeContacts: [], - separation: 0, - isActive: true, - confirmedActive: true, - isSensor: bodyA.isSensor || bodyB.isSensor, - timeCreated: timestamp, - timeUpdated: timestamp, - - collision: null, - inverseMass: 0, - friction: 0, - frictionStatic: 0, - restitution: 0, - slop: 0 - }; - - Pair.update(pair, collision, timestamp); - - return pair; - }; - - /** - * Updates a pair given a collision. - * @method update - * @param {pair} pair - * @param {collision} collision - * @param {number} timestamp - */ - Pair.update = function(pair, collision, timestamp) { - // var contacts = pair.contacts, - // supports = collision.supports, - // activeContacts = pair.activeContacts, - // parentA = collision.parentA, - // parentB = collision.parentB; - - pair.collision = collision; - // pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - // pair.friction = Math.min(parentA.friction, parentB.friction); - // pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - // pair.restitution = Math.max(parentA.restitution, parentB.restitution); - // pair.slop = Math.max(parentA.slop, parentB.slop); - // activeContacts.length = 0; - - if (collision.collided) { - - var supports = collision.supports, - activeContacts = pair.activeContacts, - parentA = collision.parentA, - parentB = collision.parentB; - - pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - pair.friction = Math.min(parentA.friction, parentB.friction); - pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - pair.restitution = Math.max(parentA.restitution, parentB.restitution); - pair.slop = Math.max(parentA.slop, parentB.slop); - - for (var i = 0; i < supports.length; i++) { - activeContacts[i] = supports[i].contact; - } - - var supportCount = supports.length; - - if (supportCount < activeContacts.length) { - activeContacts.length = supportCount; - } - - pair.separation = collision.depth; - Pair.setActive(pair, true, timestamp); - } else { - if (pair.isActive === true) - Pair.setActive(pair, false, timestamp); - } - }; - - /** - * Set a pair as active or inactive. - * @method setActive - * @param {pair} pair - * @param {bool} isActive - * @param {number} timestamp - */ - Pair.setActive = function(pair, isActive, timestamp) { - if (isActive) { - pair.isActive = true; - pair.timeUpdated = timestamp; - } else { - pair.isActive = false; - pair.activeContacts.length = 0; - } - }; - - /** - * Get the id for the given pair. - * @method id - * @param {body} bodyA - * @param {body} bodyB - * @return {string} Unique pairId + * @return {boolean} [description] */ - Pair.id = function(bodyA, bodyB) { - if (bodyA.id < bodyB.id) { - return 'A' + bodyA.id + 'B' + bodyB.id; - } else { - return 'A' + bodyB.id + 'B' + bodyA.id; - } - }; - -})(); - - -/***/ }), -/* 366 */ -/***/ (function(module, exports, __webpack_require__) { - -__webpack_require__(367); -__webpack_require__(368); -__webpack_require__(369); -__webpack_require__(370); -__webpack_require__(371); -__webpack_require__(372); -__webpack_require__(373); -__webpack_require__(374); -__webpack_require__(375); - - -/***/ }), -/* 367 */ -/***/ (function(module, exports) { - -/** -* A polyfill for Array.forEach -* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach -*/ -if (!Array.prototype.forEach) -{ - Array.prototype.forEach = function (fun /*, thisArg */) + isOffsetRelative: function (value) { - 'use strict'; - - if (this === void 0 || this === null) - { - throw new TypeError(); - } - - var t = Object(this); - var len = t.length >>> 0; + var t = typeof(value); - if (typeof fun !== 'function') + if (t === 'string') { - throw new TypeError(); - } - - var thisArg = arguments.length >= 2 ? arguments[1] : void 0; + var op = value[0]; - for (var i = 0; i < len; i++) - { - if (i in t) + if (op === '-' || op === '+') { - fun.call(thisArg, t[i], i, t); + return true; } } - }; -} - -/***/ }), -/* 368 */ -/***/ (function(module, exports) { + return false; + }, -/** -* A polyfill for Array.isArray -*/ -if (!Array.isArray) -{ - Array.isArray = function (arg) + /** + * [description] + * + * @method Phaser.Tweens.Timeline#getRelativeOffset + * @since 3.0.0 + * + * @param {string} value - [description] + * @param {number} base - [description] + * + * @return {number} [description] + */ + getRelativeOffset: function (value, base) { - return Object.prototype.toString.call(arg) === '[object Array]'; - }; -} - - -/***/ }), -/* 369 */ -/***/ (function(module, exports) { + var op = value[0]; + var num = parseFloat(value.substr(2)); + var result = base; -/* Copyright 2013 Chris Wilson + switch (op) + { + case '+': + result += num; + break; - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + case '-': + result -= num; + break; + } - http://www.apache.org/licenses/LICENSE-2.0 + // Cannot ever be < 0 + return Math.max(0, result); + }, - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ + /** + * [description] + * + * @method Phaser.Tweens.Timeline#calcDuration + * @since 3.0.0 + */ + calcDuration: function () + { + var prevEnd = 0; + var totalDuration = 0; + var offsetDuration = 0; -/* + for (var i = 0; i < this.totalData; i++) + { + var tween = this.data[i]; -This monkeypatch library is intended to be included in projects that are -written to the proper AudioContext spec (instead of webkitAudioContext), -and that use the new naming and proper bits of the Web Audio API (e.g. -using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may -have to run on systems that only support the deprecated bits. + tween.init(); -This library should be harmless to include if the browser supports -unprefixed "AudioContext", and/or if it supports the new names. + if (this.hasOffset(tween)) + { + if (this.isOffsetAbsolute(tween.offset)) + { + // An actual number, so it defines the start point from the beginning of the timeline + tween.calculatedOffset = tween.offset; -The patches this library handles: -if window.AudioContext is unsupported, it will be aliased to webkitAudioContext(). -if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or -noteGrainOn(), depending on parameters. + if (tween.offset === 0) + { + offsetDuration = 0; + } + } + else if (this.isOffsetRelative(tween.offset)) + { + // A relative offset (i.e. '-=1000', so starts at 'offset' ms relative to the PREVIOUS Tweens ending time) + tween.calculatedOffset = this.getRelativeOffset(tween.offset, prevEnd); + } + } + else + { + // Sequential + tween.calculatedOffset = offsetDuration; + } -The following aliases only take effect if the new names are not already in place: + prevEnd = tween.totalDuration + tween.calculatedOffset; -AudioBufferSourceNode.stop() is aliased to noteOff() -AudioContext.createGain() is aliased to createGainNode() -AudioContext.createDelay() is aliased to createDelayNode() -AudioContext.createScriptProcessor() is aliased to createJavaScriptNode() -AudioContext.createPeriodicWave() is aliased to createWaveTable() -OscillatorNode.start() is aliased to noteOn() -OscillatorNode.stop() is aliased to noteOff() -OscillatorNode.setPeriodicWave() is aliased to setWaveTable() -AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime() + totalDuration += tween.totalDuration; + offsetDuration += tween.totalDuration; + } -This library does NOT patch the enumerated type changes, as it is -recommended in the specification that implementations support both integer -and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel -BiquadFilterNode.type and OscillatorNode.type. + // Excludes loop values + this.duration = totalDuration; -*/ -(function (global, exports, perf) { - 'use strict'; + this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; - function fixSetTarget(param) { - if (!param) // if NYI, just return - return; - if (!param.setTargetAtTime) - param.setTargetAtTime = param.setTargetValueAtTime; - } + if (this.loopCounter > 0) + { + this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); + } + else + { + this.totalDuration = this.duration + this.completeDelay; + } + }, - if (window.hasOwnProperty('webkitAudioContext') && - !window.hasOwnProperty('AudioContext')) { - window.AudioContext = webkitAudioContext; + /** + * [description] + * + * @method Phaser.Tweens.Timeline#init + * @since 3.0.0 + * + * @return {boolean} [description] + */ + init: function () + { + this.calcDuration(); - if (!AudioContext.prototype.hasOwnProperty('createGain')) - AudioContext.prototype.createGain = AudioContext.prototype.createGainNode; - if (!AudioContext.prototype.hasOwnProperty('createDelay')) - AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode; - if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor')) - AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode; - if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave')) - AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable; + this.progress = 0; + this.totalProgress = 0; + if (this.paused) + { + this.state = TWEEN_CONST.PAUSED; - AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain; - AudioContext.prototype.createGain = function() { - var node = this.internal_createGain(); - fixSetTarget(node.gain); - return node; - }; + return false; + } + else + { + return true; + } + }, - AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay; - AudioContext.prototype.createDelay = function(maxDelayTime) { - var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay(); - fixSetTarget(node.delayTime); - return node; - }; + /** + * [description] + * + * @method Phaser.Tweens.Timeline#resetTweens + * @since 3.0.0 + * + * @param {boolean} resetFromLoop - [description] + */ + resetTweens: function (resetFromLoop) + { + for (var i = 0; i < this.totalData; i++) + { + var tween = this.data[i]; - AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource; - AudioContext.prototype.createBufferSource = function() { - var node = this.internal_createBufferSource(); - if (!node.start) { - node.start = function ( when, offset, duration ) { - if ( offset || duration ) - this.noteGrainOn( when || 0, offset, duration ); - else - this.noteOn( when || 0 ); - }; - } else { - node.internal_start = node.start; - node.start = function( when, offset, duration ) { - if( typeof duration !== 'undefined' ) - node.internal_start( when || 0, offset, duration ); - else - node.internal_start( when || 0, offset || 0 ); - }; - } - if (!node.stop) { - node.stop = function ( when ) { - this.noteOff( when || 0 ); - }; - } else { - node.internal_stop = node.stop; - node.stop = function( when ) { - node.internal_stop( when || 0 ); - }; - } - fixSetTarget(node.playbackRate); - return node; - }; + tween.play(resetFromLoop); + } + }, - AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor; - AudioContext.prototype.createDynamicsCompressor = function() { - var node = this.internal_createDynamicsCompressor(); - fixSetTarget(node.threshold); - fixSetTarget(node.knee); - fixSetTarget(node.ratio); - fixSetTarget(node.reduction); - fixSetTarget(node.attack); - fixSetTarget(node.release); - return node; - }; + /** + * [description] + * + * @method Phaser.Tweens.Timeline#setCallback + * @since 3.0.0 + * + * @param {string} type - [description] + * @param {function} callback - [description] + * @param {array} [params] - [description] + * @param {object} [scope] - [description] + * + * @return {Phaser.Tweens.Timeline} This Timeline object. + */ + setCallback: function (type, callback, params, scope) + { + if (Timeline.TYPES.indexOf(type) !== -1) + { + this.callbacks[type] = { func: callback, scope: scope, params: params }; + } - AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter; - AudioContext.prototype.createBiquadFilter = function() { - var node = this.internal_createBiquadFilter(); - fixSetTarget(node.frequency); - fixSetTarget(node.detune); - fixSetTarget(node.Q); - fixSetTarget(node.gain); - return node; - }; + return this; + }, - if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) { - AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator; - AudioContext.prototype.createOscillator = function() { - var node = this.internal_createOscillator(); - if (!node.start) { - node.start = function ( when ) { - this.noteOn( when || 0 ); - }; - } else { - node.internal_start = node.start; - node.start = function ( when ) { - node.internal_start( when || 0); - }; - } - if (!node.stop) { - node.stop = function ( when ) { - this.noteOff( when || 0 ); - }; - } else { - node.internal_stop = node.stop; - node.stop = function( when ) { - node.internal_stop( when || 0 ); - }; + /** + * [description] + * + * @method Phaser.Tweens.Timeline#play + * @since 3.0.0 + */ + play: function () + { + if (this.state === TWEEN_CONST.ACTIVE) + { + return; } - if (!node.setPeriodicWave) - node.setPeriodicWave = node.setWaveTable; - fixSetTarget(node.frequency); - fixSetTarget(node.detune); - return node; - }; - } - } - if (window.hasOwnProperty('webkitOfflineAudioContext') && - !window.hasOwnProperty('OfflineAudioContext')) { - window.OfflineAudioContext = webkitOfflineAudioContext; - } + if (this.paused) + { + this.paused = false; + + this.manager.makeActive(this); -}(window)); + return; + } + else + { + this.resetTweens(false); + this.state = TWEEN_CONST.ACTIVE; + } + var onStart = this.callbacks.onStart; -/***/ }), -/* 370 */ -/***/ (function(module, exports) { + if (onStart) + { + onStart.func.apply(onStart.scope, onStart.params); + } -/** - * Also fix for the absent console in IE9 - */ -if (!window.console) -{ - window.console = {}; - window.console.log = window.console.assert = function(){}; - window.console.warn = window.console.assert = function(){}; -} + this.emit('start', this); + }, + /** + * [description] + * + * @method Phaser.Tweens.Timeline#nextState + * @since 3.0.0 + */ + nextState: function () + { + if (this.loopCounter > 0) + { + // Reset the elapsed time + // TODO: Probably ought to be set to the remainder from elapsed - duration + // as the tweens nearly always over-run by a few ms due to rAf -/***/ }), -/* 371 */ -/***/ (function(module, exports) { + this.elapsed = 0; + this.progress = 0; -/** -* A polyfill for Function.prototype.bind -*/ -if (!Function.prototype.bind) { + this.loopCounter--; - /* jshint freeze: false */ - Function.prototype.bind = (function () { + var onLoop = this.callbacks.onLoop; - var slice = Array.prototype.slice; + if (onLoop) + { + onLoop.func.apply(onLoop.scope, onLoop.params); + } - return function (thisArg) { + this.emit('loop', this, this.loopCounter); - var target = this, boundArgs = slice.call(arguments, 1); + this.resetTweens(true); - if (typeof target !== 'function') + if (this.loopDelay > 0) { - throw new TypeError(); + this.countdown = this.loopDelay; + this.state = TWEEN_CONST.LOOP_DELAY; } - - function bound() { - var args = boundArgs.concat(slice.call(arguments)); - target.apply(this instanceof bound ? this : thisArg, args); + else + { + this.state = TWEEN_CONST.ACTIVE; } + } + else if (this.completeDelay > 0) + { + this.countdown = this.completeDelay; + this.state = TWEEN_CONST.COMPLETE_DELAY; + } + else + { + var onComplete = this.callbacks.onComplete; - bound.prototype = (function F(proto) { - if (proto) - { - F.prototype = proto; - } - - if (!(this instanceof F)) - { - /* jshint supernew: true */ - return new F; - } - })(target.prototype); - - return bound; - }; - })(); -} - - - -/***/ }), -/* 372 */ -/***/ (function(module, exports) { - -// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc -if (!Math.trunc) { - Math.trunc = function trunc(x) { - return x < 0 ? Math.ceil(x) : Math.floor(x); - }; -} - - -/***/ }), -/* 373 */ -/***/ (function(module, exports) { - -/** - * performance.now - */ -(function () { + if (onComplete) + { + onComplete.func.apply(onComplete.scope, onComplete.params); + } - if ('performance' in window === false) - { - window.performance = {}; - } + this.emit('complete', this); - // Thanks IE8 - Date.now = (Date.now || function () { - return new Date().getTime(); - }); + this.state = TWEEN_CONST.PENDING_REMOVE; + } + }, - if ('now' in window.performance === false) + /** + * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager. + * Otherwise, returns false. + * + * @method Phaser.Tweens.Timeline#update + * @since 3.0.0 + * + * @param {number} timestamp - [description] + * @param {number} delta - [description] + * + * @return {boolean} Returns `true` if this Timeline has finished and should be removed from the Tween Manager. + */ + update: function (timestamp, delta) { - var nowOffset = Date.now(); - - if (performance.timing && performance.timing.navigationStart) + if (this.state === TWEEN_CONST.PAUSED) { - nowOffset = performance.timing.navigationStart; + return; } - window.performance.now = function now () + var rawDelta = delta; + + if (this.useFrames) { - return Date.now() - nowOffset; + delta = 1 * this.manager.timeScale; } - } -})(); + delta *= this.timeScale; + this.elapsed += delta; + this.progress = Math.min(this.elapsed / this.duration, 1); -/***/ }), -/* 374 */ -/***/ (function(module, exports, __webpack_require__) { + this.totalElapsed += delta; + this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); -/* WEBPACK VAR INJECTION */(function(global) {// References: -// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -// https://gist.github.com/1579671 -// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision -// https://gist.github.com/timhall/4078614 -// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame + switch (this.state) + { + case TWEEN_CONST.ACTIVE: -// Expected to be used with Browserfiy -// Browserify automatically detects the use of `global` and passes the -// correct reference of `global`, `self`, and finally `window` + var stillRunning = this.totalData; -// Date.now -if (!(Date.now && Date.prototype.getTime)) { - Date.now = function now() { - return new Date().getTime(); - }; -} + for (var i = 0; i < this.totalData; i++) + { + var tween = this.data[i]; -// performance.now -if (!(global.performance && global.performance.now)) { - var startTime = Date.now(); - if (!global.performance) { - global.performance = {}; - } - global.performance.now = function () { - return Date.now() - startTime; - }; -} + if (tween.update(timestamp, rawDelta)) + { + stillRunning--; + } + } -// requestAnimationFrame -var lastTime = Date.now(); -var vendors = ['ms', 'moz', 'webkit', 'o']; + var onUpdate = this.callbacks.onUpdate; -for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { - global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; - global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || - global[vendors[x] + 'CancelRequestAnimationFrame']; -} + if (onUpdate) + { + onUpdate.func.apply(onUpdate.scope, onUpdate.params); + } -if (!global.requestAnimationFrame) { - global.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') { - throw new TypeError(callback + 'is not a function'); - } + this.emit('update', this); - var currentTime = Date.now(), - delay = 16 + lastTime - currentTime; + // Anything still running? If not, we're done + if (stillRunning === 0) + { + this.nextState(); + } - if (delay < 0) { - delay = 0; - } + break; - lastTime = currentTime; + case TWEEN_CONST.LOOP_DELAY: - return setTimeout(function () { - lastTime = Date.now(); - callback(performance.now()); - }, delay); - }; -} + this.countdown -= delta; -if (!global.cancelAnimationFrame) { - global.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; -} + if (this.countdown <= 0) + { + this.state = TWEEN_CONST.ACTIVE; + } + + break; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166))) + case TWEEN_CONST.COMPLETE_DELAY: -/***/ }), -/* 375 */ -/***/ (function(module, exports) { + this.countdown -= delta; -/** -* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9 -* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/ -* Cameron Foale (http://www.kibibu.com) -*/ -if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object") -{ - var CheapArray = function(type) - { - var proto = new Array(); // jshint ignore:line + if (this.countdown <= 0) + { + var onComplete = this.callbacks.onComplete; - window[type] = function(arg) { + if (onComplete) + { + onComplete.func.apply(onComplete.scope, onComplete.params); + } - if (typeof(arg) === "number") - { - Array.call(this, arg); - this.length = arg; + this.emit('complete', this); - for (var i = 0; i < this.length; i++) - { - this[i] = 0; + this.state = TWEEN_CONST.PENDING_REMOVE; } - } - else - { - Array.call(this, arg.length); - this.length = arg.length; + break; + } - for (var i = 0; i < this.length; i++) - { - this[i] = arg[i]; - } - } - }; + return (this.state === TWEEN_CONST.PENDING_REMOVE); + }, - window[type].prototype = proto; - window[type].constructor = window[type]; - }; + /** + * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. + * + * @method Phaser.Tweens.Timeline#stop + * @since 3.0.0 + */ + stop: function () + { + this.state = TWEEN_CONST.PENDING_REMOVE; + }, - CheapArray('Float32Array'); // jshint ignore:line - CheapArray('Uint32Array'); // jshint ignore:line - CheapArray('Uint16Array'); // jshint ignore:line - CheapArray('Int16Array'); // jshint ignore:line - CheapArray('ArrayBuffer'); // jshint ignore:line -} + /** + * [description] + * + * @method Phaser.Tweens.Timeline#pause + * @since 3.0.0 + * + * @return {Phaser.Tweens.Timeline} This Timeline object. + */ + pause: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + return; + } + this.paused = true; -/***/ }), -/* 376 */ -/***/ (function(module, exports) { + this._pausedState = this.state; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.state = TWEEN_CONST.PAUSED; -/** - * [description] - * - * @function Phaser.Actions.Angle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Angle = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].angle += value; - } + this.emit('pause', this); - return items; -}; + return this; + }, -module.exports = Angle; + /** + * [description] + * + * @method Phaser.Tweens.Timeline#resume + * @since 3.0.0 + * + * @return {Phaser.Tweens.Timeline} This Timeline object. + */ + resume: function () + { + if (this.state === TWEEN_CONST.PAUSED) + { + this.paused = false; + this.state = this._pausedState; + } -/***/ }), -/* 377 */ -/***/ (function(module, exports) { + this.emit('resume', this); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + }, -/** - * [description] - * - * @function Phaser.Actions.Call - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {function} callback - [description] - * @param {object} thisArg - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Call = function (items, callback, thisArg) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Tweens.Timeline#hasTarget + * @since 3.0.0 + * + * @param {object} target - [description] + * + * @return {boolean} [description] + */ + hasTarget: function (target) { - var item = items[i]; + for (var i = 0; i < this.data.length; i++) + { + if (this.data[i].hasTarget(target)) + { + return true; + } + } + + return false; + }, + + /** + * [description] + * + * @method Phaser.Tweens.Timeline#destroy + * @since 3.0.0 + */ + destroy: function () + { + for (var i = 0; i < this.data.length; i++) + { + this.data[i].destroy(); + } - callback.call(thisArg, item); } +}); - return items; -}; +Timeline.TYPES = [ 'onStart', 'onUpdate', 'onLoop', 'onComplete', 'onYoyo' ]; -module.exports = Call; +module.exports = Timeline; /***/ }), -/* 378 */ +/* 365 */ /***/ (function(module, exports) { /** @@ -75922,54 +75514,45 @@ module.exports = Call; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// compare = Object: -// { -// scaleX: 0.5, -// scaleY: 1 -// } +// Based on code by Mike Reinstein /** - * [description] + * Removes a single item from an array and returns it without creating gc (like the native splice does) * - * @function Phaser.Actions.GetFirst + * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} compare - [description] + * + * @param {array} array - [description] * @param {integer} index - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * + * @return {any} [description] */ -var GetFirst = function (items, compare, index) +var SpliceOne = function (array, index) { - for (var i = index; i < items.length; i++) + if (index >= array.length) { - var item = items[i]; + return; + } - var match = true; + var len = array.length - 1; - for (var property in compare) - { - if (item[property] !== compare[property]) - { - match = false; - } - } + var item = array[index]; - if (match) - { - return item; - } + for (var i = index; i < len; i++) + { + array[i] = array[i + 1]; } - return null; + array.length = len; + + return item; }; -module.exports = GetFirst; +module.exports = SpliceOne; /***/ }), -/* 379 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75978,560 +75561,822 @@ module.exports = GetFirst; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AlignIn = __webpack_require__(169); -var CONST = __webpack_require__(170); -var GetValue = __webpack_require__(4); -var NOOP = __webpack_require__(3); -var Zone = __webpack_require__(77); - -var tempZone = new Zone({ sys: { queueDepthSort: NOOP }}, 0, 0, 1, 1); +var Class = __webpack_require__(0); /** - * [description] + * @classdesc + * A Game Object Animation Controller. * - * @function Phaser.Actions.GridAlign + * This controller lives as an instance within a Game Object, accessible as `sprite.anims`. + * + * @class Animation + * @memberOf Phaser.GameObjects.Components + * @constructor * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} options - [description] * - * @return {array} The array of Game Objects that was passed to this Action. + * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation controller belongs. */ -var GridAlign = function (items, options) -{ - var width = GetValue(options, 'width', -1); - var height = GetValue(options, 'height', -1); - var cellWidth = GetValue(options, 'cellWidth', 1); - var cellHeight = GetValue(options, 'cellHeight', cellWidth); - var position = GetValue(options, 'position', CONST.TOP_LEFT); - var x = GetValue(options, 'x', 0); - var y = GetValue(options, 'y', 0); - - // var centerX = GetValue(options, 'centerX', null); - // var centerY = GetValue(options, 'centerY', null); - - var cx = 0; - var cy = 0; - var w = (width * cellWidth); - var h = (height * cellHeight); - - // If the Grid is centered on a position then we need to calculate it now - // if (centerX !== null && centerY !== null) - // { - // - // } +var Animation = new Class({ - tempZone.setPosition(x, y); - tempZone.setSize(cellWidth, cellHeight); + initialize: - for (var i = 0; i < items.length; i++) + function Animation (parent) { - AlignIn(items[i], tempZone, position); - - if (width === -1) - { - // We keep laying them out horizontally until we've done them all - cy += cellHeight; - tempZone.y += cellHeight; + /** + * The Game Object to which this animation controller belongs. + * + * @name Phaser.GameObjects.Components.Animation#parent + * @type {Phaser.GameObjects.GameObject} + * @since 3.0.0 + */ + this.parent = parent; - if (cy === h) - { - cy = 0; - tempZone.x += cellWidth; - tempZone.y = y; - } - } - else if (height === -1) - { - // We keep laying them out vertically until we've done them all - cx += cellWidth; - tempZone.x += cellWidth; + /** + * A reference to the global Animation Manager. + * + * @name Phaser.GameObjects.Components.Animation#animationManager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.animationManager = parent.scene.sys.anims; - if (cx === w) - { - cx = 0; - tempZone.x = x; - tempZone.y += cellHeight; - } - } - else - { - // We keep laying them out until we hit the column limit - cx += cellWidth; - tempZone.x += cellWidth; + this.animationManager.once('remove', this.remove, this); - if (cx === w) - { - cx = 0; - cy += cellHeight; - tempZone.x = x; - tempZone.y += cellHeight; + /** + * Is an animation currently playing or not? + * + * @name Phaser.GameObjects.Components.Animation#isPlaying + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isPlaying = false; - if (cy === h) - { - // We've hit the column limit, so return, even if there are items left - break; - } - } - } - } + // Reference to the Phaser.Animation object - return items; -}; + /** + * The current Animation loaded into this Animation Controller. + * + * @name Phaser.GameObjects.Components.Animation#currentAnim + * @type {?Phaser.Animations.Animation} + * @default null + * @since 3.0.0 + */ + this.currentAnim = null; -module.exports = GridAlign; + /** + * The current AnimationFrame being displayed by this Animation Controller. + * + * @name Phaser.GameObjects.Components.Animation#currentFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @since 3.0.0 + */ + this.currentFrame = null; + /** + * Time scale factor. + * + * @name Phaser.GameObjects.Components.Animation#_timeScale + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._timeScale = 1; -/***/ }), -/* 380 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The frame rate of playback in frames per second. + * The default is 24 if the `duration` property is `null`. + * + * @name Phaser.GameObjects.Components.Animation#frameRate + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.frameRate = 0; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * How long the animation should play for. + * If the `frameRate` property has been set then it overrides this value, + * otherwise frameRate is derived from `duration`. + * + * @name Phaser.GameObjects.Components.Animation#duration + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.duration = 0; -var Class = __webpack_require__(0); + /** + * ms per frame, not including frame specific modifiers that may be present in the Animation data. + * + * @name Phaser.GameObjects.Components.Animation#msPerFrame + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.msPerFrame = 0; -/** - * @classdesc - * [description] - * - * @class RandomDataGenerator - * @memberOf Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {array} [seeds] - [description] - */ -var RandomDataGenerator = new Class({ + /** + * Skip frames if the time lags, or always advanced anyway? + * + * @name Phaser.GameObjects.Components.Animation#skipMissedFrames + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.skipMissedFrames = true; - initialize: + /** + * A delay before starting playback, in seconds. + * + * @name Phaser.GameObjects.Components.Animation#_delay + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._delay = 0; - function RandomDataGenerator (seeds) - { /** - * Internal var. + * Number of times to repeat the animation (-1 for infinity) * - * @name Phaser.Math.RandomDataGenerator#c + * @name Phaser.GameObjects.Components.Animation#_repeat * @type {number} - * @default 1 * @private + * @default 0 * @since 3.0.0 */ - this.c = 1; + this._repeat = 0; /** - * Internal var. + * Delay before the repeat starts, in seconds. * - * @name Phaser.Math.RandomDataGenerator#s0 + * @name Phaser.GameObjects.Components.Animation#_repeatDelay * @type {number} + * @private * @default 0 + * @since 3.0.0 + */ + this._repeatDelay = 0; + + /** + * Should the animation yoyo? (reverse back down to the start) before repeating? + * + * @name Phaser.GameObjects.Components.Animation#_yoyo + * @type {boolean} * @private + * @default false * @since 3.0.0 */ - this.s0 = 0; + this._yoyo = false; /** - * Internal var. + * Will the playhead move forwards (`true`) or in reverse (`false`) * - * @name Phaser.Math.RandomDataGenerator#s1 + * @name Phaser.GameObjects.Components.Animation#forward + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.forward = true; + + /** + * Internal time overflow accumulator. + * + * @name Phaser.GameObjects.Components.Animation#accumulator * @type {number} * @default 0 - * @private * @since 3.0.0 */ - this.s1 = 0; + this.accumulator = 0; /** - * Internal var. + * The time point at which the next animation frame will change. * - * @name Phaser.Math.RandomDataGenerator#s2 + * @name Phaser.GameObjects.Components.Animation#nextTick + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.nextTick = 0; + + /** + * An internal counter keeping track of how many repeats are left to play. + * + * @name Phaser.GameObjects.Components.Animation#repeatCounter * @type {number} * @default 0 + * @since 3.0.0 + */ + this.repeatCounter = 0; + + /** + * An internal flag keeping track of pending repeats. + * + * @name Phaser.GameObjects.Components.Animation#pendingRepeat + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.pendingRepeat = false; + + /** + * Is the Animation paused? + * + * @name Phaser.GameObjects.Components.Animation#_paused + * @type {boolean} * @private + * @default false * @since 3.0.0 */ - this.s2 = 0; + this._paused = false; /** - * [description] + * Was the animation previously playing before being paused? * - * @name Phaser.Math.RandomDataGenerator#sign + * @name Phaser.GameObjects.Components.Animation#_wasPlaying + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._wasPlaying = false; + + /** + * Container for the callback arguments. + * + * @name Phaser.GameObjects.Components.Animation#_callbackArgs * @type {array} + * @private * @since 3.0.0 */ - this.sign = [ -1, 1 ]; + this._callbackArgs = [ parent, null ]; - if (seeds) + /** + * Container for the update arguments. + * + * @name Phaser.GameObjects.Components.Animation#_updateParams + * @type {array} + * @private + * @since 3.0.0 + */ + this._updateParams = []; + }, + + /** + * Sets the amount of time, in seconds that the animation will be delayed before starting playback. + * + * @method Phaser.GameObjects.Components.Animation#delay + * @since 3.0.0 + * + * @param {number} value - The amount of time, in seconds, to wait before starting playback. + * + * @return {Phaser.GameObjects.GameObject} This Game Object. + */ + delay: function (value) + { + if (value === undefined) { - this.init(seeds); + return this._delay; + } + else + { + this._delay = value; + + return this; } }, /** - * Private random helper. + * [description] * - * @method Phaser.Math.RandomDataGenerator#rnd + * @method Phaser.GameObjects.Components.Animation#delayedPlay * @since 3.0.0 - * @private * - * @return {number} [description] + * @param {[type]} delay - [description] + * @param {[type]} key - [description] + * @param {[type]} startFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - rnd: function () + delayedPlay: function (delay, key, startFrame) { - var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 + this.play(key, true, startFrame); - this.c = t | 0; - this.s0 = this.s1; - this.s1 = this.s2; - this.s2 = t - this.c; + this.nextTick += (delay * 1000); - return this.s2; + return this; }, /** - * Internal method that creates a seed hash. + * [description] * - * @method Phaser.Math.RandomDataGenerator#hash + * @method Phaser.GameObjects.Components.Animation#getCurrentKey * @since 3.0.0 - * @private - * - * @param {[type]} data - [description] * - * @return {number} The hashed value. + * @return {[type]} [description] */ - hash: function (data) + getCurrentKey: function () { - var h; - var n = 0xefc8249d; - - data = data.toString(); - - for (var i = 0; i < data.length; i++) + if (this.currentAnim) { - n += data.charCodeAt(i); - h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000;// 2^32 + return this.currentAnim.key; } - - return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 }, /** * [description] * - * @method Phaser.Math.RandomDataGenerator#init + * @method Phaser.GameObjects.Components.Animation#load * @since 3.0.0 * - * @param {string|array} seeds - [description] + * @param {string} key - [description] + * @param {integer} [startFrame=0] - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - init: function (seeds) + load: function (key, startFrame) { - if (typeof seeds === 'string') - { - this.state(seeds); - } - else + if (startFrame === undefined) { startFrame = 0; } + + if (this.isPlaying) { - this.sow(seeds); + this.stop(); } + + // Load the new animation in + this.animationManager.load(this, key, startFrame); + + return this; }, /** - * Reset the seed of the random data generator. - * - * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. + * [description] * - * @method Phaser.Math.RandomDataGenerator#sow + * @method Phaser.GameObjects.Components.Animation#pause * @since 3.0.0 * - * @param {any[]} seeds - The array of seeds: the `toString()` of each value is used. + * @param {[type]} atFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - sow: function (seeds) + pause: function (atFrame) { - // Always reset to default seed - this.s0 = this.hash(' '); - this.s1 = this.hash(this.s0); - this.s2 = this.hash(this.s1); - this.c = 1; - - if (!seeds) + if (!this._paused) { - return; + this._paused = true; + this._wasPlaying = this.isPlaying; + this.isPlaying = false; } - // Apply any seeds - for (var i = 0; i < seeds.length && (seeds[i] != null); i++) + if (atFrame !== undefined) { - var seed = seeds[i]; - - this.s0 -= this.hash(seed); - this.s0 += ~~(this.s0 < 0); - this.s1 -= this.hash(seed); - this.s1 += ~~(this.s1 < 0); - this.s2 -= this.hash(seed); - this.s2 += ~~(this.s2 < 0); + this.updateFrame(atFrame); } + + return this; }, /** - * Returns a random integer between 0 and 2^32. + * [description] * - * @method Phaser.Math.RandomDataGenerator#integer + * @method Phaser.GameObjects.Components.Animation#paused * @since 3.0.0 * - * @return {number} A random integer between 0 and 2^32. + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - integer: function () + paused: function (value) { - // 2^32 - return this.rnd() * 0x100000000; + if (value !== undefined) + { + // Setter + if (value) + { + return this.pause(); + } + else + { + return this.resume(); + } + } + else + { + return this._paused; + } }, /** - * Returns a random real number between 0 and 1. + * [description] * - * @method Phaser.Math.RandomDataGenerator#frac + * @method Phaser.GameObjects.Components.Animation#play * @since 3.0.0 * - * @return {number} A random real number between 0 and 1. + * @param {string} key - [description] + * @param {boolean} [ignoreIfPlaying=false] - [description] + * @param {integer} [startFrame=0] - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - frac: function () + play: function (key, ignoreIfPlaying, startFrame) { - // 2^-53 - return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; + if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } + if (startFrame === undefined) { startFrame = 0; } + + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === key) + { + return this; + } + + this.load(key, startFrame); + + var anim = this.currentAnim; + var gameObject = this.parent; + + // Should give us 9,007,199,254,740,991 safe repeats + this.repeatCounter = (this._repeat === -1) ? Number.MAX_VALUE : this._repeat; + + anim.getFirstTick(this); + + this.forward = true; + this.isPlaying = true; + this.pendingRepeat = false; + + if (anim.showOnStart) + { + gameObject.visible = true; + } + + if (anim.onStart) + { + anim.onStart.apply(anim.callbackScope, this._callbackArgs.concat(anim.onStartParams)); + } + + gameObject.setSizeToFrame(); + gameObject.updateDisplayOrigin(); + + return this; }, + // Value between 0 and 1. How far this animation is through, ignoring repeats and yoyos. + // If the animation has a non-zero repeat defined, progress and totalProgress will be different + // because progress doesn't include any repeats or repeatDelays whereas totalProgress does. /** - * Returns a random real number between 0 and 2^32. + * [description] * - * @method Phaser.Math.RandomDataGenerator#real + * @method Phaser.GameObjects.Components.Animation#progress * @since 3.0.0 * - * @return {number} A random real number between 0 and 2^32. + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - real: function () + progress: function (value) { - return this.integer() + this.frac(); + if (value === undefined) + { + var p = this.currentFrame.progress; + + if (!this.forward) + { + p = 1 - p; + } + + return p; + } + else + { + // TODO: Set progress + + return this; + } }, /** - * Returns a random integer between and including min and max. + * [description] * - * @method Phaser.Math.RandomDataGenerator#integerInRange + * @method Phaser.GameObjects.Components.Animation#remove * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. - * - * @return {number} A random number between min and max. + * @param {[type]} event - [description] */ - integerInRange: function (min, max) + remove: function (event) { - return Math.floor(this.realInRange(0, max - min + 1) + min); + if (event === undefined) { event = this.currentAnim; } + + if (this.isPlaying && event.key === this.currentAnim.key) + { + this.stop(); + + var sprite = this.parent; + var frame = this.currentAnim.frames[0]; + + this.currentFrame = frame; + + sprite.texture = frame.frame.texture; + sprite.frame = frame.frame; + } }, + // Gets or sets the number of times that the animation should repeat + // after its first iteration. For example, if repeat is 1, the animation will + // play a total of twice (the initial play plus 1 repeat). + // To repeat indefinitely, use -1. repeat should always be an integer. + /** - * Returns a random integer between and including min and max. - * This method is an alias for RandomDataGenerator.integerInRange. + * [description] * - * @method Phaser.Math.RandomDataGenerator#between + * @method Phaser.GameObjects.Components.Animation#repeat * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * @param {[type]} value - [description] * - * @return {number} A random number between min and max. + * @return {[type]} [description] */ - between: function (min, max) + repeat: function (value) { - return Math.floor(this.realInRange(0, max - min + 1) + min); + if (value === undefined) + { + return this._repeat; + } + else + { + this._repeat = value; + this.repeatCounter = 0; + + return this; + } }, + // Gets or sets the amount of time in seconds between repeats. + // For example, if repeat is 2 and repeatDelay is 1, the animation will play initially, + // then wait for 1 second before it repeats, then play again, then wait 1 second again + // before doing its final repeat. + /** - * Returns a random real number between min and max. + * [description] * - * @method Phaser.Math.RandomDataGenerator#realInRange + * @method Phaser.GameObjects.Components.Animation#repeatDelay * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * @param {[type]} value - [description] * - * @return {number} A random number between min and max. + * @return {[type]} [description] */ - realInRange: function (min, max) + repeatDelay: function (value) { - return this.frac() * (max - min) + min; + if (value === undefined) + { + return this._repeatDelay; + } + else + { + this._repeatDelay = value; + + return this; + } }, /** - * Returns a random real number between -1 and 1. + * [description] * - * @method Phaser.Math.RandomDataGenerator#normal + * @method Phaser.GameObjects.Components.Animation#restart * @since 3.0.0 * - * @return {number} A random real number between -1 and 1. + * @param {[type]} includeDelay - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - normal: function () + restart: function (includeDelay) { - return 1 - (2 * this.frac()); + if (includeDelay === undefined) { includeDelay = false; } + + this.currentAnim.getFirstTick(this, includeDelay); + + this.forward = true; + this.isPlaying = true; + this.pendingRepeat = false; + this._paused = false; + + // Set frame + this.updateFrame(this.currentAnim.frames[0]); + + return this; }, /** - * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * [description] * - * @method Phaser.Math.RandomDataGenerator#uuid + * @method Phaser.GameObjects.Components.Animation#resume * @since 3.0.0 * - * @return {string} A valid RFC4122 version4 ID hex string + * @param {[type]} fromFrame - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - uuid: function () + resume: function (fromFrame) { - var a = ''; - var b = ''; - - for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') + if (this._paused) { - // eslint-disable-next-line no-empty + this._paused = false; + this.isPlaying = this._wasPlaying; } - return b; + if (fromFrame !== undefined) + { + this.updateFrame(fromFrame); + } + + return this; }, /** - * Returns a random element from within the given array. + * [description] * - * @method Phaser.Math.RandomDataGenerator#pick + * @method Phaser.GameObjects.Components.Animation#stop * @since 3.0.0 * - * @param {array} array - The array to pick a random element from. + * @param {[type]} dispatchCallbacks - [description] * - * @return {any} A random member of the array. + * @return {Phaser.GameObjects.GameObject} This Game Object. */ - pick: function (array) + stop: function (dispatchCallbacks) { - return array[this.integerInRange(0, array.length - 1)]; + if (dispatchCallbacks === undefined) { dispatchCallbacks = false; } + + this.isPlaying = false; + + var anim = this.currentAnim; + + if (dispatchCallbacks && anim.onComplete) + { + anim.onComplete.apply(anim.callbackScope, this._callbackArgs.concat(anim.onCompleteParams)); + } + + return this; }, + // Scale the time (make it go faster / slower) + // Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc. + /** - * Returns a sign to be used with multiplication operator. + * [description] * - * @method Phaser.Math.RandomDataGenerator#sign + * @method Phaser.GameObjects.Components.Animation#timeScale * @since 3.0.0 * - * @return {number} -1 or +1. + * @param {[type]} value - [description] + * + * @return {[type]} [description] */ - sign: function () + timeScale: function (value) { - return this.pick(this.sign); + if (value === undefined) + { + return this._timeScale; + } + else + { + this._timeScale = value; + + return this; + } }, /** - * Returns a random element from within the given array, favoring the earlier entries. + * [description] * - * @method Phaser.Math.RandomDataGenerator#weightedPick + * @method Phaser.GameObjects.Components.Animation#totalFrames * @since 3.0.0 * - * @param {array} array - The array to pick a random element from. - * - * @return {any} A random member of the array. + * @return {[type]} [description] */ - weightedPick: function (array) + totalFrames: function () { - return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; + return this.currentAnim.frames.length; }, + // Value between 0 and 1. How far this animation is through, including things like delays + // repeats, custom frame durations, etc. If the animation is set to repeat -1 it can never + // have a duration, therefore this will return -1. /** - * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. + * [description] * - * @method Phaser.Math.RandomDataGenerator#timestamp + * @method Phaser.GameObjects.Components.Animation#totalProgres * @since 3.0.0 - * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. - * - * @return {number} A random timestamp between min and max. */ - timestamp: function (min, max) + totalProgres: function () { - return this.realInRange(min || 946684800000, max || 1577862000000); + // TODO }, /** - * Returns a random angle between -180 and 180. + * [description] * - * @method Phaser.Math.RandomDataGenerator#angle + * @method Phaser.GameObjects.Components.Animation#update * @since 3.0.0 * - * @return {number} A random number between -180 and 180. + * @param {[type]} timestamp - [description] + * @param {[type]} delta - [description] */ - angle: function () + update: function (timestamp, delta) { - return this.integerInRange(-180, 180); + if (!this.isPlaying || this.currentAnim.paused) + { + return; + } + + this.accumulator += delta * this._timeScale; + + if (this.accumulator >= this.nextTick) + { + this.currentAnim.setFrame(this); + } }, /** - * Returns a random rotation in radians, between -3.141 and 3.141 + * [description] * - * @method Phaser.Math.RandomDataGenerator#rotation + * @method Phaser.GameObjects.Components.Animation#updateFrame * @since 3.0.0 * - * @return {number} A random number between -3.141 and 3.141 + * @param {[type]} animationFrame - [description] */ - rotation: function () + updateFrame: function (animationFrame) { - return this.realInRange(-3.1415926, 3.1415926); + var sprite = this.parent; + + this.currentFrame = animationFrame; + + sprite.texture = animationFrame.frame.texture; + sprite.frame = animationFrame.frame; + + if (this.isPlaying) + { + if (animationFrame.setAlpha) + { + sprite.alpha = animationFrame.alpha; + } + + var anim = this.currentAnim; + + if (anim.onUpdate) + { + anim.onUpdate.apply(anim.callbackScope, this._updateParams); + } + + if (animationFrame.onUpdate) + { + animationFrame.onUpdate(sprite, animationFrame); + } + } }, /** - * Gets or Sets the state of the generator. This allows you to retain the values - * that the generator is using between games, i.e. in a game save file. - * - * To seed this generator with a previously saved state you can pass it as the - * `seed` value in your game config, or call this method directly after Phaser has booted. - * - * Call this method with no parameters to return the current state. - * - * If providing a state it should match the same format that this method - * returns, which is a string with a header `!rnd` followed by the `c`, - * `s0`, `s1` and `s2` values respectively, each comma-delimited. + * [description] * - * @method Phaser.Math.RandomDataGenerator#state + * @method Phaser.GameObjects.Components.Animation#yoyo * @since 3.0.0 * - * @param {string} [state] - Generator state to be set. + * @param {[type]} value - [description] * - * @return {string} The current state of the generator. + * @return {[type]} [description] */ - state: function (state) + yoyo: function (value) { - if (typeof state === 'string' && state.match(/^!rnd/)) + if (value === undefined) { - state = state.split(','); + return this._yoyo; + } + else + { + this._yoyo = value; - this.c = parseFloat(state[1]); - this.s0 = parseFloat(state[2]); - this.s1 = parseFloat(state[3]); - this.s2 = parseFloat(state[4]); + return this; } + }, - return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); + /** + * [description] + * + * @method Phaser.GameObjects.Components.Animation#destroy + * @since 3.0.0 + */ + destroy: function () + { + // TODO } }); -module.exports = RandomDataGenerator; +module.exports = Animation; /***/ }), -/* 381 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -76540,355 +76385,528 @@ module.exports = RandomDataGenerator; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(60); - -// bitmask flag for GameObject.renderMask -var _FLAG = 2; // 0010 +var BlitImage = __webpack_require__(368); +var CanvasSnapshot = __webpack_require__(369); +var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var DrawImage = __webpack_require__(370); +var GetBlendModes = __webpack_require__(371); +var ScaleModes = __webpack_require__(63); +var Smoothing = __webpack_require__(121); /** - * Provides methods used for setting the alpha properties of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Alpha + * @classdesc + * [description] + * + * @class CanvasRenderer + * @memberOf Phaser.Renderer.Canvas + * @constructor * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. */ +var CanvasRenderer = new Class({ -var Alpha = { + initialize: - _alpha: 1, + function CanvasRenderer (game) + { + /** + * The Phaser Game instance that owns this renderer. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - _alphaTL: 1, - _alphaTR: 1, - _alphaBL: 1, - _alphaBR: 1, + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.CANVAS; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.drawCount = 0; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#width + * @type {number} + * @since 3.0.0 + */ + this.width = game.config.width; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#height + * @type {number} + * @since 3.0.0 + */ + this.height = game.config.height; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: game.config.clearBeforeRender, + pixelArt: game.config.pixelArt, + backgroundColor: game.config.backgroundColor, + resolution: game.config.resolution, + autoResize: game.config.autoResize, + roundPixels: game.config.roundPixels + }; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode + * @type {integer} + * @since 3.0.0 + */ + this.scaleMode = (game.config.pixelArt) ? ScaleModes.NEAREST : ScaleModes.LINEAR; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.gameCanvas = game.canvas; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.gameContext = this.gameCanvas.getContext('2d'); + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.currentContext = this.gameContext; + + /** + * Map to the required function. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawImage + * @type {function} + * @since 3.0.0 + */ + this.drawImage = DrawImage(this.config.roundPixels); + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage + * @type {function} + * @since 3.0.0 + */ + this.blitImage = BlitImage(this.config.roundPixels); + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes + * @type {array} + * @since 3.0.0 + */ + this.blendModes = GetBlendModes(); + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentAlpha + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.currentAlpha = 1; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentBlendMode + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentBlendMode = 0; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentScaleMode = 0; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback + * @type {?function} + * @default null + * @since 3.0.0 + */ + this.snapshotCallback = null; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType + * @type {?[type]} + * @default null + * @since 3.0.0 + */ + this.snapshotType = null; + + /** + * [description] + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder + * @type {?[type]} + * @default null + * @since 3.0.0 + */ + this.snapshotEncoder = null; + + this.init(); + }, /** - * Clears all alpha values associated with this Game Object. - * Immediately sets the alpha levels back to 1 (fully opaque) + * [description] * - * @method Phaser.GameObjects.Components.Alpha#clearAlpha + * @method Phaser.Renderer.Canvas.CanvasRenderer#init * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - clearAlpha: function () + init: function () { - return this.setAlpha(1); + this.resize(this.width, this.height); }, /** - * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * If your game is running under WebGL you can optionally specify four different alpha values, each of which - * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. + * Resize the main game canvas. * - * @method Phaser.GameObjects.Components.Alpha#setAlpha + * @method Phaser.Renderer.Canvas.CanvasRenderer#resize * @since 3.0.0 - * - * @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. - * @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. - * @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. - * @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {integer} width - [description] + * @param {integer} height - [description] */ - setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) + resize: function (width, height) { - if (topLeft === undefined) { topLeft = 1; } + var resolution = this.config.resolution; - // Treat as if there is only one alpha value for the whole Game Object - if (topRight === undefined) + this.width = width * resolution; + this.height = height * resolution; + + this.gameCanvas.width = this.width; + this.gameCanvas.height = this.height; + + if (this.config.autoResize) { - this.alpha = topLeft; + this.gameCanvas.style.width = (this.width / resolution) + 'px'; + this.gameCanvas.style.height = (this.height / resolution) + 'px'; } - else + + // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) + if (this.scaleMode === ScaleModes.NEAREST) { - this._alphaTL = Clamp(topLeft, 0, 1); - this._alphaTR = Clamp(topRight, 0, 1); - this._alphaBL = Clamp(bottomLeft, 0, 1); - this._alphaBR = Clamp(bottomRight, 0, 1); + Smoothing.disable(this.gameContext); + } + }, + + /** + * [description] + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost + * @since 3.0.0 + * + * @param {function} callback - [description] + */ + onContextLost: function () + { + }, + + /** + * [description] + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored + * @since 3.0.0 + * + * @param {function} callback - [description] + */ + onContextRestored: function () + { + }, + + /** + * [description] + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform + * @since 3.0.0 + */ + resetTransform: function () + { + this.currentContext.setTransform(1, 0, 0, 1, 0, 0); + }, + + /** + * [description] + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode + * @since 3.0.0 + * + * @param {[type]} blendMode - [description] + * + * @return {[type]} [description] + */ + setBlendMode: function (blendMode) + { + if (this.currentBlendMode !== blendMode) + { + this.currentContext.globalCompositeOperation = blendMode; + this.currentBlendMode = blendMode; } - return this; + return this.currentBlendMode; }, /** - * The alpha value of the Game Object. + * [description] * - * This is a global value, impacting the entire Game Object, not just a region of it. - * - * @name Phaser.GameObjects.Components.Alpha#alpha - * @type {float} + * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha * @since 3.0.0 + * + * @param {float} alpha - [description] + * + * @return {float} [description] */ - alpha: { - - get: function () - { - return this._alpha; - }, - - set: function (value) + setAlpha: function (alpha) + { + if (this.currentAlpha !== alpha) { - var v = Clamp(value, 0, 1); - - this._alpha = v; - this._alphaTL = v; - this._alphaTR = v; - this._alphaBL = v; - this._alphaBR = v; - - if (v === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } + this.currentContext.globalAlpha = alpha; + this.currentAlpha = alpha; } + return this.currentAlpha; }, /** - * The alpha value starting from the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft - * @type {float} - * @webglOnly + * Called at the start of the render loop. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender * @since 3.0.0 */ - alphaTopLeft: { + preRender: function () + { + var ctx = this.gameContext; + var config = this.config; - get: function () - { - return this._alphaTL; - }, + var width = this.width; + var height = this.height; - set: function (value) + if (config.clearBeforeRender) { - var v = Clamp(value, 0, 1); - - this._alphaTL = v; + ctx.clearRect(0, 0, width, height); + } - if (v !== 0) - { - this.renderFlags |= _FLAG; - } + if (!config.transparent) + { + ctx.fillStyle = config.backgroundColor.rgba; + ctx.fillRect(0, 0, width, height); } + this.drawCount = 0; }, /** - * The alpha value starting from the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaTopRight - * @type {float} - * @webglOnly + * Renders the Scene to the given Camera. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.DisplayList} children - [description] + * @param {float} interpolationPercentage - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - alphaTopRight: { - - get: function () - { - return this._alphaTR; - }, + render: function (scene, children, interpolationPercentage, camera) + { + var ctx = scene.sys.context; + var scissor = (camera.x !== 0 || camera.y !== 0 || camera.width !== ctx.canvas.width || camera.height !== ctx.canvas.height); + var list = children.list; + var resolution = this.config.resolution; - set: function (value) - { - var v = Clamp(value, 0, 1); + this.currentContext = ctx; - this._alphaTR = v; + // If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops) - if (v !== 0) - { - this.renderFlags |= _FLAG; - } + if (!camera.transparent) + { + ctx.fillStyle = camera.backgroundColor.rgba; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); } - }, - - /** - * The alpha value starting from the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomLeft: { - - get: function () + if (this.currentAlpha !== 1) { - return this._alphaBL; - }, + ctx.globalAlpha = 1; + this.currentAlpha = 1; + } - set: function (value) + if (this.currentBlendMode !== 0) { - var v = Clamp(value, 0, 1); + ctx.globalCompositeOperation = 'source-over'; + this.currentBlendMode = 0; + } - this._alphaBL = v; + this.currentScaleMode = 0; - if (v !== 0) - { - this.renderFlags |= _FLAG; - } + this.drawCount += list.length; + + if (scissor) + { + ctx.save(); + ctx.beginPath(); + ctx.rect(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); + ctx.clip(); } - }, + var matrix = camera.matrix.matrix; - /** - * The alpha value starting from the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight - * @type {float} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomRight: { + ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); - get: function () + for (var c = 0; c < list.length; c++) { - return this._alphaBR; - }, + var child = list[c]; - set: function (value) - { - var v = Clamp(value, 0, 1); + if (child.mask) + { + child.mask.preRenderCanvas(this, child, camera); + } - this._alphaBR = v; + child.renderCanvas(this, child, interpolationPercentage, camera); - if (v !== 0) + if (child.mask) { - this.renderFlags |= _FLAG; + child.mask.postRenderCanvas(this, child, camera); } } - } - -}; - -module.exports = Alpha; - - -/***/ }), -/* 382 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + ctx.setTransform(1, 0, 0, 1, 0, 0); -var BlendModes = __webpack_require__(45); + if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) + { + ctx.globalCompositeOperation = 'source-over'; + + // fade rendering + ctx.fillStyle = 'rgb(' + (camera._fadeRed * 255) + ',' + (camera._fadeGreen * 255) + ',' + (camera._fadeBlue * 255) + ')'; + ctx.globalAlpha = camera._fadeAlpha; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); -/** - * Provides methods used for setting the blend mode of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.BlendMode - * @since 3.0.0 - */ + // flash rendering + ctx.fillStyle = 'rgb(' + (camera._flashRed * 255) + ',' + (camera._flashGreen * 255) + ',' + (camera._flashBlue * 255) + ')'; + ctx.globalAlpha = camera._flashAlpha; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); -var BlendMode = { + ctx.globalAlpha = 1.0; + } - _blendMode: BlendModes.NORMAL, + // Reset the camera scissor + if (scissor) + { + ctx.restore(); + } + }, /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN - * - * Canvas has more available depending on browser support. - * - * You can also create your own custom Blend Modes in WebGL. + * [description] * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency of which blend modes - * are used. - * - * @name Phaser.GameObjects.Components.BlendMode#blendMode - * @type {integer|string} + * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender * @since 3.0.0 */ - blendMode: { - - get: function () - { - return this._blendMode; - }, + postRender: function () + { + var ctx = this.gameContext; - set: function (value) - { - if (typeof value === 'string') - { - value = BlendModes[value]; - } + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; - value | 0; + this.currentAlpha = 1; + this.currentBlendMode = 0; - if (value >= 0) - { - this._blendMode = value; - } + if (this.snapshotCallback) + { + this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); + this.snapshotCallback = null; } - }, /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN + * [description] * - * Canvas has more available depending on browser support. + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot + * @since 3.0.0 * - * You can also create your own custom Blend Modes in WebGL. + * @param {[type]} callback - [description] + * @param {[type]} type - [description] + * @param {[type]} encoderOptions - [description] + */ + snapshot: function (callback, type, encoderOptions) + { + this.snapshotCallback = callback; + this.snapshotType = type; + this.snapshotEncoder = encoderOptions; + }, + + /** + * [description] * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency of which blend modes - * are used. - * - * @method Phaser.GameObjects.Components.BlendMode#setBlendMode + * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy * @since 3.0.0 - * - * @param {string|integer} value - The BlendMode value. Either a string or a CONST. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - setBlendMode: function (value) + destroy: function () { - this.blendMode = value; + this.gameCanvas = null; + this.gameContext = null; - return this; + this.game = null; } -}; +}); -module.exports = BlendMode; +module.exports = CanvasRenderer; /***/ }), -/* 383 */ +/* 368 */ /***/ (function(module, exports) { /** @@ -76897,85 +76915,54 @@ module.exports = BlendMode; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var roundPixels = false; + /** - * Provides methods used for setting the blend mode of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.ComputedSize + * No scaling, anchor, rotation or effects, literally draws the frame directly to the canvas. + * + * @function Phaser.Renderer.Canvas.BlitImage * @since 3.0.0 + * + * @param {number} dx - The x coordinate to render the Frame to. + * @param {number} dy - The y coordinate to render the Frame to. + * @param {Phaser.Textures.Frame} frame - The Frame to render. */ +var BlitImage = function (dx, dy, frame) +{ + var ctx = this.currentContext; + var cd = frame.canvasData; -var ComputedSize = { - - /** - * The native (un-scaled) width of this Game Object. - * - * @name Phaser.GameObjects.Components.ComputedSize#width - * @type {number} - * @since 3.0.0 - */ - width: 0, - - /** - * The native (un-scaled) height of this Game Object. - * - * @name Phaser.GameObjects.Components.ComputedSize#height - * @type {number} - * @since 3.0.0 - */ - height: 0, - - /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayWidth - * @type {number} - * @since 3.0.0 - */ - displayWidth: { - - get: function () - { - return this.scaleX * this.width; - }, - - set: function (value) - { - this.scaleX = value / this.width; - } - - }, - - /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayHeight - * @type {number} - * @since 3.0.0 - */ - displayHeight: { + if (roundPixels) + { + dx |= 0; + dy |= 0; + } - get: function () - { - return this.scaleY * this.height; - }, + ctx.drawImage( + frame.source.image, + cd.sx, + cd.sy, + cd.sWidth, + cd.sHeight, + dx, + dy, + cd.dWidth, + cd.dHeight + ); +}; - set: function (value) - { - this.scaleY = value / this.height; - } +// Special return so we can store the config value locally - } +module.exports = function (configRoundPixels) +{ + roundPixels = configRoundPixels; + return BlitImage; }; -module.exports = ComputedSize; - /***/ }), -/* 384 */ +/* 369 */ /***/ (function(module, exports) { /** @@ -76985,81 +76972,36 @@ module.exports = ComputedSize; */ /** - * Provides methods used for setting the depth of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Depth + * [description] + * + * @function Phaser.Renderer.Snapshot.Canvas * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - [description] + * @param {string} [type='image/png'] - [description] + * @param {float} [encoderOptions=0.92] - [description] + * + * @return {Image} [description] */ +var CanvasSnapshot = function (canvas, type, encoderOptions) +{ + if (type === undefined) { type = 'image/png'; } + if (encoderOptions === undefined) { encoderOptions = 0.92; } -var Depth = { - - _depth: 0, - - /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth - * value will always render in front of one with a lower value. - * - * Setting the depth will queue a depth sort event within the Scene. - * - * @name Phaser.GameObjects.Components.Depth#depth - * @type {number} - * @since 3.0.0 - */ - depth: { - - get: function () - { - return this._depth; - }, - - set: function (value) - { - this.scene.sys.queueDepthSort(); - this._depth = value; - } - - }, - - /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth - * value will always render in front of one with a lower value. - * - * Setting the depth will queue a depth sort event within the Scene. - * - * @method Phaser.GameObjects.Components.Depth#setDepth - * @since 3.0.0 - * - * @param {integer} value - The depth of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setDepth: function (value) - { - if (value === undefined) { value = 0; } + var src = canvas.toDataURL(type, encoderOptions); - this.depth = value; + var image = new Image(); - return this; - } + image.src = src; + return image; }; -module.exports = Depth; +module.exports = CanvasSnapshot; /***/ }), -/* 385 */ +/* 370 */ /***/ (function(module, exports) { /** @@ -77068,146 +77010,113 @@ module.exports = Depth; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var roundPixels = false; + /** - * Provides methods used for visually flipping a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Flip + * [description] + * + * @function Phaser.Renderer.Canvas.DrawImage * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} src - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ +var DrawImage = function (src, camera) +{ + var ctx = this.currentContext; + var frame = src.frame; + var cd = frame.canvasData; -var Flip = { + // Blend Mode - /** - * The horizontally flipped state of the Game Object. - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * - * @name Phaser.GameObjects.Components.Flip#flipX - * @type {boolean} - * @default false - * @since 3.0.0 - */ - flipX: false, + if (this.currentBlendMode !== src.blendMode) + { + this.currentBlendMode = src.blendMode; + ctx.globalCompositeOperation = this.blendModes[src.blendMode]; + } - /** - * The vertically flipped state of the Game Object. - * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * - * @name Phaser.GameObjects.Components.Flip#flipY - * @type {boolean} - * @default false - * @since 3.0.0 - */ - flipY: false, + // Alpha - /** - * Toggles the horizontal flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipX - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - toggleFlipX: function () + if (this.currentAlpha !== src.alpha) { - this.flipX = !this.flipX; + this.currentAlpha = src.alpha; + ctx.globalAlpha = src.alpha; + } - return this; - }, + // Smoothing - /** - * Toggles the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipY - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - toggleFlipY: function () + if (this.currentScaleMode !== src.scaleMode) { - this.flipY = !this.flipY; + this.currentScaleMode = src.scaleMode; - return this; - }, + // ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR); + } - /** - * Sets the horizontal flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlipX - * @since 3.0.0 - * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setFlipX: function (value) - { - this.flipX = value; + var dx = frame.x; + var dy = frame.y; - return this; - }, + var fx = 1; + var fy = 1; - /** - * Sets the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlipY - * @since 3.0.0 - * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setFlipY: function (value) + if (src.flipX) { - this.flipY = value; - - return this; - }, + fx = -1; + dx -= cd.dWidth - src.displayOriginX; + } + else + { + dx -= src.displayOriginX; + } - /** - * Sets the horizontal and vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlip - * @since 3.0.0 - * - * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setFlip: function (x, y) + if (src.flipY) { - this.flipX = x; - this.flipY = y; + fy = -1; + dy -= cd.dHeight - src.displayOriginY; + } + else + { + dy -= src.displayOriginY; + } - return this; - }, + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; - /** - * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. - * - * @method Phaser.GameObjects.Components.Flip#resetFlip - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - resetFlip: function () + if (roundPixels) { - this.flipX = false; - this.flipY = false; - - return this; + tx |= 0; + ty |= 0; + dx |= 0; + dy |= 0; } + // Perform Matrix ITRS + + ctx.save(); + + ctx.translate(tx, ty); + + ctx.rotate(src.rotation); + + ctx.scale(src.scaleX, src.scaleY); + ctx.scale(fx, fy); + + ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, dx, dy, cd.dWidth, cd.dHeight); + + ctx.restore(); }; -module.exports = Flip; +// Special return so we can store the config value locally + +module.exports = function (configRoundPixels) +{ + roundPixels = configRoundPixels; + + return DrawImage; +}; /***/ }), -/* 386 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -77216,1545 +77125,1870 @@ module.exports = Flip; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Rectangle = __webpack_require__(8); -var RotateAround = __webpack_require__(185); -var Vector2 = __webpack_require__(6); +var modes = __webpack_require__(45); +var CanvasFeatures = __webpack_require__(237); /** - * Provides methods used for obtaining the bounds of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.GetBounds + * [description] + * + * @function Phaser.Renderer.Canvas.GetBlendModes * @since 3.0.0 + * + * @return {array} [description] */ +var GetBlendModes = function () +{ + var output = []; + var useNew = CanvasFeatures.supportNewBlendModes; -var GetBounds = { - - /** - * Gets the center coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getCenter - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. - */ - getCenter: function (output) - { - if (output === undefined) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); - output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); - - return output; - }, - - /** - * Gets the top-left corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getTopLeft - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. - */ - getTopLeft: function (output) - { - if (output === undefined) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = this.y - (this.displayHeight * this.originY); - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } - - return output; - }, - - /** - * Gets the top-right corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getTopRight - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. - */ - getTopRight: function (output) - { - if (output === undefined) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = this.y - (this.displayHeight * this.originY); - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } + output[modes.NORMAL] = 'source-over'; + output[modes.ADD] = 'lighter'; + output[modes.MULTIPLY] = (useNew) ? 'multiply' : 'source-over'; + output[modes.SCREEN] = (useNew) ? 'screen' : 'source-over'; + output[modes.OVERLAY] = (useNew) ? 'overlay' : 'source-over'; + output[modes.DARKEN] = (useNew) ? 'darken' : 'source-over'; + output[modes.LIGHTEN] = (useNew) ? 'lighten' : 'source-over'; + output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : 'source-over'; + output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : 'source-over'; + output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : 'source-over'; + output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : 'source-over'; + output[modes.DIFFERENCE] = (useNew) ? 'difference' : 'source-over'; + output[modes.EXCLUSION] = (useNew) ? 'exclusion' : 'source-over'; + output[modes.HUE] = (useNew) ? 'hue' : 'source-over'; + output[modes.SATURATION] = (useNew) ? 'saturation' : 'source-over'; + output[modes.COLOR] = (useNew) ? 'color' : 'source-over'; + output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : 'source-over'; - return output; - }, + return output; +}; - /** - * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. - */ - getBottomLeft: function (output) - { - if (output === undefined) { output = new Vector2(); } +module.exports = GetBlendModes; - output.x = this.x - (this.displayWidth * this.originX); - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } +/***/ }), +/* 372 */ +/***/ (function(module, exports, __webpack_require__) { - return output; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. - * - * @method Phaser.GameObjects.Components.GetBounds#getBottomRight - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2|object} The values stored in the output object. - */ - getBottomRight: function (output) - { - if (output === undefined) { output = new Vector2(); } +var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var IsSizePowerOfTwo = __webpack_require__(126); +var Utils = __webpack_require__(41); +var WebGLSnapshot = __webpack_require__(373); - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; +// Default Pipelines +var BitmapMaskPipeline = __webpack_require__(374); +var FlatTintPipeline = __webpack_require__(375); +var ForwardDiffuseLightPipeline = __webpack_require__(163); +var TextureTintPipeline = __webpack_require__(164); - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } +/** + * @classdesc + * [description] + * + * @class WebGLRenderer + * @memberOf Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - [description] + */ +var WebGLRenderer = new Class({ - return output; - }, + initialize: - /** - * Gets the bounds of this Game Object, regardless of origin. - * The values are stored and returned in a Rectangle, or Rectangle-like, object. - * - * @method Phaser.GameObjects.Components.GetBounds#getBounds - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle|object} [output] - An object to store the values in. If not provided a new Rectangle will be created. - * - * @return {Phaser.Geom.Rectangle|object} The values stored in the output object. - */ - getBounds: function (output) + function WebGLRenderer (game) { - if (output === undefined) { output = new Rectangle(); } - - // We can use the output object to temporarily store the x/y coords in: - - this.getTopLeft(output); - - var TLx = output.x; - var TLy = output.y; - - this.getTopRight(output); - - var TRx = output.x; - var TRy = output.y; - - this.getBottomLeft(output); - - var BLx = output.x; - var BLy = output.y; - - this.getBottomRight(output); - - var BRx = output.x; - var BRy = output.y; - - output.x = Math.min(TLx, TRx, BLx, BRx); - output.y = Math.min(TLy, TRy, BLy, BRy); - output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; - output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; - - return output; - } - -}; - -module.exports = GetBounds; - - -/***/ }), -/* 387 */ -/***/ (function(module, exports) { + // eslint-disable-next-line consistent-this + var renderer = this; -var MatrixStack = { + var contextCreationConfig = { + alpha: game.config.transparent, + depth: false, // enable when 3D is added in the future + antialias: game.config.antialias, + premultipliedAlpha: game.config.transparent, + stencil: true, + preserveDrawingBuffer: game.config.preserveDrawingBuffer, + failIfMajorPerformanceCaveat: false, + powerPreference: game.config.powerPreference + }; - matrixStack: null, - currentMatrix: null, - currentMatrixIndex: 0, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: game.config.clearBeforeRender, + pixelArt: game.config.pixelArt, + backgroundColor: game.config.backgroundColor, + contextCreation: contextCreationConfig, + resolution: game.config.resolution, + autoResize: game.config.autoResize, + roundPixels: game.config.roundPixels + }; - initMatrixStack: function () - { - this.matrixStack = new Float32Array(6000); // up to 1000 matrices - this.currentMatrix = new Float32Array([1.0, 0.0, 0.0, 1.0, 0.0, 0.0]); - this.currentMatrixIndex = 0; - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - save: function () - { - if (this.currentMatrixIndex >= this.matrixStack.length) return this; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#type + * @type {integer} + * @since 3.0.0 + */ + this.type = CONST.WEBGL; - var matrixStack = this.matrixStack; - var currentMatrix = this.currentMatrix; - var currentMatrixIndex = this.currentMatrixIndex; - this.currentMatrixIndex += 6; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#width + * @type {number} + * @since 3.0.0 + */ + this.width = game.config.width; - matrixStack[currentMatrixIndex + 0] = currentMatrix[0]; - matrixStack[currentMatrixIndex + 1] = currentMatrix[1]; - matrixStack[currentMatrixIndex + 2] = currentMatrix[2]; - matrixStack[currentMatrixIndex + 3] = currentMatrix[3]; - matrixStack[currentMatrixIndex + 4] = currentMatrix[4]; - matrixStack[currentMatrixIndex + 5] = currentMatrix[5]; - - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#height + * @type {number} + * @since 3.0.0 + */ + this.height = game.config.height; - restore: function () - { - if (this.currentMatrixIndex <= 0) return this; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = game.canvas; - this.currentMatrixIndex -= 6; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks + * @type {function[]} + * @since 3.0.0 + */ + this.lostContextCallbacks = []; - var matrixStack = this.matrixStack; - var currentMatrix = this.currentMatrix; - var currentMatrixIndex = this.currentMatrixIndex; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks + * @type {function[]} + * @since 3.0.0 + */ + this.restoredContextCallbacks = []; - currentMatrix[0] = matrixStack[currentMatrixIndex + 0]; - currentMatrix[1] = matrixStack[currentMatrixIndex + 1]; - currentMatrix[2] = matrixStack[currentMatrixIndex + 2]; - currentMatrix[3] = matrixStack[currentMatrixIndex + 3]; - currentMatrix[4] = matrixStack[currentMatrixIndex + 4]; - currentMatrix[5] = matrixStack[currentMatrixIndex + 5]; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.blendModes = []; - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.nativeTextures = []; - loadIdentity: function () - { - this.setTransform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.contextLost = false; - transform: function (a, b, c, d, tx, ty) - { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var m4 = currentMatrix[4]; - var m5 = currentMatrix[5]; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @type {object} + * @default null + * @since 3.0.0 + */ + this.pipelines = null; - currentMatrix[0] = m0 * a + m2 * b; - currentMatrix[1] = m1 * a + m3 * b; - currentMatrix[2] = m0 * c + m2 * d; - currentMatrix[3] = m1 * c + m3 * d; - currentMatrix[4] = m0 * tx + m2 * ty + m4; - currentMatrix[5] = m1 * tx + m3 * ty + m5; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState + * @type {object} + * @since 3.0.0 + */ + this.snapshotState = { + callback: null, + type: null, + encoder: null + }; - return this; - }, + // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) - setTransform: function (a, b, c, d, tx, ty) - { - var currentMatrix = this.currentMatrix; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit + * @type {integer} + * @since 3.1.0 + */ + this.currentActiveTextureUnit = 0; - currentMatrix[0] = a; - currentMatrix[1] = b; - currentMatrix[2] = c; - currentMatrix[3] = d; - currentMatrix[4] = tx; - currentMatrix[5] = ty; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures + * @type {array} + * @since 3.0.0 + */ + this.currentTextures = new Array(16); - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer + * @type {WebGLFramebuffer} + * @default null + * @since 3.0.0 + */ + this.currentFramebuffer = null; - translate: function (x, y) - { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var m4 = currentMatrix[4]; - var m5 = currentMatrix[5]; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @since 3.0.0 + */ + this.currentPipeline = null; - currentMatrix[4] = m0 * x + m2 * y + m4; - currentMatrix[5] = m1 * x + m3 * y + m5; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram + * @type {WebGLProgram} + * @default null + * @since 3.0.0 + */ + this.currentProgram = null; - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentVertexBuffer = null; - scale: function (x, y) - { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer + * @type {WebGLBuffer} + * @default null + * @since 3.0.0 + */ + this.currentIndexBuffer = null; - currentMatrix[0] = m0 * x; - currentMatrix[1] = m1 * x; - currentMatrix[2] = m2 * y; - currentMatrix[3] = m3 * y; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode + * @type {integer} + * @since 3.0.0 + */ + this.currentBlendMode = Infinity; - return this; - }, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.currentScissorEnabled = false; - rotate: function (t) - { - var currentMatrix = this.currentMatrix; - var m0 = currentMatrix[0]; - var m1 = currentMatrix[1]; - var m2 = currentMatrix[2]; - var m3 = currentMatrix[3]; - var st = Math.sin(t); - var ct = Math.cos(t); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor + * @type {Uint32Array} + * @since 3.0.0 + */ + this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); - currentMatrix[0] = m0 * ct + m2 * st; - currentMatrix[1] = m1 * ct + m3 * st; - currentMatrix[2] = m2 * -st + m2 * ct; - currentMatrix[3] = m3 * -st + m3 * ct; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorIdx + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.currentScissorIdx = 0; - return this; - } + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack + * @type {Uint32Array} + * @since 3.0.0 + */ + this.scissorStack = new Uint32Array(4 * 1000); -}; + // Setup context lost and restore event listeners -module.exports = MatrixStack; + this.canvas.addEventListener('webglcontextlost', function (event) + { + renderer.contextLost = true; + event.preventDefault(); + for (var index = 0; index < renderer.lostContextCallbacks.length; ++index) + { + var callback = renderer.lostContextCallbacks[index]; + callback[0].call(callback[1], renderer); + } + }, false); -/***/ }), -/* 388 */ -/***/ (function(module, exports) { + this.canvas.addEventListener('webglcontextrestored', function () + { + renderer.contextLost = false; + renderer.init(renderer.config); + for (var index = 0; index < renderer.restoredContextCallbacks.length; ++index) + { + var callback = renderer.restoredContextCallbacks[index]; + callback[0].call(callback[1], renderer); + } + }, false); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // This are initialized post context creation -/** - * Provides methods used for getting and setting the origin of a Game Object. - * Values are normalized, given in the range 0 to 1. - * Display values contain the calculated pixel values. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Origin - * @since 3.0.0 - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#gl + * @type {WebGLRenderingContext} + * @default null + * @since 3.0.0 + */ + this.gl = null; -var Origin = { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions + * @type {object} + * @default null + * @since 3.0.0 + */ + this.supportedExtensions = null; - /** - * The horizontal origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the left of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originX - * @type {float} - * @default 0.5 - * @since 3.0.0 - */ - originX: 0.5, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.extensions = {}; - /** - * The vertical origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the top of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originY - * @type {float} - * @default 0.5 - * @since 3.0.0 - */ - originY: 0.5, + /** + * [description] + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats + * @type {array} + * @default [] + * @since 3.2.0 + */ + this.glFormats = []; - // private + read only - _displayOriginX: 0, - _displayOriginY: 0, + this.init(this.config); + }, /** - * The horizontal display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. - * - * @name Phaser.GameObjects.Components.Origin#displayOriginX - * @type {float} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#init * @since 3.0.0 + * + * @param {object} config - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - displayOriginX: { - - get: function () + init: function (config) + { + var canvas = this.canvas; + var clearColor = config.backgroundColor; + var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); + + if (!gl) { - return this._displayOriginX; - }, + this.contextLost = true; + throw new Error('This browser does not support WebGL. Try using the Canvas pipeline.'); + } - set: function (value) + this.gl = gl; + + for (var i = 0; i <= 16; i++) { - this._displayOriginX = value; - this.originX = value / this.width; + this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); } - }, + this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; + this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; + this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; - /** - * The vertical display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. - * - * @name Phaser.GameObjects.Components.Origin#displayOriginY - * @type {float} - * @since 3.0.0 - */ - displayOriginY: { + this.glFormats[0] = gl.BYTE; + this.glFormats[1] = gl.SHORT; + this.glFormats[2] = gl.UNSIGNED_BYTE; + this.glFormats[3] = gl.UNSIGNED_SHORT; + this.glFormats[4] = gl.FLOAT; - get: function () - { - return this._displayOriginY; - }, + // Load supported extensions + this.supportedExtensions = gl.getSupportedExtensions(); - set: function (value) + // Setup initial WebGL state + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.disable(gl.SCISSOR_TEST); + gl.enable(gl.BLEND); + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1.0); + + // Initialize all textures to null + for (var index = 0; index < this.currentTextures.length; ++index) { - this._displayOriginY = value; - this.originY = value / this.height; + this.currentTextures[index] = null; } + // Clear previous pipelines and reload default ones + this.pipelines = {}; + + this.addPipeline('TextureTintPipeline', new TextureTintPipeline({ game: this.game, renderer: this })); + this.addPipeline('FlatTintPipeline', new FlatTintPipeline({ game: this.game, renderer: this })); + this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: this.game, renderer: this })); + this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: this.game, renderer: this })); + + this.setBlendMode(CONST.BlendModes.NORMAL); + this.resize(this.width, this.height); + + return this; }, /** - * Sets the origin of this Game Object. + * [description] * - * The values are given in the range 0 to 1. - * - * @method Phaser.GameObjects.Components.Origin#setOrigin + * @method Phaser.Renderer.WebGL.WebGLRenderer#resize * @since 3.0.0 * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=0.5] - The vertical origin value. If not defined it will be set to the value of `x`. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {number} width - [description] + * @param {number} height - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setOrigin: function (x, y) + resize: function (width, height) { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } - - this.originX = x; - this.originY = y; + var gl = this.gl; + var pipelines = this.pipelines; + var resolution = this.config.resolution; - return this.updateDisplayOrigin(); - }, + this.width = width * resolution; + this.height = height * resolution; + + this.canvas.width = this.width; + this.canvas.height = this.height; - /** - * Sets the origin of this Game Object based on the Pivot values in its Frame. - * - * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame - * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setOriginFromFrame: function () - { - if (!this.frame || !this.frame.customPivot) + if (this.config.autoResize) { - return this.setOrigin(); + this.canvas.style.width = (this.width / resolution) + 'px'; + this.canvas.style.height = (this.height / resolution) + 'px'; } - else + + gl.viewport(0, 0, this.width, this.height); + + // Update all registered pipelines + for (var pipelineName in pipelines) { - this.originX = this.frame.pivotX; - this.originY = this.frame.pivotY; + pipelines[pipelineName].resize(width, height, resolution); } - return this.updateDisplayOrigin(); + return this; }, /** - * Sets the display origin of this Game Object. - * The difference between this and setting the origin is that you can use pixel values for setting the display origin. - * - * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored * @since 3.0.0 * - * @param {number} [x=0] - The horizontal display origin value. - * @param {number} [y=0] - The vertical display origin value. If not defined it will be set to the value of `x`. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {function} callback - [description] + * @param {object} target - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setDisplayOrigin: function (x, y) + onContextRestored: function (callback, target) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - - this.displayOriginX = x; - this.displayOriginY = y; - + this.restoredContextCallbacks.push([ callback, target ]); return this; }, /** - * Updates the Display Origin cached values internally stored on this Game Object. - * You don't usually call this directly, but it is exposed for edge-cases where you may. - * - * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {function} callback - [description] + * @param {object} target - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - updateDisplayOrigin: function () + onContextLost: function (callback, target) { - this._displayOriginX = Math.round(this.originX * this.width); - this._displayOriginY = Math.round(this.originY * this.height); - + this.lostContextCallbacks.push([ callback, target ]); return this; - } - -}; - -module.exports = Origin; - - -/***/ }), -/* 389 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var ScaleModes = __webpack_require__(62); - -/** - * Provides methods used for getting and setting the scale of a Game Object. - * - * @name Phaser.GameObjects.Components.ScaleMode - * @since 3.0.0 - */ - -var ScaleMode = { - - _scaleMode: ScaleModes.DEFAULT, + }, /** - * The Scale Mode being used by this Game Object. - * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. - * - * @name Phaser.GameObjects.Components.ScaleMode#scaleMode - * @type {integer} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension * @since 3.0.0 + * + * @param {string} extensionName - [description] + * + * @return {boolean} [description] */ - scaleMode: { + hasExtension: function (extensionName) + { + return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; + }, - get: function () - { - return this._scaleMode; - }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension + * @since 3.0.0 + * + * @param {string} extensionName - [description] + * + * @return {object} [description] + */ + getExtension: function (extensionName) + { + if (!this.hasExtension(extensionName)) { return null; } - set: function (value) + if (!(extensionName in this.extensions)) { - if (value === ScaleModes.LINEAR || value === ScaleModes.NEAREST) - { - this._scaleMode = value; - } + this.extensions[extensionName] = this.gl.getExtension(extensionName); } + return this.extensions[extensionName]; }, /** - * Sets the Scale Mode being used by this Game Object. - * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. - * - * @method Phaser.GameObjects.Components.ScaleMode#setScaleMode - * @since 3.0.0 + * [description] * - * @param {integer} value - The Scale Mode to be used by this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @method Phaser.Renderer.WebGL.WebGLRenderer#flush + * @since 3.0.0 */ - setScaleMode: function (value) + flush: function () { - this.scaleMode = value; - - return this; - } - -}; - -module.exports = ScaleMode; - - -/***/ }), -/* 390 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Provides methods used for getting and setting the Scroll Factor of a Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor - * @since 3.0.0 - */ + if (this.currentPipeline) + { + this.currentPipeline.flush(); + } + }, -var ScrollFactor = { + /* Renderer State Manipulation Functions */ /** - * The horizontal scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX - * @type {number} - * @default 1 + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline * @since 3.0.0 + * + * @param {string} pipelineName - [description] + * + * @return {boolean} [description] */ - scrollFactorX: 1, + hasPipeline: function (pipelineName) + { + return (pipelineName in this.pipelines); + }, /** - * The vertical scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY - * @type {number} - * @default 1 + * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline * @since 3.0.0 + * + * @param {string} pipelineName - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - scrollFactorY: 1, + getPipeline: function (pipelineName) + { + return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; + }, /** - * Sets the scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * [description] * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor + * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline * @since 3.0.0 * - * @param {number} x - The horizontal scroll factor of this Game Object. - * @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {string} pipelineName - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setScrollFactor: function (x, y) + removePipeline: function (pipelineName) { - if (y === undefined) { y = x; } - - this.scrollFactorX = x; - this.scrollFactorY = y; - + delete this.pipelines[pipelineName]; return this; - } - -}; - -module.exports = ScrollFactor; - - -/***/ }), -/* 391 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * Provides methods used for getting and setting the size of a Game Object. - * - * @name Phaser.GameObjects.Components.Size - * @since 3.0.0 - */ - -var Size = { + }, /** - * The native (un-scaled) width of this Game Object. - * - * @name Phaser.GameObjects.Components.Size#width - * @type {number} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline * @since 3.0.0 + * + * @param {string} pipelineName - [description] + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - width: 0, + addPipeline: function (pipelineName, pipelineInstance) + { + if (!this.hasPipeline(pipelineName)) { this.pipelines[pipelineName] = pipelineInstance; } + else { console.warn('Pipeline', pipelineName, ' already exists.'); } - /** - * The native (un-scaled) height of this Game Object. - * - * @name Phaser.GameObjects.Components.Size#height - * @type {number} - * @since 3.0.0 - */ - height: 0, + pipelineInstance.name = pipelineName; + this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); + + return pipelineInstance; + }, /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.Size#displayWidth - * @type {number} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor * @since 3.0.0 + * + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} w - [description] + * @param {integer} h - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - displayWidth: { + setScissor: function (x, y, w, h) + { + var gl = this.gl; + var currentScissor = this.currentScissor; + var enabled = (x === 0 && y === 0 && w === gl.canvas.width && h === gl.canvas.height && w >= 0 && h >= 0); - get: function () + if (currentScissor[0] !== x || + currentScissor[1] !== y || + currentScissor[2] !== w || + currentScissor[3] !== h) { - return this.scaleX * this.frame.realWidth; - }, + this.flush(); + } - set: function (value) + currentScissor[0] = x; + currentScissor[1] = y; + currentScissor[2] = w; + currentScissor[3] = h; + + this.currentScissorEnabled = enabled; + + if (enabled) { - this.scaleX = value / this.frame.realWidth; + gl.disable(gl.SCISSOR_TEST); + return; } + gl.enable(gl.SCISSOR_TEST); + gl.scissor(x, (gl.drawingBufferHeight - y - h), w, h); + + return this; }, /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. - * - * @name Phaser.GameObjects.Components.Size#displayHeight - * @type {number} + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor * @since 3.0.0 + * + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} w - [description] + * @param {integer} h - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - displayHeight: { - - get: function () - { - return this.scaleY * this.frame.realHeight; - }, + pushScissor: function (x, y, w, h) + { + var scissorStack = this.scissorStack; + var stackIndex = this.currentScissorIdx; + var currentScissor = this.currentScissor; - set: function (value) - { - this.scaleY = value / this.frame.realHeight; - } + scissorStack[stackIndex + 0] = currentScissor[0]; + scissorStack[stackIndex + 1] = currentScissor[1]; + scissorStack[stackIndex + 2] = currentScissor[2]; + scissorStack[stackIndex + 3] = currentScissor[3]; + + this.currentScissorIdx += 4; + this.setScissor(x, y, w, h); + return this; }, /** - * Sets the size of this Game Object to be that of the given Frame. - * - * @method Phaser.GameObjects.Components.Size#setSizeToFrame + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor * @since 3.0.0 * - * @param {Phaser.Textures.Frame} frame - The frame to base the size of this Game Object on. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setSizeToFrame: function (frame) + popScissor: function () { - if (frame === undefined) { frame = this.frame; } - - this.width = frame.realWidth; - this.height = frame.realHeight; + var scissorStack = this.scissorStack; + var stackIndex = this.currentScissorIdx - 4; + + var x = scissorStack[stackIndex + 0]; + var y = scissorStack[stackIndex + 1]; + var w = scissorStack[stackIndex + 2]; + var h = scissorStack[stackIndex + 3]; + this.currentScissorIdx = stackIndex; + this.setScissor(x, y, w, h); + return this; }, /** - * Sets the size of this Game Object. - * - * @method Phaser.GameObjects.Components.Size#setSize + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] */ - setSize: function (width, height) + setPipeline: function (pipelineInstance) { - this.width = width; - this.height = height; + if (this.currentPipeline !== pipelineInstance || + this.currentPipeline.vertexBuffer !== this.currentVertexBuffer || + this.currentPipeline.program !== this.currentProgram) + { + this.flush(); + this.currentPipeline = pipelineInstance; + this.currentPipeline.bind(); + } - return this; + this.currentPipeline.onBind(); + + return this.currentPipeline; }, /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Components.Size#setDisplaySize + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {integer} blendModeId - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setDisplaySize: function (width, height) + setBlendMode: function (blendModeId) { - this.displayWidth = width; - this.displayHeight = height; - - return this; - } + var gl = this.gl; + var blendMode = this.blendModes[blendModeId]; -}; + if (blendModeId !== CONST.BlendModes.SKIP_CHECK && + this.currentBlendMode !== blendModeId) + { + this.flush(); -module.exports = Size; + gl.enable(gl.BLEND); + gl.blendEquation(blendMode.equation); + if (blendMode.func.length > 2) + { + gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); + } + else + { + gl.blendFunc(blendMode.func[0], blendMode.func[1]); + } -/***/ }), -/* 392 */ -/***/ (function(module, exports) { + this.currentBlendMode = blendModeId; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return this; + }, -// bitmask flag for GameObject.renderMask -var _FLAG = 8; // 1000 + addBlendMode: function (func, equation) + { + var index = this.blendModes.push({ func: func, equation: equation }); -/** - * Provides methods used for getting and setting the texture of a Game Object. - * - * @name Phaser.GameObjects.Components.Texture - * @since 3.0.0 - */ + return index - 1; + }, -var Texture = { + updateBlendMode: function (index, func, equation) + { + if (this.blendModes[index]) + { + this.blendModes[index].func = func; - /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#texture - * @type {Phaser.Textures.Texture} - * @since 3.0.0 - */ - texture: null, + if (equation) + { + this.blendModes[index].equation = equation; + } + } - /** - * The Texture Frame this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - frame: null, + return this; + }, - /** - * Sets the texture and frame this Game Object will use to render with. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * @method Phaser.GameObjects.Components.Texture#setTexture - * @since 3.0.0 - * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {string|integer} [frame] - The name or index of the frame within the Texture. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setTexture: function (key, frame) + removeBlendMode: function (index) { - this.texture = this.scene.sys.textures.get(key); + if (index > 16 && this.blendModes[index]) + { + this.blendModes.splice(index, 1); + } - return this.setFrame(frame); + return this; }, /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. + * [description] * - * It can be either a string or an index. - * - * @method Phaser.GameObjects.Components.Texture#setFrame + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D * @since 3.0.0 * - * @param {string|integer} frame - The name or index of the frame within the Texture. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLTexture} texture - [description] + * @param {integer} textureUnit - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setFrame: function (frame) + setTexture2D: function (texture, textureUnit) { - this.frame = this.texture.get(frame); + var gl = this.gl; - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~_FLAG; - } - else + if (texture !== this.currentTextures[textureUnit]) { - this.renderFlags |= _FLAG; - } + this.flush(); - if (this.frame.customPivot) - { - this.setOrigin(this.frame.pivotX, this.frame.pivotY); + if (this.currentActiveTextureUnit !== textureUnit) + { + gl.activeTexture(gl.TEXTURE0 + textureUnit); + this.currentActiveTextureUnit = textureUnit; + } + gl.bindTexture(gl.TEXTURE_2D, texture); + + this.currentTextures[textureUnit] = texture; } return this; - } - -}; - -module.exports = Texture; - - -/***/ }), -/* 393 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GetColor = function (value) -{ - return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); -}; - -/** - * Provides methods used for setting the tint of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Tint - * @webglOnly - * @since 3.0.0 - */ - -var Tint = { - - // 0: topLeft, 1: topRight, 2: bottomLeft, 3: bottomRight - _tintTL: 16777215, - _tintTR: 16777215, - _tintBL: 16777215, - _tintBR: 16777215, + }, /** - * Clears all tint values associated with this Game Object. - * Immediately sets the alpha levels back to 0xffffff (no tint) + * [description] * - * @method Phaser.GameObjects.Components.Tint#clearTint - * @webglOnly + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer * @since 3.0.0 - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * + * @param {WebGLFramebuffer} framebuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - clearTint: function () + setFramebuffer: function (framebuffer) { - this.setTint(0xffffff); + var gl = this.gl; + + if (framebuffer !== this.currentFramebuffer) + { + this.flush(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + this.currentFramebuffer = framebuffer; + } return this; }, /** - * Sets the tint values for this Game Object. + * [description] * - * @method Phaser.GameObjects.Components.Tint#setTint - * @webglOnly + * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram * @since 3.0.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setTint: function (topLeft, topRight, bottomLeft, bottomRight) + setProgram: function (program) { - if (topLeft === undefined) { topLeft = 0xffffff; } + var gl = this.gl; - if (topRight === undefined) + if (program !== this.currentProgram) { - topRight = topLeft; - bottomLeft = topLeft; - bottomRight = topLeft; - } + this.flush(); - this._tintTL = GetColor(topLeft); - this._tintTR = GetColor(topRight); - this._tintBL = GetColor(bottomLeft); - this._tintBR = GetColor(bottomRight); + gl.useProgram(program); + this.currentProgram = program; + } return this; }, /** - * The tint value being applied to the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopLeft - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - tintTopLeft: { + setVertexBuffer: function (vertexBuffer) + { + var gl = this.gl; - get: function () + if (vertexBuffer !== this.currentVertexBuffer) { - return this._tintTL; - }, + this.flush(); - set: function (value) - { - this._tintTL = GetColor(value); + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + this.currentVertexBuffer = vertexBuffer; } + return this; }, /** - * The tint value being applied to the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopRight - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer * @since 3.0.0 + * + * @param {WebGLBuffer} indexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - tintTopRight: { - - get: function () - { - return this._tintTR; - }, + setIndexBuffer: function (indexBuffer) + { + var gl = this.gl; - set: function (value) + if (indexBuffer !== this.currentIndexBuffer) { - this._tintTR = GetColor(value); + this.flush(); + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + this.currentIndexBuffer = indexBuffer; } + return this; }, + /* Renderer Resource Creation Functions */ /** - * The tint value being applied to the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomLeft - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource * @since 3.0.0 + * + * @param {object} source - [description] + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {integer} scaleMode - [description] + * + * @return {WebGLTexture} [description] */ - tintBottomLeft: { + createTextureFromSource: function (source, width, height, scaleMode) + { + var gl = this.gl; + var filter = gl.NEAREST; + var wrap = gl.CLAMP_TO_EDGE; + var texture = null; - get: function () + width = source ? source.width : width; + height = source ? source.height : height; + + if (IsSizePowerOfTwo(width, height)) { - return this._tintBL; - }, + wrap = gl.REPEAT; + } - set: function (value) + if (scaleMode === CONST.ScaleModes.LINEAR) { - this._tintBL = GetColor(value); + filter = gl.LINEAR; + } + else if (scaleMode === CONST.ScaleModes.NEAREST || this.config.pixelArt) + { + filter = gl.NEAREST; + } + + if (!source && typeof width === 'number' && typeof height === 'number') + { + texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + } + else + { + texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, source); } + return texture; }, /** - * The tint value being applied to the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomRight - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D * @since 3.0.0 + * + * @param {integer} mipLevel - [description] + * @param {integer} minFilter - [description] + * @param {integer} magFilter - [description] + * @param {integer} wrapT - [description] + * @param {integer} wrapS - [description] + * @param {integer} format - [description] + * @param {object} pixels - [description] + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {boolean} pma - [description] + * + * @return {WebGLTexture} [description] */ - tintBottomRight: { + createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) + { + var gl = this.gl; + var texture = gl.createTexture(); - get: function () - { - return this._tintBR; - }, + pma = (pma === undefined || pma === null) ? true : pma; - set: function (value) + this.setTexture2D(texture, 0); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); + + if (pixels === null || pixels === undefined) { - this._tintBR = GetColor(value); + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); + } + else + { + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); + width = pixels.width; + height = pixels.height; } + this.setTexture2D(null, 0); + + texture.isAlphaPremultiplied = pma; + texture.isRenderTexture = false; + texture.width = width; + texture.height = height; + + this.nativeTextures.push(texture); + + return texture; }, /** - * The tint value being applied to the whole of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tint - * @type {integer} - * @webglOnly + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer * @since 3.0.0 + * + * @param {integer} width - [description] + * @param {integer} height - [description] + * @param {WebGLFramebuffer} renderTexture - [description] + * @param {boolean} addDepthStencilBuffer - [description] + * + * @return {WebGLFramebuffer} [description] */ - tint: { + createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) + { + var gl = this.gl; + var framebuffer = gl.createFramebuffer(); + var complete = 0; - set: function (value) + this.setFramebuffer(framebuffer); + + if (addDepthStencilBuffer) { - this.setTint(value, value, value, value); + var depthStencilBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); } - } -}; + renderTexture.isRenderTexture = true; + renderTexture.isAlphaPremultiplied = false; -module.exports = Tint; + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); + complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); -/***/ }), -/* 394 */ -/***/ (function(module, exports) { + if (complete !== gl.FRAMEBUFFER_COMPLETE) + { + var errors = { + 36054: 'Incomplete Attachment', + 36055: 'Missing Attachment', + 36057: 'Incomplete Dimensions', + 36061: 'Framebuffer Unsupported' + }; + throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + framebuffer.renderTexture = renderTexture; -// Default Game Object JSON export -// Is extended further by Game Object specific implementations + this.setFramebuffer(null); -var ToJSON = function (gameObject) -{ - var out = { - name: gameObject.name, - type: gameObject.type, - x: gameObject.x, - y: gameObject.y, - depth: gameObject.depth, - scale: { - x: gameObject.scaleX, - y: gameObject.scaleY - }, - origin: { - x: gameObject.originX, - y: gameObject.originY - }, - flipX: gameObject.flipX, - flipY: gameObject.flipY, - rotation: gameObject.rotation, - alpha: gameObject.alpha, - visible: gameObject.visible, - scaleMode: gameObject.scaleMode, - blendMode: gameObject.blendMode, - textureKey: '', - frameKey: '', - data: {} - }; + return framebuffer; + }, - if (gameObject.texture) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram + * @since 3.0.0 + * + * @param {string} vertexShader - [description] + * @param {string} fragmentShader - [description] + * + * @return {WebGLProgram} [description] + */ + createProgram: function (vertexShader, fragmentShader) { - out.textureKey = gameObject.texture.key; - out.frameKey = gameObject.frame.name; - } + var gl = this.gl; + var program = gl.createProgram(); + var vs = gl.createShader(gl.VERTEX_SHADER); + var fs = gl.createShader(gl.FRAGMENT_SHADER); - return out; -}; + gl.shaderSource(vs, vertexShader); + gl.shaderSource(fs, fragmentShader); + gl.compileShader(vs); + gl.compileShader(fs); -module.exports = ToJSON; + if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) + { + throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); + } + if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) + { + throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); + } + gl.attachShader(program, vs); + gl.attachShader(program, fs); + gl.linkProgram(program); -/***/ }), -/* 395 */ -/***/ (function(module, exports, __webpack_require__) { + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) + { + throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return program; + }, -var MATH_CONST = __webpack_require__(16); -var WrapAngle = __webpack_require__(162); -var WrapAngleDegrees = __webpack_require__(163); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer + * @since 3.0.0 + * + * @param {ArrayBuffer} initialDataOrSize - [description] + * @param {integer} bufferUsage - [description] + * + * @return {WebGLBuffer} [description] + */ + createVertexBuffer: function (initialDataOrSize, bufferUsage) + { + var gl = this.gl; + var vertexBuffer = gl.createBuffer(); -// global bitmask flag for GameObject.renderMask (used by Scale) -var _FLAG = 4; // 0100 + this.setVertexBuffer(vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); + this.setVertexBuffer(null); -/** - * Provides methods used for getting and setting the position, scale and rotation of a Game Object. - * - * @name Phaser.GameObjects.Components.Transform - * @since 3.0.0 - */ + return vertexBuffer; + }, -var Transform = { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer + * @since 3.0.0 + * + * @param {ArrayBuffer} initialDataOrSize - [description] + * @param {integer} bufferUsage - [description] + * + * @return {WebGLBuffer} [description] + */ + createIndexBuffer: function (initialDataOrSize, bufferUsage) + { + var gl = this.gl; + var indexBuffer = gl.createBuffer(); - // "private" properties - _scaleX: 1, - _scaleY: 1, - _rotation: 0, + this.setIndexBuffer(indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); + this.setIndexBuffer(null); + + return indexBuffer; + }, /** - * The x position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#x - * @type {number} - * @default 0 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture * @since 3.0.0 + * + * @param {WebGLTexture} texture - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - x: 0, + deleteTexture: function (texture) + { + this.gl.deleteTexture(texture); + return this; + }, /** - * The y position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#y - * @type {number} - * @default 0 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer * @since 3.0.0 + * + * @param {WebGLFramebuffer} framebuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - y: 0, + deleteFramebuffer: function (framebuffer) + { + this.gl.deleteFramebuffer(framebuffer); + return this; + }, /** - * The z position of this Game Object. - * Note: Do not use this value to set the z-index, instead see the `depth` property. - * - * @name Phaser.GameObjects.Components.Transform#z - * @type {number} - * @default 0 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - z: 0, + deleteProgram: function (program) + { + this.gl.deleteProgram(program); + return this; + }, /** - * The w position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#w - * @type {number} - * @default 0 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer * @since 3.0.0 + * + * @param {WebGLBuffer} vertexBuffer - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - w: 0, + deleteBuffer: function (buffer) + { + this.gl.deleteBuffer(buffer); + return this; + }, + + /* Rendering Functions */ /** - * The horizontal scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleX - * @type {number} - * @default 1 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - scaleX: { + preRenderCamera: function (camera) + { + var resolution = this.config.resolution; - get: function () + this.pushScissor(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); + + if (camera.backgroundColor.alphaGL > 0) { - return this._scaleX; - }, + var color = camera.backgroundColor; + var FlatTintPipeline = this.pipelines.FlatTintPipeline; - set: function (value) + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1.0), + color.alphaGL, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + FlatTintPipeline.flush(); + } + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + postRenderCamera: function (camera) + { + if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) { - this._scaleX = value; + var FlatTintPipeline = this.pipelines.FlatTintPipeline; - if (this._scaleX === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } + // Fade + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0), + camera._fadeAlpha, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + // Flash + FlatTintPipeline.batchFillRect( + 0, 0, 1, 1, 0, + camera.x, camera.y, camera.width, camera.height, + Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0), + camera._flashAlpha, + 1, 0, 0, 1, 0, 0, + [ 1, 0, 0, 1, 0, 0 ] + ); + + FlatTintPipeline.flush(); } + this.popScissor(); }, /** - * The vertical scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleY - * @type {number} - * @default 1 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender * @since 3.0.0 */ - scaleY: { + preRender: function () + { + if (this.contextLost) { return; } - get: function () + var gl = this.gl; + var color = this.config.backgroundColor; + var pipelines = this.pipelines; + + // Bind custom framebuffer here + gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); + + if (this.config.clearBeforeRender) + { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } + + for (var key in pipelines) { - return this._scaleY; - }, + pipelines[key].onPreRender(); + } + }, - set: function (value) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#render + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {Phaser.GameObjects.GameObject} children - [description] + * @param {number} interpolationPercentage - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + render: function (scene, children, interpolationPercentage, camera) + { + if (this.contextLost) { return; } + + var list = children.list; + var childCount = list.length; + var pipelines = this.pipelines; + + for (var key in pipelines) { - this._scaleY = value; + pipelines[key].onRender(scene, camera); + } - if (this._scaleY === 0) + this.preRenderCamera(camera); + + for (var index = 0; index < childCount; ++index) + { + var child = list[index]; + + if (!child.willRender()) { - this.renderFlags &= ~_FLAG; + continue; } - else + + if (child.blendMode !== this.currentBlendMode) { - this.renderFlags |= _FLAG; + this.setBlendMode(child.blendMode); + } + + if (child.mask) + { + child.mask.preRenderWebGL(this, child, camera); + } + + child.renderWebGL(this, child, interpolationPercentage, camera); + + if (child.mask) + { + child.mask.postRenderWebGL(this, child); } } + this.flush(); + this.setBlendMode(CONST.BlendModes.NORMAL); + this.postRenderCamera(camera); }, /** - * The angle of this Game Object as expressed in degrees. - * - * Where 0 is to the right, 90 is down, 180 is left. - * - * If you prefer to work in radians, see the `rotation` property instead. - * - * @name Phaser.GameObjects.Components.Transform#angle - * @type {integer} - * @default 0 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender * @since 3.0.0 */ - angle: { + postRender: function () + { + if (this.contextLost) { return; } - get: function () + // Unbind custom framebuffer here + + if (this.snapshotState.callback) { - return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); - }, + this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); + this.snapshotState.callback = null; + } - set: function (value) + var pipelines = this.pipelines; + + for (var key in pipelines) { - // value is in degrees - this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; + pipelines[key].onPostRender(); } }, /** - * The angle of this Game Object in radians. - * - * If you prefer to work in degrees, see the `angle` property instead. - * - * @name Phaser.GameObjects.Components.Transform#rotation - * @type {number} - * @default 1 + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot * @since 3.0.0 + * + * @param {function} callback - [description] + * @param {string} type - [description] + * @param {float} encoderOptions - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - rotation: { + snapshot: function (callback, type, encoderOptions) + { + this.snapshotState.callback = callback; + this.snapshotState.type = type; + this.snapshotState.encoder = encoderOptions; + return this; + }, - get: function () + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture + * @since 3.0.0 + * + * @param {HTMLCanvasElement} srcCanvas - [description] + * @param {WebGLTexture} dstTexture - [description] + * @param {boolean} shouldReallocate - [description] + * @param {integer} scaleMode - [description] + * + * @return {WebGLTexture} [description] + */ + canvasToTexture: function (srcCanvas, dstTexture) + { + var gl = this.gl; + + if (!dstTexture) { - return this._rotation; - }, + var wrapping = gl.CLAMP_TO_EDGE; - set: function (value) + if (IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height)) + { + wrapping = gl.REPEAT; + } + + dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); + } + else { - // value is in radians - this._rotation = WrapAngle(value); + this.setTexture2D(dstTexture, 0); + + // if (!shouldReallocate && dstTexture.width >= srcCanvas.width || dstTexture.height >= srcCanvas.height) + // { + // gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, srcCanvas.width, srcCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); + // } + // else + { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); + dstTexture.width = srcCanvas.width; + dstTexture.height = srcCanvas.height; + } + + this.setTexture2D(null, 0); } + + return dstTexture; }, /** - * Sets the position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setPosition + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter * @since 3.0.0 * - * @param {number} [x=0] - The x position of this Game Object. - * @param {number} [y] - The y position of this Game Object. If not set it will use the `x` value. - * @param {number} [z=0] - The z position of this Game Object. - * @param {number} [w=0] - The w position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {integer} texture - [description] + * @param {integer} filter - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setPosition: function (x, y, z, w) + setTextureFilter: function (texture, filter) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - if (z === undefined) { z = 0; } - if (w === undefined) { w = 0; } + var gl = this.gl; + var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; - this.x = x; - this.y = y; - this.z = z; - this.w = w; + this.setTexture2D(texture, 0); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); + + this.setTexture2D(null, 0); return this; }, /** - * Sets the rotation of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setRotation + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 * @since 3.0.0 * - * @param {number} [radians=0] - The rotation of this Game Object, in radians. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setRotation: function (radians) + setFloat1: function (program, name, x) { - if (radians === undefined) { radians = 0; } + this.setProgram(program); + this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); + return this; + }, - this.rotation = radians; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setFloat2: function (program, name, x, y) + { + this.setProgram(program); + this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); + return this; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setFloat3: function (program, name, x, y, z) + { + this.setProgram(program); + this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); return this; }, /** - * Sets the angle of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setAngle + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 * @since 3.0.0 * - * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} z - [description] + * @param {float} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setAngle: function (degrees) + setFloat4: function (program, name, x, y, z, w) { - if (degrees === undefined) { degrees = 0; } + this.setProgram(program); + this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); + return this; + }, - this.angle = degrees; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setInt1: function (program, name, x) + { + this.setProgram(program); + this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setInt2: function (program, name, x, y) + { + this.setProgram(program); + this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); + return this; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 + * @since 3.0.0 + * + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} z - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + */ + setInt3: function (program, name, x, y, z) + { + this.setProgram(program); + this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); return this; }, /** - * Sets the scale of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setScale + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 * @since 3.0.0 * - * @param {number} x - The horizontal scale of this Game Object. - * @param {number} [y] - The vertical scale of this Game Object. If not set it will use the `x` value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {integer} x - [description] + * @param {integer} y - [description] + * @param {integer} z - [description] + * @param {integer} w - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setScale: function (x, y) + setInt4: function (program, name, x, y, z, w) { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } - - this.scaleX = x; - this.scaleY = y; - + this.setProgram(program); + this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); return this; }, /** - * Sets the x position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setX + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 * @since 3.0.0 * - * @param {number} [value=0] - The x position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setX: function (value) + setMatrix2: function (program, name, transpose, matrix) { - if (value === undefined) { value = 0; } - - this.x = value; - + this.setProgram(program); + this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); return this; }, /** - * Sets the y position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setY + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 * @since 3.0.0 * - * @param {number} [value=0] - The y position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setY: function (value) + setMatrix3: function (program, name, transpose, matrix) { - if (value === undefined) { value = 0; } - - this.y = value; - + this.setProgram(program); + this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); return this; }, /** - * Sets the z position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setZ + * [description] + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 * @since 3.0.0 * - * @param {number} [value=0] - The z position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @param {WebGLProgram} program - [description] + * @param {string} name - [description] + * @param {boolean} transpose - [description] + * @param {Float32Array} matrix - [description] + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] */ - setZ: function (value) + setMatrix4: function (program, name, transpose, matrix) { - if (value === undefined) { value = 0; } - - this.z = value; - + this.setProgram(program); + this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); return this; }, /** - * Sets the w position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setW - * @since 3.0.0 + * [description] * - * @param {number} [value=0] - The w position of this Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. + * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy + * @since 3.0.0 */ - setW: function (value) + destroy: function () { - if (value === undefined) { value = 0; } + // Clear-up anything that should be cleared :) + for (var key in this.pipelines) + { + this.pipelines[key].destroy(); + delete this.pipelines[key]; + } - this.w = value; + for (var index = 0; index < this.nativeTextures.length; ++index) + { + this.deleteTexture(this.nativeTextures[index]); + delete this.nativeTextures[index]; + } - return this; + if (this.hasExtension('WEBGL_lose_context')) + { + this.getExtension('WEBGL_lose_context').loseContext(); + } + + delete this.gl; + delete this.game; + + this.contextLost = true; + this.extensions = {}; + this.nativeTextures.length = 0; } -}; +}); -module.exports = Transform; +module.exports = WebGLRenderer; /***/ }), -/* 396 */ +/* 373 */ /***/ (function(module, exports) { /** @@ -78763,79 +78997,68 @@ module.exports = Transform; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -// bitmask flag for GameObject.renderMask -var _FLAG = 1; // 0001 - /** - * Provides methods used for setting the visibility of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @name Phaser.GameObjects.Components.Visible + * [description] + * + * @function Phaser.Renderer.Snapshot.WebGL * @since 3.0.0 + * + * @param {HTMLCanvasElement} sourceCanvas - [description] + * @param {string} [type='image/png'] - [description] + * @param {float} [encoderOptions=0.92] - [description] + * + * @return {Image} [description] */ +var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) +{ + if (!type) { type = 'image/png'; } + if (!encoderOptions) { encoderOptions = 0.92; } -var Visible = { + var gl = sourceCanvas.getContext('experimental-webgl'); + var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); + gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - _visible: true, + // CanvasPool? + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var imageData; - /** - * The visible state of the Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. - * - * @name Phaser.GameObjects.Components.Visible#visible - * @type {boolean} - * @since 3.0.0 - */ - visible: { + canvas.width = gl.drawingBufferWidth; + canvas.height = gl.drawingBufferHeight; - get: function () - { - return this._visible; - }, + imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); - set: function (value) + var data = imageData.data; + + for (var y = 0; y < canvas.height; y += 1) + { + for (var x = 0; x < canvas.width; x += 1) { - if (value) - { - this._visible = true; - this.renderFlags |= _FLAG; - } - else - { - this._visible = false; - this.renderFlags &= ~_FLAG; - } + var si = ((canvas.height - y) * canvas.width + x) * 4; + var di = (y * canvas.width + x) * 4; + data[di + 0] = pixels[si + 0]; + data[di + 1] = pixels[si + 1]; + data[di + 2] = pixels[si + 2]; + data[di + 3] = pixels[si + 3]; } + } - }, + ctx.putImageData(imageData, 0, 0); - /** - * Sets the visibility of this Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. - * - * @method Phaser.GameObjects.Components.Visible#setVisible - * @since 3.0.0 - * - * @param {boolean} value - The visible state of the Game Object. - * - * @return {Phaser.GameObjects.GameObject} This Game Object instance. - */ - setVisible: function (value) - { - this.visible = value; + var src = canvas.toDataURL(type, encoderOptions); + var image = new Image(); - return this; - } + image.src = src; + + return image; }; -module.exports = Visible; +module.exports = WebGLSnapshot; /***/ }), -/* 397 */ -/***/ (function(module, exports) { +/* 374 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -78843,103 +79066,209 @@ module.exports = Visible; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); +var ShaderSourceFS = __webpack_require__(512); +var ShaderSourceVS = __webpack_require__(513); +var WebGLPipeline = __webpack_require__(103); + /** + * @classdesc * [description] * - * @function Phaser.Actions.IncAlpha + * @class BitmapMaskPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] * - * @return {array} The array of Game Objects that was passed to this Action. + * @param {object} config - [description] */ -var IncAlpha = function (items, value) -{ - for (var i = 0; i < items.length; i++) +var BitmapMaskPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function BitmapMaskPipeline (config) { - items[i].alpha += value; - } + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapacity ? config.vertexCapacity : 3), - return items; -}; + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2), -module.exports = IncAlpha; + vertices: new Float32Array([ + -1, +1, -1, -7, +7, +1 + ]).buffer, + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + } + ] + }); -/***/ }), -/* 398 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#maxQuads + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.maxQuads = 1; -/** - * [description] - * - * @function Phaser.Actions.IncX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncX = function (items, value) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#resolutionDirty + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.resolutionDirty = true; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] + */ + onBind: function () { - items[i].x += value; - } + WebGLPipeline.prototype.onBind.call(this); - return items; -}; + var renderer = this.renderer; + var program = this.program; + + if (this.resolutionDirty) + { + renderer.setFloat2(program, 'uResolution', this.width, this.height); + renderer.setInt1(program, 'uMainSampler', 0); + renderer.setInt1(program, 'uMaskSampler', 1); + this.resolutionDirty = false; + } -module.exports = IncX; + return this; + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] + */ + resize: function (width, height, resolution) + { + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.resolutionDirty = true; + return this; + }, -/***/ }), -/* 399 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#beginMask + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} mask - [description] + * @param {Phaser.GameObjects.GameObject} maskedObject - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + beginMask: function (mask, maskedObject, camera) + { + var bitmapMask = mask.bitmapMask; + var renderer = this.renderer; + var gl = this.gl; + var visible = bitmapMask.visible; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (bitmapMask && gl) + { + // First we clear the mask framebuffer + renderer.setFramebuffer(mask.maskFramebuffer); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); -/** - * [description] - * - * @function Phaser.Actions.IncXY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var IncXY = function (items, x, y) -{ - for (var i = 0; i < items.length; i++) + // We render out mask source + bitmapMask.visible = true; + bitmapMask.renderWebGL(renderer, bitmapMask, 0.0, camera); + bitmapMask.visible = visible; + renderer.flush(); + + // Bind and clear our main source (masked object) + renderer.setFramebuffer(mask.mainFramebuffer); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#endMask + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} mask - [description] + */ + endMask: function (mask) { - items[i].x += x; - items[i].y += y; + var bitmapMask = mask.bitmapMask; + var renderer = this.renderer; + var gl = this.gl; + + if (bitmapMask) + { + // Return to default framebuffer + renderer.setFramebuffer(null); + + // Bind bitmap mask pipeline and draw + renderer.setPipeline(this); + + renderer.setTexture2D(mask.maskTexture, 1); + renderer.setTexture2D(mask.mainTexture, 0); + renderer.setInt1(this.program, 'uInvertMaskAlpha', mask.invertAlpha); + + // Finally draw a triangle filling the whole screen + gl.drawArrays(this.topology, 0, 3); + } } - return items; -}; +}); -module.exports = IncXY; +module.exports = BitmapMaskPipeline; /***/ }), -/* 400 */ -/***/ (function(module, exports) { +/* 375 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -78947,1249 +79276,1862 @@ module.exports = IncXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); +var Commands = __webpack_require__(127); +var Earcut = __webpack_require__(238); +var ModelViewProjection = __webpack_require__(239); +var ShaderSourceFS = __webpack_require__(514); +var ShaderSourceVS = __webpack_require__(515); +var Utils = __webpack_require__(41); +var WebGLPipeline = __webpack_require__(103); + +var Point = function (x, y, width, rgb, alpha) +{ + this.x = x; + this.y = y; + this.width = width; + this.rgb = rgb; + this.alpha = alpha; +}; + +var Path = function (x, y, width, rgb, alpha) +{ + this.points = []; + this.pointsLength = 1; + this.points[0] = new Point(x, y, width, rgb, alpha); +}; + +var currentMatrix = new Float32Array([ 1, 0, 0, 1, 0, 0 ]); +var matrixStack = new Float32Array(6 * 1000); +var matrixStackLength = 0; +var pathArray = []; + /** + * @classdesc * [description] * - * @function Phaser.Actions.IncY + * @class FlatTintPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberOf Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] * - * @return {array} The array of Game Objects that was passed to this Action. + * @param {object} config - [description] */ -var IncY = function (items, value) -{ - for (var i = 0; i < items.length; i++) +var FlatTintPipeline = new Class({ + + Extends: WebGLPipeline, + + Mixins: [ + ModelViewProjection + ], + + initialize: + + function FlatTintPipeline (config) { - items[i].y += value; - } + WebGLPipeline.call(this, { + game: config.game, + renderer: config.renderer, + gl: config.renderer.gl, + topology: (config.topology ? config.topology : config.renderer.gl.TRIANGLES), + vertShader: (config.vertShader ? config.vertShader : ShaderSourceVS), + fragShader: (config.fragShader ? config.fragShader : ShaderSourceFS), + vertexCapacity: (config.vertexCapcity ? config.vertexCapacity : 12000), + + vertexSize: (config.vertexSize ? config.vertexSize : + Float32Array.BYTES_PER_ELEMENT * 2 + + Uint8Array.BYTES_PER_ELEMENT * 4), - return items; -}; + attributes: [ + { + name: 'inPosition', + size: 2, + type: config.renderer.gl.FLOAT, + normalized: false, + offset: 0 + }, + { + name: 'inTint', + size: 4, + type: config.renderer.gl.UNSIGNED_BYTE, + normalized: true, + offset: Float32Array.BYTES_PER_ELEMENT * 2 + } + ] + }); -module.exports = IncY; + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32 = new Float32Array(this.vertexData); + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32 = new Uint32Array(this.vertexData); -/***/ }), -/* 401 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#tempTriangle + * @type {array} + * @since 3.0.0 + */ + this.tempTriangle = [ + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, + {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0} + ]; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Renderer.WebGL.FlatTintPipeline#polygonCache + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.polygonCache = []; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnCircle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=6.28] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnCircle = function (items, circle, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + this.mvpInit(); + }, - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#onBind + * @since 3.0.0 + * + * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] + */ + onBind: function () + { + WebGLPipeline.prototype.onBind.call(this); + this.mvpUpdate(); - for (var i = 0; i < items.length; i++) + return this; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#resize + * @since 3.0.0 + * + * @param {number} width - [description] + * @param {number} height - [description] + * @param {number} resolution - [description] + * + * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] + */ + resize: function (width, height, resolution) { - items[i].x = circle.x + (circle.radius * Math.cos(angle)); - items[i].y = circle.y + (circle.radius * Math.sin(angle)); + WebGLPipeline.prototype.resize.call(this, width, height, resolution); + this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); + + return this; + }, - angle += angleStep; - } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillRect + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x - [description] + * @param {float} y - [description] + * @param {float} width - [description] + * @param {float} height - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + { + this.renderer.setPipeline(this); - return items; -}; + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = this.vertexCount * this.vertexComponentCount; + var xw = x + width; + var yh = y + height; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tx0 = x * a + y * c + e; + var ty0 = x * b + y * d + f; + var tx1 = x * a + yh * c + e; + var ty1 = x * b + yh * d + f; + var tx2 = xw * a + yh * c + e; + var ty2 = xw * b + yh * d + f; + var tx3 = xw * a + y * c + e; + var ty3 = xw * b + y * d + f; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); -module.exports = PlaceOnCircle; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; + vertexViewF32[vertexOffset + 9] = tx0; + vertexViewF32[vertexOffset + 10] = ty0; + vertexViewU32[vertexOffset + 11] = tint; + vertexViewF32[vertexOffset + 12] = tx2; + vertexViewF32[vertexOffset + 13] = ty2; + vertexViewU32[vertexOffset + 14] = tint; + vertexViewF32[vertexOffset + 15] = tx3; + vertexViewF32[vertexOffset + 16] = ty3; + vertexViewU32[vertexOffset + 17] = tint; + this.vertexCount += 6; + }, -/***/ }), -/* 402 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillTriangle + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x0 - [description] + * @param {float} y0 - [description] + * @param {float} x1 - [description] + * @param {float} y1 - [description] + * @param {float} x2 - [description] + * @param {float} y2 - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + { + this.renderer.setPipeline(this); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this.vertexCount + 3 > this.vertexCapacity) + { + this.flush(); + } -/** - * [description] - * - * @function Phaser.Actions.PlaceOnEllipse - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - [description] - * @param {number} [startAngle=0] - [description] - * @param {number} [endAngle=6.28] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = this.vertexCount * this.vertexComponentCount; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tx0 = x0 * a + y0 * c + e; + var ty0 = x0 * b + y0 * d + f; + var tx1 = x1 * a + y1 * c + e; + var ty1 = x1 * b + y1 * d + f; + var tx2 = x2 * a + y2 * c + e; + var ty2 = x2 * b + y2 * d + f; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; - var a = ellipse.width / 2; - var b = ellipse.height / 2; + this.vertexCount += 3; + }, - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokeTriangle + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} x0 - [description] + * @param {float} y0 - [description] + * @param {float} x1 - [description] + * @param {float} y1 - [description] + * @param {float} x2 - [description] + * @param {float} y2 - [description] + * @param {float} lineWidth - [description] + * @param {integer} lineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a - [description] + * @param {float} b - [description] + * @param {float} c - [description] + * @param {float} d - [description] + * @param {float} e - [description] + * @param {float} f - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix) { - items[i].x = ellipse.x + a * Math.cos(angle); - items[i].y = ellipse.y + b * Math.sin(angle); + var tempTriangle = this.tempTriangle; - angle += angleStep; - } + tempTriangle[0].x = x0; + tempTriangle[0].y = y0; + tempTriangle[0].width = lineWidth; + tempTriangle[0].rgb = lineColor; + tempTriangle[0].alpha = lineAlpha; + tempTriangle[1].x = x1; + tempTriangle[1].y = y1; + tempTriangle[1].width = lineWidth; + tempTriangle[1].rgb = lineColor; + tempTriangle[1].alpha = lineAlpha; + tempTriangle[2].x = x2; + tempTriangle[2].y = y2; + tempTriangle[2].width = lineWidth; + tempTriangle[2].rgb = lineColor; + tempTriangle[2].alpha = lineAlpha; + tempTriangle[3].x = x0; + tempTriangle[3].y = y0; + tempTriangle[3].width = lineWidth; + tempTriangle[3].rgb = lineColor; + tempTriangle[3].alpha = lineAlpha; - return items; -}; + this.batchStrokePath( + srcX, srcY, srcScaleX, srcScaleY, srcRotation, + tempTriangle, lineWidth, lineColor, lineAlpha, + a, b, c, d, e, f, + false, + currentMatrix + ); + }, -module.exports = PlaceOnEllipse; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillPath + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} path - [description] + * @param {integer} fillColor - [description] + * @param {float} fillAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) + { + this.renderer.setPipeline(this); + var length = path.length; + var polygonCache = this.polygonCache; + var polygonIndexArray; + var point; + var v0, v1, v2; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset = 0; + var x0, y0, x1, y1, x2, y2; + var tx0, ty0, tx1, ty1, tx2, ty2; + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); -/***/ }), -/* 403 */ -/***/ (function(module, exports, __webpack_require__) { + for (var pathIndex = 0; pathIndex < length; ++pathIndex) + { + point = path[pathIndex]; + polygonCache.push(point.x, point.y); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + polygonIndexArray = Earcut(polygonCache); + length = polygonIndexArray.length; -var GetPoints = __webpack_require__(108); + for (var index = 0; index < length; index += 3) + { + v0 = polygonIndexArray[index + 0] * 2; + v1 = polygonIndexArray[index + 1] * 2; + v2 = polygonIndexArray[index + 2] * 2; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnLine - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnLine = function (items, line) -{ - var points = GetPoints(line, items.length); + if (this.vertexCount + 3 > this.vertexCapacity) + { + this.flush(); + } - for (var i = 0; i < items.length; i++) + vertexOffset = this.vertexCount * this.vertexComponentCount; + + x0 = polygonCache[v0 + 0]; + y0 = polygonCache[v0 + 1]; + x1 = polygonCache[v1 + 0]; + y1 = polygonCache[v1 + 1]; + x2 = polygonCache[v2 + 0]; + y2 = polygonCache[v2 + 1]; + + tx0 = x0 * a + y0 * c + e; + ty0 = x0 * b + y0 * d + f; + tx1 = x1 * a + y1 * c + e; + ty1 = x1 * b + y1 * d + f; + tx2 = x2 * a + y2 * c + e; + ty2 = x2 * b + y2 * d + f; + + vertexViewF32[vertexOffset + 0] = tx0; + vertexViewF32[vertexOffset + 1] = ty0; + vertexViewU32[vertexOffset + 2] = tint; + vertexViewF32[vertexOffset + 3] = tx1; + vertexViewF32[vertexOffset + 4] = ty1; + vertexViewU32[vertexOffset + 5] = tint; + vertexViewF32[vertexOffset + 6] = tx2; + vertexViewF32[vertexOffset + 7] = ty2; + vertexViewU32[vertexOffset + 8] = tint; + + this.vertexCount += 3; + } + + polygonCache.length = 0; + }, + + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokePath + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {array} path - [description] + * @param {float} lineWidth - [description] + * @param {integer} lineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a - [description] + * @param {float} b - [description] + * @param {float} c - [description] + * @param {float} d - [description] + * @param {float} e - [description] + * @param {float} f - [description] + * @param {boolean} isLastPath - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix) { - var item = items[i]; - var point = points[i]; - - item.x = point.x; - item.y = point.y; - } - - return items; -}; + this.renderer.setPipeline(this); -module.exports = PlaceOnLine; + var point0, point1; + var pathLength = path.length; + var polylines = this.polygonCache; + var last, curr; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var vertexOffset; + var line; + var getTint = Utils.getTintAppendFloatAlphaAndSwap; + for (var pathIndex = 0; pathIndex + 1 < pathLength; pathIndex += 1) + { + point0 = path[pathIndex]; + point1 = path[pathIndex + 1]; -/***/ }), -/* 404 */ -/***/ (function(module, exports, __webpack_require__) { + line = this.batchLine( + srcX, srcY, srcScaleX, srcScaleY, srcRotation, + point0.x, point0.y, + point1.x, point1.y, + point0.width / 2, point1.width / 2, + point0.rgb, point1.rgb, lineAlpha, + a, b, c, d, e, f, + currentMatrix + ); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + polylines.push(line); + } -var MarchingAnts = __webpack_require__(188); -var RotateLeft = __webpack_require__(189); -var RotateRight = __webpack_require__(190); + /* Render joints */ + for (var index = 1, polylinesLength = polylines.length; index < polylinesLength; ++index) + { + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } -// Place the items in the array around the perimeter of the given rectangle. + last = polylines[index - 1] || polylines[polylinesLength - 1]; + curr = polylines[index]; + vertexOffset = this.vertexCount * this.vertexComponentCount; -// Placement starts from the top-left of the rectangle, and proceeds in a -// clockwise direction. If the shift parameter is given you can offset where -// placement begins. + vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0]; + vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1]; + vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha); + vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0]; + vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1]; + vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha); + vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0]; + vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1]; + vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha); + vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0]; + vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1]; + vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha); + vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0]; + vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1]; + vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha); + vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0]; + vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1]; + vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha); -/** - * [description] - * - * @function Phaser.Actions.PlaceOnRectangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - [description] - * @param {integer} [shift=1] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnRectangle = function (items, rect, shift) -{ - if (shift === undefined) { shift = 0; } + this.vertexCount += 6; + } - var points = MarchingAnts(rect, false, items.length); + polylines.length = 0; + }, - if (shift > 0) - { - RotateLeft(points, shift); - } - else if (shift < 0) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchLine + * @since 3.0.0 + * + * @param {float} srcX - [description] + * @param {float} srcY - [description] + * @param {float} srcScaleX - [description] + * @param {float} srcScaleY - [description] + * @param {float} srcRotation - [description] + * @param {float} ax - [description] + * @param {float} ay - [description] + * @param {float} bx - [description] + * @param {float} by - [description] + * @param {float} aLineWidth - [description] + * @param {float} bLineWidth - [description] + * @param {integer} aLineColor - [description] + * @param {integer} bLineColor - [description] + * @param {float} lineAlpha - [description] + * @param {float} a1 - [description] + * @param {float} b1 - [description] + * @param {float} c1 - [description] + * @param {float} d1 - [description] + * @param {float} e1 - [description] + * @param {float} f1 - [description] + * @param {Float32Array} currentMatrix - [description] + */ + batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) { - RotateRight(points, Math.abs(shift)); - } + this.renderer.setPipeline(this); - for (var i = 0; i < items.length; i++) - { - items[i].x = points[i].x; - items[i].y = points[i].y; - } + if (this.vertexCount + 6 > this.vertexCapacity) + { + this.flush(); + } + + var a0 = currentMatrix[0]; + var b0 = currentMatrix[1]; + var c0 = currentMatrix[2]; + var d0 = currentMatrix[3]; + var e0 = currentMatrix[4]; + var f0 = currentMatrix[5]; + var a = a1 * a0 + b1 * c0; + var b = a1 * b0 + b1 * d0; + var c = c1 * a0 + d1 * c0; + var d = c1 * b0 + d1 * d0; + var e = e1 * a0 + f1 * c0 + e0; + var f = e1 * b0 + f1 * d0 + f0; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + var dx = bx - ax; + var dy = by - ay; + var len = Math.sqrt(dx * dx + dy * dy); + var al0 = aLineWidth * (by - ay) / len; + var al1 = aLineWidth * (ax - bx) / len; + var bl0 = bLineWidth * (by - ay) / len; + var bl1 = bLineWidth * (ax - bx) / len; + var lx0 = bx - bl0; + var ly0 = by - bl1; + var lx1 = ax - al0; + var ly1 = ay - al1; + var lx2 = bx + bl0; + var ly2 = by + bl1; + var lx3 = ax + al0; + var ly3 = ay + al1; + var x0 = lx0 * a + ly0 * c + e; + var y0 = lx0 * b + ly0 * d + f; + var x1 = lx1 * a + ly1 * c + e; + var y1 = lx1 * b + ly1 * d + f; + var x2 = lx2 * a + ly2 * c + e; + var y2 = lx2 * b + ly2 * d + f; + var x3 = lx3 * a + ly3 * c + e; + var y3 = lx3 * b + ly3 * d + f; + var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var aTint = getTint(aLineColor, lineAlpha); + var bTint = getTint(bLineColor, lineAlpha); + var vertexOffset = this.vertexCount * this.vertexComponentCount; - return items; -}; + vertexViewF32[vertexOffset + 0] = x0; + vertexViewF32[vertexOffset + 1] = y0; + vertexViewU32[vertexOffset + 2] = bTint; + vertexViewF32[vertexOffset + 3] = x1; + vertexViewF32[vertexOffset + 4] = y1; + vertexViewU32[vertexOffset + 5] = aTint; + vertexViewF32[vertexOffset + 6] = x2; + vertexViewF32[vertexOffset + 7] = y2; + vertexViewU32[vertexOffset + 8] = bTint; + vertexViewF32[vertexOffset + 9] = x1; + vertexViewF32[vertexOffset + 10] = y1; + vertexViewU32[vertexOffset + 11] = aTint; + vertexViewF32[vertexOffset + 12] = x3; + vertexViewF32[vertexOffset + 13] = y3; + vertexViewU32[vertexOffset + 14] = aTint; + vertexViewF32[vertexOffset + 15] = x2; + vertexViewF32[vertexOffset + 16] = y2; + vertexViewU32[vertexOffset + 17] = bTint; -module.exports = PlaceOnRectangle; + this.vertexCount += 6; + return [ + x0, y0, bLineColor, + x1, y1, aLineColor, + x2, y2, bLineColor, + x3, y3, aLineColor + ]; + }, -/***/ }), -/* 405 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchGraphics + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchGraphics: function (graphics, camera) + { + if (graphics.commandBuffer.length <= 0) { return; } + + this.renderer.setPipeline(this); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + var cameraScrollX = camera.scrollX * graphics.scrollFactorX; + var cameraScrollY = camera.scrollY * graphics.scrollFactorY; + var srcX = graphics.x - cameraScrollX; + var srcY = graphics.y - cameraScrollY; + var srcScaleX = graphics.scaleX; + var srcScaleY = graphics.scaleY; + var srcRotation = -graphics.rotation; + var commands = graphics.commandBuffer; + var lineAlpha = 1.0; + var fillAlpha = 1.0; + var lineColor = 0; + var fillColor = 0; + var lineWidth = 1.0; + var cameraMatrix = camera.matrix.matrix; + var lastPath = null; + var iteration = 0; + var iterStep = 0.01; + var tx = 0; + var ty = 0; + var ta = 0; + var x = 0; + var y = 0; + var radius = 0; + var startAngle = 0; + var endAngle = 0; + var anticlockwise = 0; + var path = null; + var sin = Math.sin; + var cos = Math.cos; + var PI2 = Math.PI * 2; + var sr = sin(srcRotation); + var cr = cos(srcRotation); + var sra = cr * srcScaleX; + var srb = -sr * srcScaleX; + var src = sr * srcScaleY; + var srd = cr * srcScaleY; + var sre = srcX; + var srf = srcY; + var cma = cameraMatrix[0]; + var cmb = cameraMatrix[1]; + var cmc = cameraMatrix[2]; + var cmd = cameraMatrix[3]; + var cme = cameraMatrix[4]; + var cmf = cameraMatrix[5]; + var mva = sra * cma + srb * cmc; + var mvb = sra * cmb + srb * cmd; + var mvc = src * cma + srd * cmc; + var mvd = src * cmb + srd * cmd; + var mve = sre * cma + srf * cmc + cme; + var mvf = sre * cmb + srf * cmd + cmf; -// var GetPointsOnLine = require('../geom/line/GetPointsOnLine'); -var BresenhamPoints = __webpack_require__(191); + var pathArrayIndex; + var pathArrayLength; -/** - * [description] - * - * @function Phaser.Actions.PlaceOnTriangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - [description] - * @param {number} [stepRate=1] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlaceOnTriangle = function (items, triangle, stepRate) -{ - var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); - var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); - var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); + pathArray.length = 0; - // Remove overlaps - p1.pop(); - p2.pop(); - p3.pop(); + for (var cmdIndex = 0, cmdLength = commands.length; cmdIndex < cmdLength; ++cmdIndex) + { + cmd = commands[cmdIndex]; - p1 = p1.concat(p2, p3); + switch (cmd) + { + case Commands.ARC: + iteration = 0; + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + radius = commands[cmdIndex + 3]; + startAngle = commands[cmdIndex + 4]; + endAngle = commands[cmdIndex + 5]; + anticlockwise = commands[cmdIndex + 6]; - var step = p1.length / items.length; - var p = 0; + if (lastPath === null) + { + lastPath = new Path(x + cos(startAngle) * radius, y + sin(startAngle) * radius, lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + iteration += iterStep; + } - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - var point = p1[Math.floor(p)]; + endAngle -= startAngle; + if (anticlockwise) + { + if (endAngle < -PI2) + { + endAngle = -PI2; + } + else if (endAngle > 0) + { + endAngle = -PI2 + endAngle % PI2; + } + } + else if (endAngle > PI2) + { + endAngle = PI2; + } + else if (endAngle < 0) + { + endAngle = PI2 + endAngle % PI2; + } - item.x = point.x; - item.y = point.y; + while (iteration < 1) + { + ta = endAngle * iteration + startAngle; + tx = x + cos(ta) * radius; + ty = y + sin(ta) * radius; - p += step; - } + lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); - return items; -}; + iteration += iterStep; + } -module.exports = PlaceOnTriangle; + ta = endAngle + startAngle; + tx = x + cos(ta) * radius; + ty = y + sin(ta) * radius; + lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); -/***/ }), -/* 406 */ -/***/ (function(module, exports) { + cmdIndex += 6; + break; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + case Commands.LINE_STYLE: + lineWidth = commands[cmdIndex + 1]; + lineColor = commands[cmdIndex + 2]; + lineAlpha = commands[cmdIndex + 3]; + cmdIndex += 3; + break; -/** - * [description] - * - * @function Phaser.Actions.PlayAnimation - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} key - [description] - * @param {string|integer} [startFrame] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var PlayAnimation = function (items, key, startFrame) -{ - for (var i = 0; i < items.length; i++) - { - items[i].anims.play(key, startFrame); - } + case Commands.FILL_STYLE: + fillColor = commands[cmdIndex + 1]; + fillAlpha = commands[cmdIndex + 2]; + cmdIndex += 2; + break; - return items; -}; + case Commands.BEGIN_PATH: + pathArray.length = 0; + lastPath = null; + break; -module.exports = PlayAnimation; + case Commands.CLOSE_PATH: + if (lastPath && lastPath.points.length) + { + lastPath.points.push(lastPath.points[0]); + } + break; + case Commands.FILL_PATH: + for (pathArrayIndex = 0, pathArrayLength = pathArray.length; + pathArrayIndex < pathArrayLength; + ++pathArrayIndex) + { + this.batchFillPath( -/***/ }), -/* 407 */ -/***/ (function(module, exports, __webpack_require__) { + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /* Rectangle properties */ + pathArray[pathArrayIndex].points, + fillColor, + fillAlpha, -var Random = __webpack_require__(105); + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + } + break; -/** - * [description] - * - * @function Phaser.Actions.RandomCircle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomCircle = function (items, circle) -{ - for (var i = 0; i < items.length; i++) - { - Random(circle, items[i]); - } + case Commands.STROKE_PATH: + for (pathArrayIndex = 0, pathArrayLength = pathArray.length; + pathArrayIndex < pathArrayLength; + ++pathArrayIndex) + { + path = pathArray[pathArrayIndex]; + this.batchStrokePath( - return items; -}; + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -module.exports = RandomCircle; + /* Rectangle properties */ + path.points, + lineWidth, + lineColor, + lineAlpha, + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + path === this._lastPath, + currentMatrix + ); + } + break; + + case Commands.FILL_RECT: + this.batchFillRect( -/***/ }), -/* 408 */ -/***/ (function(module, exports, __webpack_require__) { + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /* Rectangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + fillColor, + fillAlpha, -var Random = __webpack_require__(109); + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 4; + break; -/** - * [description] - * - * @function Phaser.Actions.RandomEllipse - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomEllipse = function (items, ellipse) -{ - for (var i = 0; i < items.length; i++) - { - Random(ellipse, items[i]); - } + case Commands.FILL_TRIANGLE: + this.batchFillTriangle( - return items; -}; + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -module.exports = RandomEllipse; + /* Triangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5], + commands[cmdIndex + 6], + fillColor, + fillAlpha, + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 6; + break; -/***/ }), -/* 409 */ -/***/ (function(module, exports, __webpack_require__) { + case Commands.STROKE_TRIANGLE: + this.batchStrokeTriangle( -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /* Graphics Game Object Properties */ + srcX, srcY, srcScaleX, srcScaleY, srcRotation, -var Random = __webpack_require__(110); + /* Triangle properties */ + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5], + commands[cmdIndex + 6], + lineWidth, + lineColor, + lineAlpha, -/** - * [description] - * - * @function Phaser.Actions.RandomLine - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomLine = function (items, line) -{ - for (var i = 0; i < items.length; i++) - { - Random(line, items[i]); - } + /* Transform */ + mva, mvb, mvc, mvd, mve, mvf, + currentMatrix + ); + + cmdIndex += 6; + break; - return items; -}; + case Commands.LINE_TO: + if (lastPath !== null) + { + lastPath.points.push(new Point(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha)); + } + else + { + lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + } + cmdIndex += 2; + break; -module.exports = RandomLine; + case Commands.MOVE_TO: + lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); + pathArray.push(lastPath); + cmdIndex += 2; + break; + case Commands.LINE_FX_TO: + if (lastPath !== null) + { + lastPath.points.push(new Point( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + )); + } + else + { + lastPath = new Path( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + ); + pathArray.push(lastPath); + } + cmdIndex += 5; + break; -/***/ }), -/* 410 */ -/***/ (function(module, exports, __webpack_require__) { + case Commands.MOVE_FX_TO: + lastPath = new Path( + commands[cmdIndex + 1], + commands[cmdIndex + 2], + commands[cmdIndex + 3], + commands[cmdIndex + 4], + commands[cmdIndex + 5] + ); + pathArray.push(lastPath); + cmdIndex += 5; + break; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + case Commands.SAVE: + matrixStack[matrixStackLength + 0] = currentMatrix[0]; + matrixStack[matrixStackLength + 1] = currentMatrix[1]; + matrixStack[matrixStackLength + 2] = currentMatrix[2]; + matrixStack[matrixStackLength + 3] = currentMatrix[3]; + matrixStack[matrixStackLength + 4] = currentMatrix[4]; + matrixStack[matrixStackLength + 5] = currentMatrix[5]; + matrixStackLength += 6; + break; -var Random = __webpack_require__(107); + case Commands.RESTORE: + matrixStackLength -= 6; + currentMatrix[0] = matrixStack[matrixStackLength + 0]; + currentMatrix[1] = matrixStack[matrixStackLength + 1]; + currentMatrix[2] = matrixStack[matrixStackLength + 2]; + currentMatrix[3] = matrixStack[matrixStackLength + 3]; + currentMatrix[4] = matrixStack[matrixStackLength + 4]; + currentMatrix[5] = matrixStack[matrixStackLength + 5]; + break; -/** - * [description] - * - * @function Phaser.Actions.RandomRectangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomRectangle = function (items, rect) -{ - for (var i = 0; i < items.length; i++) - { - Random(rect, items[i]); - } + case Commands.TRANSLATE: + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + currentMatrix[4] = currentMatrix[0] * x + currentMatrix[2] * y + currentMatrix[4]; + currentMatrix[5] = currentMatrix[1] * x + currentMatrix[3] * y + currentMatrix[5]; + cmdIndex += 2; + break; - return items; -}; + case Commands.SCALE: + x = commands[cmdIndex + 1]; + y = commands[cmdIndex + 2]; + currentMatrix[0] *= x; + currentMatrix[1] *= x; + currentMatrix[2] *= y; + currentMatrix[3] *= y; + cmdIndex += 2; + break; -module.exports = RandomRectangle; + case Commands.ROTATE: + y = commands[cmdIndex + 1]; + x = sin(y); + y = cos(y); + sra = currentMatrix[0]; + srb = currentMatrix[1]; + src = currentMatrix[2]; + srd = currentMatrix[3]; + currentMatrix[0] = y * sra + x * src; + currentMatrix[1] = y * srb + x * srd; + currentMatrix[2] = -x * sra + y * src; + currentMatrix[3] = -x * srb + y * srd; + cmdIndex += 1; + break; + default: + // eslint-disable-next-line no-console + console.error('Phaser: Invalid Graphics Command ID ' + cmd); + break; + } + } + }, -/***/ }), -/* 411 */ -/***/ (function(module, exports, __webpack_require__) { + // Stubs -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawStaticTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawStaticTilemapLayer: function () + { + }, -var Random = __webpack_require__(111); + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawEmitterManager + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmittermanager} emitterManager - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawEmitterManager: function () + { + }, -/** - * [description] - * - * @function Phaser.Actions.RandomTriangle - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RandomTriangle = function (items, triangle) -{ - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawBlitter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Blitter} blitter - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + drawBlitter: function () { - Random(triangle, items[i]); - } + }, - return items; -}; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchSprite: function () + { + }, -module.exports = RandomTriangle; + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchMesh + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Mesh} mesh - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchMesh: function () + { + }, + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchBitmapText: function () + { + }, -/***/ }), -/* 412 */ -/***/ (function(module, exports) { + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicBitmapText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchDynamicBitmapText: function () + { + }, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Text} text - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchText: function () + { + }, -/** - * [description] - * - * @function Phaser.Actions.Rotate - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var Rotate = function (items, value, step) -{ - if (step === undefined) { step = 0; } + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchDynamicTilemapLayer: function () + { + }, - for (var i = 0; i < items.length; i++) + /** + * [description] + * + * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchTileSprite + * @since 3.0.0 + * + * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + */ + batchTileSprite: function () { - items[i].rotation += value + (i * step); } - return items; -}; +}); -module.exports = Rotate; +module.exports = FlatTintPipeline; /***/ }), -/* 413 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var RotateAroundDistance = __webpack_require__(112); -var DistanceBetween = __webpack_require__(41); +/* 376 */ +/***/ (function(module, exports) { /** - * [description] - * - * @function Phaser.Actions.RotateAround - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RotateAround = function (items, point, angle) -{ - var x = point.x; - var y = point.y; +* The `Matter.Pair` module contains methods for creating and manipulating collision pairs. +* +* @class Pair +*/ - for (var i = 0; i < items.length; i++) - { - var item = items[i]; +var Pair = {}; - RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); - } +module.exports = Pair; - return items; -}; +(function() { + + /** + * Creates a pair. + * @method create + * @param {collision} collision + * @param {number} timestamp + * @return {pair} A new pair + */ + Pair.create = function(collision, timestamp) { + var bodyA = collision.bodyA, + bodyB = collision.bodyB; -module.exports = RotateAround; + var pair = { + id: Pair.id(bodyA, bodyB), + bodyA: bodyA, + bodyB: bodyB, + activeContacts: [], + separation: 0, + isActive: true, + confirmedActive: true, + isSensor: bodyA.isSensor || bodyB.isSensor, + timeCreated: timestamp, + timeUpdated: timestamp, + collision: null, + inverseMass: 0, + friction: 0, + frictionStatic: 0, + restitution: 0, + slop: 0 + }; -/***/ }), -/* 414 */ -/***/ (function(module, exports, __webpack_require__) { + Pair.update(pair, collision, timestamp); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + return pair; + }; -var MathRotateAroundDistance = __webpack_require__(112); + /** + * Updates a pair given a collision. + * @method update + * @param {pair} pair + * @param {collision} collision + * @param {number} timestamp + */ + Pair.update = function(pair, collision, timestamp) { + // var contacts = pair.contacts, + // supports = collision.supports, + // activeContacts = pair.activeContacts, + // parentA = collision.parentA, + // parentB = collision.parentB; + + pair.collision = collision; + // pair.inverseMass = parentA.inverseMass + parentB.inverseMass; + // pair.friction = Math.min(parentA.friction, parentB.friction); + // pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); + // pair.restitution = Math.max(parentA.restitution, parentB.restitution); + // pair.slop = Math.max(parentA.slop, parentB.slop); + // activeContacts.length = 0; + + if (collision.collided) { -/** - * [description] - * - * @function Phaser.Actions.RotateAroundDistance - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * @param {number} distance - The distance from the point of rotation in pixels. - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var RotateAroundDistance = function (items, point, angle, distance) -{ - var x = point.x; - var y = point.y; + var supports = collision.supports, + activeContacts = pair.activeContacts, + parentA = collision.parentA, + parentB = collision.parentB; - // There's nothing to do - if (distance === 0) - { - return items; - } + pair.inverseMass = parentA.inverseMass + parentB.inverseMass; + pair.friction = Math.min(parentA.friction, parentB.friction); + pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); + pair.restitution = Math.max(parentA.restitution, parentB.restitution); + pair.slop = Math.max(parentA.slop, parentB.slop); - for (var i = 0; i < items.length; i++) - { - MathRotateAroundDistance(items[i], x, y, angle, distance); - } + for (var i = 0; i < supports.length; i++) { + activeContacts[i] = supports[i].contact; + } - return items; -}; + var supportCount = supports.length; -module.exports = RotateAroundDistance; + if (supportCount < activeContacts.length) { + activeContacts.length = supportCount; + } + pair.separation = collision.depth; + Pair.setActive(pair, true, timestamp); + } else { + if (pair.isActive === true) + Pair.setActive(pair, false, timestamp); + } + }; + + /** + * Set a pair as active or inactive. + * @method setActive + * @param {pair} pair + * @param {bool} isActive + * @param {number} timestamp + */ + Pair.setActive = function(pair, isActive, timestamp) { + if (isActive) { + pair.isActive = true; + pair.timeUpdated = timestamp; + } else { + pair.isActive = false; + pair.activeContacts.length = 0; + } + }; -/***/ }), -/* 415 */ -/***/ (function(module, exports) { + /** + * Get the id for the given pair. + * @method id + * @param {body} bodyA + * @param {body} bodyB + * @return {string} Unique pairId + */ + Pair.id = function(bodyA, bodyB) { + if (bodyA.id < bodyB.id) { + return 'A' + bodyA.id + 'B' + bodyB.id; + } else { + return 'A' + bodyB.id + 'B' + bodyA.id; + } + }; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +})(); -/** - * [description] - * - * @function Phaser.Actions.ScaleX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ScaleX = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].scaleX += value; - } - return items; -}; +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = ScaleX; +__webpack_require__(378); +__webpack_require__(379); +__webpack_require__(380); +__webpack_require__(381); +__webpack_require__(382); +__webpack_require__(383); +__webpack_require__(384); +__webpack_require__(385); +__webpack_require__(386); /***/ }), -/* 416 */ +/* 378 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.ScaleXY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ScaleXY = function (items, x, y) +* A polyfill for Array.forEach +* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach +*/ +if (!Array.prototype.forEach) { - for (var i = 0; i < items.length; i++) + Array.prototype.forEach = function (fun /*, thisArg */) { - items[i].scaleX += x; - items[i].scaleY += y; - } + 'use strict'; - return items; -}; + if (this === void 0 || this === null) + { + throw new TypeError(); + } -module.exports = ScaleXY; + var t = Object(this); + var len = t.length >>> 0; + + if (typeof fun !== 'function') + { + throw new TypeError(); + } + + var thisArg = arguments.length >= 2 ? arguments[1] : void 0; + + for (var i = 0; i < len; i++) + { + if (i in t) + { + fun.call(thisArg, t[i], i, t); + } + } + }; +} /***/ }), -/* 417 */ +/* 379 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.ScaleY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var ScaleY = function (items, value) +* A polyfill for Array.isArray +*/ +if (!Array.isArray) { - for (var i = 0; i < items.length; i++) + Array.isArray = function (arg) { - items[i].scaleY += value; - } - - return items; -}; - -module.exports = ScaleY; + return Object.prototype.toString.call(arg) === '[object Array]'; + }; +} /***/ }), -/* 418 */ +/* 380 */ /***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +/* Copyright 2013 Chris Wilson -/** - * [description] - * - * @function Phaser.Actions.SetAlpha - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetAlpha = function (items, value, step) -{ - if (step === undefined) { step = 0; } + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - for (var i = 0; i < items.length; i++) - { - items[i].alpha = value + (i * step); - } + http://www.apache.org/licenses/LICENSE-2.0 - return items; -}; + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ -module.exports = SetAlpha; +/* +This monkeypatch library is intended to be included in projects that are +written to the proper AudioContext spec (instead of webkitAudioContext), +and that use the new naming and proper bits of the Web Audio API (e.g. +using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may +have to run on systems that only support the deprecated bits. -/***/ }), -/* 419 */ -/***/ (function(module, exports) { +This library should be harmless to include if the browser supports +unprefixed "AudioContext", and/or if it supports the new names. -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +The patches this library handles: +if window.AudioContext is unsupported, it will be aliased to webkitAudioContext(). +if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or +noteGrainOn(), depending on parameters. -/** - * [description] - * - * @function Phaser.Actions.SetBlendMode - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetBlendMode = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setBlendMode(value); - } +The following aliases only take effect if the new names are not already in place: - return items; -}; +AudioBufferSourceNode.stop() is aliased to noteOff() +AudioContext.createGain() is aliased to createGainNode() +AudioContext.createDelay() is aliased to createDelayNode() +AudioContext.createScriptProcessor() is aliased to createJavaScriptNode() +AudioContext.createPeriodicWave() is aliased to createWaveTable() +OscillatorNode.start() is aliased to noteOn() +OscillatorNode.stop() is aliased to noteOff() +OscillatorNode.setPeriodicWave() is aliased to setWaveTable() +AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime() -module.exports = SetBlendMode; +This library does NOT patch the enumerated type changes, as it is +recommended in the specification that implementations support both integer +and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel +BiquadFilterNode.type and OscillatorNode.type. +*/ +(function (global, exports, perf) { + 'use strict'; -/***/ }), -/* 420 */ -/***/ (function(module, exports) { + function fixSetTarget(param) { + if (!param) // if NYI, just return + return; + if (!param.setTargetAtTime) + param.setTargetAtTime = param.setTargetValueAtTime; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (window.hasOwnProperty('webkitAudioContext') && + !window.hasOwnProperty('AudioContext')) { + window.AudioContext = webkitAudioContext; -/** - * [description] - * - * @function Phaser.Actions.SetDepth - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetDepth = function (items, value, step) -{ - if (step === undefined) { step = 0; } + if (!AudioContext.prototype.hasOwnProperty('createGain')) + AudioContext.prototype.createGain = AudioContext.prototype.createGainNode; + if (!AudioContext.prototype.hasOwnProperty('createDelay')) + AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode; + if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor')) + AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode; + if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave')) + AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable; - for (var i = 0; i < items.length; i++) - { - items[i].depth = value + (i * step); - } - return items; -}; + AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain; + AudioContext.prototype.createGain = function() { + var node = this.internal_createGain(); + fixSetTarget(node.gain); + return node; + }; -module.exports = SetDepth; + AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay; + AudioContext.prototype.createDelay = function(maxDelayTime) { + var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay(); + fixSetTarget(node.delayTime); + return node; + }; + AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource; + AudioContext.prototype.createBufferSource = function() { + var node = this.internal_createBufferSource(); + if (!node.start) { + node.start = function ( when, offset, duration ) { + if ( offset || duration ) + this.noteGrainOn( when || 0, offset, duration ); + else + this.noteOn( when || 0 ); + }; + } else { + node.internal_start = node.start; + node.start = function( when, offset, duration ) { + if( typeof duration !== 'undefined' ) + node.internal_start( when || 0, offset, duration ); + else + node.internal_start( when || 0, offset || 0 ); + }; + } + if (!node.stop) { + node.stop = function ( when ) { + this.noteOff( when || 0 ); + }; + } else { + node.internal_stop = node.stop; + node.stop = function( when ) { + node.internal_stop( when || 0 ); + }; + } + fixSetTarget(node.playbackRate); + return node; + }; -/***/ }), -/* 421 */ -/***/ (function(module, exports) { + AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor; + AudioContext.prototype.createDynamicsCompressor = function() { + var node = this.internal_createDynamicsCompressor(); + fixSetTarget(node.threshold); + fixSetTarget(node.knee); + fixSetTarget(node.ratio); + fixSetTarget(node.reduction); + fixSetTarget(node.attack); + fixSetTarget(node.release); + return node; + }; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter; + AudioContext.prototype.createBiquadFilter = function() { + var node = this.internal_createBiquadFilter(); + fixSetTarget(node.frequency); + fixSetTarget(node.detune); + fixSetTarget(node.Q); + fixSetTarget(node.gain); + return node; + }; -/** - * [description] - * - * @function Phaser.Actions.SetHitArea - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {any} hitArea - [description] - * @param {function} hitAreaCallback - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetHitArea = function (items, hitArea, hitAreaCallback) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setInteractive(hitArea, hitAreaCallback); + if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) { + AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator; + AudioContext.prototype.createOscillator = function() { + var node = this.internal_createOscillator(); + if (!node.start) { + node.start = function ( when ) { + this.noteOn( when || 0 ); + }; + } else { + node.internal_start = node.start; + node.start = function ( when ) { + node.internal_start( when || 0); + }; + } + if (!node.stop) { + node.stop = function ( when ) { + this.noteOff( when || 0 ); + }; + } else { + node.internal_stop = node.stop; + node.stop = function( when ) { + node.internal_stop( when || 0 ); + }; + } + if (!node.setPeriodicWave) + node.setPeriodicWave = node.setWaveTable; + fixSetTarget(node.frequency); + fixSetTarget(node.detune); + return node; + }; } + } - return items; -}; + if (window.hasOwnProperty('webkitOfflineAudioContext') && + !window.hasOwnProperty('OfflineAudioContext')) { + window.OfflineAudioContext = webkitOfflineAudioContext; + } + +}(window)); -module.exports = SetHitArea; /***/ }), -/* 422 */ +/* 381 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetOrigin - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * Also fix for the absent console in IE9 */ -var SetOrigin = function (items, x, y) +if (!window.console) { - for (var i = 0; i < items.length; i++) - { - items[i].setOrigin(x, y); - } - - return items; -}; - -module.exports = SetOrigin; + window.console = {}; + window.console.log = window.console.assert = function(){}; + window.console.warn = window.console.assert = function(){}; +} /***/ }), -/* 423 */ +/* 382 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetRotation - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetRotation = function (items, value, step) -{ - if (step === undefined) { step = 0; } +* A polyfill for Function.prototype.bind +*/ +if (!Function.prototype.bind) { - for (var i = 0; i < items.length; i++) - { - items[i].rotation = value + (i * step); - } + /* jshint freeze: false */ + Function.prototype.bind = (function () { - return items; -}; + var slice = Array.prototype.slice; -module.exports = SetRotation; + return function (thisArg) { + var target = this, boundArgs = slice.call(arguments, 1); -/***/ }), -/* 424 */ -/***/ (function(module, exports) { + if (typeof target !== 'function') + { + throw new TypeError(); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + function bound() { + var args = boundArgs.concat(slice.call(arguments)); + target.apply(this instanceof bound ? this : thisArg, args); + } -/** - * [description] - * - * @function Phaser.Actions.SetScale - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} [stepX=0] - [description] - * @param {number} [stepY=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetScale = function (items, x, y, stepX, stepY) -{ - if (stepX === undefined) { stepX = 0; } - if (stepY === undefined) { stepY = 0; } + bound.prototype = (function F(proto) { + if (proto) + { + F.prototype = proto; + } - for (var i = 0; i < items.length; i++) - { - items[i].setScale( - x + (i * stepX), - y + (i * stepY) - ); - } + if (!(this instanceof F)) + { + /* jshint supernew: true */ + return new F; + } + })(target.prototype); - return items; -}; + return bound; + }; + })(); +} -module.exports = SetScale; /***/ }), -/* 425 */ +/* 383 */ /***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetScaleX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetScaleX = function (items, value, step) -{ - if (step === undefined) { step = 0; } - - for (var i = 0; i < items.length; i++) - { - items[i].scaleX = value + (i * step); - } - - return items; -}; - -module.exports = SetScaleX; +// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc +if (!Math.trunc) { + Math.trunc = function trunc(x) { + return x < 0 ? Math.ceil(x) : Math.floor(x); + }; +} /***/ }), -/* 426 */ +/* 384 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetScaleY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. + * performance.now */ -var SetScaleY = function (items, value, step) -{ - if (step === undefined) { step = 0; } +(function () { - for (var i = 0; i < items.length; i++) + if ('performance' in window === false) { - items[i].scaleY = value + (i * step); + window.performance = {}; } - return items; -}; - -module.exports = SetScaleY; - + // Thanks IE8 + Date.now = (Date.now || function () { + return new Date().getTime(); + }); -/***/ }), -/* 427 */ -/***/ (function(module, exports) { + if ('now' in window.performance === false) + { + var nowOffset = Date.now(); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (performance.timing && performance.timing.navigationStart) + { + nowOffset = performance.timing.navigationStart; + } -/** - * [description] - * - * @function Phaser.Actions.SetTint - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} topLeft - [description] - * @param {number} [topRight] - [description] - * @param {number} [bottomLeft] - [description] - * @param {number} [bottomRight] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); + window.performance.now = function now () + { + return Date.now() - nowOffset; + } } - return items; -}; - -module.exports = SetTint; +})(); /***/ }), -/* 428 */ -/***/ (function(module, exports) { +/* 385 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +/* WEBPACK VAR INJECTION */(function(global) {// References: +// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// https://gist.github.com/1579671 +// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision +// https://gist.github.com/timhall/4078614 +// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame -/** - * [description] - * - * @function Phaser.Actions.SetVisible - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {boolean} value - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetVisible = function (items, value) -{ - for (var i = 0; i < items.length; i++) - { - items[i].visible = value; - } +// Expected to be used with Browserfiy +// Browserify automatically detects the use of `global` and passes the +// correct reference of `global`, `self`, and finally `window` - return items; -}; +// Date.now +if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { + return new Date().getTime(); + }; +} -module.exports = SetVisible; +// performance.now +if (!(global.performance && global.performance.now)) { + var startTime = Date.now(); + if (!global.performance) { + global.performance = {}; + } + global.performance.now = function () { + return Date.now() - startTime; + }; +} +// requestAnimationFrame +var lastTime = Date.now(); +var vendors = ['ms', 'moz', 'webkit', 'o']; -/***/ }), -/* 429 */ -/***/ (function(module, exports) { +for(var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { + global.requestAnimationFrame = global[vendors[x] + 'RequestAnimationFrame']; + global.cancelAnimationFrame = global[vendors[x] + 'CancelAnimationFrame'] || + global[vendors[x] + 'CancelRequestAnimationFrame']; +} -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +if (!global.requestAnimationFrame) { + global.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + 'is not a function'); + } -/** - * [description] - * - * @function Phaser.Actions.SetX - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetX = function (items, value, step) -{ - if (step === undefined) { step = 0; } + var currentTime = Date.now(), + delay = 16 + lastTime - currentTime; - for (var i = 0; i < items.length; i++) - { - items[i].x = value + (i * step); - } + if (delay < 0) { + delay = 0; + } - return items; -}; + lastTime = currentTime; -module.exports = SetX; + return setTimeout(function () { + lastTime = Date.now(); + callback(performance.now()); + }, delay); + }; +} +if (!global.cancelAnimationFrame) { + global.cancelAnimationFrame = function(id) { + clearTimeout(id); + }; +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(167))) /***/ }), -/* 430 */ +/* 386 */ /***/ (function(module, exports) { /** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -/** - * [description] - * - * @function Phaser.Actions.SetXY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {number} [stepX=0] - [description] - * @param {number} [stepY=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetXY = function (items, x, y, stepX, stepY) +* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9 +* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/ +* Cameron Foale (http://www.kibibu.com) +*/ +if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object") { - if (stepX === undefined) { stepX = 0; } - if (stepY === undefined) { stepY = 0; } - - for (var i = 0; i < items.length; i++) + var CheapArray = function(type) { - items[i].x = x + (i * stepX); - items[i].y = y + (i * stepY); - } - - return items; -}; - -module.exports = SetXY; + var proto = new Array(); // jshint ignore:line + window[type] = function(arg) { -/***/ }), -/* 431 */ -/***/ (function(module, exports) { + if (typeof(arg) === "number") + { + Array.call(this, arg); + this.length = arg; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + for (var i = 0; i < this.length; i++) + { + this[i] = 0; + } + } + else + { + Array.call(this, arg.length); -/** - * [description] - * - * @function Phaser.Actions.SetY - * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} value - [description] - * @param {number} [step=0] - [description] - * - * @return {array} The array of Game Objects that was passed to this Action. - */ -var SetY = function (items, value, step) -{ - if (step === undefined) { step = 0; } + this.length = arg.length; - for (var i = 0; i < items.length; i++) - { - items[i].y = value + (i * step); - } + for (var i = 0; i < this.length; i++) + { + this[i] = arg[i]; + } + } + }; - return items; -}; + window[type].prototype = proto; + window[type].constructor = window[type]; + }; -module.exports = SetY; + CheapArray('Float32Array'); // jshint ignore:line + CheapArray('Uint32Array'); // jshint ignore:line + CheapArray('Uint16Array'); // jshint ignore:line + CheapArray('Int16Array'); // jshint ignore:line + CheapArray('ArrayBuffer'); // jshint ignore:line +} /***/ }), -/* 432 */ -/***/ (function(module, exports, __webpack_require__) { +/* 387 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -80197,126 +81139,33 @@ module.exports = SetY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Vector2 = __webpack_require__(6); - -// Iterate through items changing the position of each element to -// be that of the element that came before it in the array (or after it if direction = 1) -// The first items position is set to x/y. -// The final x/y coords are returned - /** * [description] * - * @function Phaser.Actions.ShiftPosition + * @function Phaser.Actions.Angle * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} x - [description] - * @param {number} y - [description] - * @param {integer} [direction=0] - [description] - * @param {Phaser.Math.Vector2|object} [output] - [description] + * @param {number} value - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var ShiftPosition = function (items, x, y, direction, output) +var Angle = function (items, value) { - if (direction === undefined) { direction = 0; } - if (output === undefined) { output = new Vector2(); } - - var px; - var py; - - if (items.length > 1) - { - var i; - var cx; - var cy; - var cur; - - if (direction === 0) - { - // Bottom to Top - - var len = items.length - 1; - - px = items[len].x; - py = items[len].y; - - for (i = len - 1; i >= 0; i--) - { - // Current item - cur = items[i]; - - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; - - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; - - // Set current as previous - px = cx; - py = cy; - } - - // Update the head item to the new x/y coordinates - items[len].x = x; - items[len].y = y; - } - else - { - // Top to Bottom - - px = items[0].x; - py = items[0].y; - - for (i = 1; i < items.length; i++) - { - // Current item - cur = items[i]; - - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; - - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; - - // Set current as previous - px = cx; - py = cy; - } - - // Update the head item to the new x/y coordinates - items[0].x = x; - items[0].y = y; - } - } - else + for (var i = 0; i < items.length; i++) { - px = items[0].x; - py = items[0].y; - - items[0].x = x; - items[0].y = y; + items[i].angle += value; } - // Return the final set of coordinates as they're effectively lost from the shift and may be needed - - output.x = px; - output.y = py; - - return output; + return items; }; -module.exports = ShiftPosition; +module.exports = Angle; /***/ }), -/* 433 */ -/***/ (function(module, exports, __webpack_require__) { +/* 388 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -80324,29 +81173,36 @@ module.exports = ShiftPosition; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ArrayShuffle = __webpack_require__(80); - /** * [description] * - * @function Phaser.Actions.Shuffle + * @function Phaser.Actions.Call * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {function} callback - [description] + * @param {object} thisArg - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var Shuffle = function (items) +var Call = function (items, callback, thisArg) { - return ArrayShuffle(items); + for (var i = 0; i < items.length; i++) + { + var item = items[i]; + + callback.call(thisArg, item); + } + + return items; }; -module.exports = Shuffle; +module.exports = Call; /***/ }), -/* 434 */ -/***/ (function(module, exports, __webpack_require__) { +/* 389 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -80354,52 +81210,54 @@ module.exports = Shuffle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmootherStep = __webpack_require__(192); +// compare = Object: +// { +// scaleX: 0.5, +// scaleY: 1 +// } /** * [description] * - * @function Phaser.Actions.SmootherStep + * @function Phaser.Actions.GetFirst * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] - * + * @param {object} compare - [description] + * @param {integer} index - [description] + * * @return {array} The array of Game Objects that was passed to this Action. */ -var SmootherStep = function (items, property, min, max, inc) +var GetFirst = function (items, compare, index) { - if (inc === undefined) { inc = false; } + for (var i = index; i < items.length; i++) + { + var item = items[i]; - var step = Math.abs(max - min) / items.length; - var i; + var match = true; - if (inc) - { - for (i = 0; i < items.length; i++) + for (var property in compare) { - items[i][property] += MathSmootherStep(i * step, min, max); + if (item[property] !== compare[property]) + { + match = false; + } } - } - else - { - for (i = 0; i < items.length; i++) + + if (match) { - items[i][property] = MathSmootherStep(i * step, min, max); + return item; } } - return items; + return null; }; -module.exports = SmootherStep; +module.exports = GetFirst; /***/ }), -/* 435 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80408,53 +81266,113 @@ module.exports = SmootherStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MathSmoothStep = __webpack_require__(193); +var AlignIn = __webpack_require__(170); +var CONST = __webpack_require__(171); +var GetValue = __webpack_require__(4); +var NOOP = __webpack_require__(3); +var Zone = __webpack_require__(77); + +var tempZone = new Zone({ sys: { queueDepthSort: NOOP }}, 0, 0, 1, 1); /** * [description] * - * @function Phaser.Actions.SmoothStep + * @function Phaser.Actions.GridAlign * @since 3.0.0 * * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] + * @param {object} options - [description] * * @return {array} The array of Game Objects that was passed to this Action. */ -var SmoothStep = function (items, property, min, max, inc) +var GridAlign = function (items, options) { - if (inc === undefined) { inc = false; } + var width = GetValue(options, 'width', -1); + var height = GetValue(options, 'height', -1); + var cellWidth = GetValue(options, 'cellWidth', 1); + var cellHeight = GetValue(options, 'cellHeight', cellWidth); + var position = GetValue(options, 'position', CONST.TOP_LEFT); + var x = GetValue(options, 'x', 0); + var y = GetValue(options, 'y', 0); - var step = Math.abs(max - min) / items.length; - var i; + // var centerX = GetValue(options, 'centerX', null); + // var centerY = GetValue(options, 'centerY', null); - if (inc) + var cx = 0; + var cy = 0; + var w = (width * cellWidth); + var h = (height * cellHeight); + + // If the Grid is centered on a position then we need to calculate it now + // if (centerX !== null && centerY !== null) + // { + // + // } + + tempZone.setPosition(x, y); + tempZone.setSize(cellWidth, cellHeight); + + for (var i = 0; i < items.length; i++) { - for (i = 0; i < items.length; i++) + AlignIn(items[i], tempZone, position); + + if (width === -1) { - items[i][property] += MathSmoothStep(i * step, min, max); + // We keep laying them out horizontally until we've done them all + cy += cellHeight; + tempZone.y += cellHeight; + + if (cy === h) + { + cy = 0; + tempZone.x += cellWidth; + tempZone.y = y; + } } - } - else - { - for (i = 0; i < items.length; i++) + else if (height === -1) { - items[i][property] = MathSmoothStep(i * step, min, max); + // We keep laying them out vertically until we've done them all + cx += cellWidth; + tempZone.x += cellWidth; + + if (cx === w) + { + cx = 0; + tempZone.x = x; + tempZone.y += cellHeight; + } + } + else + { + // We keep laying them out until we hit the column limit + cx += cellWidth; + tempZone.x += cellWidth; + + if (cx === w) + { + cx = 0; + cy += cellHeight; + tempZone.x = x; + tempZone.y += cellHeight; + + if (cy === h) + { + // We've hit the column limit, so return, even if there are items left + break; + } + } } } return items; }; -module.exports = SmoothStep; +module.exports = GridAlign; /***/ }), -/* 436 */ -/***/ (function(module, exports) { +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -80462,51 +81380,461 @@ module.exports = SmoothStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Class = __webpack_require__(0); + /** + * @classdesc * [description] * - * @function Phaser.Actions.Spread + * @class RandomDataGenerator + * @memberOf Phaser.Math + * @constructor * @since 3.0.0 - * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - [description] - * @param {number} min - [description] - * @param {number} max - [description] - * @param {number} inc - [description] * - * @return {array} The array of Game Objects that was passed to this Action. + * @param {array} [seeds] - [description] */ -var Spread = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } +var RandomDataGenerator = new Class({ - var step = Math.abs(max - min) / items.length; - var i; + initialize: - if (inc) + function RandomDataGenerator (seeds) { - for (i = 0; i < items.length; i++) + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#c + * @type {number} + * @default 1 + * @private + * @since 3.0.0 + */ + this.c = 1; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s0 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s0 = 0; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s1 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s1 = 0; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s2 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s2 = 0; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#n + * @type {number} + * @default 0 + * @private + * @since 3.2.0 + */ + this.n = 0; + + /** + * [description] + * + * @name Phaser.Math.RandomDataGenerator#sign + * @type {array} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; + + if (seeds) { - items[i][property] += i * step; + this.init(seeds); } - } - else + }, + + /** + * Private random helper. + * + * @method Phaser.Math.RandomDataGenerator#rnd + * @since 3.0.0 + * @private + * + * @return {number} [description] + */ + rnd: function () { - for (i = 0; i < items.length; i++) + var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 + + this.c = t | 0; + this.s0 = this.s1; + this.s1 = this.s2; + this.s2 = t - this.c; + + return this.s2; + }, + + /** + * Internal method that creates a seed hash. + * + * @method Phaser.Math.RandomDataGenerator#hash + * @since 3.0.0 + * @private + * + * @param {[type]} data - [description] + * + * @return {number} The hashed value. + */ + hash: function (data) + { + var h; + var n = this.n; + + data = data.toString(); + + for (var i = 0; i < data.length; i++) { - items[i][property] = i * step; + n += data.charCodeAt(i); + h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000;// 2^32 + } + + this.n = n; + + return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 + }, + + /** + * [description] + * + * @method Phaser.Math.RandomDataGenerator#init + * @since 3.0.0 + * + * @param {string|array} seeds - [description] + */ + init: function (seeds) + { + if (typeof seeds === 'string') + { + this.state(seeds); + } + else + { + this.sow(seeds); + } + }, + + /** + * Reset the seed of the random data generator. + * + * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. + * + * @method Phaser.Math.RandomDataGenerator#sow + * @since 3.0.0 + * + * @param {any[]} seeds - The array of seeds: the `toString()` of each value is used. + */ + sow: function (seeds) + { + // Always reset to default seed + this.n = 0xefc8249d; + this.s0 = this.hash(' '); + this.s1 = this.hash(' '); + this.s2 = this.hash(' '); + this.c = 1; + + if (!seeds) + { + return; + } + + // Apply any seeds + for (var i = 0; i < seeds.length && (seeds[i] != null); i++) + { + var seed = seeds[i]; + + this.s0 -= this.hash(seed); + this.s0 += ~~(this.s0 < 0); + this.s1 -= this.hash(seed); + this.s1 += ~~(this.s1 < 0); + this.s2 -= this.hash(seed); + this.s2 += ~~(this.s2 < 0); + } + }, + + /** + * Returns a random integer between 0 and 2^32. + * + * @method Phaser.Math.RandomDataGenerator#integer + * @since 3.0.0 + * + * @return {number} A random integer between 0 and 2^32. + */ + integer: function () + { + // 2^32 + return this.rnd() * 0x100000000; + }, + + /** + * Returns a random real number between 0 and 1. + * + * @method Phaser.Math.RandomDataGenerator#frac + * @since 3.0.0 + * + * @return {number} A random real number between 0 and 1. + */ + frac: function () + { + // 2^-53 + return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; + }, + + /** + * Returns a random real number between 0 and 2^32. + * + * @method Phaser.Math.RandomDataGenerator#real + * @since 3.0.0 + * + * @return {number} A random real number between 0 and 2^32. + */ + real: function () + { + return this.integer() + this.frac(); + }, + + /** + * Returns a random integer between and including min and max. + * + * @method Phaser.Math.RandomDataGenerator#integerInRange + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + integerInRange: function (min, max) + { + return Math.floor(this.realInRange(0, max - min + 1) + min); + }, + + /** + * Returns a random integer between and including min and max. + * This method is an alias for RandomDataGenerator.integerInRange. + * + * @method Phaser.Math.RandomDataGenerator#between + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + between: function (min, max) + { + return Math.floor(this.realInRange(0, max - min + 1) + min); + }, + + /** + * Returns a random real number between min and max. + * + * @method Phaser.Math.RandomDataGenerator#realInRange + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. + */ + realInRange: function (min, max) + { + return this.frac() * (max - min) + min; + }, + + /** + * Returns a random real number between -1 and 1. + * + * @method Phaser.Math.RandomDataGenerator#normal + * @since 3.0.0 + * + * @return {number} A random real number between -1 and 1. + */ + normal: function () + { + return 1 - (2 * this.frac()); + }, + + /** + * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * + * @method Phaser.Math.RandomDataGenerator#uuid + * @since 3.0.0 + * + * @return {string} A valid RFC4122 version4 ID hex string + */ + uuid: function () + { + var a = ''; + var b = ''; + + for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') + { + // eslint-disable-next-line no-empty + } + + return b; + }, + + /** + * Returns a random element from within the given array. + * + * @method Phaser.Math.RandomDataGenerator#pick + * @since 3.0.0 + * + * @param {array} array - The array to pick a random element from. + * + * @return {any} A random member of the array. + */ + pick: function (array) + { + return array[this.integerInRange(0, array.length - 1)]; + }, + + /** + * Returns a sign to be used with multiplication operator. + * + * @method Phaser.Math.RandomDataGenerator#sign + * @since 3.0.0 + * + * @return {number} -1 or +1. + */ + sign: function () + { + return this.pick(this.signs); + }, + + /** + * Returns a random element from within the given array, favoring the earlier entries. + * + * @method Phaser.Math.RandomDataGenerator#weightedPick + * @since 3.0.0 + * + * @param {array} array - The array to pick a random element from. + * + * @return {any} A random member of the array. + */ + weightedPick: function (array) + { + return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; + }, + + /** + * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. + * + * @method Phaser.Math.RandomDataGenerator#timestamp + * @since 3.0.0 + * + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random timestamp between min and max. + */ + timestamp: function (min, max) + { + return this.realInRange(min || 946684800000, max || 1577862000000); + }, + + /** + * Returns a random angle between -180 and 180. + * + * @method Phaser.Math.RandomDataGenerator#angle + * @since 3.0.0 + * + * @return {number} A random number between -180 and 180. + */ + angle: function () + { + return this.integerInRange(-180, 180); + }, + + /** + * Returns a random rotation in radians, between -3.141 and 3.141 + * + * @method Phaser.Math.RandomDataGenerator#rotation + * @since 3.0.0 + * + * @return {number} A random number between -3.141 and 3.141 + */ + rotation: function () + { + return this.realInRange(-3.1415926, 3.1415926); + }, + + /** + * Gets or Sets the state of the generator. This allows you to retain the values + * that the generator is using between games, i.e. in a game save file. + * + * To seed this generator with a previously saved state you can pass it as the + * `seed` value in your game config, or call this method directly after Phaser has booted. + * + * Call this method with no parameters to return the current state. + * + * If providing a state it should match the same format that this method + * returns, which is a string with a header `!rnd` followed by the `c`, + * `s0`, `s1` and `s2` values respectively, each comma-delimited. + * + * @method Phaser.Math.RandomDataGenerator#state + * @since 3.0.0 + * + * @param {string} [state] - Generator state to be set. + * + * @return {string} The current state of the generator. + */ + state: function (state) + { + if (typeof state === 'string' && state.match(/^!rnd/)) + { + state = state.split(','); + + this.c = parseFloat(state[1]); + this.s0 = parseFloat(state[2]); + this.s1 = parseFloat(state[3]); + this.s2 = parseFloat(state[4]); } + + return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); } - return items; -}; +}); -module.exports = Spread; +module.exports = RandomDataGenerator; /***/ }), -/* 437 */ -/***/ (function(module, exports) { +/* 392 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -80514,31 +81842,244 @@ module.exports = Spread; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Clamp = __webpack_require__(61); + +// bitmask flag for GameObject.renderMask +var _FLAG = 2; // 0010 + /** - * [description] - * - * @function Phaser.Actions.ToggleVisible - * @since 3.0.0 + * Provides methods used for setting the alpha properties of a Game Object. + * Should be applied as a mixin and not used directly. * - * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. - * - * @return {array} The array of Game Objects that was passed to this Action. + * @name Phaser.GameObjects.Components.Alpha + * @since 3.0.0 */ -var ToggleVisible = function (items) -{ - for (var i = 0; i < items.length; i++) + +var Alpha = { + + _alpha: 1, + + _alphaTL: 1, + _alphaTR: 1, + _alphaBL: 1, + _alphaBR: 1, + + /** + * Clears all alpha values associated with this Game Object. + * Immediately sets the alpha levels back to 1 (fully opaque) + * + * @method Phaser.GameObjects.Components.Alpha#clearAlpha + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + clearAlpha: function () { - items[i].visible = !items[i].visible; + return this.setAlpha(1); + }, + + /** + * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * If your game is running under WebGL you can optionally specify four different alpha values, each of which + * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. + * + * @method Phaser.GameObjects.Components.Alpha#setAlpha + * @since 3.0.0 + * + * @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. + * @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. + * @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. + * @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) + { + if (topLeft === undefined) { topLeft = 1; } + + // Treat as if there is only one alpha value for the whole Game Object + if (topRight === undefined) + { + this.alpha = topLeft; + } + else + { + this._alphaTL = Clamp(topLeft, 0, 1); + this._alphaTR = Clamp(topRight, 0, 1); + this._alphaBL = Clamp(bottomLeft, 0, 1); + this._alphaBR = Clamp(bottomRight, 0, 1); + } + + return this; + }, + + /** + * The alpha value of the Game Object. + * + * This is a global value, impacting the entire Game Object, not just a region of it. + * + * @name Phaser.GameObjects.Components.Alpha#alpha + * @type {float} + * @since 3.0.0 + */ + alpha: { + + get: function () + { + return this._alpha; + }, + + set: function (value) + { + var v = Clamp(value, 0, 1); + + this._alpha = v; + this._alphaTL = v; + this._alphaTR = v; + this._alphaBL = v; + this._alphaBR = v; + + if (v === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } + + }, + + /** + * The alpha value starting from the top-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaTopLeft: { + + get: function () + { + return this._alphaTL; + }, + + set: function (value) + { + var v = Clamp(value, 0, 1); + + this._alphaTL = v; + + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } + + }, + + /** + * The alpha value starting from the top-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopRight + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaTopRight: { + + get: function () + { + return this._alphaTR; + }, + + set: function (value) + { + var v = Clamp(value, 0, 1); + + this._alphaTR = v; + + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } + + }, + + /** + * The alpha value starting from the bottom-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomLeft: { + + get: function () + { + return this._alphaBL; + }, + + set: function (value) + { + var v = Clamp(value, 0, 1); + + this._alphaBL = v; + + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } + + }, + + /** + * The alpha value starting from the bottom-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight + * @type {float} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomRight: { + + get: function () + { + return this._alphaBR; + }, + + set: function (value) + { + var v = Clamp(value, 0, 1); + + this._alphaBR = v; + + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } + } - return items; }; -module.exports = ToggleVisible; +module.exports = Alpha; /***/ }), -/* 438 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80547,44 +82088,197 @@ module.exports = ToggleVisible; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var BlendModes = __webpack_require__(45); + /** - * @namespace Phaser.Animations + * Provides methods used for setting the blend mode of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.BlendMode + * @since 3.0.0 */ -module.exports = { +var BlendMode = { + + _blendMode: BlendModes.NORMAL, + + /** + * Sets the Blend Mode being used by this Game Object. + * + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) + * + * Under WebGL only the following Blend Modes are available: + * + * * ADD + * * MULTIPLY + * * SCREEN + * + * Canvas has more available depending on browser support. + * + * You can also create your own custom Blend Modes in WebGL. + * + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency of which blend modes + * are used. + * + * @name Phaser.GameObjects.Components.BlendMode#blendMode + * @type {integer|string} + * @since 3.0.0 + */ + blendMode: { + + get: function () + { + return this._blendMode; + }, + + set: function (value) + { + if (typeof value === 'string') + { + value = BlendModes[value]; + } + + value | 0; + + if (value >= 0) + { + this._blendMode = value; + } + } + + }, + + /** + * Sets the Blend Mode being used by this Game Object. + * + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) + * + * Under WebGL only the following Blend Modes are available: + * + * * ADD + * * MULTIPLY + * * SCREEN + * + * Canvas has more available depending on browser support. + * + * You can also create your own custom Blend Modes in WebGL. + * + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency of which blend modes + * are used. + * + * @method Phaser.GameObjects.Components.BlendMode#setBlendMode + * @since 3.0.0 + * + * @param {string|integer} value - The BlendMode value. Either a string or a CONST. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setBlendMode: function (value) + { + this.blendMode = value; - Animation: __webpack_require__(194), - AnimationFrame: __webpack_require__(195), - AnimationManager: __webpack_require__(196) + return this; + } }; +module.exports = BlendMode; + /***/ }), -/* 439 */ -/***/ (function(module, exports, __webpack_require__) { +/* 394 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Provides methods used for setting the blend mode of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.ComputedSize + * @since 3.0.0 + */ + +var ComputedSize = { + + /** + * The native (un-scaled) width of this Game Object. + * + * @name Phaser.GameObjects.Components.ComputedSize#width + * @type {number} + * @since 3.0.0 + */ + width: 0, + + /** + * The native (un-scaled) height of this Game Object. + * + * @name Phaser.GameObjects.Components.ComputedSize#height + * @type {number} + * @since 3.0.0 + */ + height: 0, + + /** + * The displayed width of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.ComputedSize#displayWidth + * @type {number} + * @since 3.0.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -/** - * @namespace Phaser.Cache - */ + /** + * The displayed height of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.ComputedSize#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { -module.exports = { + get: function () + { + return this.scaleY * this.height; + }, - BaseCache: __webpack_require__(198), - CacheManager: __webpack_require__(199) + set: function (value) + { + this.scaleY = value / this.height; + } + + } }; +module.exports = ComputedSize; + /***/ }), -/* 440 */ -/***/ (function(module, exports, __webpack_require__) { +/* 395 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -80593,43 +82287,82 @@ module.exports = { */ /** - * @namespace Phaser.Cameras + * Provides methods used for setting the depth of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Depth + * @since 3.0.0 */ -module.exports = { +var Depth = { - Controls: __webpack_require__(441), - Scene2D: __webpack_require__(444), - Sprite3D: __webpack_require__(446) + _depth: 0, -}; + /** + * The depth of this Game Object within the Scene. + * + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. + * + * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth + * value will always render in front of one with a lower value. + * + * Setting the depth will queue a depth sort event within the Scene. + * + * @name Phaser.GameObjects.Components.Depth#depth + * @type {number} + * @since 3.0.0 + */ + depth: { + get: function () + { + return this._depth; + }, -/***/ }), -/* 441 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this.scene.sys.queueDepthSort(); + this._depth = value; + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -/** - * @namespace Phaser.Cameras.Controls - */ + /** + * The depth of this Game Object within the Scene. + * + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. + * + * The depth starts from zero (the default value) and increases from that point. A Game Object with a higher depth + * value will always render in front of one with a lower value. + * + * Setting the depth will queue a depth sort event within the Scene. + * + * @method Phaser.GameObjects.Components.Depth#setDepth + * @since 3.0.0 + * + * @param {integer} value - The depth of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setDepth: function (value) + { + if (value === undefined) { value = 0; } -module.exports = { + this.depth = value; - Fixed: __webpack_require__(442), - Smoothed: __webpack_require__(443) + return this; + } }; +module.exports = Depth; + /***/ }), -/* 442 */ -/***/ (function(module, exports, __webpack_require__) { +/* 396 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -80637,291 +82370,146 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(4); - -// var camControl = new CameraControl({ -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// speed: float OR { x: 0, y: 0 } -// }) - /** - * @classdesc - * [description] - * - * @class FixedKeyControl - * @memberOf Phaser.Cameras.Controls - * @constructor + * Provides methods used for visually flipping a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Flip * @since 3.0.0 - * - * @param {object} config - [description] */ -var FixedKeyControl = new Class({ - - initialize: - - function FixedKeyControl (config) - { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); - - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#left - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); - - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#right - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); - - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#up - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); - - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#down - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); - - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); - - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); - - /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed - * @type {float} - * @default 0.01 - * @since 3.0.0 - */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); - /** - * The horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedX - * @type {float} - * @default 0 - * @since 3.0.0 - */ +var Flip = { - /** - * The vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var speed = GetValue(config, 'speed', null); + /** + * The horizontally flipped state of the Game Object. + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * + * @name Phaser.GameObjects.Components.Flip#flipX + * @type {boolean} + * @default false + * @since 3.0.0 + */ + flipX: false, - if (typeof speed === 'number') - { - this.speedX = speed; - this.speedY = speed; - } - else - { - this.speedX = GetValue(config, 'speed.x', 0); - this.speedY = GetValue(config, 'speed.y', 0); - } + /** + * The vertically flipped state of the Game Object. + * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * + * @name Phaser.GameObjects.Components.Flip#flipY + * @type {boolean} + * @default false + * @since 3.0.0 + */ + flipY: false, - /** - * [description] - * - * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; + /** + * Toggles the horizontal flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipX + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + toggleFlipX: function () + { + this.flipX = !this.flipX; - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); + return this; }, /** - * Starts the Key Control running, providing it has been linked to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#start + * Toggles the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipY * @since 3.0.0 - * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - start: function () + toggleFlipY: function () { - this.active = (this.camera !== null); + this.flipY = !this.flipY; return this; }, /** - * Stops this Key Control from running. Call `start` to start it again. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#stop + * Sets the horizontal flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlipX * @since 3.0.0 * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - stop: function () + setFlipX: function (value) { - this.active = false; + this.flipX = value; return this; }, /** - * Binds this Key Control to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera + * Sets the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlipY * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. - * - * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - setCamera: function (camera) + setFlipY: function (value) { - this.camera = camera; + this.flipY = value; return this; }, /** - * [description] - * - * @method Phaser.Cameras.Controls.FixedKeyControl#update + * Sets the horizontal and vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlip * @since 3.0.0 * - * @param {number} delta - [description] + * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - update: function (delta) + setFlip: function (x, y) { - if (!this.active) - { - return; - } - - if (delta === undefined) { delta = 1; } - - var cam = this.camera; - - if (this.up && this.up.isDown) - { - cam.scrollY -= ((this.speedY * delta) | 0); - } - else if (this.down && this.down.isDown) - { - cam.scrollY += ((this.speedY * delta) | 0); - } - - if (this.left && this.left.isDown) - { - cam.scrollX -= ((this.speedX * delta) | 0); - } - else if (this.right && this.right.isDown) - { - cam.scrollX += ((this.speedX * delta) | 0); - } - - // Camera zoom - - if (this.zoomIn && this.zoomIn.isDown) - { - cam.zoom -= this.zoomSpeed; + this.flipX = x; + this.flipY = y; - if (cam.zoom < 0.1) - { - cam.zoom = 0.1; - } - } - else if (this.zoomOut && this.zoomOut.isDown) - { - cam.zoom += this.zoomSpeed; - } + return this; }, /** - * Destroys this Key Control. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#destroy + * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. + * + * @method Phaser.GameObjects.Components.Flip#resetFlip * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - destroy: function () + resetFlip: function () { - this.camera = null; - - this.left = null; - this.right = null; - this.up = null; - this.down = null; + this.flipX = false; + this.flipY = false; - this.zoomIn = null; - this.zoomOut = null; + return this; } -}); +}; -module.exports = FixedKeyControl; +module.exports = Flip; /***/ }), -/* 443 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80930,486 +82518,193 @@ module.exports = FixedKeyControl; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(4); - -// var controlConfig = { -// camera: this.cameras.main, -// left: cursors.left, -// right: cursors.right, -// up: cursors.up, -// down: cursors.down, -// zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), -// zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), -// zoomSpeed: 0.02, -// acceleration: 0.06, -// drag: 0.0005, -// maxSpeed: 1.0 -// }; +var Rectangle = __webpack_require__(8); +var RotateAround = __webpack_require__(186); +var Vector2 = __webpack_require__(6); /** - * @classdesc - * [description] - * - * @class SmoothedKeyControl - * @memberOf Phaser.Cameras.Controls - * @constructor + * Provides methods used for obtaining the bounds of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.GetBounds * @since 3.0.0 - * - * @param {object} config - [description] */ -var SmoothedKeyControl = new Class({ - - initialize: - - function SmoothedKeyControl (config) - { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); - - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#left - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); - - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#right - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); - - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#up - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); - - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#down - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); - - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); - - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut - * @type {Phaser.Input.Keyboard} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); - - /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed - * @type {float} - * @default 0.01 - * @since 3.0.0 - */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); - - /** - * The horizontal acceleration the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX - * @type {float} - * @default 0 - * @since 3.0.0 - */ - - /** - * The vertical acceleration the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var accel = GetValue(config, 'acceleration', null); - - if (typeof accel === 'number') - { - this.accelX = accel; - this.accelY = accel; - } - else - { - this.accelX = GetValue(config, 'acceleration.x', 0); - this.accelY = GetValue(config, 'acceleration.y', 0); - } - - /** - * The horizontal drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX - * @type {float} - * @default 0 - * @since 3.0.0 - */ - - /** - * The vertical drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var drag = GetValue(config, 'drag', null); - - if (typeof drag === 'number') - { - this.dragX = drag; - this.dragY = drag; - } - else - { - this.dragX = GetValue(config, 'drag.x', 0); - this.dragY = GetValue(config, 'drag.y', 0); - } - - /** - * The maximum horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX - * @type {float} - * @default 0 - * @since 3.0.0 - */ - - /** - * The maximum vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY - * @type {float} - * @default 0 - * @since 3.0.0 - */ - var maxSpeed = GetValue(config, 'maxSpeed', null); - - if (typeof maxSpeed === 'number') - { - this.maxSpeedX = maxSpeed; - this.maxSpeedY = maxSpeed; - } - else - { - this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); - this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); - } - - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedX = 0; - - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedY = 0; - /** - * [description] - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; - - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); - }, +var GetBounds = { /** - * Starts the Key Control running, providing it has been linked to a camera. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#start + * Gets the center coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getCenter * @since 3.0.0 * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. */ - start: function () + getCenter: function (output) { - this.active = (this.camera !== null); + if (output === undefined) { output = new Vector2(); } - return this; + output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); + output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); + + return output; }, /** - * Stops this Key Control from running. Call `start` to start it again. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop + * Gets the top-left corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getTopLeft * @since 3.0.0 * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. */ - stop: function () + getTopLeft: function (output) { - this.active = false; + if (output === undefined) { output = new Vector2(); } - return this; - }, + output.x = this.x - (this.displayWidth * this.originX); + output.y = this.y - (this.displayHeight * this.originY); - /** - * Binds this Key Control to a camera. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. - * - * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. - */ - setCamera: function (camera) - { - this.camera = camera; + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } - return this; + return output; }, /** - * [description] - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#update + * Gets the top-right corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getTopRight * @since 3.0.0 * - * @param {[type]} delta - [description] + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. */ - update: function (delta) + getTopRight: function (output) { - if (!this.active) - { - return; - } - - if (delta === undefined) { delta = 1; } - - var cam = this.camera; - - // Apply Deceleration - - if (this._speedX > 0) - { - this._speedX -= this.dragX * delta; - - if (this._speedX < 0) - { - this._speedX = 0; - } - } - else if (this._speedX < 0) - { - this._speedX += this.dragX * delta; - - if (this._speedX > 0) - { - this._speedX = 0; - } - } + if (output === undefined) { output = new Vector2(); } - if (this._speedY > 0) - { - this._speedY -= this.dragY * delta; + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = this.y - (this.displayHeight * this.originY); - if (this._speedY < 0) - { - this._speedY = 0; - } - } - else if (this._speedY < 0) + if (this.rotation !== 0) { - this._speedY += this.dragY * delta; - - if (this._speedY > 0) - { - this._speedY = 0; - } + RotateAround(output, this.x, this.y, this.rotation); } - // Check for keys - - if (this.up && this.up.isDown) - { - this._speedY += this.accelY; - - if (this._speedY > this.maxSpeedY) - { - this._speedY = this.maxSpeedY; - } - } - else if (this.down && this.down.isDown) - { - this._speedY -= this.accelY; + return output; + }, - if (this._speedY < -this.maxSpeedY) - { - this._speedY = -this.maxSpeedY; - } - } + /** + * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getBottomLeft: function (output) + { + if (output === undefined) { output = new Vector2(); } - if (this.left && this.left.isDown) - { - this._speedX += this.accelX; + output.x = this.x - (this.displayWidth * this.originX); + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - if (this._speedX > this.maxSpeedX) - { - this._speedX = this.maxSpeedX; - } - } - else if (this.right && this.right.isDown) + if (this.rotation !== 0) { - this._speedX -= this.accelX; - - if (this._speedX < -this.maxSpeedX) - { - this._speedX = -this.maxSpeedX; - } + RotateAround(output, this.x, this.y, this.rotation); } - // Camera zoom - - if (this.zoomIn && this.zoomIn.isDown) - { - this._zoom = -this.zoomSpeed; - } - else if (this.zoomOut && this.zoomOut.isDown) - { - this._zoom = this.zoomSpeed; - } - else - { - this._zoom = 0; - } + return output; + }, - // Apply to Camera + /** + * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. + * + * @method Phaser.GameObjects.Components.GetBounds#getBottomRight + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2|object} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2|object} The values stored in the output object. + */ + getBottomRight: function (output) + { + if (output === undefined) { output = new Vector2(); } - if (this._speedX !== 0) - { - cam.scrollX -= ((this._speedX * delta) | 0); - } + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - if (this._speedY !== 0) + if (this.rotation !== 0) { - cam.scrollY -= ((this._speedY * delta) | 0); + RotateAround(output, this.x, this.y, this.rotation); } - if (this._zoom !== 0) - { - cam.zoom += this._zoom; - - if (cam.zoom < 0.1) - { - cam.zoom = 0.1; - } - } + return output; }, /** - * Destroys this Key Control. - * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy + * Gets the bounds of this Game Object, regardless of origin. + * The values are stored and returned in a Rectangle, or Rectangle-like, object. + * + * @method Phaser.GameObjects.Components.GetBounds#getBounds * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle|object} [output] - An object to store the values in. If not provided a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle|object} The values stored in the output object. */ - destroy: function () + getBounds: function (output) { - this.camera = null; + if (output === undefined) { output = new Rectangle(); } - this.left = null; - this.right = null; - this.up = null; - this.down = null; + // We can use the output object to temporarily store the x/y coords in: - this.zoomIn = null; - this.zoomOut = null; - } + this.getTopLeft(output); -}); + var TLx = output.x; + var TLy = output.y; -module.exports = SmoothedKeyControl; + this.getTopRight(output); + + var TRx = output.x; + var TRy = output.y; + this.getBottomLeft(output); -/***/ }), -/* 444 */ -/***/ (function(module, exports, __webpack_require__) { + var BLx = output.x; + var BLy = output.y; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + this.getBottomRight(output); -/** - * @namespace Phaser.Cameras.Scene2D - */ + var BRx = output.x; + var BRy = output.y; -module.exports = { + output.x = Math.min(TLx, TRx, BLx, BRx); + output.y = Math.min(TLy, TRy, BLy, BRy); + output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; + output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; - Camera: __webpack_require__(114), - CameraManager: __webpack_require__(445) + return output; + } }; +module.exports = GetBounds; + /***/ }), -/* 445 */ -/***/ (function(module, exports, __webpack_require__) { +/* 398 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -81417,478 +82712,489 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Camera = __webpack_require__(114); -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var PluginManager = __webpack_require__(12); -var RectangleContains = __webpack_require__(33); - /** - * @classdesc - * [description] - * - * @class CameraManager - * @memberOf Phaser.Cameras.Scene2D - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. - */ -var CameraManager = new Class({ - - initialize: - - function CameraManager (scene) - { - /** - * The Scene that owns the Camera Manager plugin. - * - * @name Phaser.Cameras.Scene2D.CameraManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - if (!scene.sys.settings.isBooted) - { - scene.sys.events.once('boot', this.boot, this); - } - - /** - * The current Camera ID. - * - * @name Phaser.Cameras.Scene2D.CameraManager#currentCameraId - * @type {number} - * @default 1 - * @readOnly - * @since 3.0.0 - */ - this.currentCameraId = 1; - - /** - * An Array of the Camera objects being managed by this Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#cameras - * @type {Phaser.Cameras.Scene2D.Camera[]} - * @since 3.0.0 - */ - this.cameras = []; + * Provides methods used for getting and setting the transform values of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.MatrixStack + * @since 3.2.0 + */ - /** - * A pool of Camera objects available to be used by the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#cameraPool - * @type {Phaser.Cameras.Scene2D.Camera[]} - * @since 3.0.0 - */ - this.cameraPool = []; +var MatrixStack = { - if (scene.sys.settings.cameras) - { - // We have cameras to create - this.fromJSON(scene.sys.settings.cameras); - } - else - { - // Make one - this.add(); - } + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#matrixStack + * @type {Float32Array} + * @private + * @since 3.2.0 + */ + matrixStack: null, - /** - * The default Camera in the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#main - * @type {Phaser.Cameras.Scene2D.Camera} - * @since 3.0.0 - */ - this.main = this.cameras[0]; + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#currentMatrix + * @type {Float32Array} + * @private + * @since 3.2.0 + */ + currentMatrix: null, - /** - * This scale affects all cameras. It's used by Scale Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#baseScale - * @type {number} - * @since 3.0.0 - */ - this.baseScale = 1.0; - }, + /** + * [description] + * + * @name Phaser.GameObjects.Components.MatrixStack#currentMatrixIndex + * @type {integer} + * @private + * @since 3.2.0 + */ + currentMatrixIndex: 0, /** - * Called when the Camera Manager boots. - * Starts the event listeners running. + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#initMatrixStack + * @since 3.2.0 * - * @method Phaser.Cameras.Scene2D.CameraManager#boot - * @since 3.0.0 + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - boot: function () + initMatrixStack: function () { - var eventEmitter = this.systems.events; + this.matrixStack = new Float32Array(6000); // up to 1000 matrices + this.currentMatrix = new Float32Array([ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]); + this.currentMatrixIndex = 0; - eventEmitter.on('update', this.update, this); - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); + return this; }, /** * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#add - * @since 3.0.0 - * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] - * @param {number} [width] - [description] - * @param {number} [height] - [description] - * @param {boolean} [makeMain=false] - [description] - * @param {string} [name=''] - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#save + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - add: function (x, y, width, height, makeMain, name) + save: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.scene.sys.game.config.width; } - if (height === undefined) { height = this.scene.sys.game.config.height; } - if (makeMain === undefined) { makeMain = false; } - if (name === undefined) { name = ''; } + if (this.currentMatrixIndex >= this.matrixStack.length) { return this; } - var camera = null; + var matrixStack = this.matrixStack; + var currentMatrix = this.currentMatrix; + var currentMatrixIndex = this.currentMatrixIndex; + this.currentMatrixIndex += 6; - if (this.cameraPool.length > 0) - { - camera = this.cameraPool.pop(); + matrixStack[currentMatrixIndex + 0] = currentMatrix[0]; + matrixStack[currentMatrixIndex + 1] = currentMatrix[1]; + matrixStack[currentMatrixIndex + 2] = currentMatrix[2]; + matrixStack[currentMatrixIndex + 3] = currentMatrix[3]; + matrixStack[currentMatrixIndex + 4] = currentMatrix[4]; + matrixStack[currentMatrixIndex + 5] = currentMatrix[5]; + + return this; + }, - camera.setViewport(x, y, width, height); - } - else - { - camera = new Camera(x, y, width, height); - } + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#restore + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + restore: function () + { + if (this.currentMatrixIndex <= 0) { return this; } - camera.setName(name); - camera.setScene(this.scene); + this.currentMatrixIndex -= 6; - this.cameras.push(camera); + var matrixStack = this.matrixStack; + var currentMatrix = this.currentMatrix; + var currentMatrixIndex = this.currentMatrixIndex; - if (makeMain) - { - this.main = camera; - } + currentMatrix[0] = matrixStack[currentMatrixIndex + 0]; + currentMatrix[1] = matrixStack[currentMatrixIndex + 1]; + currentMatrix[2] = matrixStack[currentMatrixIndex + 2]; + currentMatrix[3] = matrixStack[currentMatrixIndex + 3]; + currentMatrix[4] = matrixStack[currentMatrixIndex + 4]; + currentMatrix[5] = matrixStack[currentMatrixIndex + 5]; - camera._id = this.currentCameraId; + return this; + }, - this.currentCameraId = this.currentCameraId << 1; + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#loadIdentity + * @since 3.2.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + loadIdentity: function () + { + this.setTransform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - return camera; + return this; }, /** * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#transform + * @since 3.2.0 * - * @method Phaser.Cameras.Scene2D.CameraManager#addExisting - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - addExisting: function (camera) + transform: function (a, b, c, d, tx, ty) { - var index = this.cameras.indexOf(camera); - var poolIndex = this.cameraPool.indexOf(camera); + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var m4 = currentMatrix[4]; + var m5 = currentMatrix[5]; - if (index < 0 && poolIndex >= 0) - { - this.cameras.push(camera); - this.cameraPool.slice(poolIndex, 1); - return camera; - } - - return null; + currentMatrix[0] = m0 * a + m2 * b; + currentMatrix[1] = m1 * a + m3 * b; + currentMatrix[2] = m0 * c + m2 * d; + currentMatrix[3] = m1 * c + m3 * d; + currentMatrix[4] = m0 * tx + m2 * ty + m4; + currentMatrix[5] = m1 * tx + m3 * ty + m5; + + return this; }, - /* + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#setTransform + * @since 3.2.0 + * + * @param {number} a - [description] + * @param {number} b - [description] + * @param {number} c - [description] + * @param {number} d - [description] + * @param {number} tx - [description] + * @param {number} ty - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setTransform: function (a, b, c, d, tx, ty) { - cameras: [ - { - name: string - x: int - y: int - width: int - height: int - zoom: float - rotation: float - roundPixels: bool - scrollX: float - scrollY: float - backgroundColor: string - bounds: { - x: int - y: int - width: int - height: int - } - } - ] - } - */ + var currentMatrix = this.currentMatrix; + + currentMatrix[0] = a; + currentMatrix[1] = b; + currentMatrix[2] = c; + currentMatrix[3] = d; + currentMatrix[4] = tx; + currentMatrix[5] = ty; + + return this; + }, /** * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#translate + * @since 3.2.0 * - * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON - * @since 3.0.0 - * - * @param {[type]} config - [description] + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + translate: function (x, y) + { + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var m4 = currentMatrix[4]; + var m5 = currentMatrix[5]; + + currentMatrix[4] = m0 * x + m2 * y + m4; + currentMatrix[5] = m1 * x + m3 * y + m5; + + return this; + }, + + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#scale + * @since 3.2.0 * - * @return {[type]} [description] + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - fromJSON: function (config) + scale: function (x, y) { - if (!Array.isArray(config)) - { - config = [ config ]; - } + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; - var gameWidth = this.scene.sys.game.config.width; - var gameHeight = this.scene.sys.game.config.height; + currentMatrix[0] = m0 * x; + currentMatrix[1] = m1 * x; + currentMatrix[2] = m2 * y; + currentMatrix[3] = m3 * y; - for (var i = 0; i < config.length; i++) - { - var cameraConfig = config[i]; + return this; + }, - var x = GetFastValue(cameraConfig, 'x', 0); - var y = GetFastValue(cameraConfig, 'y', 0); - var width = GetFastValue(cameraConfig, 'width', gameWidth); - var height = GetFastValue(cameraConfig, 'height', gameHeight); + /** + * [description] + * + * @method Phaser.GameObjects.Components.MatrixStack#rotate + * @since 3.2.0 + * + * @param {number} t - The angle of rotation, in radians. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + rotate: function (t) + { + var currentMatrix = this.currentMatrix; + var m0 = currentMatrix[0]; + var m1 = currentMatrix[1]; + var m2 = currentMatrix[2]; + var m3 = currentMatrix[3]; + var st = Math.sin(t); + var ct = Math.cos(t); - var camera = this.add(x, y, width, height); + currentMatrix[0] = m0 * ct + m2 * st; + currentMatrix[1] = m1 * ct + m3 * st; + currentMatrix[2] = m0 * -st + m2 * ct; + currentMatrix[3] = m1 * -st + m3 * ct; - // Direct properties - camera.name = GetFastValue(cameraConfig, 'name', ''); - camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); - camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); - camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); - camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); - camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); + return this; + } - // Background Color +}; - var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); +module.exports = MatrixStack; - if (backgroundColor) - { - camera.setBackgroundColor(backgroundColor); - } - // Bounds +/***/ }), +/* 399 */ +/***/ (function(module, exports) { - var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (boundsConfig) - { - var bx = GetFastValue(boundsConfig, 'x', 0); - var by = GetFastValue(boundsConfig, 'y', 0); - var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); - var bheight = GetFastValue(boundsConfig, 'height', gameHeight); +/** + * Provides methods used for getting and setting the origin of a Game Object. + * Values are normalized, given in the range 0 to 1. + * Display values contain the calculated pixel values. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Origin + * @since 3.0.0 + */ - camera.setBounds(bx, by, bwidth, bheight); - } - } +var Origin = { - return this; - }, + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Origin#_originComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _originComponent: true, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#getCamera + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. + * + * @name Phaser.GameObjects.Components.Origin#originX + * @type {float} + * @default 0.5 * @since 3.0.0 - * - * @param {string} name - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - getCamera: function (name) - { - this.cameras.forEach(function (camera) - { - if (camera.name === name) - { - return camera; - } - }); - - return null; - }, + originX: 0.5, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#getCameraBelowPointer + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. + * + * @name Phaser.GameObjects.Components.Origin#originY + * @type {float} + * @default 0.5 * @since 3.0.0 - * - * @param {[type]} pointer - [description] - * - * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - getCameraBelowPointer: function (pointer) - { - var cameras = this.cameras; - - // Start from the most recently added camera (the 'top' camera) - for (var i = cameras.length - 1; i >= 0; i--) - { - var camera = cameras[i]; + originY: 0.5, - if (camera.inputEnabled && RectangleContains(camera, pointer.x, pointer.y)) - { - return camera; - } - } - }, + // private + read only + _displayOriginX: 0, + _displayOriginY: 0, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#remove + * The horizontal display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginX + * @type {float} * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - remove: function (camera) - { - var cameraIndex = this.cameras.indexOf(camera); + displayOriginX: { - if (cameraIndex >= 0 && this.cameras.length > 1) + get: function () { - this.cameraPool.push(this.cameras[cameraIndex]); - this.cameras.splice(cameraIndex, 1); + return this._displayOriginX; + }, - if (this.main === camera) - { - this.main = this.cameras[0]; - } + set: function (value) + { + this._displayOriginX = value; + this.originX = value / this.width; } + }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#render + * The vertical display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginY + * @type {float} * @since 3.0.0 - * - * @param {[type]} renderer - [description] - * @param {[type]} children - [description] - * @param {[type]} interpolation - [description] */ - render: function (renderer, children, interpolation) - { - var cameras = this.cameras; - var baseScale = this.baseScale; + displayOriginY: { - for (var i = 0, l = cameras.length; i < l; ++i) + get: function () { - var camera = cameras[i]; - - camera.preRender(baseScale, renderer.config.resolution); + return this._displayOriginY; + }, - renderer.render(this.scene, children, interpolation, camera); + set: function (value) + { + this._displayOriginY = value; + this.originY = value / this.height; } + }, /** - * [description] + * Sets the origin of this Game Object. * - * @method Phaser.Cameras.Scene2D.CameraManager#resetAll + * The values are given in the range 0 to 1. + * + * @method Phaser.GameObjects.Components.Origin#setOrigin * @since 3.0.0 * - * @return {Phaser.Cameras.Scene2D.Camera} [description] + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=0.5] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - resetAll: function () + setOrigin: function (x, y) { - while (this.cameras.length > 0) - { - this.cameraPool.push(this.cameras.pop()); - } + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } - this.main = this.add(); + this.originX = x; + this.originY = y; - return this.main; + return this.updateDisplayOrigin(); }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#update + * Sets the origin of this Game Object based on the Pivot values in its Frame. + * + * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame * @since 3.0.0 - * - * @param {number} timestep - [description] - * @param {number} delta - [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - update: function (timestep, delta) + setOriginFromFrame: function () { - for (var i = 0, l = this.cameras.length; i < l; ++i) + if (!this.frame || !this.frame.customPivot) { - this.cameras[i].update(timestep, delta); + return this.setOrigin(); + } + else + { + this.originX = this.frame.pivotX; + this.originY = this.frame.pivotY; } + + return this.updateDisplayOrigin(); }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#shutdown + * Sets the display origin of this Game Object. + * The difference between this and setting the origin is that you can use pixel values for setting the display origin. + * + * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin * @since 3.0.0 + * + * @param {number} [x=0] - The horizontal display origin value. + * @param {number} [y=0] - The vertical display origin value. If not defined it will be set to the value of `x`. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - shutdown: function () + setDisplayOrigin: function (x, y) { - // TODO + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + + this.displayOriginX = x; + this.displayOriginY = y; + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Scene2D.CameraManager#destroy + * Updates the Display Origin cached values internally stored on this Game Object. + * You don't usually call this directly, but it is exposed for edge-cases where you may. + * + * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - destroy: function () + updateDisplayOrigin: function () { - this.main = undefined; - - for (var i = 0; i < this.cameras.length; i++) - { - this.cameras[i].destroy(); - } - - for (i = 0; i < this.cameraPool.length; i++) - { - this.cameraPool[i].destroy(); - } + this._displayOriginX = Math.round(this.originX * this.width); + this._displayOriginY = Math.round(this.originY * this.height); - this.cameras = []; - this.cameraPool = []; - this.scene = undefined; + return this; } -}); - -PluginManager.register('CameraManager', CameraManager, 'cameras'); +}; -module.exports = CameraManager; +module.exports = Origin; /***/ }), -/* 446 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -81897,54 +83203,70 @@ module.exports = CameraManager; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var ScaleModes = __webpack_require__(63); + /** - * @namespace Phaser.Cameras.Sprite3D + * Provides methods used for getting and setting the scale of a Game Object. + * + * @name Phaser.GameObjects.Components.ScaleMode + * @since 3.0.0 */ -module.exports = { - - Camera: __webpack_require__(117), - CameraManager: __webpack_require__(450), - OrthographicCamera: __webpack_require__(211), - PerspectiveCamera: __webpack_require__(212) - -}; - +var ScaleMode = { -/***/ }), -/* 447 */ -/***/ (function(module, exports, __webpack_require__) { + _scaleMode: ScaleModes.DEFAULT, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * The Scale Mode being used by this Game Object. + * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. + * + * @name Phaser.GameObjects.Components.ScaleMode#scaleMode + * @type {integer} + * @since 3.0.0 + */ + scaleMode: { -var renderWebGL = __webpack_require__(3); -var renderCanvas = __webpack_require__(3); + get: function () + { + return this._scaleMode; + }, -if (true) -{ - renderWebGL = __webpack_require__(448); -} + set: function (value) + { + if (value === ScaleModes.LINEAR || value === ScaleModes.NEAREST) + { + this._scaleMode = value; + } + } -if (true) -{ - renderCanvas = __webpack_require__(449); -} + }, -module.exports = { + /** + * Sets the Scale Mode being used by this Game Object. + * Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`. + * + * @method Phaser.GameObjects.Components.ScaleMode#setScaleMode + * @since 3.0.0 + * + * @param {integer} value - The Scale Mode to be used by this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setScaleMode: function (value) + { + this.scaleMode = value; - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + return this; + } }; +module.exports = ScaleMode; + /***/ }), -/* 448 */ -/***/ (function(module, exports, __webpack_require__) { +/* 401 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -81952,38 +83274,91 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObject = __webpack_require__(1); - /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderWebGL + * Provides methods used for getting and setting the Scroll Factor of a Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera) -{ - if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + +var ScrollFactor = { + + /** + * The horizontal scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scrollFactorX: 1, + + /** + * The vertical scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scrollFactorY: 1, + + /** + * Sets the scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor + * @since 3.0.0 + * + * @param {number} x - The horizontal scroll factor of this Game Object. + * @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setScrollFactor: function (x, y) { - return; + if (y === undefined) { y = x; } + + this.scrollFactorX = x; + this.scrollFactorY = y; + + return this; } - this.pipeline.batchSprite(src, camera); }; -module.exports = SpriteWebGLRenderer; +module.exports = ScrollFactor; /***/ }), -/* 449 */ -/***/ (function(module, exports, __webpack_require__) { +/* 402 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -81991,38 +83366,155 @@ module.exports = SpriteWebGLRenderer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GameObject = __webpack_require__(1); - /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderCanvas + * Provides methods used for getting and setting the size of a Game Object. + * + * @name Phaser.GameObjects.Components.Size * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera) -{ - if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + +var Size = { + + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Size#_sizeComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _sizeComponent: true, + + /** + * The native (un-scaled) width of this Game Object. + * + * @name Phaser.GameObjects.Components.Size#width + * @type {number} + * @since 3.0.0 + */ + width: 0, + + /** + * The native (un-scaled) height of this Game Object. + * + * @name Phaser.GameObjects.Components.Size#height + * @type {number} + * @since 3.0.0 + */ + height: 0, + + /** + * The displayed width of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.Size#displayWidth + * @type {number} + * @since 3.0.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.frame.realWidth; + }, + + set: function (value) + { + this.scaleX = value / this.frame.realWidth; + } + + }, + + /** + * The displayed height of this Game Object. + * This value takes into account the scale factor. + * + * @name Phaser.GameObjects.Components.Size#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.frame.realHeight; + }, + + set: function (value) + { + this.scaleY = value / this.frame.realHeight; + } + + }, + + /** + * Sets the size of this Game Object to be that of the given Frame. + * + * @method Phaser.GameObjects.Components.Size#setSizeToFrame + * @since 3.0.0 + * + * @param {Phaser.Textures.Frame} frame - The frame to base the size of this Game Object on. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setSizeToFrame: function (frame) { - return; + if (frame === undefined) { frame = this.frame; } + + this.width = frame.realWidth; + this.height = frame.realHeight; + + return this; + }, + + /** + * Sets the size of this Game Object. + * + * @method Phaser.GameObjects.Components.Size#setSize + * @since 3.0.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + + return this; + }, + + /** + * Sets the display size of this Game Object. + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Components.Size#setDisplaySize + * @since 3.0.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setDisplaySize: function (width, height) + { + this.displayWidth = width; + this.displayHeight = height; + + return this; } - renderer.drawImage(src, camera); }; -module.exports = SpriteCanvasRenderer; +module.exports = Size; /***/ }), -/* 450 */ -/***/ (function(module, exports, __webpack_require__) { +/* 403 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -82030,276 +83522,309 @@ module.exports = SpriteCanvasRenderer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var OrthographicCamera = __webpack_require__(211); -var PerspectiveCamera = __webpack_require__(212); -var PluginManager = __webpack_require__(12); +// bitmask flag for GameObject.renderMask +var _FLAG = 8; // 1000 /** - * @classdesc - * [description] - * - * @class CameraManager - * @memberOf Phaser.Cameras.Sprite3D - * @constructor + * Provides methods used for getting and setting the texture of a Game Object. + * + * @name Phaser.GameObjects.Components.Texture * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] */ -var CameraManager = new Class({ - - initialize: - - function CameraManager (scene) - { - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.CameraManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * [description] - * - * @name Phaser.Cameras.Sprite3D.CameraManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - /** - * An Array of the Camera objects being managed by this Camera Manager. - * - * @name Phaser.Cameras.Sprite3D.CameraManager#cameras - * @type {array} - * @since 3.0.0 - */ - this.cameras = []; - if (!scene.sys.settings.isBooted) - { - scene.sys.events.once('boot', this.boot, this); - } - }, +var Texture = { /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#boot + * The Texture this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#texture + * @type {Phaser.Textures.Texture} * @since 3.0.0 */ - boot: function () - { - var eventEmitter = this.systems.events; + texture: null, - eventEmitter.on('update', this.update, this); - eventEmitter.on('shutdown', this.shutdown, this); - eventEmitter.on('destroy', this.destroy, this); - }, + /** + * The Texture Frame this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + frame: null, /** - * [description] + * Sets the texture and frame this Game Object will use to render with. * - * @method Phaser.Cameras.Sprite3D.CameraManager#add + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * @method Phaser.GameObjects.Components.Texture#setTexture * @since 3.0.0 * - * @param {[type]} fieldOfView - [description] - * @param {[type]} width - [description] - * @param {[type]} height - [description] - * - * @return {[type]} [description] + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {string|integer} [frame] - The name or index of the frame within the Texture. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - add: function (fieldOfView, width, height) + setTexture: function (key, frame) { - return this.addPerspectiveCamera(fieldOfView, width, height); + this.texture = this.scene.sys.textures.get(key); + + return this.setFrame(frame); }, /** - * [description] + * Sets the frame this Game Object will use to render with. * - * @method Phaser.Cameras.Sprite3D.CameraManager#addOrthographicCamera - * @since 3.0.0 + * The Frame has to belong to the current Texture being used. * - * @param {number} width - [description] - * @param {number} height - [description] + * It can be either a string or an index. * - * @return {[type]} [description] + * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. + * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. + * + * @method Phaser.GameObjects.Components.Texture#setFrame + * @since 3.0.0 + * + * @param {string|integer} frame - The name or index of the frame within the Texture. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - addOrthographicCamera: function (width, height) + setFrame: function (frame) { - var config = this.scene.sys.game.config; + this.frame = this.texture.get(frame); - if (width === undefined) { width = config.width; } - if (height === undefined) { height = config.height; } + if (!this.frame.cutWidth || !this.frame.cutHeight) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } - var camera = new OrthographicCamera(this.scene, width, height); + if (this._sizeComponent) + { + this.setSizeToFrame(); + } - this.cameras.push(camera); + if (this._originComponent) + { + if (this.frame.customPivot) + { + this.setOrigin(this.frame.pivotX, this.frame.pivotY); + } + else + { + this.updateDisplayOrigin(); + } + } - return camera; - }, + return this; + } - /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#addPerspectiveCamera - * @since 3.0.0 - * - * @param {number} [fieldOfView=80] - [description] - * @param {number} [width] - [description] - * @param {number} [height] - [description] - * - * @return {[type]} [description] - */ - addPerspectiveCamera: function (fieldOfView, width, height) - { - var config = this.scene.sys.game.config; +}; - if (fieldOfView === undefined) { fieldOfView = 80; } - if (width === undefined) { width = config.width; } - if (height === undefined) { height = config.height; } +module.exports = Texture; - var camera = new PerspectiveCamera(this.scene, fieldOfView, width, height); - this.cameras.push(camera); +/***/ }), +/* 404 */ +/***/ (function(module, exports) { - return camera; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GetColor = function (value) +{ + return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); +}; + +/** + * Provides methods used for setting the tint of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Tint + * @webglOnly + * @since 3.0.0 + */ + +var Tint = { + + // 0: topLeft, 1: topRight, 2: bottomLeft, 3: bottomRight + _tintTL: 16777215, + _tintTR: 16777215, + _tintBL: 16777215, + _tintBR: 16777215, /** - * [description] + * Clears all tint values associated with this Game Object. + * Immediately sets the alpha levels back to 0xffffff (no tint) * - * @method Phaser.Cameras.Sprite3D.CameraManager#getCamera + * @method Phaser.GameObjects.Components.Tint#clearTint + * @webglOnly * @since 3.0.0 - * - * @param {string} name - [description] - * - * @return {[type]} [description] + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - getCamera: function (name) + clearTint: function () { - this.cameras.forEach(function (camera) - { - if (camera.name === name) - { - return camera; - } - }); + this.setTint(0xffffff); - return null; + return this; }, /** - * [description] + * Sets the tint values for this Game Object. * - * @method Phaser.Cameras.Sprite3D.CameraManager#removeCamera + * @method Phaser.GameObjects.Components.Tint#setTint + * @webglOnly * @since 3.0.0 * - * @param {[type]} camera - [description] + * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. + * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - removeCamera: function (camera) + setTint: function (topLeft, topRight, bottomLeft, bottomRight) { - var cameraIndex = this.cameras.indexOf(camera); + if (topLeft === undefined) { topLeft = 0xffffff; } - if (cameraIndex !== -1) + if (topRight === undefined) { - this.cameras.splice(cameraIndex, 1); + topRight = topLeft; + bottomLeft = topLeft; + bottomRight = topLeft; } + + this._tintTL = GetColor(topLeft); + this._tintTR = GetColor(topRight); + this._tintBL = GetColor(bottomLeft); + this._tintBR = GetColor(bottomRight); + + return this; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#removeAll + * The tint value being applied to the top-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintTopLeft + * @type {integer} + * @webglOnly * @since 3.0.0 - * - * @return {[type]} [description] */ - removeAll: function () - { - while (this.cameras.length > 0) + tintTopLeft: { + + get: function () { - var camera = this.cameras.pop(); + return this._tintTL; + }, - camera.destroy(); + set: function (value) + { + this._tintTL = GetColor(value); } - return this.main; }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#update + * The tint value being applied to the top-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintTopRight + * @type {integer} + * @webglOnly * @since 3.0.0 - * - * @param {number} timestep - [description] - * @param {number} delta - [description] */ - update: function (timestep, delta) - { - for (var i = 0, l = this.cameras.length; i < l; ++i) + tintTopRight: { + + get: function () { - this.cameras[i].update(timestep, delta); + return this._tintTR; + }, + + set: function (value) + { + this._tintTR = GetColor(value); } + }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#shutdown + * The tint value being applied to the bottom-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintBottomLeft + * @type {integer} + * @webglOnly * @since 3.0.0 */ - shutdown: function () - { + tintBottomLeft: { + + get: function () + { + return this._tintBL; + }, + + set: function (value) + { + this._tintBL = GetColor(value); + } + }, /** - * [description] - * - * @method Phaser.Cameras.Sprite3D.CameraManager#destroy + * The tint value being applied to the bottom-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tintBottomRight + * @type {integer} + * @webglOnly * @since 3.0.0 */ - destroy: function () - { - this.scene = undefined; - } - -}); - -PluginManager.register('CameraManager3D', CameraManager, 'cameras3d'); - -module.exports = CameraManager; + tintBottomRight: { + get: function () + { + return this._tintBR; + }, -/***/ }), -/* 451 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this._tintBR = GetColor(value); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + }, -/** - * @namespace Phaser.Create - */ + /** + * The tint value being applied to the whole of the Game Object. + * + * @name Phaser.GameObjects.Components.Tint#tint + * @type {integer} + * @webglOnly + * @since 3.0.0 + */ + tint: { -module.exports = { - - GenerateTexture: __webpack_require__(213), - Palettes: __webpack_require__(452) + set: function (value) + { + this.setTint(value, value, value, value); + } + } }; +module.exports = Tint; + /***/ }), -/* 452 */ -/***/ (function(module, exports, __webpack_require__) { +/* 405 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -82307,24 +83832,52 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * @namespace Phaser.Create.Palettes - */ +// Default Game Object JSON export +// Is extended further by Game Object specific implementations -module.exports = { +var ToJSON = function (gameObject) +{ + var out = { + name: gameObject.name, + type: gameObject.type, + x: gameObject.x, + y: gameObject.y, + depth: gameObject.depth, + scale: { + x: gameObject.scaleX, + y: gameObject.scaleY + }, + origin: { + x: gameObject.originX, + y: gameObject.originY + }, + flipX: gameObject.flipX, + flipY: gameObject.flipY, + rotation: gameObject.rotation, + alpha: gameObject.alpha, + visible: gameObject.visible, + scaleMode: gameObject.scaleMode, + blendMode: gameObject.blendMode, + textureKey: '', + frameKey: '', + data: {} + }; - ARNE16: __webpack_require__(214), - C64: __webpack_require__(453), - CGA: __webpack_require__(454), - JMP: __webpack_require__(455), - MSX: __webpack_require__(456) - + if (gameObject.texture) + { + out.textureKey = gameObject.texture.key; + out.frameKey = gameObject.frame.name; + } + + return out; }; +module.exports = ToJSON; + /***/ }), -/* 453 */ -/***/ (function(module, exports) { +/* 406 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -82332,1006 +83885,964 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -/** - * A 16 color palette inspired by the Commodore 64. - * - * @name Phaser.Create.Palettes.C64 - * @since 3.0.0 - * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. - */ -module.exports = { - 0: '#000', - 1: '#fff', - 2: '#8b4131', - 3: '#7bbdc5', - 4: '#8b41ac', - 5: '#6aac41', - 6: '#3931a4', - 7: '#d5de73', - 8: '#945a20', - 9: '#5a4100', - A: '#bd736a', - B: '#525252', - C: '#838383', - D: '#acee8b', - E: '#7b73de', - F: '#acacac' -}; - - -/***/ }), -/* 454 */ -/***/ (function(module, exports) { +var MATH_CONST = __webpack_require__(16); +var WrapAngle = __webpack_require__(161); +var WrapAngleDegrees = __webpack_require__(162); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ +// global bitmask flag for GameObject.renderMask (used by Scale) +var _FLAG = 4; // 0100 /** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) + * Provides methods used for getting and setting the position, scale and rotation of a Game Object. * - * @name Phaser.Create.Palettes.CGA + * @name Phaser.GameObjects.Components.Transform * @since 3.0.0 - * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. */ -module.exports = { - 0: '#000', - 1: '#2234d1', - 2: '#0c7e45', - 3: '#44aacc', - 4: '#8a3622', - 5: '#5c2e78', - 6: '#aa5c3d', - 7: '#b5b5b5', - 8: '#5e606e', - 9: '#4c81fb', - A: '#6cd947', - B: '#7be2f9', - C: '#eb8a60', - D: '#e23d69', - E: '#ffd93f', - F: '#fff' -}; +var Transform = { -/***/ }), -/* 455 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + // "private" properties + _scaleX: 1, + _scaleY: 1, + _rotation: 0, -/** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @type {object} - * @since 3.0.0 - * - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. - */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#f5f4eb' -}; + /** + * The x position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + x: 0, + /** + * The y position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + y: 0, -/***/ }), -/* 456 */ -/***/ (function(module, exports) { + /** + * The z position of this Game Object. + * Note: Do not use this value to set the z-index, instead see the `depth` property. + * + * @name Phaser.GameObjects.Components.Transform#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + z: 0, -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * The w position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: 0, -/** - * A 16 color palette inspired by Japanese computers like the MSX. - * - * @name Phaser.Create.Palettes.MSX - * @since 3.0.0 - * - * @type {object} - * @property {string} 0 - Color value 1. - * @property {string} 1 - Color value 2. - * @property {string} 2 - Color value 3. - * @property {string} 3 - Color value 4. - * @property {string} 4 - Color value 5. - * @property {string} 5 - Color value 6. - * @property {string} 6 - Color value 7. - * @property {string} 7 - Color value 8. - * @property {string} 8 - Color value 9. - * @property {string} 9 - Color value 10. - * @property {string} A - Color value 11. - * @property {string} B - Color value 12. - * @property {string} C - Color value 13. - * @property {string} D - Color value 14. - * @property {string} E - Color value 15. - * @property {string} F - Color value 16. - */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#fff' -}; + /** + * The horizontal scale of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#scaleX + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scaleX: { + get: function () + { + return this._scaleX; + }, -/***/ }), -/* 457 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this._scaleX = value; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this._scaleX === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } -/** - * @namespace Phaser.Curves - */ + }, -module.exports = { + /** + * The vertical scale of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#scaleY + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scaleY: { - Path: __webpack_require__(458), + get: function () + { + return this._scaleY; + }, - CubicBezier: __webpack_require__(215), - Curve: __webpack_require__(66), - Ellipse: __webpack_require__(217), - Line: __webpack_require__(219), - Spline: __webpack_require__(220) + set: function (value) + { + this._scaleY = value; -}; + if (this._scaleY === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } + }, -/***/ }), -/* 458 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The angle of this Game Object as expressed in degrees. + * + * Where 0 is to the right, 90 is down, 180 is left. + * + * If you prefer to work in radians, see the `rotation` property instead. + * + * @name Phaser.GameObjects.Components.Transform#angle + * @type {integer} + * @default 0 + * @since 3.0.0 + */ + angle: { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + get: function () + { + return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); + }, -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + set: function (value) + { + // value is in degrees + this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; + } + }, -var Class = __webpack_require__(0); -var CubicBezierCurve = __webpack_require__(215); -var EllipseCurve = __webpack_require__(217); -var GameObjectFactory = __webpack_require__(9); -var LineCurve = __webpack_require__(219); -var MovePathTo = __webpack_require__(459); -var Rectangle = __webpack_require__(8); -var SplineCurve = __webpack_require__(220); -var Vector2 = __webpack_require__(6); + /** + * The angle of this Game Object in radians. + * + * If you prefer to work in degrees, see the `angle` property instead. + * + * @name Phaser.GameObjects.Components.Transform#rotation + * @type {number} + * @default 1 + * @since 3.0.0 + */ + rotation: { -/** - * @classdesc - * [description] - * - * @class Path - * @memberOf Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {number} [x=0] - [description] - * @param {number} [y=0] - [description] - */ -var Path = new Class({ + get: function () + { + return this._rotation; + }, - initialize: + set: function (value) + { + // value is in radians + this._rotation = WrapAngle(value); + } + }, - function Path (x, y) + /** + * Sets the position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setPosition + * @since 3.0.0 + * + * @param {number} [x=0] - The x position of this Game Object. + * @param {number} [y] - The y position of this Game Object. If not set it will use the `x` value. + * @param {number} [z=0] - The z position of this Game Object. + * @param {number} [w=0] - The w position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setPosition: function (x, y, z, w) { if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - /** - * [description] - * - * @name Phaser.Curves.Path#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; - - /** - * [description] - * - * @name Phaser.Curves.Path#curves - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.curves = []; - - /** - * [description] - * - * @name Phaser.Curves.Path#cacheLengths - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; + if (y === undefined) { y = x; } + if (z === undefined) { z = 0; } + if (w === undefined) { w = 0; } - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; + this.x = x; + this.y = y; + this.z = z; + this.w = w; - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); + return this; + }, - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); + /** + * Sets the rotation of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setRotation + * @since 3.0.0 + * + * @param {number} [radians=0] - The rotation of this Game Object, in radians. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. + */ + setRotation: function (radians) + { + if (radians === undefined) { radians = 0; } - /** - * [description] - * - * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); + this.rotation = radians; - if (typeof x === 'object') - { - this.fromJSON(x); - } - else - { - this.startPoint.set(x, y); - } + return this; }, /** - * [description] - * - * @method Phaser.Curves.Path#add + * Sets the angle of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setAngle * @since 3.0.0 * - * @param {Phaser.Curves.Curve} curve - [description] - * - * @return {Phaser.Curves.Path} [description] + * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - add: function (curve) + setAngle: function (degrees) { - this.curves.push(curve); + if (degrees === undefined) { degrees = 0; } + + this.angle = degrees; return this; }, /** - * [description] - * - * @method Phaser.Curves.Path#circleTo + * Sets the scale of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setScale * @since 3.0.0 * - * @param {number} radius - [description] - * @param {boolean} [clockwise] - [description] - * @param {number} [rotation] - [description] - * - * @return {Phaser.Curves.Path} [description] + * @param {number} x - The horizontal scale of this Game Object. + * @param {number} [y] - The vertical scale of this Game Object. If not set it will use the `x` value. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - circleTo: function (radius, clockwise, rotation) + setScale: function (x, y) { - if (clockwise === undefined) { clockwise = false; } + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + this.scaleX = x; + this.scaleY = y; + + return this; }, /** - * [description] - * - * @method Phaser.Curves.Path#closePath + * Sets the x position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setX * @since 3.0.0 * - * @return {Phaser.Curves.Path} [description] + * @param {number} [value=0] - The x position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - closePath: function () + setX: function (value) { - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length - 1].getPoint(1); + if (value === undefined) { value = 0; } - if (!startPoint.equals(endPoint)) - { - // This will copy a reference to the vectors, which probably isn't sensible - this.curves.push(new LineCurve(endPoint, startPoint)); - } + this.x = value; return this; }, - // Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points - /** - * [description] - * - * @method Phaser.Curves.Path#cubicBezierTo + * Sets the y position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setY * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {Phaser.Math.Vector2} control1X - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control1Y - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control2X - {Phaser.Math[description] - * @param {Phaser.Math.Vector2} control2Y - {Phaser.Math[description] - * - * @return {Phaser.Curves.Path} [description] + * @param {number} [value=0] - The y position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) + setY: function (value) { - var p0 = this.getEndPoint(); - var p1; - var p2; - var p3; + if (value === undefined) { value = 0; } - // Assume they're all vec2s - if (x instanceof Vector2) - { - p1 = x; - p2 = y; - p3 = control1X; - } - else - { - p1 = new Vector2(control1X, control1Y); - p2 = new Vector2(control2X, control2Y); - p3 = new Vector2(x, y); - } + this.y = value; - return this.add(new CubicBezierCurve(p0, p1, p2, p3)); + return this; }, /** - * [description] - * - * @method Phaser.Curves.Path#destroy + * Sets the z position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setZ * @since 3.0.0 + * + * @param {number} [value=0] - The z position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - destroy: function () + setZ: function (value) { - this.curves.length = 0; - this.cacheLengths.length = 0; - this.startPoint = undefined; + if (value === undefined) { value = 0; } + + this.z = value; + + return this; }, /** - * [description] - * - * @method Phaser.Curves.Path#draw + * Sets the w position of this Game Object. + * + * @method Phaser.GameObjects.Components.Transform#setW * @since 3.0.0 * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {integer} [pointsTotal=32] - [description] - * - * @return {Phaser.GameObjects.Graphics} [description] + * @param {number} [value=0] - The w position of this Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - draw: function (graphics, pointsTotal) + setW: function (value) { - for (var i = 0; i < this.curves.length; i++) + if (value === undefined) { value = 0; } + + this.w = value; + + return this; + } + +}; + +module.exports = Transform; + + +/***/ }), +/* 407 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +// bitmask flag for GameObject.renderMask +var _FLAG = 1; // 0001 + +/** + * Provides methods used for setting the visibility of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @name Phaser.GameObjects.Components.Visible + * @since 3.0.0 + */ + +var Visible = { + + _visible: true, + + /** + * The visible state of the Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @name Phaser.GameObjects.Components.Visible#visible + * @type {boolean} + * @since 3.0.0 + */ + visible: { + + get: function () { - var curve = this.curves[i]; + return this._visible; + }, - if (!curve.active) + set: function (value) + { + if (value) + { + this._visible = true; + this.renderFlags |= _FLAG; + } + else { - continue; + this._visible = false; + this.renderFlags &= ~_FLAG; } - - curve.draw(graphics, pointsTotal); } - return graphics; }, /** - * Creates an ellipse curve positioned at the previous end point, using the given parameters. + * Sets the visibility of this Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. * - * @method Phaser.Curves.Path#ellipseTo + * @method Phaser.GameObjects.Components.Visible#setVisible * @since 3.0.0 * - * @param {number} xRadius - [description] - * @param {number} yRadius - [description] - * @param {number} startAngle - [description] - * @param {number} endAngle - [description] - * @param {boolean} clockwise - [description] - * @param {number} rotation - [description] - * - * @return {Phaser.Curves.Path} [description] + * @param {boolean} value - The visible state of the Game Object. + * + * @return {Phaser.GameObjects.GameObject} This Game Object instance. */ - ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + setVisible: function (value) { - var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); + this.visible = value; - var end = this.getEndPoint(this._tmpVec2A); + return this; + } +}; - // Calculate where to center the ellipse - var start = ellipse.getStartPoint(this._tmpVec2B); +module.exports = Visible; - end.subtract(start); - ellipse.x = end.x; - ellipse.y = end.y; +/***/ }), +/* 408 */ +/***/ (function(module, exports) { - return this.add(ellipse); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.Path#fromJSON - * @since 3.0.0 - * - * @param {object} data - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - fromJSON: function (data) +/** + * [description] + * + * @function Phaser.Actions.IncAlpha + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var IncAlpha = function (items, value) +{ + for (var i = 0; i < items.length; i++) { - // data should be an object matching the Path.toJSON object structure. + items[i].alpha += value; + } - this.curves = []; - this.cacheLengths = []; + return items; +}; - this.startPoint.set(data.x, data.y); +module.exports = IncAlpha; - this.autoClose = data.autoClose; - for (var i = 0; i < data.curves.length; i++) - { - var curve = data.curves[i]; +/***/ }), +/* 409 */ +/***/ (function(module, exports) { - switch (curve.type) - { - case 'LineCurve': - this.add(LineCurve.fromJSON(curve)); - break; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - case 'EllipseCurve': - this.add(EllipseCurve.fromJSON(curve)); - break; +/** + * [description] + * + * @function Phaser.Actions.IncX + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var IncX = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].x += value; + } - case 'SplineCurve': - this.add(SplineCurve.fromJSON(curve)); - break; + return items; +}; - case 'CubicBezierCurve': - this.add(CubicBezierCurve.fromJSON(curve)); - break; - } - } +module.exports = IncX; - return this; - }, - /** - * [description] - * - * @method Phaser.Curves.Path#getBounds - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} [out] - [description] - * @param {integer} [accuracy=16] - [description] - * - * @return {Phaser.Geom.Rectangle} [description] - */ - getBounds: function (out, accuracy) +/***/ }), +/* 410 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Actions.IncXY + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var IncXY = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } + items[i].x += x; + items[i].y += y; + } - out.x = Number.MAX_VALUE; - out.y = Number.MAX_VALUE; + return items; +}; - var bounds = new Rectangle(); - var maxRight = Number.MIN_SAFE_INTEGER; - var maxBottom = Number.MIN_SAFE_INTEGER; +module.exports = IncXY; - for (var i = 0; i < this.curves.length; i++) - { - var curve = this.curves[i]; - if (!curve.active) - { - continue; - } +/***/ }), +/* 411 */ +/***/ (function(module, exports) { - curve.getBounds(bounds, accuracy); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - out.x = Math.min(out.x, bounds.x); - out.y = Math.min(out.y, bounds.y); +/** + * [description] + * + * @function Phaser.Actions.IncY + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var IncY = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].y += value; + } - maxRight = Math.max(maxRight, bounds.right); - maxBottom = Math.max(maxBottom, bounds.bottom); - } + return items; +}; - out.right = maxRight; - out.bottom = maxBottom; +module.exports = IncY; - return out; - }, - /** - * [description] - * - * @method Phaser.Curves.Path#getCurveLengths - * @since 3.0.0 - * - * @return {array} [description] - */ - getCurveLengths: function () +/***/ }), +/* 412 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Actions.PlaceOnCircle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=6.28] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnCircle = function (items, circle, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } + + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; + + for (var i = 0; i < items.length; i++) { - // We use cache values if curves and cache array are same length + items[i].x = circle.x + (circle.radius * Math.cos(angle)); + items[i].y = circle.y + (circle.radius * Math.sin(angle)); - if (this.cacheLengths.length === this.curves.length) - { - return this.cacheLengths; - } + angle += angleStep; + } - // Get length of sub-curve - // Push sums into cached array + return items; +}; - var lengths = []; - var sums = 0; +module.exports = PlaceOnCircle; - for (var i = 0; i < this.curves.length; i++) - { - sums += this.curves[i].getLength(); - lengths.push(sums); - } +/***/ }), +/* 413 */ +/***/ (function(module, exports) { - this.cacheLengths = lengths; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return lengths; - }, +/** + * [description] + * + * @function Phaser.Actions.PlaceOnEllipse + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - [description] + * @param {number} [startAngle=0] - [description] + * @param {number} [endAngle=6.28] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } - /** - * [description] - * - * @method Phaser.Curves.Path#getEndPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getEndPoint: function (out) + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; + + var a = ellipse.width / 2; + var b = ellipse.height / 2; + + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + items[i].x = ellipse.x + a * Math.cos(angle); + items[i].y = ellipse.y + b * Math.sin(angle); - if (this.curves.length > 0) - { - this.curves[this.curves.length - 1].getPoint(1, out); - } - else - { - out.copy(this.startPoint); - } + angle += angleStep; + } - return out; - }, + return items; +}; - /** - * [description] - * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 - * - * @return {number} [description] - */ - getLength: function () - { - var lens = this.getCurveLengths(); +module.exports = PlaceOnEllipse; - return lens[lens.length - 1]; - }, - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: +/***/ }), +/* 414 */ +/***/ (function(module, exports, __webpack_require__) { - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.Path#getPoint - * @since 3.0.0 - * - * @param {number} t - [description] - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2|null} [description] - */ - getPoint: function (t, out) +var GetPoints = __webpack_require__(109); + +/** + * [description] + * + * @function Phaser.Actions.PlaceOnLine + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnLine = function (items, line) +{ + var points = GetPoints(line, items.length); + + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + var item = items[i]; + var point = points[i]; - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; + item.x = point.x; + item.y = point.y; + } - while (i < curveLengths.length) - { - if (curveLengths[i] >= d) - { - var diff = curveLengths[i] - d; - var curve = this.curves[i]; + return items; +}; - var segmentLength = curve.getLength(); - var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; +module.exports = PlaceOnLine; - return curve.getPointAt(u, out); - } - i++; - } +/***/ }), +/* 415 */ +/***/ (function(module, exports, __webpack_require__) { - // loop where sum != 0, sum > d , sum+1 + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Curves.Path#getPoints - * @since 3.0.0 - * - * @param {integer} [divisions=12] - [description] - * - * @return {Phaser.Math.Vector2[]} [description] - */ - getPoints: function (divisions) +var MarchingAnts = __webpack_require__(189); +var RotateLeft = __webpack_require__(190); +var RotateRight = __webpack_require__(191); + +// Place the items in the array around the perimeter of the given rectangle. + +// Placement starts from the top-left of the rectangle, and proceeds in a +// clockwise direction. If the shift parameter is given you can offset where +// placement begins. + +/** + * [description] + * + * @function Phaser.Actions.PlaceOnRectangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - [description] + * @param {integer} [shift=1] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnRectangle = function (items, rect, shift) +{ + if (shift === undefined) { shift = 0; } + + var points = MarchingAnts(rect, false, items.length); + + if (shift > 0) { - if (divisions === undefined) { divisions = 12; } + RotateLeft(points, shift); + } + else if (shift < 0) + { + RotateRight(points, Math.abs(shift)); + } - var points = []; - var last; + for (var i = 0; i < items.length; i++) + { + items[i].x = points[i].x; + items[i].y = points[i].y; + } - for (var i = 0; i < this.curves.length; i++) - { - var curve = this.curves[i]; + return items; +}; - if (!curve.active) - { - continue; - } +module.exports = PlaceOnRectangle; - var resolution = curve.getResolution(divisions); - var pts = curve.getPoints(resolution); +/***/ }), +/* 416 */ +/***/ (function(module, exports, __webpack_require__) { - for (var j = 0; j < pts.length; j++) - { - var point = pts[j]; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (last && last.equals(point)) - { - // ensures no consecutive points are duplicates - continue; - } +// var GetPointsOnLine = require('../geom/line/GetPointsOnLine'); +var BresenhamPoints = __webpack_require__(192); - points.push(point); +/** + * [description] + * + * @function Phaser.Actions.PlaceOnTriangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - [description] + * @param {number} [stepRate=1] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlaceOnTriangle = function (items, triangle, stepRate) +{ + var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); + var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); + var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); - last = point; - } - } + // Remove overlaps + p1.pop(); + p2.pop(); + p3.pop(); - if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) - { - points.push(points[0]); - } + p1 = p1.concat(p2, p3); - return points; - }, + var step = p1.length / items.length; + var p = 0; - /** - * [description] - * - * @method Phaser.Curves.Path#getRandomPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getRandomPoint: function (out) + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + var item = items[i]; + var point = p1[Math.floor(p)]; - return this.getPoint(Math.random(), out); - }, + item.x = point.x; + item.y = point.y; - /** - * [description] - * - * @method Phaser.Curves.Path#getSpacedPoints - * @since 3.0.0 - * - * @param {integer} [divisions=40] - [description] - * - * @return {Phaser.Math.Vector2[]} [description] - */ - getSpacedPoints: function (divisions) - { - if (divisions === undefined) { divisions = 40; } + p += step; + } - var points = []; + return items; +}; - for (var i = 0; i <= divisions; i++) - { - points.push(this.getPoint(i / divisions)); - } +module.exports = PlaceOnTriangle; - if (this.autoClose) - { - points.push(points[0]); - } - return points; - }, +/***/ }), +/* 417 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Curves.Path#getStartPoint - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} [out] - {Phaser.Math[description] - * - * @return {Phaser.Math.Vector2} {Phaser.Math[description] - */ - getStartPoint: function (out) +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Actions.PlayAnimation + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} key - [description] + * @param {string|integer} [startFrame] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var PlayAnimation = function (items, key, startFrame) +{ + for (var i = 0; i < items.length; i++) { - if (out === undefined) { out = new Vector2(); } + items[i].anims.play(key, startFrame); + } - return out.copy(this.startPoint); - }, + return items; +}; - // Creates a line curve from the previous end point to x/y +module.exports = PlayAnimation; - /** - * [description] - * - * @method Phaser.Curves.Path#lineTo - * @since 3.0.0 - * - * @param {number|Phaser.Math.Vector2} x - {Phaser.Math[description] - * @param {number} [y] - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - lineTo: function (x, y) - { - if (x instanceof Vector2) - { - this._tmpVec2B.copy(x); - } - else - { - this._tmpVec2B.set(x, y); - } - var end = this.getEndPoint(this._tmpVec2A); +/***/ }), +/* 418 */ +/***/ (function(module, exports, __webpack_require__) { - return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Creates a spline curve starting at the previous end point, using the given parameters +var Random = __webpack_require__(106); - /** - * [description] - * - * @method Phaser.Curves.Path#splineTo - * @since 3.0.0 - * - * @param {[type]} points - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - splineTo: function (points) +/** + * [description] + * + * @function Phaser.Actions.RandomCircle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomCircle = function (items, circle) +{ + for (var i = 0; i < items.length; i++) { - points.unshift(this.getEndPoint()); + Random(circle, items[i]); + } - return this.add(new SplineCurve(points)); - }, + return items; +}; - /** - * [description] - * - * @method Phaser.Curves.Path#moveTo - * @since 3.0.0 - * - * @param {number} x - [description] - * @param {number} y - [description] - * - * @return {Phaser.Curves.Path} [description] - */ - moveTo: function (x, y) - { - return this.add(new MovePathTo(x, y)); - }, +module.exports = RandomCircle; - /** - * [description] - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 - * - * @return {object} [description] - */ - toJSON: function () - { - var out = []; - for (var i = 0; i < this.curves.length; i++) - { - out.push(this.curves[i].toJSON()); - } +/***/ }), +/* 419 */ +/***/ (function(module, exports, __webpack_require__) { - return { - type: 'Path', - x: this.startPoint.x, - y: this.startPoint.y, - autoClose: this.autoClose, - curves: out - }; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // cacheLengths must be recalculated. +var Random = __webpack_require__(110); - /** - * [description] - * - * @method Phaser.Curves.Path#updateArcLengths - * @since 3.0.0 - */ - updateArcLengths: function () +/** + * [description] + * + * @function Phaser.Actions.RandomEllipse + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomEllipse = function (items, ellipse) +{ + for (var i = 0; i < items.length; i++) { - this.cacheLengths = []; - - this.getCurveLengths(); + Random(ellipse, items[i]); } -}); + return items; +}; + +module.exports = RandomEllipse; + + +/***/ }), +/* 420 */ +/***/ (function(module, exports, __webpack_require__) { /** - * Creates a new Path Object. + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Random = __webpack_require__(111); + +/** + * [description] * - * @method Phaser.GameObjects.GameObjectFactory#path + * @function Phaser.Actions.RandomLine * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Path. - * @param {number} y - The vertical position of this Path. * - * @return {Phaser.Curves.Path} The Path Object that was created. + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ -GameObjectFactory.register('path', function (x, y) +var RandomLine = function (items, line) { - return new Path(x, y); -}); + for (var i = 0; i < items.length; i++) + { + Random(line, items[i]); + } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + return items; +}; -module.exports = Path; +module.exports = RandomLine; /***/ }), -/* 459 */ +/* 421 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83340,134 +84851,150 @@ module.exports = Path; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var Vector2 = __webpack_require__(6); +var Random = __webpack_require__(108); /** - * @classdesc * [description] * - * @class MoveTo - * @memberOf Phaser.Curves - * @constructor + * @function Phaser.Actions.RandomRectangle * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - [description] * - * @param {number} [x] - [description] - * @param {number} [y] - [description] + * @return {array} The array of Game Objects that was passed to this Action. */ -var MoveTo = new Class({ +var RandomRectangle = function (items, rect) +{ + for (var i = 0; i < items.length; i++) + { + Random(rect, items[i]); + } - initialize: + return items; +}; - function MoveTo (x, y) - { - // Skip length calcs in paths +module.exports = RandomRectangle; - /** - * [description] - * - * @name Phaser.Curves.MoveTo#active - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.active = false; - /** - * [description] - * - * @name Phaser.Curves.MoveTo#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = new Vector2(x, y); - }, +/***/ }), +/* 422 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @param {[type]} t - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return out.copy(this.p0); - }, +var Random = __webpack_require__(112); - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getPointAt - * @since 3.0.0 - * - * @param {[type]} u - [description] - * @param {[type]} out - [description] - * - * @return {[type]} [description] - */ - getPointAt: function (u, out) +/** + * [description] + * + * @function Phaser.Actions.RandomTriangle + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RandomTriangle = function (items, triangle) +{ + for (var i = 0; i < items.length; i++) { - return this.getPoint(u, out); - }, + Random(triangle, items[i]); + } - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getResolution: function () - { - return 1; - }, + return items; +}; - /** - * [description] - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {[type]} [description] - */ - getLength: function () +module.exports = RandomTriangle; + + +/***/ }), +/* 423 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Actions.Rotate + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var Rotate = function (items, value, step) +{ + if (step === undefined) { step = 0; } + + for (var i = 0; i < items.length; i++) { - return 0; - }, + items[i].rotation += value + (i * step); + } + + return items; +}; + +module.exports = Rotate; + + +/***/ }), +/* 424 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var RotateAroundDistance = __webpack_require__(113); +var DistanceBetween = __webpack_require__(42); + +/** + * [description] + * + * @function Phaser.Actions.RotateAround + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var RotateAround = function (items, point, angle) +{ + var x = point.x; + var y = point.y; - /** - * [description] - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {[type]} [description] - */ - toJSON: function () + for (var i = 0; i < items.length; i++) { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; + var item = items[i]; + + RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); } -}); + return items; +}; -module.exports = MoveTo; +module.exports = RotateAround; /***/ }), -/* 460 */ +/* 425 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83476,21 +85003,46 @@ module.exports = MoveTo; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var MathRotateAroundDistance = __webpack_require__(113); + /** - * @namespace Phaser.Data + * [description] + * + * @function Phaser.Actions.RotateAroundDistance + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * @param {number} distance - The distance from the point of rotation in pixels. + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var RotateAroundDistance = function (items, point, angle, distance) +{ + var x = point.x; + var y = point.y; -module.exports = { + // There's nothing to do + if (distance === 0) + { + return items; + } - DataManager: __webpack_require__(79), - DataManagerPlugin: __webpack_require__(461) + for (var i = 0; i < items.length; i++) + { + MathRotateAroundDistance(items[i], x, y, angle, distance); + } + return items; }; +module.exports = RotateAroundDistance; + /***/ }), -/* 461 */ -/***/ (function(module, exports, __webpack_require__) { +/* 426 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83498,107 +85050,103 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var DataManager = __webpack_require__(79); -var PluginManager = __webpack_require__(12); - /** - * @classdesc - * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. + * [description] * - * @class DataManagerPlugin - * @extends Phaser.Data.DataManager - * @memberOf Phaser.Data - * @constructor + * @function Phaser.Actions.ScaleX * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] * - * @param {Phaser.Scene} scene - [description] + * @return {array} The array of Game Objects that was passed to this Action. */ -var DataManagerPlugin = new Class({ - - Extends: DataManager, +var ScaleX = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].scaleX += value; + } - initialize: + return items; +}; - function DataManagerPlugin (scene) - { - /** - * [description] - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; +module.exports = ScaleX; - /** - * [description] - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - if (!scene.sys.settings.isBooted) - { - scene.sys.events.once('boot', this.boot, this); - } +/***/ }), +/* 427 */ +/***/ (function(module, exports) { - DataManager.call(this, this.scene, scene.sys.events); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#boot - * @since 3.0.0 - */ - boot: function () +/** + * [description] + * + * @function Phaser.Actions.ScaleXY + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var ScaleXY = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) { - var eventEmitter = this.systems.events; + items[i].scaleX += x; + items[i].scaleY += y; + } - eventEmitter.on('shutdown', this.shutdownPlugin, this); - eventEmitter.on('destroy', this.destroyPlugin, this); - }, + return items; +}; - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#shutdownPlugin - * @since 3.0.0 - */ - shutdownPlugin: function () - { - // Should we reset the events? - }, +module.exports = ScaleXY; - /** - * [description] - * - * @method Phaser.Data.DataManagerPlugin#destroyPlugin - * @since 3.0.0 - */ - destroyPlugin: function () - { - this.destroy(); - this.scene = undefined; - this.systems = undefined; - } +/***/ }), +/* 428 */ +/***/ (function(module, exports) { -}); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data'); +/** + * [description] + * + * @function Phaser.Actions.ScaleY + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var ScaleY = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].scaleY += value; + } -module.exports = DataManagerPlugin; + return items; +}; + +module.exports = ScaleY; /***/ }), -/* 462 */ -/***/ (function(module, exports, __webpack_require__) { +/* 429 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83607,23 +85155,35 @@ module.exports = DataManagerPlugin; */ /** - * @namespace Phaser.Display + * [description] + * + * @function Phaser.Actions.SetAlpha + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetAlpha = function (items, value, step) +{ + if (step === undefined) { step = 0; } -module.exports = { + for (var i = 0; i < items.length; i++) + { + items[i].alpha = value + (i * step); + } - Align: __webpack_require__(463), - Bounds: __webpack_require__(478), - Canvas: __webpack_require__(481), - Color: __webpack_require__(222), - Masks: __webpack_require__(492) - + return items; }; +module.exports = SetAlpha; + /***/ }), -/* 463 */ -/***/ (function(module, exports, __webpack_require__) { +/* 430 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83632,20 +85192,32 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align + * [description] + * + * @function Phaser.Actions.SetBlendMode + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetBlendMode = function (items, value) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setBlendMode(value); + } -module.exports = { - - In: __webpack_require__(464), - To: __webpack_require__(465) - + return items; }; +module.exports = SetBlendMode; + /***/ }), -/* 464 */ -/***/ (function(module, exports, __webpack_require__) { +/* 431 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83654,28 +85226,35 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align.In + * [description] + * + * @function Phaser.Actions.SetDepth + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetDepth = function (items, value, step) +{ + if (step === undefined) { step = 0; } -module.exports = { - - BottomCenter: __webpack_require__(171), - BottomLeft: __webpack_require__(172), - BottomRight: __webpack_require__(173), - Center: __webpack_require__(174), - LeftCenter: __webpack_require__(176), - QuickSet: __webpack_require__(169), - RightCenter: __webpack_require__(177), - TopCenter: __webpack_require__(178), - TopLeft: __webpack_require__(179), - TopRight: __webpack_require__(180) + for (var i = 0; i < items.length; i++) + { + items[i].depth = value + (i * step); + } + return items; }; +module.exports = SetDepth; + /***/ }), -/* 465 */ -/***/ (function(module, exports, __webpack_require__) { +/* 432 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83684,30 +85263,68 @@ module.exports = { */ /** - * @namespace Phaser.Display.Align.To + * [description] + * + * @function Phaser.Actions.SetHitArea + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {any} hitArea - [description] + * @param {function} hitAreaCallback - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SetHitArea = function (items, hitArea, hitAreaCallback) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setInteractive(hitArea, hitAreaCallback); + } + + return items; +}; + +module.exports = SetHitArea; -module.exports = { - BottomCenter: __webpack_require__(466), - BottomLeft: __webpack_require__(467), - BottomRight: __webpack_require__(468), - LeftBottom: __webpack_require__(469), - LeftCenter: __webpack_require__(470), - LeftTop: __webpack_require__(471), - RightBottom: __webpack_require__(472), - RightCenter: __webpack_require__(473), - RightTop: __webpack_require__(474), - TopCenter: __webpack_require__(475), - TopLeft: __webpack_require__(476), - TopRight: __webpack_require__(477) +/***/ }), +/* 433 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * [description] + * + * @function Phaser.Actions.SetOrigin + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. + */ +var SetOrigin = function (items, x, y) +{ + for (var i = 0; i < items.length; i++) + { + items[i].setOrigin(x, y); + } + return items; }; +module.exports = SetOrigin; + /***/ }), -/* 466 */ -/***/ (function(module, exports, __webpack_require__) { +/* 434 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83715,41 +85332,36 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetCenterX = __webpack_require__(46); -var SetCenterX = __webpack_require__(47); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. + * [description] * - * @function Phaser.Display.Align.To.BottomCenter + * @function Phaser.Actions.SetRotation * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetRotation = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].rotation = value + (i * step); + } - return gameObject; + return items; }; -module.exports = BottomCenter; +module.exports = SetRotation; /***/ }), -/* 467 */ -/***/ (function(module, exports, __webpack_require__) { +/* 435 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83757,41 +85369,42 @@ module.exports = BottomCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. + * [description] * - * @function Phaser.Display.Align.To.BottomLeft + * @function Phaser.Actions.SetScale * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} [stepX=0] - [description] + * @param {number} [stepY=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) +var SetScale = function (items, x, y, stepX, stepY) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (stepX === undefined) { stepX = 0; } + if (stepY === undefined) { stepY = 0; } - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].setScale( + x + (i * stepX), + y + (i * stepY) + ); + } - return gameObject; + return items; }; -module.exports = BottomLeft; +module.exports = SetScale; /***/ }), -/* 468 */ -/***/ (function(module, exports, __webpack_require__) { +/* 436 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83799,41 +85412,36 @@ module.exports = BottomLeft; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. + * [description] * - * @function Phaser.Display.Align.To.BottomRight + * @function Phaser.Actions.SetScaleX * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var BottomRight = function (gameObject, alignTo, offsetX, offsetY) +var SetScaleX = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].scaleX = value + (i * step); + } - return gameObject; + return items; }; -module.exports = BottomRight; +module.exports = SetScaleX; /***/ }), -/* 469 */ -/***/ (function(module, exports, __webpack_require__) { +/* 437 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83841,41 +85449,36 @@ module.exports = BottomRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetLeft = __webpack_require__(26); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftBottom + * @function Phaser.Actions.SetScaleY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) +var SetScaleY = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].scaleY = value + (i * step); + } - return gameObject; + return items; }; -module.exports = LeftBottom; +module.exports = SetScaleY; /***/ }), -/* 470 */ -/***/ (function(module, exports, __webpack_require__) { +/* 438 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83883,41 +85486,36 @@ module.exports = LeftBottom; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(49); -var GetLeft = __webpack_require__(26); -var SetCenterY = __webpack_require__(48); -var SetRight = __webpack_require__(29); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftCenter + * @function Phaser.Actions.SetTint * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} topLeft - [description] + * @param {number} [topRight] - [description] + * @param {number} [bottomLeft] - [description] + * @param {number} [bottomRight] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); + } - return gameObject; + return items; }; -module.exports = LeftCenter; +module.exports = SetTint; /***/ }), -/* 471 */ -/***/ (function(module, exports, __webpack_require__) { +/* 439 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83925,41 +85523,33 @@ module.exports = LeftCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetRight = __webpack_require__(29); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * [description] * - * @function Phaser.Display.Align.To.LeftTop + * @function Phaser.Actions.SetVisible * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {boolean} value - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var LeftTop = function (gameObject, alignTo, offsetX, offsetY) +var SetVisible = function (items, value) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].visible = value; + } - return gameObject; + return items; }; -module.exports = LeftTop; +module.exports = SetVisible; /***/ }), -/* 472 */ -/***/ (function(module, exports, __webpack_require__) { +/* 440 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -83967,41 +85557,36 @@ module.exports = LeftTop; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetBottom = __webpack_require__(24); -var GetRight = __webpack_require__(28); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightBottom + * @function Phaser.Actions.SetX * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightBottom = function (gameObject, alignTo, offsetX, offsetY) +var SetX = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].x = value + (i * step); + } - return gameObject; + return items; }; -module.exports = RightBottom; +module.exports = SetX; /***/ }), -/* 473 */ -/***/ (function(module, exports, __webpack_require__) { +/* 441 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -84009,41 +85594,40 @@ module.exports = RightBottom; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterY = __webpack_require__(49); -var GetRight = __webpack_require__(28); -var SetCenterY = __webpack_require__(48); -var SetLeft = __webpack_require__(27); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightCenter + * @function Phaser.Actions.SetXY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {number} [stepX=0] - [description] + * @param {number} [stepY=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightCenter = function (gameObject, alignTo, offsetX, offsetY) +var SetXY = function (items, x, y, stepX, stepY) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (stepX === undefined) { stepX = 0; } + if (stepY === undefined) { stepY = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].x = x + (i * stepX); + items[i].y = y + (i * stepY); + } - return gameObject; + return items; }; -module.exports = RightCenter; +module.exports = SetXY; /***/ }), -/* 474 */ -/***/ (function(module, exports, __webpack_require__) { +/* 442 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -84051,40 +85635,35 @@ module.exports = RightCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetLeft = __webpack_require__(27); -var SetTop = __webpack_require__(31); - /** - * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. + * [description] * - * @function Phaser.Display.Align.To.RightTop + * @function Phaser.Actions.SetY * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} value - [description] + * @param {number} [step=0] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var RightTop = function (gameObject, alignTo, offsetX, offsetY) +var SetY = function (items, value, step) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (step === undefined) { step = 0; } - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); + for (var i = 0; i < items.length; i++) + { + items[i].y = value + (i * step); + } - return gameObject; + return items; }; -module.exports = RightTop; +module.exports = SetY; /***/ }), -/* 475 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84093,40 +85672,125 @@ module.exports = RightTop; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetCenterX = __webpack_require__(46); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetCenterX = __webpack_require__(47); +var Vector2 = __webpack_require__(6); + +// Iterate through items changing the position of each element to +// be that of the element that came before it in the array (or after it if direction = 1) +// The first items position is set to x/y. +// The final x/y coords are returned /** - * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopCenter + * @function Phaser.Actions.ShiftPosition * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} x - [description] + * @param {number} y - [description] + * @param {integer} [direction=0] - [description] + * @param {Phaser.Math.Vector2|object} [output] - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopCenter = function (gameObject, alignTo, offsetX, offsetY) +var ShiftPosition = function (items, x, y, direction, output) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (direction === undefined) { direction = 0; } + if (output === undefined) { output = new Vector2(); } - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + var px; + var py; - return gameObject; + if (items.length > 1) + { + var i; + var cx; + var cy; + var cur; + + if (direction === 0) + { + // Bottom to Top + + var len = items.length - 1; + + px = items[len].x; + py = items[len].y; + + for (i = len - 1; i >= 0; i--) + { + // Current item + cur = items[i]; + + // Get current item x/y, to be passed to the next item in the list + cx = cur.x; + cy = cur.y; + + // Set current item to the previous items x/y + cur.x = px; + cur.y = py; + + // Set current as previous + px = cx; + py = cy; + } + + // Update the head item to the new x/y coordinates + items[len].x = x; + items[len].y = y; + } + else + { + // Top to Bottom + + px = items[0].x; + py = items[0].y; + + for (i = 1; i < items.length; i++) + { + // Current item + cur = items[i]; + + // Get current item x/y, to be passed to the next item in the list + cx = cur.x; + cy = cur.y; + + // Set current item to the previous items x/y + cur.x = px; + cur.y = py; + + // Set current as previous + px = cx; + py = cy; + } + + // Update the head item to the new x/y coordinates + items[0].x = x; + items[0].y = y; + } + } + else + { + px = items[0].x; + py = items[0].y; + + items[0].x = x; + items[0].y = y; + } + + // Return the final set of coordinates as they're effectively lost from the shift and may be needed + + output.x = px; + output.y = py; + + return output; }; -module.exports = TopCenter; +module.exports = ShiftPosition; /***/ }), -/* 476 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84135,40 +85799,28 @@ module.exports = TopCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetLeft = __webpack_require__(26); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetLeft = __webpack_require__(27); +var ArrayShuffle = __webpack_require__(80); /** - * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopLeft + * @function Phaser.Actions.Shuffle * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopLeft = function (gameObject, alignTo, offsetX, offsetY) +var Shuffle = function (items) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; + return ArrayShuffle(items); }; -module.exports = TopLeft; +module.exports = Shuffle; /***/ }), -/* 477 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84177,40 +85829,52 @@ module.exports = TopLeft; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetRight = __webpack_require__(28); -var GetTop = __webpack_require__(30); -var SetBottom = __webpack_require__(25); -var SetRight = __webpack_require__(29); +var MathSmootherStep = __webpack_require__(193); /** - * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * [description] * - * @function Phaser.Display.Align.To.TopRight + * @function Phaser.Actions.SmootherStep * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {array} The array of Game Objects that was passed to this Action. */ -var TopRight = function (gameObject, alignTo, offsetX, offsetY) +var SmootherStep = function (items, property, min, max, inc) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (inc === undefined) { inc = false; } - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + var step = Math.abs(max - min) / items.length; + var i; - return gameObject; + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmootherStep(i * step, min, max); + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmootherStep(i * step, min, max); + } + } + + return items; }; -module.exports = TopRight; +module.exports = SmootherStep; /***/ }), -/* 478 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84219,33 +85883,52 @@ module.exports = TopRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var MathSmoothStep = __webpack_require__(194); + /** - * @namespace Phaser.Display.Bounds + * [description] + * + * @function Phaser.Actions.SmoothStep + * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] + * + * @return {array} The array of Game Objects that was passed to this Action. */ +var SmoothStep = function (items, property, min, max, inc) +{ + if (inc === undefined) { inc = false; } -module.exports = { + var step = Math.abs(max - min) / items.length; + var i; - CenterOn: __webpack_require__(175), - GetBottom: __webpack_require__(24), - GetCenterX: __webpack_require__(46), - GetCenterY: __webpack_require__(49), - GetLeft: __webpack_require__(26), - GetOffsetX: __webpack_require__(479), - GetOffsetY: __webpack_require__(480), - GetRight: __webpack_require__(28), - GetTop: __webpack_require__(30), - SetBottom: __webpack_require__(25), - SetCenterX: __webpack_require__(47), - SetCenterY: __webpack_require__(48), - SetLeft: __webpack_require__(27), - SetRight: __webpack_require__(29), - SetTop: __webpack_require__(31) - + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmoothStep(i * step, min, max); + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmoothStep(i * step, min, max); + } + } + + return items; }; +module.exports = SmoothStep; + /***/ }), -/* 479 */ +/* 447 */ /***/ (function(module, exports) { /** @@ -84255,27 +85938,49 @@ module.exports = { */ /** - * Returns the amount the Game Object is visually offset from its x coordinate. - * This is the same as `width * origin.x`. - * This value will only be > 0 if `origin.x` is not equal to zero. + * [description] * - * @function Phaser.Display.Bounds.GetOffsetX + * @function Phaser.Actions.Spread * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - [description] + * @param {number} min - [description] + * @param {number} max - [description] + * @param {number} inc - [description] * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The horizontal offset of the Game Object. + * @return {array} The array of Game Objects that was passed to this Action. */ -var GetOffsetX = function (gameObject) +var Spread = function (items, property, min, max, inc) { - return gameObject.width * gameObject.originX; + if (inc === undefined) { inc = false; } + + var step = Math.abs(max - min) / items.length; + var i; + + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += i * step; + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = i * step; + } + } + + return items; }; -module.exports = GetOffsetX; +module.exports = Spread; /***/ }), -/* 480 */ +/* 448 */ /***/ (function(module, exports) { /** @@ -84285,27 +85990,30 @@ module.exports = GetOffsetX; */ /** - * Returns the amount the Game Object is visually offset from its y coordinate. - * This is the same as `width * origin.y`. - * This value will only be > 0 if `origin.y` is not equal to zero. + * [description] * - * @function Phaser.Display.Bounds.GetOffsetY + * @function Phaser.Actions.ToggleVisible * @since 3.0.0 + * + * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The vertical offset of the Game Object. + * @return {array} The array of Game Objects that was passed to this Action. */ -var GetOffsetY = function (gameObject) +var ToggleVisible = function (items) { - return gameObject.height * gameObject.originY; + for (var i = 0; i < items.length; i++) + { + items[i].visible = !items[i].visible; + } + + return items; }; -module.exports = GetOffsetY; +module.exports = ToggleVisible; /***/ }), -/* 481 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84315,23 +86023,21 @@ module.exports = GetOffsetY; */ /** - * @namespace Phaser.Display.Canvas + * @namespace Phaser.Animations */ module.exports = { - Interpolation: __webpack_require__(221), - Pool: __webpack_require__(21), - Smoothing: __webpack_require__(120), - TouchAction: __webpack_require__(482), - UserSelect: __webpack_require__(483) - + Animation: __webpack_require__(195), + AnimationFrame: __webpack_require__(196), + AnimationManager: __webpack_require__(197) + }; /***/ }), -/* 482 */ -/***/ (function(module, exports) { +/* 450 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -84340,33 +86046,20 @@ module.exports = { */ /** - * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. - * - * @function Phaser.Display.Canvas.TouchAction - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. - * - * @return {HTMLCanvasElement} The canvas element. + * @namespace Phaser.Cache */ -var TouchAction = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - canvas.style['msTouchAction'] = value; - canvas.style['ms-touch-action'] = value; - canvas.style['touch-action'] = value; +module.exports = { - return canvas; -}; + BaseCache: __webpack_require__(199), + CacheManager: __webpack_require__(200) -module.exports = TouchAction; +}; /***/ }), -/* 483 */ -/***/ (function(module, exports) { +/* 451 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -84375,45 +86068,21 @@ module.exports = TouchAction; */ /** - * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. - * - * @function Phaser.Display.Canvas.UserSelect - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. - * - * @return {HTMLCanvasElement} The canvas element. + * @namespace Phaser.Cameras */ -var UserSelect = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - - var vendors = [ - '-webkit-', - '-khtml-', - '-moz-', - '-ms-', - '' - ]; - vendors.forEach(function (vendor) - { - canvas.style[vendor + 'user-select'] = value; - }); +module.exports = { - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; + Controls: __webpack_require__(452), + Scene2D: __webpack_require__(455), + Sprite3D: __webpack_require__(457) - return canvas; }; -module.exports = UserSelect; - /***/ }), -/* 484 */ -/***/ (function(module, exports) { +/* 452 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -84422,45 +86091,19 @@ module.exports = UserSelect; */ /** - * @typedef {Object} ColorObject - * @property {number} r - The red color value in the range 0 to 255. - * @property {number} g - The green color value in the range 0 to 255. - * @property {number} b - The blue color value in the range 0 to 255. - * @property {number} a - The alpha color value in the range 0 to 255. + * @namespace Phaser.Cameras.Controls */ -/** - * Converts the given color value into an Object containing r,g,b and a properties. - * - * @function Phaser.Display.Color.ColorToRGBA - * @since 3.0.0 - * - * @param {number} color - A color value, optionally including the alpha value. - * - * @return {ColorObject} An object containing the parsed color values. - */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; +module.exports = { - if (color > 16777215) - { - output.a = color >>> 24; - } + Fixed: __webpack_require__(453), + Smoothed: __webpack_require__(454) - return output; }; -module.exports = ColorToRGBA; - /***/ }), -/* 485 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84469,117 +86112,291 @@ module.exports = ColorToRGBA; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Color = __webpack_require__(36); -var HueToComponent = __webpack_require__(224); +var Class = __webpack_require__(0); +var GetValue = __webpack_require__(4); + +// var camControl = new CameraControl({ +// camera: this.cameras.main, +// left: cursors.left, +// right: cursors.right, +// speed: float OR { x: 0, y: 0 } +// }) /** - * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. + * @classdesc + * [description] * - * @function Phaser.Display.Color.HSLToColor + * @class FixedKeyControl + * @memberOf Phaser.Cameras.Controls + * @constructor * @since 3.0.0 * - * @param {number} h - The hue value in the range 0 to 1. - * @param {number} s - The saturation value in the range 0 to 1. - * @param {number} l - The lightness value in the range 0 to 1. - * - * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. + * @param {object} config - [description] */ -var HSLToColor = function (h, s, l) -{ - // achromatic by default - var r = l; - var g = l; - var b = l; +var FixedKeyControl = new Class({ - if (s !== 0) + initialize: + + function FixedKeyControl (config) { - var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#left + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - var color = new Color(); + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#right + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); - return color.setGLTo(r, g, b, 1); -}; + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#up + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); -module.exports = HSLToColor; + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#down + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); -/***/ }), -/* 486 */ -/***/ (function(module, exports) { + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed + * @type {float} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + /** + * The horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/***/ }), -/* 487 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var speed = GetValue(config, 'speed', null); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (typeof speed === 'number') + { + this.speedX = speed; + this.speedY = speed; + } + else + { + this.speedX = GetValue(config, 'speed.x', 0); + this.speedY = GetValue(config, 'speed.y', 0); + } -var HSVToRGB = __webpack_require__(225); + /** + * [description] + * + * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; -/** - * Get HSV color wheel values in an array which will be 360 elements in size. - * - * @function Phaser.Display.Color.HSVColorWheel - * @since 3.0.0 - * - * @param {number} [s=1] - The saturation, in the range 0 - 1. - * @param {number} [v=1] - The value, in the range 0 - 1. - * - * @return {array} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. - */ -var HSVColorWheel = function (s, v) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, - var colors = []; + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#start + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + start: function () + { + this.active = (this.camera !== null); - for (var c = 0; c <= 359; c++) + return this; + }, + + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#stop + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + stop: function () { - colors.push(HSVToRGB(c / 359, s, v)); + this.active = false; + + return this; + }, + + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {Phaser.Cameras.Controls.FixedKeyControl} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Controls.FixedKeyControl#update + * @since 3.0.0 + * + * @param {number} delta - [description] + */ + update: function (delta) + { + if (!this.active) + { + return; + } + + if (delta === undefined) { delta = 1; } + + var cam = this.camera; + + if (this.up && this.up.isDown) + { + cam.scrollY -= ((this.speedY * delta) | 0); + } + else if (this.down && this.down.isDown) + { + cam.scrollY += ((this.speedY * delta) | 0); + } + + if (this.left && this.left.isDown) + { + cam.scrollX -= ((this.speedX * delta) | 0); + } + else if (this.right && this.right.isDown) + { + cam.scrollX += ((this.speedX * delta) | 0); + } + + // Camera zoom + + if (this.zoomIn && this.zoomIn.isDown) + { + cam.zoom -= this.zoomSpeed; + + if (cam.zoom < 0.1) + { + cam.zoom = 0.1; + } + } + else if (this.zoomOut && this.zoomOut.isDown) + { + cam.zoom += this.zoomSpeed; + } + }, + + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.camera = null; + + this.left = null; + this.right = null; + this.up = null; + this.down = null; + + this.zoomIn = null; + this.zoomOut = null; } - return colors; -}; +}); -module.exports = HSVColorWheel; +module.exports = FixedKeyControl; /***/ }), -/* 488 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84588,245 +86405,463 @@ module.exports = HSVColorWheel; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Linear = __webpack_require__(226); +var Class = __webpack_require__(0); +var GetValue = __webpack_require__(4); -/** - * Interpolates color values - * - * @namespace Phaser.Display.Color.Interpolate - * @since 3.0.0 - */ +// var controlConfig = { +// camera: this.cameras.main, +// left: cursors.left, +// right: cursors.right, +// up: cursors.up, +// down: cursors.down, +// zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), +// zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), +// zoomSpeed: 0.02, +// acceleration: 0.06, +// drag: 0.0005, +// maxSpeed: 1.0 +// }; /** - * Interpolates between the two given color ranges over the length supplied. + * @classdesc + * [description] * - * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @class SmoothedKeyControl + * @memberOf Phaser.Cameras.Controls + * @constructor * @since 3.0.0 * - * @param {number} r1 - Red value. - * @param {number} g1 - Blue value. - * @param {number} b1 - Green value. - * @param {number} r2 - Red value. - * @param {number} g2 - Blue value. - * @param {number} b2 - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. + * @param {object} config - [description] */ -var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } +var SmoothedKeyControl = new Class({ - var t = index / length; + initialize: - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; + function SmoothedKeyControl (config) + { + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); -/** - * Interpolates between the two given color objects over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithColor - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {Phaser.Display.Color} color2 - The second Color object. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. - */ -var ColorWithColor = function (color1, color2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#left + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); -}; + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#right + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); -/** - * Interpolates between the Color object and color values over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithRGB - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {number} r - Red value. - * @param {number} g - Blue value. - * @param {number} b - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {ColorObject} An object containing the interpolated color values. - */ -var ColorWithRGB = function (color, r, g, b, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#up + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#down + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); -module.exports = { + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut + * @type {Phaser.Input.Keyboard} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); -}; + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed + * @type {float} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + /** + * The horizontal acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/***/ }), -/* 489 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The vertical acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var accel = GetValue(config, 'acceleration', null); -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (typeof accel === 'number') + { + this.accelX = accel; + this.accelY = accel; + } + else + { + this.accelX = GetValue(config, 'acceleration.x', 0); + this.accelY = GetValue(config, 'acceleration.y', 0); + } -var Between = __webpack_require__(228); -var Color = __webpack_require__(36); + /** + * The horizontal drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX + * @type {float} + * @default 0 + * @since 3.0.0 + */ -/** - * Creates a new Color object where the r, g, and b values have been set to random values - * based on the given min max values. - * - * @function Phaser.Display.Color.RandomRGB - * @since 3.0.0 - * - * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) - * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) - * - * @return {Phaser.Display.Color} A Color object. - */ -var RandomRGB = function (min, max) -{ - if (min === undefined) { min = 0; } - if (max === undefined) { max = 255; } + /** + * The vertical drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var drag = GetValue(config, 'drag', null); - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; + if (typeof drag === 'number') + { + this.dragX = drag; + this.dragY = drag; + } + else + { + this.dragX = GetValue(config, 'drag.x', 0); + this.dragY = GetValue(config, 'drag.y', 0); + } -module.exports = RandomRGB; + /** + * The maximum horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX + * @type {float} + * @default 0 + * @since 3.0.0 + */ + /** + * The maximum vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY + * @type {float} + * @default 0 + * @since 3.0.0 + */ + var maxSpeed = GetValue(config, 'maxSpeed', null); -/***/ }), -/* 490 */ -/***/ (function(module, exports) { + if (typeof maxSpeed === 'number') + { + this.maxSpeedX = maxSpeed; + this.maxSpeedY = maxSpeed; + } + else + { + this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); + this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); + } -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedX = 0; -/** - * Converts an RGB color value to HSV (hue, saturation and value). - * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. - * Based on code by Michael Jackson (https://github.com/mjijackson) - * - * @function Phaser.Display.Color.RGBToHSV - * @since 3.0.0 - * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * - * @return {object} An object with the properties `h`, `s` and `v`. - */ -var RGBToHSV = function (r, g, b) -{ - r /= 255; - g /= 255; - b /= 255; + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedY = 0; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var d = max - min; + /** + * [description] + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; - // achromatic by default - var h = 0; - var s = (max === 0) ? 0 : d / max; - var v = max; + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, - if (max !== min) + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#start + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + start: function () { - if (max === r) + this.active = (this.camera !== null); + + return this; + }, + + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop + * @since 3.0.0 + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + stop: function () + { + this.active = false; + + return this; + }, + + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {Phaser.Cameras.Controls.SmoothedKeyControl} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; + + return this; + }, + + /** + * [description] + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#update + * @since 3.0.0 + * + * @param {[type]} delta - [description] + */ + update: function (delta) + { + if (!this.active) { - h = (g - b) / d + ((g < b) ? 6 : 0); + return; } - else if (max === g) + + if (delta === undefined) { delta = 1; } + + var cam = this.camera; + + // Apply Deceleration + + if (this._speedX > 0) { - h = (b - r) / d + 2; + this._speedX -= this.dragX * delta; + + if (this._speedX < 0) + { + this._speedX = 0; + } } - else if (max === b) + else if (this._speedX < 0) { - h = (r - g) / d + 4; + this._speedX += this.dragX * delta; + + if (this._speedX > 0) + { + this._speedX = 0; + } } - h /= 6; - } + if (this._speedY > 0) + { + this._speedY -= this.dragY * delta; - return { h: h, s: s, v: v }; -}; + if (this._speedY < 0) + { + this._speedY = 0; + } + } + else if (this._speedY < 0) + { + this._speedY += this.dragY * delta; -module.exports = RGBToHSV; + if (this._speedY > 0) + { + this._speedY = 0; + } + } + // Check for keys -/***/ }), -/* 491 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.up && this.up.isDown) + { + this._speedY += this.accelY; -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ + if (this._speedY > this.maxSpeedY) + { + this._speedY = this.maxSpeedY; + } + } + else if (this.down && this.down.isDown) + { + this._speedY -= this.accelY; -var ComponentToHex = __webpack_require__(223); + if (this._speedY < -this.maxSpeedY) + { + this._speedY = -this.maxSpeedY; + } + } -/** - * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. - * - * @function Phaser.Display.Color.RGBToString - * @since 3.0.0 - * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * @param {integer} [a=255] - The alpha value. A number between 0 and 255. - * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. - * - * @return {string} A string-based representation of the color values. - */ -var RGBToString = function (r, g, b, a, prefix) -{ - if (a === undefined) { a = 255; } - if (prefix === undefined) { prefix = '#'; } + if (this.left && this.left.isDown) + { + this._speedX += this.accelX; - if (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); - } - else + if (this._speedX > this.maxSpeedX) + { + this._speedX = this.maxSpeedX; + } + } + else if (this.right && this.right.isDown) + { + this._speedX -= this.accelX; + + if (this._speedX < -this.maxSpeedX) + { + this._speedX = -this.maxSpeedX; + } + } + + // Camera zoom + + if (this.zoomIn && this.zoomIn.isDown) + { + this._zoom = -this.zoomSpeed; + } + else if (this.zoomOut && this.zoomOut.isDown) + { + this._zoom = this.zoomSpeed; + } + else + { + this._zoom = 0; + } + + // Apply to Camera + + if (this._speedX !== 0) + { + cam.scrollX -= ((this._speedX * delta) | 0); + } + + if (this._speedY !== 0) + { + cam.scrollY -= ((this._speedY * delta) | 0); + } + + if (this._zoom !== 0) + { + cam.zoom += this._zoom; + + if (cam.zoom < 0.1) + { + cam.zoom = 0.1; + } + } + }, + + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + this.camera = null; + + this.left = null; + this.right = null; + this.up = null; + this.down = null; + + this.zoomIn = null; + this.zoomOut = null; } -}; -module.exports = RGBToString; +}); + +module.exports = SmoothedKeyControl; /***/ }), -/* 492 */ +/* 455 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84836,19 +86871,19 @@ module.exports = RGBToString; */ /** - * @namespace Phaser.Display.Masks + * @namespace Phaser.Cameras.Scene2D */ module.exports = { - BitmapMask: __webpack_require__(493), - GeometryMask: __webpack_require__(494) + Camera: __webpack_require__(115), + CameraManager: __webpack_require__(456) }; /***/ }), -/* 493 */ +/* 456 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84857,357 +86892,495 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Camera = __webpack_require__(115); var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var PluginManager = __webpack_require__(12); +var RectangleContains = __webpack_require__(33); /** * @classdesc * [description] * - * @class BitmapMask - * @memberOf Phaser.Display.Masks + * @class CameraManager + * @memberOf Phaser.Cameras.Scene2D * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {[type]} renderable - [description] + * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. */ -var BitmapMask = new Class({ - +var CameraManager = new Class({ + initialize: - function BitmapMask (scene, renderable) + function CameraManager (scene) { - var renderer = scene.sys.game.renderer; - /** - * [description] + * The Scene that owns the Camera Manager plugin. * - * @name Phaser.Display.Masks.BitmapMask#bitmapMask - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.bitmapMask = renderable; + this.scene = scene; /** - * [description] + * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#maskRenderTarget - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#systems + * @type {Phaser.Scenes.Systems} * @since 3.0.0 */ - this.maskRenderTarget = null; + this.systems = scene.sys; - /** - * [description] - * - * @name Phaser.Display.Masks.BitmapMask#mainRenderTarget - * @type {[type]} - * @default null - * @since 3.0.0 - */ - this.mainRenderTarget = null; + if (!scene.sys.settings.isBooted) + { + scene.sys.events.once('boot', this.boot, this); + } /** - * [description] + * The current Camera ID. * - * @name Phaser.Display.Masks.BitmapMask#maskTexture - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#currentCameraId + * @type {number} + * @default 1 + * @readOnly * @since 3.0.0 */ - this.maskTexture = null; + this.currentCameraId = 1; /** - * [description] + * An Array of the Camera objects being managed by this Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#mainTexture - * @type {[type]} - * @default null + * @name Phaser.Cameras.Scene2D.CameraManager#cameras + * @type {Phaser.Cameras.Scene2D.Camera[]} * @since 3.0.0 */ - this.mainTexture = null; + this.cameras = []; /** - * [description] + * A pool of Camera objects available to be used by the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#dirty - * @type {boolean} - * @default true + * @name Phaser.Cameras.Scene2D.CameraManager#cameraPool + * @type {Phaser.Cameras.Scene2D.Camera[]} * @since 3.0.0 */ - this.dirty = true; + this.cameraPool = []; + + if (scene.sys.settings.cameras) + { + // We have cameras to create + this.fromJSON(scene.sys.settings.cameras); + } + else + { + // Make one + this.add(); + } /** - * [description] + * The default Camera in the Camera Manager. * - * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#main + * @type {Phaser.Cameras.Scene2D.Camera} * @since 3.0.0 */ - this.mainFramebuffer = null; + this.main = this.cameras[0]; /** - * [description] + * This scale affects all cameras. It's used by Scale Manager. * - * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer - * @type {[type]} + * @name Phaser.Cameras.Scene2D.CameraManager#baseScale + * @type {number} * @since 3.0.0 */ - this.maskFramebuffer = null; - - if (renderer.gl) - { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; - - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); - - renderer.onContextRestored(function (renderer) - { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; + this.baseScale = 1.0; + }, - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); + /** + * Called when the Camera Manager boots. + * Starts the event listeners running. + * + * @method Phaser.Cameras.Scene2D.CameraManager#boot + * @since 3.0.0 + */ + boot: function () + { + var eventEmitter = this.systems.events; - }, this); - } + eventEmitter.on('update', this.update, this); + eventEmitter.on('shutdown', this.shutdown, this); + eventEmitter.on('destroy', this.destroy, this); }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#setBitmap + * @method Phaser.Cameras.Scene2D.CameraManager#add * @since 3.0.0 * - * @param {[type]} renderable - [description] + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] + * @param {number} [width] - [description] + * @param {number} [height] - [description] + * @param {boolean} [makeMain=false] - [description] + * @param {string} [name=''] - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - setBitmap: function (renderable) + add: function (x, y, width, height, makeMain, name) { - this.bitmapMask = renderable; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.scene.sys.game.config.width; } + if (height === undefined) { height = this.scene.sys.game.config.height; } + if (makeMain === undefined) { makeMain = false; } + if (name === undefined) { name = ''; } + + var camera = null; + + if (this.cameraPool.length > 0) + { + camera = this.cameraPool.pop(); + + camera.setViewport(x, y, width, height); + } + else + { + camera = new Camera(x, y, width, height); + } + + camera.setName(name); + camera.setScene(this.scene); + + this.cameras.push(camera); + + if (makeMain) + { + this.main = camera; + } + + camera._id = this.currentCameraId; + + this.currentCameraId = this.currentCameraId << 1; + + return camera; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#addExisting * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} maskedObject - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - preRenderWebGL: function (renderer, maskedObject, camera) + addExisting: function (camera) { - renderer.pipelines.BitmapMaskPipeline.beginMask(this, maskedObject, camera); + var index = this.cameras.indexOf(camera); + var poolIndex = this.cameraPool.indexOf(camera); + + if (index < 0 && poolIndex >= 0) + { + this.cameras.push(camera); + this.cameraPool.slice(poolIndex, 1); + return camera; + } + + return null; }, + /* + { + cameras: [ + { + name: string + x: int + y: int + width: int + height: int + zoom: float + rotation: float + roundPixels: bool + scrollX: float + scrollY: float + backgroundColor: string + bounds: { + x: int + y: int + width: int + height: int + } + } + ] + } + */ + /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON * @since 3.0.0 * - * @param {[type]} renderer - [description] + * @param {[type]} config - [description] + * + * @return {[type]} [description] */ - postRenderWebGL: function (renderer) + fromJSON: function (config) { - renderer.pipelines.BitmapMaskPipeline.endMask(this); + if (!Array.isArray(config)) + { + config = [ config ]; + } + + var gameWidth = this.scene.sys.game.config.width; + var gameHeight = this.scene.sys.game.config.height; + + for (var i = 0; i < config.length; i++) + { + var cameraConfig = config[i]; + + var x = GetFastValue(cameraConfig, 'x', 0); + var y = GetFastValue(cameraConfig, 'y', 0); + var width = GetFastValue(cameraConfig, 'width', gameWidth); + var height = GetFastValue(cameraConfig, 'height', gameHeight); + + var camera = this.add(x, y, width, height); + + // Direct properties + camera.name = GetFastValue(cameraConfig, 'name', ''); + camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); + camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); + camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); + camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); + camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); + + // Background Color + + var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); + + if (backgroundColor) + { + camera.setBackgroundColor(backgroundColor); + } + + // Bounds + + var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); + + if (boundsConfig) + { + var bx = GetFastValue(boundsConfig, 'x', 0); + var by = GetFastValue(boundsConfig, 'y', 0); + var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); + var bheight = GetFastValue(boundsConfig, 'height', gameHeight); + + camera.setBounds(bx, by, bwidth, bheight); + } + } + + return this; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#getCamera * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {string} name - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - preRenderCanvas: function () + getCamera: function (name) { - // NOOP + this.cameras.forEach(function (camera) + { + if (camera.name === name) + { + return camera; + } + }); + + return null; }, /** * [description] * - * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#getCameraBelowPointer * @since 3.0.0 * - * @param {[type]} renderer - [description] + * @param {[type]} pointer - [description] + * + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - postRenderCanvas: function () + getCameraBelowPointer: function (pointer) { - // NOOP - } - -}); - -module.exports = BitmapMask; - - -/***/ }), -/* 494 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * [description] - * - * @class GeometryMask - * @memberOf Phaser.Display.Masks - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {[type]} graphicsGeometry - [description] - */ -var GeometryMask = new Class({ + var cameras = this.cameras; - initialize: + // Start from the most recently added camera (the 'top' camera) + for (var i = cameras.length - 1; i >= 0; i--) + { + var camera = cameras[i]; - function GeometryMask (scene, graphicsGeometry) - { - /** - * [description] - * - * @name Phaser.Display.Masks.GeometryMask#geometryMask - * @type {Phaser.GameObjects.Graphics} - * @since 3.0.0 - */ - this.geometryMask = graphicsGeometry; + if (camera.inputEnabled && RectangleContains(camera, pointer.x, pointer.y)) + { + return camera; + } + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#setShape + * @method Phaser.Cameras.Scene2D.CameraManager#remove * @since 3.0.0 * - * @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setShape: function (graphicsGeometry) + remove: function (camera) { - this.geometryMask = graphicsGeometry; + var cameraIndex = this.cameras.indexOf(camera); + + if (cameraIndex >= 0 && this.cameras.length > 1) + { + this.cameraPool.push(this.cameras[cameraIndex]); + this.cameras.splice(cameraIndex, 1); + + if (this.main === camera) + { + this.main = this.cameras[0]; + } + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#render * @since 3.0.0 * * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {[type]} children - [description] + * @param {[type]} interpolation - [description] */ - preRenderWebGL: function (renderer, mask, camera) + render: function (renderer, children, interpolation) { - var gl = renderer.gl; - var geometryMask = this.geometryMask; - - // Force flushing before drawing to stencil buffer - renderer.flush(); + var cameras = this.cameras; + var baseScale = this.baseScale; - // Enable and setup GL state to write to stencil buffer - gl.enable(gl.STENCIL_TEST); - gl.clear(gl.STENCIL_BUFFER_BIT); - gl.colorMask(false, false, false, false); - gl.stencilFunc(gl.NOTEQUAL, 1, 1); - gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); + for (var i = 0, l = cameras.length; i < l; ++i) + { + var camera = cameras[i]; - // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); - renderer.flush(); + camera.preRender(baseScale, renderer.config.resolution); - // Use stencil buffer to affect next rendering object - gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, 1, 1); - gl.stencilOp(gl.INVERT, gl.INVERT, gl.INVERT); + renderer.render(this.scene, children, interpolation, camera); + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL + * @method Phaser.Cameras.Scene2D.CameraManager#resetAll * @since 3.0.0 * - * @param {[type]} renderer - [description] + * @return {Phaser.Cameras.Scene2D.Camera} [description] */ - postRenderWebGL: function (renderer) + resetAll: function () { - var gl = renderer.gl; + while (this.cameras.length > 0) + { + this.cameraPool.push(this.cameras.pop()); + } - // Force flush before disabling stencil test - renderer.flush(); - gl.disable(gl.STENCIL_TEST); + this.main = this.add(); + + return this.main; }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#update * @since 3.0.0 * - * @param {[type]} renderer - [description] - * @param {[type]} mask - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {number} timestep - [description] + * @param {number} delta - [description] */ - preRenderCanvas: function (renderer, mask, camera) + update: function (timestep, delta) { - var geometryMask = this.geometryMask; - - renderer.currentContext.save(); - - geometryMask.renderCanvas(renderer, geometryMask, 0.0, camera, null, true); + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].update(timestep, delta); + } + }, - renderer.currentContext.clip(); + /** + * Resizes all cameras to the given dimensions. + * + * @method Phaser.Cameras.Scene2D.CameraManager#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the camera. + * @param {number} height - The new height of the camera. + */ + resize: function (width, height) + { + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].setSize(width, height); + } }, /** * [description] * - * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas + * @method Phaser.Cameras.Scene2D.CameraManager#shutdown * @since 3.0.0 + */ + shutdown: function () + { + // TODO + }, + + /** + * [description] * - * @param {[type]} renderer - [description] + * @method Phaser.Cameras.Scene2D.CameraManager#destroy + * @since 3.0.0 */ - postRenderCanvas: function (renderer) + destroy: function () { - renderer.currentContext.restore(); + this.main = undefined; + + for (var i = 0; i < this.cameras.length; i++) + { + this.cameras[i].destroy(); + } + + for (i = 0; i < this.cameraPool.length; i++) + { + this.cameraPool[i].destroy(); + } + + this.cameras = []; + this.cameraPool = []; + this.scene = undefined; } }); -module.exports = GeometryMask; +PluginManager.register('CameraManager', CameraManager, 'cameras'); + +module.exports = CameraManager; /***/ }), -/* 495 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85217,212 +87390,52 @@ module.exports = GeometryMask; */ /** - * @namespace Phaser.DOM + * @namespace Phaser.Cameras.Sprite3D */ module.exports = { - AddToDOM: __webpack_require__(123), - DOMContentLoaded: __webpack_require__(229), - ParseXML: __webpack_require__(230), - RemoveFromDOM: __webpack_require__(231), - RequestAnimationFrame: __webpack_require__(232) + Camera: __webpack_require__(118), + CameraManager: __webpack_require__(461), + OrthographicCamera: __webpack_require__(212), + PerspectiveCamera: __webpack_require__(213) }; /***/ }), -/* 496 */ -/***/ (function(module, exports) { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; +/* 458 */ +/***/ (function(module, exports, __webpack_require__) { -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +var renderWebGL = __webpack_require__(3); +var renderCanvas = __webpack_require__(3); - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); +if (true) +{ + renderWebGL = __webpack_require__(459); } -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; +if (true) +{ + renderCanvas = __webpack_require__(460); } -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; -process.listeners = function (name) { return [] } +module.exports = { -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); }; -process.umask = function() { return 0; }; /***/ }), -/* 497 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85431,180 +87444,37 @@ process.umask = function() { return 0; }; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var EE = __webpack_require__(14); -var PluginManager = __webpack_require__(12); - -/** - * @namespace Phaser.Events - */ +var GameObject = __webpack_require__(1); /** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class EventEmitter - * @extends EventEmitter - * @memberOf Phaser.Events - * @constructor + * @method Phaser.GameObjects.Sprite#renderWebGL * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var EventEmitter = new Class({ - - Extends: EE, - - initialize: - - function EventEmitter () - { - EE.call(this); - }, - - /** - * Removes all listeners. - * - * @method Phaser.Events.EventEmitter#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.removeAllListeners(); - }, - - /** - * Removes all listeners. - * - * @method Phaser.Events.EventEmitter#destroy - * @since 3.0.0 - */ - destroy: function () +var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) { - this.removeAllListeners(); + return; } -}); - -/** - * @namespace EventEmitter - */ - -/** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method EventEmitter#eventNames - * - * @return {array} - */ - -/** - * Return the listeners registered for a given event. - * - * @method EventEmitter#listeners - * - * @param {string|symbol} event - The event name. - * - * @return {array} The registered listeners. - */ - -/** - * Return the number of listeners listening to a given event. - * - * @method EventEmitter#listenerCount - * - * @param {string|symbol} event - The event name. - * - * @return {number} The number of listeners. - */ - -/** - * Calls each of the listeners registered for a given event. - * - * @method EventEmitter#emit - * - * @param {string|symbol} event - The event name. - * - * @return {Boolean} `true` if the event had listeners, else `false`. - */ - -/** - * Add a listener for a given event. - * - * @method EventEmitter#on - * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {EventEmitter} `this`. - */ - -/** - * Add a listener for a given event. - * - * @method EventEmitter#addListener - * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {EventEmitter} `this`. - */ - -/** - * Add a one-time listener for a given event. - * - * @method EventEmitter#once - * - * @param {string|symbol} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method EventEmitter#removeListener - * - * @param {string|symbol} event - The event name. - * @param {function} fn - Only remove the listeners that match this function. - * @param {*} context - Only remove the listeners that have this context. - * @param {boolean} once - Only remove one-time listeners. - * - * @return {EventEmitter} `this`. - */ - -/** - * Remove the listeners of a given event. - * - * @method EventEmitter#off - * - * @param {string|symbol} event - The event name. - * @param {function} fn - Only remove the listeners that match this function. - * @param {*} context - Only remove the listeners that have this context. - * @param {boolean} once - Only remove one-time listeners. - * - * @return {EventEmitter} `this`. - */ - -/** - * Remove all listeners, or those of the specified event. - * - * @method EventEmitter#removeAllListeners - * - * @param {string|symbol} [event] - The event name. - * - * @return {EventEmitter} `this`. - */ - -PluginManager.register('EventEmitter', EventEmitter, 'events'); + this.pipeline.batchSprite(src, camera); +}; -module.exports = EventEmitter; +module.exports = SpriteWebGLRenderer; /***/ }), -/* 498 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85613,479 +87483,292 @@ module.exports = EventEmitter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AddToDOM = __webpack_require__(123); -var AnimationManager = __webpack_require__(196); -var CacheManager = __webpack_require__(199); -var CanvasPool = __webpack_require__(21); -var Class = __webpack_require__(0); -var Config = __webpack_require__(499); -var CreateRenderer = __webpack_require__(500); -var DataManager = __webpack_require__(79); -var DebugHeader = __webpack_require__(517); -var Device = __webpack_require__(518); -var DOMContentLoaded = __webpack_require__(229); -var EventEmitter = __webpack_require__(14); -var InputManager = __webpack_require__(239); -var NOOP = __webpack_require__(3); -var PluginManager = __webpack_require__(12); -var SceneManager = __webpack_require__(251); -var SoundManagerCreator = __webpack_require__(255); -var TextureManager = __webpack_require__(262); -var TimeStep = __webpack_require__(541); -var VisibilityHandler = __webpack_require__(542); +var GameObject = __webpack_require__(1); /** - * @classdesc - * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible - * for handling the boot process, parsing the configuration values, creating the renderer, - * and setting-up all of the global Phaser systems, such as sound and input. - * Once that is complete it will start the Scene Manager and then begin the main game loop. - * - * You should generally avoid accessing any of the systems created by Game, and instead use those - * made available to you via the Phaser.Scene Systems class instead. - * - * @class Game - * @memberOf Phaser - * @constructor - * @since 3.0.0 - * - * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. - */ -var Game = new Class({ - - initialize: - - function Game (config) - { - /** - * The parsed Game Configuration object. - * - * The values stored within this object are read-only and should not be changed at run-time. - * - * @name Phaser.Game#config - * @type {Phaser.Boot.Config} - * @readOnly - * @since 3.0.0 - */ - this.config = new Config(config); - - /** - * A reference to either the Canvas or WebGL Renderer that this Game is using. - * - * @name Phaser.Game#renderer - * @type {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = null; - - /** - * A reference to the HTML Canvas Element on which the renderer is drawing. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; - - /** - * A reference to the Canvas Rendering Context belonging to the Canvas Element this game is rendering to. - * - * @name Phaser.Game#context - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.context = null; - - /** - * A flag indicating when this Game instance has finished its boot process. - * - * @name Phaser.Game#isBooted - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - this.isBooted = false; - - /** - * A flag indicating if this Game is currently running its game step or not. - * - * @name Phaser.Game#isRunning - * @type {boolean} - * @readOnly - * @since 3.0.0 - */ - this.isRunning = false; - - /** - * An Event Emitter which is used to broadcast game-level events from the global systems. - * - * @name Phaser.Game#events - * @type {EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Sprite#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + { + return; + } - /** - * An instance of the Animation Manager. - * - * The Animation Manager is a global system responsible for managing all animations used within your game. - * - * @name Phaser.Game#anims - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.anims = new AnimationManager(this); + renderer.drawImage(src, camera); +}; - /** - * An instance of the Texture Manager. - * - * The Texture Manager is a global system responsible for managing all textures being used by your game. - * - * @name Phaser.Game#textures - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 - */ - this.textures = new TextureManager(this); +module.exports = SpriteCanvasRenderer; - /** - * An instance of the Cache Manager. - * - * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. - * - * @name Phaser.Game#cache - * @type {Phaser.Cache.CacheManager} - * @since 3.0.0 - */ - this.cache = new CacheManager(this); - /** - * [description] - * - * @name Phaser.Game#registry - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.registry = new DataManager(this); +/***/ }), +/* 461 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * An instance of the Input Manager. - * - * The Input Manager is a global system responsible for the capture of browser-level input events. - * - * @name Phaser.Game#input - * @type {Phaser.Input.InputManager} - * @since 3.0.0 - */ - this.input = new InputManager(this, this.config); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * An instance of the Scene Manager. - * - * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. - * - * @name Phaser.Game#scene - * @type {Phaser.Scenes.SceneManager} - * @since 3.0.0 - */ - this.scene = new SceneManager(this, this.config.sceneConfig); +var Class = __webpack_require__(0); +var OrthographicCamera = __webpack_require__(212); +var PerspectiveCamera = __webpack_require__(213); +var PluginManager = __webpack_require__(12); - /** - * A reference to the Device inspector. - * - * Contains information about the device running this game, such as OS, browser vendor and feature support. - * Used by various systems to determine capabilities and code paths. - * - * @name Phaser.Game#device - * @type {Phaser.Device} - * @since 3.0.0 - */ - this.device = Device; +/** + * @classdesc + * [description] + * + * @class CameraManager + * @memberOf Phaser.Cameras.Sprite3D + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + */ +var CameraManager = new Class({ - /** - * An instance of the base Sound Manager. - * - * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. - * - * @name Phaser.Game#sound - * @type {Phaser.BaseSoundManager} - * @since 3.0.0 - */ - this.sound = SoundManagerCreator.create(this); + initialize: + function CameraManager (scene) + { /** - * An instance of the Time Step. - * - * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing - * them and calculating delta values. It then automatically calls the game step. + * [description] * - * @name Phaser.Game#loop - * @type {Phaser.Boot.TimeStep} + * @name Phaser.Cameras.Sprite3D.CameraManager#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.loop = new TimeStep(this, this.config.fps); + this.scene = scene; /** - * An instance of the Plugin Manager. - * - * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install - * those plugins into Scenes as required. + * [description] * - * @name Phaser.Game#plugins - * @type {Phaser.Boot.PluginManager} + * @name Phaser.Cameras.Sprite3D.CameraManager#systems + * @type {Phaser.Scenes.Systems} * @since 3.0.0 */ - this.plugins = new PluginManager(this, this.config); + this.systems = scene.sys; /** - * The `onStepCallback` is a callback that is fired each time the Time Step ticks. - * It is set automatically when the Game boot process has completed. + * An Array of the Camera objects being managed by this Camera Manager. * - * @name Phaser.Game#onStepCallback - * @type {function} - * @private + * @name Phaser.Cameras.Sprite3D.CameraManager#cameras + * @type {array} * @since 3.0.0 */ - this.onStepCallback = NOOP; + this.cameras = []; - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(this)); + if (!scene.sys.settings.isBooted) + { + scene.sys.events.once('boot', this.boot, this); + } }, /** - * Game boot event. - * - * This is an internal event dispatched when the game has finished booting, but before it is ready to start running. - * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. - * - * @event Phaser.Game#boot - */ - - /** - * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, - * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. - * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. + * [description] * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Game#boot + * @method Phaser.Cameras.Sprite3D.CameraManager#boot * @since 3.0.0 */ boot: function () { - this.isBooted = true; - - this.config.preBoot(); - - CreateRenderer(this); - - DebugHeader(this); - - AddToDOM(this.canvas, this.config.parent); - - this.events.emit('boot'); + var eventEmitter = this.systems.events; - // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready, so it will emit this event - this.events.once('ready', this.start, this); + eventEmitter.on('update', this.update, this); + eventEmitter.on('shutdown', this.shutdown, this); + eventEmitter.on('destroy', this.destroy, this); }, /** - * Called automatically by Game.boot once all of the global systems have finished setting themselves up. - * By this point the Game is now ready to start the main loop running. - * It will also enable the Visibility Handler. + * [description] * - * @method Phaser.Game#start - * @protected + * @method Phaser.Cameras.Sprite3D.CameraManager#add * @since 3.0.0 + * + * @param {[type]} fieldOfView - [description] + * @param {[type]} width - [description] + * @param {[type]} height - [description] + * + * @return {[type]} [description] */ - start: function () + add: function (fieldOfView, width, height) { - this.isRunning = true; - - this.config.postBoot(); - - this.loop.start(this.step.bind(this)); - - VisibilityHandler(this.events); - - this.events.on('hidden', this.onHidden, this); - this.events.on('visible', this.onVisible, this); - this.events.on('blur', this.onBlur, this); - this.events.on('focus', this.onFocus, this); + return this.addPerspectiveCamera(fieldOfView, width, height); }, /** - * Game Pre-Render event. - * - * This event is dispatched immediately before any of the Scenes have started to render. - * The renderer will already have been initialized this frame, clearing itself and preparing to receive - * the Scenes for rendering, but it won't have actually drawn anything yet. + * [description] * - * @event Phaser.Game#prerenderEvent - * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. - */ - - /** - * Game Post-Render event. + * @method Phaser.Cameras.Sprite3D.CameraManager#addOrthographicCamera + * @since 3.0.0 * - * This event is dispatched right at the end of the render process. - * Every Scene will have rendered and drawn to the canvas. + * @param {number} width - [description] + * @param {number} height - [description] * - * @event Phaser.Game#postrenderEvent - * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. + * @return {[type]} [description] */ + addOrthographicCamera: function (width, height) + { + var config = this.scene.sys.game.config; + + if (width === undefined) { width = config.width; } + if (height === undefined) { height = config.height; } + + var camera = new OrthographicCamera(this.scene, width, height); + + this.cameras.push(camera); + + return camera; + }, /** - * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of - * Request Animation Frame, or Set Timeout on very old browsers.) - * - * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. - * - * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * [description] * - * @method Phaser.Game#step - * @fires Phaser.Game#prerenderEvent - * @fires Phaser.Game#postrenderEvent + * @method Phaser.Cameras.Sprite3D.CameraManager#addPerspectiveCamera * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. + * @param {number} [fieldOfView=80] - [description] + * @param {number} [width] - [description] + * @param {number} [height] - [description] + * + * @return {[type]} [description] */ - step: function (time, delta) + addPerspectiveCamera: function (fieldOfView, width, height) { - // Global Managers - - this.input.update(time, delta); - - this.sound.update(time, delta); - - // Scenes - - this.onStepCallback(); - - this.scene.update(time, delta); - - // Render - - var renderer = this.renderer; - - renderer.preRender(); + var config = this.scene.sys.game.config; - this.events.emit('prerender', renderer); + if (fieldOfView === undefined) { fieldOfView = 80; } + if (width === undefined) { width = config.width; } + if (height === undefined) { height = config.height; } - this.scene.render(renderer); + var camera = new PerspectiveCamera(this.scene, fieldOfView, width, height); - renderer.postRender(); + this.cameras.push(camera); - this.events.emit('postrender', renderer); + return camera; }, /** - * Game Pause event. + * [description] * - * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. + * @method Phaser.Cameras.Sprite3D.CameraManager#getCamera + * @since 3.0.0 * - * @event Phaser.Game#pauseEvent - */ - - /** - * Called automatically by the Visibility Handler. - * This will pause the main loop and then emit a pause event. + * @param {string} name - [description] * - * @method Phaser.Game#onHidden - * @protected - * @fires Phaser.Game#pauseEvent - * @since 3.0.0 + * @return {[type]} [description] */ - onHidden: function () + getCamera: function (name) { - this.loop.pause(); + this.cameras.forEach(function (camera) + { + if (camera.name === name) + { + return camera; + } + }); - this.events.emit('pause'); + return null; }, /** - * Game Resume event. + * [description] * - * This event is dispatched when the game loop leaves a paused state and resumes running. + * @method Phaser.Cameras.Sprite3D.CameraManager#removeCamera + * @since 3.0.0 * - * @event Phaser.Game#resumeEvent + * @param {[type]} camera - [description] */ + removeCamera: function (camera) + { + var cameraIndex = this.cameras.indexOf(camera); + + if (cameraIndex !== -1) + { + this.cameras.splice(cameraIndex, 1); + } + }, /** - * Called automatically by the Visibility Handler. - * This will resume the main loop and then emit a resume event. + * [description] * - * @method Phaser.Game#onVisible - * @protected - * @fires Phaser.Game#resumeEvent + * @method Phaser.Cameras.Sprite3D.CameraManager#removeAll * @since 3.0.0 + * + * @return {[type]} [description] */ - onVisible: function () + removeAll: function () { - this.loop.resume(); + while (this.cameras.length > 0) + { + var camera = this.cameras.pop(); - this.events.emit('resume'); + camera.destroy(); + } + + return this.main; }, /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'blurred' state, which pauses it. + * [description] * - * @method Phaser.Game#onBlur - * @protected + * @method Phaser.Cameras.Sprite3D.CameraManager#update * @since 3.0.0 + * + * @param {number} timestep - [description] + * @param {number} delta - [description] */ - onBlur: function () + update: function (timestep, delta) { - this.loop.blur(); + for (var i = 0, l = this.cameras.length; i < l; ++i) + { + this.cameras[i].update(timestep, delta); + } }, /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'focused' state, which resumes it. + * [description] * - * @method Phaser.Game#onFocus - * @protected + * @method Phaser.Cameras.Sprite3D.CameraManager#shutdown * @since 3.0.0 */ - onFocus: function () + shutdown: function () { - this.loop.focus(); }, /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * [description] * - * @method Phaser.Game#destroy + * @method Phaser.Cameras.Sprite3D.CameraManager#destroy * @since 3.0.0 */ - destroy: function (removeCanvas) + destroy: function () { - this.loop.destroy(); - - this.scene.destroy(); - - this.renderer.destroy(); - - this.events.emit('destroy'); - - this.events.removeAllListeners(); - - this.onStepCallback = null; - - if (removeCanvas) - { - CanvasPool.remove(this.canvas); - } + this.scene = undefined; } }); -module.exports = Game; +PluginManager.register('CameraManager3D', CameraManager, 'cameras3d'); + +module.exports = CameraManager; /***/ }), -/* 499 */ +/* 462 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86094,230 +87777,154 @@ module.exports = Game; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var GetValue = __webpack_require__(4); -var MATH = __webpack_require__(16); -var NOOP = __webpack_require__(3); -var Plugins = __webpack_require__(233); -var ValueToColor = __webpack_require__(115); - /** - * This callback type is completely empty, a no-operation. - * - * @callback NOOP + * @namespace Phaser.Create */ -/** - * @typedef {object} FPSConfig - * - * @property {integer} [min=10] - [description] - * @property {integer} [target=60] - [description] - * @property {boolean} [forceSetTimeOut=false] - [description] - * @property {integer} [deltaHistory=10] - [description] - * @property {integer} [panicMax=120] - [description] - */ +module.exports = { + + GenerateTexture: __webpack_require__(214), + Palettes: __webpack_require__(463) -/** - * @typedef {object} LoaderConfig - * - * @property {string} [baseURL] - [description] - * @property {string} [path] - [description] - * @property {boolean} [enableParallel=true] - [description] - * @property {integer} [maxParallelDownloads=4] - [description] - * @property {string|undefined} [crossOrigin=undefined] - [description] - * @property {string} [responseType] - [description] - * @property {boolean} [async=true] - [description] - * @property {string} [user] - [description] - * @property {string} [password] - [description] - * @property {integer} [timeout=0] - [description] - */ +}; + + +/***/ }), +/* 463 */ +/***/ (function(module, exports, __webpack_require__) { /** - * @typedef {object} GameConfig - * - * @property {integer|string} [width=1024] - [description] - * @property {integer|string} [height=768] - [description] - * @property {number} [zoom=1] - [description] - * @property {number} [resolution=1] - [description] - * @property {number} [type=CONST.AUTO] - [description] - * @property {object} [?parent=null] - [description] - * @property {HTMLCanvasElement} [?canvas=null] - [description] - * @property {string} [?canvasStyle=null] - [description] - * @property {object} [?scene=null] - [description] - * @property {array} [seed] - [description] - * @property {string} [title=''] - [description] - * @property {string} [url='http://phaser.io'] - [description] - * @property {string} [version=''] - [description] - * @property {object} [input] - [description] - * @property {boolean} [input.keyboard=true] - [description] - * @property {object} [input.keyboard.target=window] - [description] - * @property {boolean} [input.mouse=true] - [description] - * @property {object} [?input.mouse.target=null] - [description] - * @property {boolean} [input.touch=true] - [description] - * @property {object} [?input.touch.target=null] - [description] - * @property {object} [?input.touch.capture=true] - [description] - * @property {boolean} [input.gamepad=false] - [description] - * @property {boolean} [disableContextMenu=false] - [description] - * @property {boolean} [banner=false] - [description] - * @property {boolean} [banner.hidePhaser=false] - [description] - * @property {string} [banner.text='#ffffff'] - [description] - * @property {array} [banner.background] - [description] - * @property {FPSConfig} [?fps] - [description] - * @property {boolean} [pixelArt=false] - [description] - * @property {boolean} [transparent=false] - [description] - * @property {boolean} [clearBeforeRender=true] - [description] - * @property {string|number} [backgroundColor=0x000000] - [description] - * @property {object} [?callbacks] - [description] - * @property {function} [callbacks.preBoot=NOOP] - [description] - * @property {function} [callbacks.postBoot=NOOP] - [description] - * @property {LoaderConfig} [?loader] - [description] - * @property {object} [?images] - [description] - * @property {string} [images.default] - [description] - * @property {string} [images.missing] - [description] + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** - * @classdesc - * [description] - * - * @class Config - * @memberOf Phaser.Boot - * @constructor - * @since 3.0.0 - * - * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. - * + * @namespace Phaser.Create.Palettes */ -var Config = new Class({ - - initialize: - - function Config (config) - { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; - - var defaultBannerTextColor = '#ffffff'; - - this.width = GetValue(config, 'width', 1024); - this.height = GetValue(config, 'height', 768); - this.zoom = GetValue(config, 'zoom', 1); - - this.resolution = GetValue(config, 'resolution', 1); - - this.renderType = GetValue(config, 'type', CONST.AUTO); - - this.parent = GetValue(config, 'parent', null); - this.canvas = GetValue(config, 'canvas', null); - this.canvasStyle = GetValue(config, 'canvasStyle', null); - - this.sceneConfig = GetValue(config, 'scene', null); - - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - - MATH.RND.init(this.seed); - - this.gameTitle = GetValue(config, 'title', ''); - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - this.gameVersion = GetValue(config, 'version', ''); - - // Input - this.inputKeyboard = GetValue(config, 'input.keyboard', true); - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - - this.inputMouse = GetValue(config, 'input.mouse', true); - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); - - this.inputTouch = GetValue(config, 'input.touch', true); - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - - this.inputGamepad = GetValue(config, 'input.gamepad', false); - - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - - this.audio = GetValue(config, 'audio'); - - // If you do: { banner: false } it won't display any banner at all - this.hideBanner = (GetValue(config, 'banner', null) === false); - - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); - - if (this.gameTitle === '' && this.hidePhaser) - { - this.hideBanner = true; - } - - // Frame Rate config - // fps: { - // min: 10, - // target: 60, - // forceSetTimeOut: false, - // deltaHistory: 10 - // } - this.fps = GetValue(config, 'fps', null); +module.exports = { - this.pixelArt = GetValue(config, 'pixelArt', false); - this.transparent = GetValue(config, 'transparent', false); - this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true); - this.backgroundColor = ValueToColor(GetValue(config, 'backgroundColor', 0)); + ARNE16: __webpack_require__(215), + C64: __webpack_require__(464), + CGA: __webpack_require__(465), + JMP: __webpack_require__(466), + MSX: __webpack_require__(467) + +}; - // Callbacks - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); - // Physics - // physics: { - // system: 'impact', - // setBounds: true, - // gravity: 0, - // cellSize: 64 - // } - this.physics = GetValue(config, 'physics', {}); - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); +/***/ }), +/* 464 */ +/***/ (function(module, exports) { - // Loader Defaults - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); - this.loaderPath = GetValue(config, 'loader.path', ''); - this.loaderEnableParallel = GetValue(config, 'loader.enableParallel', true); - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 4); - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - this.loaderAsync = GetValue(config, 'loader.async', true); - this.loaderUser = GetValue(config, 'loader.user', ''); - this.loaderPassword = GetValue(config, 'loader.password', ''); - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Scene Plugins - this.defaultPlugins = GetValue(config, 'plugins', Plugins.DefaultScene); +/** + * A 16 color palette inspired by the Commodore 64. + * + * @name Phaser.Create.Palettes.C64 + * @since 3.0.0 + * + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. + */ +module.exports = { + 0: '#000', + 1: '#fff', + 2: '#8b4131', + 3: '#7bbdc5', + 4: '#8b41ac', + 5: '#6aac41', + 6: '#3931a4', + 7: '#d5de73', + 8: '#945a20', + 9: '#5a4100', + A: '#bd736a', + B: '#525252', + C: '#838383', + D: '#acee8b', + E: '#7b73de', + F: '#acacac' +}; - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); - } +/***/ }), +/* 465 */ +/***/ (function(module, exports) { -}); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -module.exports = Config; +/** + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 + * + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. + */ +module.exports = { + 0: '#000', + 1: '#2234d1', + 2: '#0c7e45', + 3: '#44aacc', + 4: '#8a3622', + 5: '#5c2e78', + 6: '#aa5c3d', + 7: '#b5b5b5', + 8: '#5e606e', + 9: '#4c81fb', + A: '#6cd947', + B: '#7be2f9', + C: '#eb8a60', + D: '#e23d69', + E: '#ffd93f', + F: '#fff' +}; /***/ }), -/* 500 */ -/***/ (function(module, exports, __webpack_require__) { +/* 466 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -86325,127 +87932,132 @@ module.exports = Config; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasInterpolation = __webpack_require__(221); -var CanvasPool = __webpack_require__(21); -var CONST = __webpack_require__(22); -var Features = __webpack_require__(124); - /** - * Called automatically by Phaser.Game and responsible for creating the renderer it will use. - * - * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. - * - * @function Phaser.Boot.CreateRenderer + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) + * + * @name Phaser.Create.Palettes.JMP + * @type {object} * @since 3.0.0 - * - * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. + * + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. */ -var CreateRenderer = function (game) -{ - var config = game.config; - - // Game either requested Canvas, - // or requested AUTO or WEBGL but the browser doesn't support it, so fall back to Canvas - if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL)) - { - if (Features.canvas) - { - // They requested Canvas and their browser supports it - config.renderType = CONST.CANVAS; - } - else - { - throw new Error('Cannot create Canvas or WebGL context, aborting.'); - } - } - else - { - // Game requested WebGL and browser says it supports it - config.renderType = CONST.WEBGL; - } - - // Pixel Art mode? - if (config.pixelArt) - { - CanvasPool.disableSmoothing(); - } - - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; - } - else - { - game.canvas = CanvasPool.create(game, config.width, config.height, config.renderType); - } +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#f5f4eb' +}; - // Does the game config provide some canvas css styles to use? - if (config.canvasStyle) - { - game.canvas.style = config.canvasStyle; - } - // Pixel Art mode? - if (config.pixelArt) - { - CanvasInterpolation.setCrisp(game.canvas); - } +/***/ }), +/* 467 */ +/***/ (function(module, exports) { - // Zoomed? - if (config.zoom !== 1) - { - game.canvas.style.width = (config.width * config.zoom).toString() + 'px'; - game.canvas.style.height = (config.height * config.zoom).toString() + 'px'; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var CanvasRenderer; - var WebGLRenderer; +/** + * A 16 color palette inspired by Japanese computers like the MSX. + * + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 + * + * @type {object} + * @property {string} 0 - Color value 1. + * @property {string} 1 - Color value 2. + * @property {string} 2 - Color value 3. + * @property {string} 3 - Color value 4. + * @property {string} 4 - Color value 5. + * @property {string} 5 - Color value 6. + * @property {string} 6 - Color value 7. + * @property {string} 7 - Color value 8. + * @property {string} 8 - Color value 9. + * @property {string} 9 - Color value 10. + * @property {string} A - Color value 11. + * @property {string} B - Color value 12. + * @property {string} C - Color value 13. + * @property {string} D - Color value 14. + * @property {string} E - Color value 15. + * @property {string} F - Color value 16. + */ +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#fff' +}; - if (true) - { - CanvasRenderer = __webpack_require__(501); - WebGLRenderer = __webpack_require__(506); - // Let the config pick the renderer type, both are included - if (config.renderType === CONST.WEBGL) - { - game.renderer = new WebGLRenderer(game); - game.context = null; - } - else - { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } - } +/***/ }), +/* 468 */ +/***/ (function(module, exports, __webpack_require__) { - if (false) - { - WebGLRenderer = require('../renderer/webgl/WebGLRenderer'); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // Force the type to WebGL, regardless what was requested - config.renderType = CONST.WEBGL; - game.renderer = new WebGLRenderer(game); - game.context = null; - } +/** + * @namespace Phaser.Curves + */ - if (false) - { - CanvasRenderer = require('../renderer/canvas/CanvasRenderer'); +module.exports = { + Path: __webpack_require__(469), - // Force the type to Canvas, regardless what was requested - config.renderType = CONST.CANVAS; - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } + CubicBezier: __webpack_require__(216), + Curve: __webpack_require__(52), + Ellipse: __webpack_require__(218), + Line: __webpack_require__(220), + QuadraticBezier: __webpack_require__(221), + Spline: __webpack_require__(223) }; -module.exports = CreateRenderer; - /***/ }), -/* 501 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86454,528 +88066,1096 @@ module.exports = CreateRenderer; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BlitImage = __webpack_require__(502); -var CanvasSnapshot = __webpack_require__(503); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var DrawImage = __webpack_require__(504); -var GetBlendModes = __webpack_require__(505); -var ScaleModes = __webpack_require__(62); -var Smoothing = __webpack_require__(120); +var CubicBezierCurve = __webpack_require__(216); +var EllipseCurve = __webpack_require__(218); +var GameObjectFactory = __webpack_require__(9); +var LineCurve = __webpack_require__(220); +var MovePathTo = __webpack_require__(470); +var QuadraticBezierCurve = __webpack_require__(221); +var Rectangle = __webpack_require__(8); +var SplineCurve = __webpack_require__(223); +var Vector2 = __webpack_require__(6); /** * @classdesc * [description] * - * @class CanvasRenderer - * @memberOf Phaser.Renderer.Canvas + * @class Path + * @memberOf Phaser.Curves * @constructor * @since 3.0.0 * - * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. + * @param {number} [x=0] - [description] + * @param {number} [y=0] - [description] */ -var CanvasRenderer = new Class({ - - initialize: - - function CanvasRenderer (game) - { - /** - * The Phaser Game instance that owns this renderer. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#type - * @type {integer} - * @since 3.0.0 - */ - this.type = CONST.CANVAS; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.drawCount = 0; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = game.config.width; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = game.config.height; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: game.config.clearBeforeRender, - pixelArt: game.config.pixelArt, - backgroundColor: game.config.backgroundColor, - resolution: game.config.resolution, - autoResize: game.config.autoResize - }; - - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#scaleMode - * @type {integer} - * @since 3.0.0 - */ - this.scaleMode = (game.config.pixelArt) ? ScaleModes.NEAREST : ScaleModes.LINEAR; +var Path = new Class({ - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.gameCanvas = game.canvas; + initialize: - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.gameContext = this.gameCanvas.getContext('2d'); + function Path (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.currentContext = this.gameContext; - - /** - * Map to the required function. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#drawImage - * @type {function} + * @name Phaser.Curves.Path#name + * @type {string} + * @default '' * @since 3.0.0 */ - this.drawImage = DrawImage; + this.name = ''; /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage - * @type {function} + * @name Phaser.Curves.Path#curves + * @type {array} + * @default [] * @since 3.0.0 */ - this.blitImage = BlitImage; + this.curves = []; /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes + * @name Phaser.Curves.Path#cacheLengths * @type {array} + * @default [] * @since 3.0.0 */ - this.blendModes = GetBlendModes(); + this.cacheLengths = []; /** - * [description] + * Automatically closes the path. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentAlpha - * @type {number} - * @default 1 + * @name Phaser.Curves.Path#autoClose + * @type {boolean} + * @default false * @since 3.0.0 */ - this.currentAlpha = 1; + this.autoClose = false; /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentBlendMode - * @type {number} - * @default 0 + * @name {Phaser.MathPhaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.currentBlendMode = 0; + this.startPoint = new Vector2(); /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentScaleMode - * @type {number} - * @default 0 + * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.currentScaleMode = 0; + this._tmpVec2A = new Vector2(); /** * [description] * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback - * @type {?function} - * @default null + * @name {Phaser.MathPhaser.Curves.Path#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.snapshotCallback = null; + this._tmpVec2B = new Vector2(); - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotType - * @type {?[type]} - * @default null - * @since 3.0.0 - */ - this.snapshotType = null; + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } + }, - /** - * [description] - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotEncoder - * @type {?[type]} - * @default null - * @since 3.0.0 - */ - this.snapshotEncoder = null; + /** + * [description] + * + * @method Phaser.Curves.Path#add + * @since 3.0.0 + * + * @param {Phaser.Curves.Curve} curve - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + add: function (curve) + { + this.curves.push(curve); - this.init(); + return this; }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#init + * @method Phaser.Curves.Path#circleTo * @since 3.0.0 + * + * @param {number} radius - [description] + * @param {boolean} [clockwise=false] - [description] + * @param {number} [rotation=0] - [description] + * + * @return {Phaser.Curves.Path} [description] */ - init: function () + circleTo: function (radius, clockwise, rotation) { - this.resize(this.width, this.height); + if (clockwise === undefined) { clockwise = false; } + + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); }, /** - * Resize the main game canvas. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resize + * @method Phaser.Curves.Path#closePath * @since 3.0.0 * - * @param {integer} width - [description] - * @param {integer} height - [description] + * @return {Phaser.Curves.Path} [description] */ - resize: function (width, height) + closePath: function () { - var resolution = this.config.resolution; - - this.width = width * resolution; - this.height = height * resolution; - - this.gameCanvas.width = this.width; - this.gameCanvas.height = this.height; + // Add a line curve if start and end of lines are not connected + var startPoint = this.curves[0].getPoint(0); + var endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (this.config.autoResize) + if (!startPoint.equals(endPoint)) { - this.gameCanvas.style.width = (this.width / resolution) + 'px'; - this.gameCanvas.style.height = (this.height / resolution) + 'px'; + // This will copy a reference to the vectors, which probably isn't sensible + this.curves.push(new LineCurve(endPoint, startPoint)); } - // Resizing a canvas will reset imageSmoothingEnabled (and probably other properties) - if (this.scaleMode === ScaleModes.NEAREST) + return this; + }, + + // Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points + + /** + * [description] + * + * @method Phaser.Curves.Path#cubicBezierTo + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * @param {Phaser.Math.Vector2} control1X - [description] + * @param {Phaser.Math.Vector2} control1Y - [description] + * @param {Phaser.Math.Vector2} control2X - [description] + * @param {Phaser.Math.Vector2} control2Y - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) + { + var p0 = this.getEndPoint(); + var p1; + var p2; + var p3; + + // Assume they're all vec2s + if (x instanceof Vector2) { - Smoothing.disable(this.gameContext); + p1 = x; + p2 = y; + p3 = control1X; + } + else + { + p1 = new Vector2(control1X, control1Y); + p2 = new Vector2(control2X, control2Y); + p3 = new Vector2(x, y); } + + return this.add(new CubicBezierCurve(p0, p1, p2, p3)); }, + // Creates a quadratic bezier curve starting at the previous end point and ending at p2, using p1 as a control point + /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextLost - * @since 3.0.0 + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 * - * @param {function} callback - [description] + * @param {number|Phaser.Math.Vector2[]} x - [description] + * @param {number} [y] - [description] + * @param {number} [controlX] - [description] + * @param {number} [controlY] - [description] + * + * @return {Phaser.Curves.Path} [description] */ - onContextLost: function () + quadraticBezierTo: function (x, y, controlX, controlY) { + var p0 = this.getEndPoint(); + var p1; + var p2; + + // Assume they're all vec2s + if (x instanceof Vector2) + { + p1 = x; + p2 = y; + } + else + { + p1 = new Vector2(controlX, controlY); + p2 = new Vector2(x, y); + } + + return this.add(new QuadraticBezierCurve(p0, p1, p2)); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#onContextRestored + * @method Phaser.Curves.Path#draw * @since 3.0.0 * - * @param {function} callback - [description] + * @param {Phaser.GameObjects.Graphics} graphics - [description] + * @param {integer} [pointsTotal=32] - [description] + * + * @return {Phaser.GameObjects.Graphics} [description] */ - onContextRestored: function () + draw: function (graphics, pointsTotal) { + for (var i = 0; i < this.curves.length; i++) + { + var curve = this.curves[i]; + + if (!curve.active) + { + continue; + } + + curve.draw(graphics, pointsTotal); + } + + return graphics; }, /** - * [description] + * Creates an ellipse curve positioned at the previous end point, using the given parameters. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform + * @method Phaser.Curves.Path#ellipseTo * @since 3.0.0 + * + * @param {number} xRadius - [description] + * @param {number} yRadius - [description] + * @param {number} startAngle - [description] + * @param {number} endAngle - [description] + * @param {boolean} clockwise - [description] + * @param {number} rotation - [description] + * + * @return {Phaser.Curves.Path} [description] */ - resetTransform: function () + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) { - this.currentContext.setTransform(1, 0, 0, 1, 0, 0); + var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); + + var end = this.getEndPoint(this._tmpVec2A); + + // Calculate where to center the ellipse + var start = ellipse.getStartPoint(this._tmpVec2B); + + end.subtract(start); + + ellipse.x = end.x; + ellipse.y = end.y; + + return this.add(ellipse); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode + * @method Phaser.Curves.Path#fromJSON * @since 3.0.0 * - * @param {[type]} blendMode - [description] + * @param {object} data - [description] * - * @return {[type]} [description] + * @return {Phaser.Curves.Path} [description] */ - setBlendMode: function (blendMode) + fromJSON: function (data) { - if (this.currentBlendMode !== blendMode) + // data should be an object matching the Path.toJSON object structure. + + this.curves = []; + this.cacheLengths = []; + + this.startPoint.set(data.x, data.y); + + this.autoClose = data.autoClose; + + for (var i = 0; i < data.curves.length; i++) { - this.currentContext.globalCompositeOperation = blendMode; - this.currentBlendMode = blendMode; + var curve = data.curves[i]; + + switch (curve.type) + { + case 'LineCurve': + this.add(LineCurve.fromJSON(curve)); + break; + + case 'EllipseCurve': + this.add(EllipseCurve.fromJSON(curve)); + break; + + case 'SplineCurve': + this.add(SplineCurve.fromJSON(curve)); + break; + + case 'CubicBezierCurve': + this.add(CubicBezierCurve.fromJSON(curve)); + break; + + case 'QuadraticBezierCurve': + this.add(QuadraticBezierCurve.fromJSON(curve)); + break; + } } - return this.currentBlendMode; + return this; }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha + * @method Phaser.Curves.Path#getBounds * @since 3.0.0 * - * @param {float} alpha - [description] + * @param {Phaser.Geom.Rectangle} [out] - [description] + * @param {integer} [accuracy=16] - [description] * - * @return {float} [description] + * @return {Phaser.Geom.Rectangle} [description] */ - setAlpha: function (alpha) + getBounds: function (out, accuracy) { - if (this.currentAlpha !== alpha) + if (out === undefined) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } + + out.x = Number.MAX_VALUE; + out.y = Number.MAX_VALUE; + + var bounds = new Rectangle(); + var maxRight = Number.MIN_SAFE_INTEGER; + var maxBottom = Number.MIN_SAFE_INTEGER; + + for (var i = 0; i < this.curves.length; i++) { - this.currentContext.globalAlpha = alpha; - this.currentAlpha = alpha; + var curve = this.curves[i]; + + if (!curve.active) + { + continue; + } + + curve.getBounds(bounds, accuracy); + + out.x = Math.min(out.x, bounds.x); + out.y = Math.min(out.y, bounds.y); + + maxRight = Math.max(maxRight, bounds.right); + maxBottom = Math.max(maxBottom, bounds.bottom); } - return this.currentAlpha; + out.right = maxRight; + out.bottom = maxBottom; + + return out; }, /** - * Called at the start of the render loop. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender + * @method Phaser.Curves.Path#getCurveLengths * @since 3.0.0 + * + * @return {array} [description] */ - preRender: function () + getCurveLengths: function () { - var ctx = this.gameContext; - var config = this.config; - - var width = this.width; - var height = this.height; + // We use cache values if curves and cache array are same length - if (config.clearBeforeRender) + if (this.cacheLengths.length === this.curves.length) { - ctx.clearRect(0, 0, width, height); + return this.cacheLengths; } - if (!config.transparent) + // Get length of sub-curve + // Push sums into cached array + + var lengths = []; + var sums = 0; + + for (var i = 0; i < this.curves.length; i++) { - ctx.fillStyle = config.backgroundColor.rgba; - ctx.fillRect(0, 0, width, height); + sums += this.curves[i].getLength(); + + lengths.push(sums); } - this.drawCount = 0; + this.cacheLengths = lengths; + + return lengths; }, /** - * Renders the Scene to the given Camera. + * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#render + * @method Phaser.Curves.Path#getEndPoint * @since 3.0.0 * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.DisplayList} children - [description] - * @param {float} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - render: function (scene, children, interpolationPercentage, camera) + getEndPoint: function (out) { - var ctx = scene.sys.context; - var scissor = (camera.x !== 0 || camera.y !== 0 || camera.width !== ctx.canvas.width || camera.height !== ctx.canvas.height); - var list = children.list; - var resolution = this.config.resolution; - - this.currentContext = ctx; - - // If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops) + if (out === undefined) { out = new Vector2(); } - if (!camera.transparent) + if (this.curves.length > 0) { - ctx.fillStyle = camera.backgroundColor.rgba; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + this.curves[this.curves.length - 1].getPoint(1, out); } - - if (this.currentAlpha !== 1) + else { - ctx.globalAlpha = 1; - this.currentAlpha = 1; + out.copy(this.startPoint); } - if (this.currentBlendMode !== 0) - { - ctx.globalCompositeOperation = 'source-over'; - this.currentBlendMode = 0; - } + return out; + }, - this.currentScaleMode = 0; + /** + * [description] + * + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 + * + * @return {number} [description] + */ + getLength: function () + { + var lens = this.getCurveLengths(); - this.drawCount += list.length; + return lens[lens.length - 1]; + }, - if (scissor) + // To get accurate point with reference to + // entire path distance at time t, + // following has to be done: + + // 1. Length of each sub path have to be known + // 2. Locate and identify type of curve + // 3. Get t for the curve + // 4. Return curve.getPointAt(t') + + /** + * [description] + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @param {number} t - [description] + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2|null} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; + + while (i < curveLengths.length) { - ctx.save(); - ctx.beginPath(); - ctx.rect(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); - ctx.clip(); + if (curveLengths[i] >= d) + { + var diff = curveLengths[i] - d; + var curve = this.curves[i]; + + var segmentLength = curve.getLength(); + var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; + + return curve.getPointAt(u, out); + } + + i++; } - var matrix = camera.matrix.matrix; + // loop where sum != 0, sum > d , sum+1 0 || camera._flashAlpha > 0) + if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) { - ctx.globalCompositeOperation = 'source-over'; - - // fade rendering - ctx.fillStyle = 'rgb(' + (camera._fadeRed * 255) + ',' + (camera._fadeGreen * 255) + ',' + (camera._fadeBlue * 255) + ')'; - ctx.globalAlpha = camera._fadeAlpha; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + points.push(points[0]); + } - // flash rendering - ctx.fillStyle = 'rgb(' + (camera._flashRed * 255) + ',' + (camera._flashGreen * 255) + ',' + (camera._flashBlue * 255) + ')'; - ctx.globalAlpha = camera._flashAlpha; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + return points; + }, - ctx.globalAlpha = 1.0; + /** + * [description] + * + * @method Phaser.Curves.Path#getRandomPoint + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] + */ + getRandomPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(Math.random(), out); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#getSpacedPoints + * @since 3.0.0 + * + * @param {integer} [divisions=40] - [description] + * + * @return {Phaser.Math.Vector2[]} [description] + */ + getSpacedPoints: function (divisions) + { + if (divisions === undefined) { divisions = 40; } + + var points = []; + + for (var i = 0; i <= divisions; i++) + { + points.push(this.getPoint(i / divisions)); } - // Reset the camera scissor - if (scissor) + if (this.autoClose) { - ctx.restore(); + points.push(points[0]); } + + return points; }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender + * @method Phaser.Curves.Path#getStartPoint * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} [out] - [description] + * + * @return {Phaser.Math.Vector2} [description] */ - postRender: function () + getStartPoint: function (out) { - var ctx = this.gameContext; + if (out === undefined) { out = new Vector2(); } - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; + return out.copy(this.startPoint); + }, - this.currentAlpha = 1; - this.currentBlendMode = 0; + // Creates a line curve from the previous end point to x/y - if (this.snapshotCallback) + /** + * [description] + * + * @method Phaser.Curves.Path#lineTo + * @since 3.0.0 + * + * @param {number|Phaser.Math.Vector2} x - [description] + * @param {number} [y] - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + lineTo: function (x, y) + { + if (x instanceof Vector2) { - this.snapshotCallback(CanvasSnapshot(this.gameCanvas, this.snapshotType, this.snapshotEncoder)); - this.snapshotCallback = null; + this._tmpVec2B.copy(x); + } + else + { + this._tmpVec2B.set(x, y); } + + var end = this.getEndPoint(this._tmpVec2A); + + return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); }, + // Creates a spline curve starting at the previous end point, using the given parameters + /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot + * @method Phaser.Curves.Path#splineTo * @since 3.0.0 * - * @param {[type]} callback - [description] - * @param {[type]} type - [description] - * @param {[type]} encoderOptions - [description] + * @param {[type]} points - [description] + * + * @return {Phaser.Curves.Path} [description] */ - snapshot: function (callback, type, encoderOptions) + splineTo: function (points) { - this.snapshotCallback = callback; - this.snapshotType = type; - this.snapshotEncoder = encoderOptions; + points.unshift(this.getEndPoint()); + + return this.add(new SplineCurve(points)); }, /** * [description] * - * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy + * @method Phaser.Curves.Path#moveTo + * @since 3.0.0 + * + * @param {number} x - [description] + * @param {number} y - [description] + * + * @return {Phaser.Curves.Path} [description] + */ + moveTo: function (x, y) + { + return this.add(new MovePathTo(x, y)); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#toJSON + * @since 3.0.0 + * + * @return {object} [description] + */ + toJSON: function () + { + var out = []; + + for (var i = 0; i < this.curves.length; i++) + { + out.push(this.curves[i].toJSON()); + } + + return { + type: 'Path', + x: this.startPoint.x, + y: this.startPoint.y, + autoClose: this.autoClose, + curves: out + }; + }, + + // cacheLengths must be recalculated. + + /** + * [description] + * + * @method Phaser.Curves.Path#updateArcLengths + * @since 3.0.0 + */ + updateArcLengths: function () + { + this.cacheLengths = []; + + this.getCurveLengths(); + }, + + /** + * [description] + * + * @method Phaser.Curves.Path#destroy * @since 3.0.0 */ destroy: function () { - this.gameCanvas = null; - this.gameContext = null; + this.curves.length = 0; + this.cacheLengths.length = 0; + this.startPoint = undefined; + } + +}); + +/** + * Creates a new Path Object. + * + * @method Phaser.GameObjects.GameObjectFactory#path + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Path. + * @param {number} y - The vertical position of this Path. + * + * @return {Phaser.Curves.Path} The Path Object that was created. + */ +GameObjectFactory.register('path', function (x, y) +{ + return new Path(x, y); +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns + +module.exports = Path; + + +/***/ }), +/* 470 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var Vector2 = __webpack_require__(6); + +/** + * @classdesc + * [description] + * + * @class MoveTo + * @memberOf Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - [description] + * @param {number} [y] - [description] + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) + { + // Skip length calcs in paths + + /** + * [description] + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; + + /** + * [description] + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); + }, + + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getPoint + * @since 3.0.0 + * + * @param {[type]} t - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @param {[type]} u - [description] + * @param {[type]} out - [description] + * + * @return {[type]} [description] + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, + + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getResolution: function () + { + return 1; + }, + + /** + * [description] + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {[type]} [description] + */ + getLength: function () + { + return 0; + }, + + /** + * [description] + * + * @method Phaser.Curves.MoveTo#toJSON + * @since 3.0.0 + * + * @return {[type]} [description] + */ + toJSON: function () + { + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; + } + +}); + +module.exports = MoveTo; + + +/***/ }), +/* 471 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Data + */ + +module.exports = { + + DataManager: __webpack_require__(79), + DataManagerPlugin: __webpack_require__(472) + +}; + + +/***/ }), +/* 472 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var DataManager = __webpack_require__(79); +var PluginManager = __webpack_require__(12); + +/** + * @classdesc + * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. + * + * @class DataManagerPlugin + * @extends Phaser.Data.DataManager + * @memberOf Phaser.Data + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + */ +var DataManagerPlugin = new Class({ + + Extends: DataManager, + + initialize: + + function DataManagerPlugin (scene) + { + /** + * [description] + * + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * [description] + * + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + if (!scene.sys.settings.isBooted) + { + scene.sys.events.once('boot', this.boot, this); + } + + DataManager.call(this, this.scene, scene.sys.events); + }, + + /** + * [description] + * + * @method Phaser.Data.DataManagerPlugin#boot + * @since 3.0.0 + */ + boot: function () + { + var eventEmitter = this.systems.events; + + eventEmitter.on('shutdown', this.shutdownPlugin, this); + eventEmitter.on('destroy', this.destroyPlugin, this); + }, + + /** + * [description] + * + * @method Phaser.Data.DataManagerPlugin#shutdownPlugin + * @since 3.0.0 + */ + shutdownPlugin: function () + { + // Should we reset the events? + }, + + /** + * [description] + * + * @method Phaser.Data.DataManagerPlugin#destroyPlugin + * @since 3.0.0 + */ + destroyPlugin: function () + { + this.destroy(); + + this.scene = undefined; + this.systems = undefined; + } + +}); + +PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data'); + +module.exports = DataManagerPlugin; + + +/***/ }), +/* 473 */ +/***/ (function(module, exports, __webpack_require__) { - this.game = null; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ -}); +/** + * @namespace Phaser.Display + */ -module.exports = CanvasRenderer; +module.exports = { + + Align: __webpack_require__(474), + Bounds: __webpack_require__(489), + Canvas: __webpack_require__(492), + Color: __webpack_require__(225), + Masks: __webpack_require__(503) + +}; /***/ }), -/* 502 */ -/***/ (function(module, exports) { +/* 474 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -86984,39 +89164,20 @@ module.exports = CanvasRenderer; */ /** - * No scaling, anchor, rotation or effects, literally draws the frame directly to the canvas. - * - * @function Phaser.Renderer.Canvas.BlitImage - * @since 3.0.0 - * - * @param {number} dx - The x coordinate to render the Frame to. - * @param {number} dy - The y coordinate to render the Frame to. - * @param {Phaser.Textures.Frame} frame - The Frame to render. + * @namespace Phaser.Display.Align */ -var BlitImage = function (dx, dy, frame) -{ - var ctx = this.currentContext; - var cd = frame.canvasData; - ctx.drawImage( - frame.source.image, - cd.sx, - cd.sy, - cd.sWidth, - cd.sHeight, - dx, - dy, - cd.dWidth, - cd.dHeight - ); -}; +module.exports = { -module.exports = BlitImage; + In: __webpack_require__(475), + To: __webpack_require__(476) + +}; /***/ }), -/* 503 */ -/***/ (function(module, exports) { +/* 475 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -87025,37 +89186,28 @@ module.exports = BlitImage; */ /** - * [description] - * - * @function Phaser.Renderer.Snapshot.Canvas - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {float} [encoderOptions=0.92] - [description] - * - * @return {Image} [description] + * @namespace Phaser.Display.Align.In */ -var CanvasSnapshot = function (canvas, type, encoderOptions) -{ - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } - - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); +module.exports = { - image.src = src; + BottomCenter: __webpack_require__(172), + BottomLeft: __webpack_require__(173), + BottomRight: __webpack_require__(174), + Center: __webpack_require__(175), + LeftCenter: __webpack_require__(177), + QuickSet: __webpack_require__(170), + RightCenter: __webpack_require__(178), + TopCenter: __webpack_require__(179), + TopLeft: __webpack_require__(180), + TopRight: __webpack_require__(181) - return image; }; -module.exports = CanvasSnapshot; - /***/ }), -/* 504 */ -/***/ (function(module, exports) { +/* 476 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -87064,92 +89216,113 @@ module.exports = CanvasSnapshot; */ /** - * [description] - * - * @function Phaser.Renderer.Canvas.DrawImage - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} src - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @namespace Phaser.Display.Align.To */ -var DrawImage = function (src, camera) -{ - var ctx = this.currentContext; - var frame = src.frame; - var cd = frame.canvasData; - // Blend Mode +module.exports = { - if (this.currentBlendMode !== src.blendMode) - { - this.currentBlendMode = src.blendMode; - ctx.globalCompositeOperation = this.blendModes[src.blendMode]; - } + BottomCenter: __webpack_require__(477), + BottomLeft: __webpack_require__(478), + BottomRight: __webpack_require__(479), + LeftBottom: __webpack_require__(480), + LeftCenter: __webpack_require__(481), + LeftTop: __webpack_require__(482), + RightBottom: __webpack_require__(483), + RightCenter: __webpack_require__(484), + RightTop: __webpack_require__(485), + TopCenter: __webpack_require__(486), + TopLeft: __webpack_require__(487), + TopRight: __webpack_require__(488) - // Alpha +}; - if (this.currentAlpha !== src.alpha) - { - this.currentAlpha = src.alpha; - ctx.globalAlpha = src.alpha; - } - // Smoothing +/***/ }), +/* 477 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.currentScaleMode !== src.scaleMode) - { - this.currentScaleMode = src.scaleMode; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - // ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR); - } +var GetBottom = __webpack_require__(24); +var GetCenterX = __webpack_require__(46); +var SetCenterX = __webpack_require__(47); +var SetTop = __webpack_require__(31); - var dx = frame.x; - var dy = frame.y; +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. + * + * @function Phaser.Display.Align.To.BottomCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - var fx = 1; - var fy = 1; + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - if (src.flipX) - { - fx = -1; - dx -= cd.dWidth - src.displayOriginX; - } - else - { - dx -= src.displayOriginX; - } + return gameObject; +}; - if (src.flipY) - { - fy = -1; - dy -= cd.dHeight - src.displayOriginY; - } - else - { - dy -= src.displayOriginY; - } +module.exports = BottomCenter; - // Perform Matrix ITRS - ctx.save(); +/***/ }), +/* 478 */ +/***/ (function(module, exports, __webpack_require__) { - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - ctx.rotate(src.rotation); +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); - ctx.scale(src.scaleX, src.scaleY); - ctx.scale(fx, fy); +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. + * + * @function Phaser.Display.Align.To.BottomLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, dx, dy, cd.dWidth, cd.dHeight); + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - ctx.restore(); + return gameObject; }; -module.exports = DrawImage; +module.exports = BottomLeft; /***/ }), -/* 505 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87158,48 +89331,40 @@ module.exports = DrawImage; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var modes = __webpack_require__(45); -var CanvasFeatures = __webpack_require__(234); +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); /** - * [description] + * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. * - * @function Phaser.Renderer.Canvas.GetBlendModes + * @function Phaser.Display.Align.To.BottomRight * @since 3.0.0 * - * @return {array} [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var GetBlendModes = function () +var BottomRight = function (gameObject, alignTo, offsetX, offsetY) { - var output = []; - var useNew = CanvasFeatures.supportNewBlendModes; + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - output[modes.NORMAL] = 'source-over'; - output[modes.ADD] = 'lighter'; - output[modes.MULTIPLY] = (useNew) ? 'multiply' : 'source-over'; - output[modes.SCREEN] = (useNew) ? 'screen' : 'source-over'; - output[modes.OVERLAY] = (useNew) ? 'overlay' : 'source-over'; - output[modes.DARKEN] = (useNew) ? 'darken' : 'source-over'; - output[modes.LIGHTEN] = (useNew) ? 'lighten' : 'source-over'; - output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : 'source-over'; - output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : 'source-over'; - output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : 'source-over'; - output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : 'source-over'; - output[modes.DIFFERENCE] = (useNew) ? 'difference' : 'source-over'; - output[modes.EXCLUSION] = (useNew) ? 'exclusion' : 'source-over'; - output[modes.HUE] = (useNew) ? 'hue' : 'source-over'; - output[modes.SATURATION] = (useNew) ? 'saturation' : 'source-over'; - output[modes.COLOR] = (useNew) ? 'color' : 'source-over'; - output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : 'source-over'; + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - return output; + return gameObject; }; -module.exports = GetBlendModes; +module.exports = BottomRight; /***/ }), -/* 506 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87208,1804 +89373,1383 @@ module.exports = GetBlendModes; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(22); -var IsSizePowerOfTwo = __webpack_require__(125); -var Utils = __webpack_require__(42); -var WebGLSnapshot = __webpack_require__(507); - -// Default Pipelines -var BitmapMaskPipeline = __webpack_require__(508); -var FlatTintPipeline = __webpack_require__(511); -var ForwardDiffuseLightPipeline = __webpack_require__(237); -var TextureTintPipeline = __webpack_require__(238); +var GetBottom = __webpack_require__(24); +var GetLeft = __webpack_require__(26); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); /** - * @classdesc - * [description] + * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. * - * @class WebGLRenderer - * @memberOf Phaser.Renderer.WebGL - * @constructor + * @function Phaser.Display.Align.To.LeftBottom * @since 3.0.0 * - * @param {Phaser.Game} game - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var WebGLRenderer = new Class({ +var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - initialize: + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); - function WebGLRenderer (game) - { - // eslint-disable-next-line consistent-this - var renderer = this; + return gameObject; +}; - var contextCreationConfig = { - alpha: game.config.transparent, - depth: false, // enable when 3D is added in the future - antialias: game.config.antialias, - premultipliedAlpha: game.config.transparent, - stencil: true, - preserveDrawingBuffer: game.config.preserveDrawingBuffer, - failIfMajorPerformanceCaveat: false, - powerPreference: game.config.powerPreference - }; +module.exports = LeftBottom; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: game.config.clearBeforeRender, - pixelArt: game.config.pixelArt, - backgroundColor: game.config.backgroundColor, - contextCreation: contextCreationConfig, - resolution: game.config.resolution, - autoResize: game.config.autoResize - }; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; +/***/ }), +/* 481 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {integer} - * @since 3.0.0 - */ - this.type = CONST.WEBGL; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = game.config.width; +var GetCenterY = __webpack_require__(49); +var GetLeft = __webpack_require__(26); +var SetCenterY = __webpack_require__(48); +var SetRight = __webpack_require__(29); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = game.config.height; +/** + * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. + * + * @function Phaser.Display.Align.To.LeftCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = game.canvas; + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks - * @type {function[]} - * @since 3.0.0 - */ - this.lostContextCallbacks = []; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks - * @type {function[]} - * @since 3.0.0 - */ - this.restoredContextCallbacks = []; +module.exports = LeftCenter; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.blendModes = []; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.nativeTextures = []; +/***/ }), +/* 482 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.contextLost = false; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines - * @type {object} - * @default null - * @since 3.0.0 - */ - this.pipelines = null; +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetRight = __webpack_require__(29); +var SetTop = __webpack_require__(31); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {object} - * @since 3.0.0 - */ - this.snapshotState = { - callback: null, - type: null, - encoder: null - }; +/** + * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * + * @function Phaser.Display.Align.To.LeftTop + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTextureUnit - * @type {integer} - * @since 3.1.0 - */ - this.currentActiveTextureUnit = 0; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentTextures - * @type {array} - * @since 3.0.0 - */ - this.currentTextures = new Array(16); +module.exports = LeftTop; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer - * @type {WebGLFramebuffer} - * @default null - * @since 3.0.0 - */ - this.currentFramebuffer = null; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @since 3.0.0 - */ - this.currentPipeline = null; +/***/ }), +/* 483 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram - * @type {WebGLProgram} - * @default null - * @since 3.0.0 - */ - this.currentProgram = null; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentVertexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentVertexBuffer = null; +var GetBottom = __webpack_require__(24); +var GetRight = __webpack_require__(28); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentIndexBuffer - * @type {WebGLBuffer} - * @default null - * @since 3.0.0 - */ - this.currentIndexBuffer = null; +/** + * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. + * + * @function Phaser.Display.Align.To.RightBottom + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {integer} - * @since 3.0.0 - */ - this.currentBlendMode = Infinity; + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.currentScissorEnabled = false; + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor - * @type {Uint32Array} - * @since 3.0.0 - */ - this.currentScissor = new Uint32Array([ 0, 0, this.width, this.height ]); +module.exports = RightBottom; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorIdx - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.currentScissorIdx = 0; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack - * @type {Uint32Array} - * @since 3.0.0 - */ - this.scissorStack = new Uint32Array(4 * 1000); +/***/ }), +/* 484 */ +/***/ (function(module, exports, __webpack_require__) { - // Setup context lost and restore event listeners +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.canvas.addEventListener('webglcontextlost', function (event) - { - renderer.contextLost = true; - event.preventDefault(); +var GetCenterY = __webpack_require__(49); +var GetRight = __webpack_require__(28); +var SetCenterY = __webpack_require__(48); +var SetLeft = __webpack_require__(27); - for (var index = 0; index < renderer.lostContextCallbacks.length; ++index) - { - var callback = renderer.lostContextCallbacks[index]; - callback[0].call(callback[1], renderer); - } - }, false); +/** + * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * + * @function Phaser.Display.Align.To.RightCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - this.canvas.addEventListener('webglcontextrestored', function () - { - renderer.contextLost = false; - renderer.init(renderer.config); - for (var index = 0; index < renderer.restoredContextCallbacks.length; ++index) - { - var callback = renderer.restoredContextCallbacks[index]; - callback[0].call(callback[1], renderer); - } - }, false); + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - // This are initialized post context creation + return gameObject; +}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 - */ - this.gl = null; +module.exports = RightCenter; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {object} - * @default null - * @since 3.0.0 - */ - this.supportedExtensions = null; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.extensions = {}; +/***/ }), +/* 485 */ +/***/ (function(module, exports, __webpack_require__) { - this.init(this.config); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#init - * @since 3.0.0 - * - * @param {object} config - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - init: function (config) - { - var canvas = this.canvas; - var clearColor = config.backgroundColor; - var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); - - if (!gl) - { - this.contextLost = true; - throw new Error('This browser does not support WebGL. Try using the Canvas pipeline.'); - } +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetLeft = __webpack_require__(27); +var SetTop = __webpack_require__(31); - this.gl = gl; +/** + * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. + * + * @function Phaser.Display.Align.To.RightTop + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - for (var i = 0; i <= 16; i++) - { - this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); - } + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; - this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; - this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; + return gameObject; +}; - // Load supported extensions - this.supportedExtensions = gl.getSupportedExtensions(); +module.exports = RightTop; - // Setup initial WebGL state - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.CULL_FACE); - gl.disable(gl.SCISSOR_TEST); - gl.enable(gl.BLEND); - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, 1.0); - // Initialize all textures to null - for (var index = 0; index < this.currentTextures.length; ++index) - { - this.currentTextures[index] = null; - } +/***/ }), +/* 486 */ +/***/ (function(module, exports, __webpack_require__) { - // Clear previous pipelines and reload default ones - this.pipelines = {}; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.addPipeline('TextureTintPipeline', new TextureTintPipeline(this.game, gl, this)); - this.addPipeline('FlatTintPipeline', new FlatTintPipeline(this.game, gl, this)); - this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline(this.game, gl, this)); - this.addPipeline('Light2D', new ForwardDiffuseLightPipeline(this.game, gl, this)); - - this.setBlendMode(CONST.BlendModes.NORMAL); - this.resize(this.width, this.height); - - return this; - }, +var GetCenterX = __webpack_require__(46); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetCenterX = __webpack_require__(47); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - resize: function (width, height) - { - var gl = this.gl; - var pipelines = this.pipelines; - var resolution = this.config.resolution; +/** + * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. + * + * @function Phaser.Display.Align.To.TopCenter + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - this.width = width * resolution; - this.height = height * resolution; - - this.canvas.width = this.width; - this.canvas.height = this.height; + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - if (this.config.autoResize) - { - this.canvas.style.width = (this.width / resolution) + 'px'; - this.canvas.style.height = (this.height / resolution) + 'px'; - } + return gameObject; +}; - gl.viewport(0, 0, this.width, this.height); +module.exports = TopCenter; - // Update all registered pipelines - for (var pipelineName in pipelines) - { - pipelines[pipelineName].resize(width, height, resolution); - } - return this; - }, +/***/ }), +/* 487 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {object} target - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - onContextRestored: function (callback, target) - { - this.restoredContextCallbacks.push([ callback, target ]); - return this; - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {object} target - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - onContextLost: function (callback, target) - { - this.lostContextCallbacks.push([ callback, target ]); - return this; - }, +var GetLeft = __webpack_require__(26); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetLeft = __webpack_require__(27); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension - * @since 3.0.0 - * - * @param {string} extensionName - [description] - * - * @return {boolean} [description] - */ - hasExtension: function (extensionName) - { - return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. + * + * @function Phaser.Display.Align.To.TopLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension - * @since 3.0.0 - * - * @param {string} extensionName - [description] - * - * @return {object} [description] - */ - getExtension: function (extensionName) - { - if (!this.hasExtension(extensionName)) { return null; } + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - if (!(extensionName in this.extensions)) - { - this.extensions[extensionName] = this.gl.getExtension(extensionName); - } + return gameObject; +}; - return this.extensions[extensionName]; - }, +module.exports = TopLeft; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#flush - * @since 3.0.0 - */ - flush: function () - { - if (this.currentPipeline) - { - this.currentPipeline.flush(); - } - }, - /* Renderer State Manipulation Functions */ +/***/ }), +/* 488 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {boolean} [description] - */ - hasPipeline: function (pipelineName) - { - return (pipelineName in this.pipelines); - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - getPipeline: function (pipelineName) - { - return (this.hasPipeline(pipelineName)) ? this.pipelines[pipelineName] : null; - }, +var GetRight = __webpack_require__(28); +var GetTop = __webpack_require__(30); +var SetBottom = __webpack_require__(25); +var SetRight = __webpack_require__(29); + +/** + * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * + * @function Phaser.Display.Align.To.TopRight + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#removePipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - removePipeline: function (pipelineName) - { - delete this.pipelines[pipelineName]; - return this; - }, + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#addPipeline - * @since 3.0.0 - * - * @param {string} pipelineName - [description] - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - addPipeline: function (pipelineName, pipelineInstance) - { - if (!this.hasPipeline(pipelineName)) { this.pipelines[pipelineName] = pipelineInstance; } - else { console.warn('Pipeline', pipelineName, ' already exists.'); } + return gameObject; +}; - pipelineInstance.name = pipelineName; - this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution); +module.exports = TopRight; - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor - * @since 3.0.0 - * - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} w - [description] - * @param {integer} h - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setScissor: function (x, y, w, h) - { - var gl = this.gl; - var currentScissor = this.currentScissor; - var enabled = (x === 0 && y === 0 && w === gl.canvas.width && h === gl.canvas.height && w >= 0 && h >= 0); +/***/ }), +/* 489 */ +/***/ (function(module, exports, __webpack_require__) { - if (currentScissor[0] !== x || - currentScissor[1] !== y || - currentScissor[2] !== w || - currentScissor[3] !== h) - { - this.flush(); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - currentScissor[0] = x; - currentScissor[1] = y; - currentScissor[2] = w; - currentScissor[3] = h; +/** + * @namespace Phaser.Display.Bounds + */ - this.currentScissorEnabled = enabled; +module.exports = { - if (enabled) - { - gl.disable(gl.SCISSOR_TEST); - return; - } + CenterOn: __webpack_require__(176), + GetBottom: __webpack_require__(24), + GetCenterX: __webpack_require__(46), + GetCenterY: __webpack_require__(49), + GetLeft: __webpack_require__(26), + GetOffsetX: __webpack_require__(490), + GetOffsetY: __webpack_require__(491), + GetRight: __webpack_require__(28), + GetTop: __webpack_require__(30), + SetBottom: __webpack_require__(25), + SetCenterX: __webpack_require__(47), + SetCenterY: __webpack_require__(48), + SetLeft: __webpack_require__(27), + SetRight: __webpack_require__(29), + SetTop: __webpack_require__(31) + +}; - gl.enable(gl.SCISSOR_TEST); - gl.scissor(x, (gl.drawingBufferHeight - y - h), w, h); - return this; - }, +/***/ }), +/* 490 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor - * @since 3.0.0 - * - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} w - [description] - * @param {integer} h - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - pushScissor: function (x, y, w, h) - { - var scissorStack = this.scissorStack; - var stackIndex = this.currentScissorIdx; - var currentScissor = this.currentScissor; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - scissorStack[stackIndex + 0] = currentScissor[0]; - scissorStack[stackIndex + 1] = currentScissor[1]; - scissorStack[stackIndex + 2] = currentScissor[2]; - scissorStack[stackIndex + 3] = currentScissor[3]; - - this.currentScissorIdx += 4; - this.setScissor(x, y, w, h); +/** + * Returns the amount the Game Object is visually offset from its x coordinate. + * This is the same as `width * origin.x`. + * This value will only be > 0 if `origin.x` is not equal to zero. + * + * @function Phaser.Display.Bounds.GetOffsetX + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The horizontal offset of the Game Object. + */ +var GetOffsetX = function (gameObject) +{ + return gameObject.width * gameObject.originX; +}; - return this; - }, +module.exports = GetOffsetX; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - popScissor: function () - { - var scissorStack = this.scissorStack; - var stackIndex = this.currentScissorIdx - 4; - - var x = scissorStack[stackIndex + 0]; - var y = scissorStack[stackIndex + 1]; - var w = scissorStack[stackIndex + 2]; - var h = scissorStack[stackIndex + 3]; - this.currentScissorIdx = stackIndex; - this.setScissor(x, y, w, h); - - return this; - }, +/***/ }), +/* 491 */ +/***/ (function(module, exports) { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setPipeline - * @since 3.0.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipelineInstance - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description] - */ - setPipeline: function (pipelineInstance) - { - if (this.currentPipeline !== pipelineInstance || - this.currentPipeline.vertexBuffer !== this.currentVertexBuffer || - this.currentPipeline.program !== this.currentProgram) - { - this.flush(); - this.currentPipeline = pipelineInstance; - this.currentPipeline.bind(); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentPipeline.onBind(); +/** + * Returns the amount the Game Object is visually offset from its y coordinate. + * This is the same as `width * origin.y`. + * This value will only be > 0 if `origin.y` is not equal to zero. + * + * @function Phaser.Display.Bounds.GetOffsetY + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The vertical offset of the Game Object. + */ +var GetOffsetY = function (gameObject) +{ + return gameObject.height * gameObject.originY; +}; - return this.currentPipeline; - }, +module.exports = GetOffsetY; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode - * @since 3.0.0 - * - * @param {integer} blendModeId - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setBlendMode: function (blendModeId) - { - var gl = this.gl; - var blendMode = this.blendModes[blendModeId]; - if (blendModeId !== CONST.BlendModes.SKIP_CHECK && - this.currentBlendMode !== blendModeId) - { - this.flush(); +/***/ }), +/* 492 */ +/***/ (function(module, exports, __webpack_require__) { - gl.enable(gl.BLEND); - gl.blendEquation(blendMode.equation); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (blendMode.func.length > 2) - { - gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); - } - else - { - gl.blendFunc(blendMode.func[0], blendMode.func[1]); - } +/** + * @namespace Phaser.Display.Canvas + */ - this.currentBlendMode = blendModeId; - } +module.exports = { - return this; - }, + Interpolation: __webpack_require__(224), + Pool: __webpack_require__(19), + Smoothing: __webpack_require__(121), + TouchAction: __webpack_require__(493), + UserSelect: __webpack_require__(494) + +}; - addBlendMode: function (func, equation) - { - var index = this.blendModes.push({ func: func, equation: equation }); - return index - 1; - }, +/***/ }), +/* 493 */ +/***/ (function(module, exports) { - updateBlendMode: function (index, func, equation) - { - if (this.blendModes[index]) - { - this.blendModes[index].func = func; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (equation) - { - this.blendModes[index].equation = equation; - } - } +/** + * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. + * + * @function Phaser.Display.Canvas.TouchAction + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var TouchAction = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } - return this; - }, + canvas.style['msTouchAction'] = value; + canvas.style['ms-touch-action'] = value; + canvas.style['touch-action'] = value; - removeBlendMode: function (index) - { - if (index > 16 && this.blendModes[index]) - { - this.blendModes.splice(index, 1); - } + return canvas; +}; - return this; - }, +module.exports = TouchAction; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D - * @since 3.0.0 - * - * @param {WebGLTexture} texture - [description] - * @param {integer} textureUnit - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setTexture2D: function (texture, textureUnit) - { - var gl = this.gl; - if (texture !== this.currentTextures[textureUnit]) - { - this.flush(); +/***/ }), +/* 494 */ +/***/ (function(module, exports) { - if (this.currentActiveTextureUnit !== textureUnit) - { - gl.activeTexture(gl.TEXTURE0 + textureUnit); - this.currentActiveTextureUnit = textureUnit; - } - gl.bindTexture(gl.TEXTURE_2D, texture); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - this.currentTextures[textureUnit] = texture; - } +/** + * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. + * + * @function Phaser.Display.Canvas.UserSelect + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var UserSelect = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } - return this; - }, + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setFramebuffer: function (framebuffer) + vendors.forEach(function (vendor) { - var gl = this.gl; + canvas.style[vendor + 'user-select'] = value; + }); - if (framebuffer !== this.currentFramebuffer) - { - this.flush(); + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - this.currentFramebuffer = framebuffer; - } + return canvas; +}; - return this; - }, +module.exports = UserSelect; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setProgram: function (program) - { - var gl = this.gl; - if (program !== this.currentProgram) - { - this.flush(); +/***/ }), +/* 495 */ +/***/ (function(module, exports) { - gl.useProgram(program); - this.currentProgram = program; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +/** + * @typedef {Object} ColorObject + * @property {number} r - The red color value in the range 0 to 255. + * @property {number} g - The green color value in the range 0 to 255. + * @property {number} b - The blue color value in the range 0 to 255. + * @property {number} a - The alpha color value in the range 0 to 255. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setVertexBuffer: function (vertexBuffer) +/** + * Converts the given color value into an Object containing r,g,b and a properties. + * + * @function Phaser.Display.Color.ColorToRGBA + * @since 3.0.0 + * + * @param {number} color - A color value, optionally including the alpha value. + * + * @return {ColorObject} An object containing the parsed color values. + */ +var ColorToRGBA = function (color) +{ + var output = { + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF, + a: 255 + }; + + if (color > 16777215) { - var gl = this.gl; + output.a = color >>> 24; + } - if (vertexBuffer !== this.currentVertexBuffer) - { - this.flush(); + return output; +}; - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - this.currentVertexBuffer = vertexBuffer; - } +module.exports = ColorToRGBA; - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} indexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setIndexBuffer: function (indexBuffer) - { - var gl = this.gl; +/***/ }), +/* 496 */ +/***/ (function(module, exports, __webpack_require__) { - if (indexBuffer !== this.currentIndexBuffer) - { - this.flush(); - - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - this.currentIndexBuffer = indexBuffer; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return this; - }, +var Color = __webpack_require__(36); +var HueToComponent = __webpack_require__(227); - /* Renderer Resource Creation Functions */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource - * @since 3.0.0 - * - * @param {object} source - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {integer} scaleMode - [description] - * - * @return {WebGLTexture} [description] - */ - createTextureFromSource: function (source, width, height, scaleMode) +/** + * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. + * + * @function Phaser.Display.Color.HSLToColor + * @since 3.0.0 + * + * @param {number} h - The hue value in the range 0 to 1. + * @param {number} s - The saturation value in the range 0 to 1. + * @param {number} l - The lightness value in the range 0 to 1. + * + * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. + */ +var HSLToColor = function (h, s, l) +{ + // achromatic by default + var r = l; + var g = l; + var b = l; + + if (s !== 0) { - var gl = this.gl; - var filter = gl.NEAREST; - var wrap = gl.CLAMP_TO_EDGE; - var texture = null; + var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; - width = source ? source.width : width; - height = source ? source.height : height; + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } - if (IsSizePowerOfTwo(width, height)) - { - wrap = gl.REPEAT; - } + var color = new Color(); - if (scaleMode === CONST.ScaleModes.LINEAR) - { - filter = gl.LINEAR; - } - else if (scaleMode === CONST.ScaleModes.NEAREST || this.config.pixelArt) - { - filter = gl.NEAREST; - } + return color.setGLTo(r, g, b, 1); +}; - if (!source && typeof width === 'number' && typeof height === 'number') - { - texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - } - else - { - texture = this.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, source); - } +module.exports = HSLToColor; - return texture; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D - * @since 3.0.0 - * - * @param {integer} mipLevel - [description] - * @param {integer} minFilter - [description] - * @param {integer} magFilter - [description] - * @param {integer} wrapT - [description] - * @param {integer} wrapS - [description] - * @param {integer} format - [description] - * @param {object} pixels - [description] - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {boolean} pma - [description] - * - * @return {WebGLTexture} [description] - */ - createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma) - { - var gl = this.gl; - var texture = gl.createTexture(); +/***/ }), +/* 497 */ +/***/ (function(module, exports) { - pma = (pma === undefined || pma === null) ? true : pma; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; - this.setTexture2D(texture, 0); - - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); - if (pixels === null || pixels === undefined) - { - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); - } - else - { - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); - width = pixels.width; - height = pixels.height; - } +/***/ }), +/* 498 */ +/***/ (function(module, exports, __webpack_require__) { - this.setTexture2D(null, 0); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - texture.isAlphaPremultiplied = pma; - texture.isRenderTexture = false; - texture.width = width; - texture.height = height; +var HSVToRGB = __webpack_require__(228); - this.nativeTextures.push(texture); +/** + * Get HSV color wheel values in an array which will be 360 elements in size. + * + * @function Phaser.Display.Color.HSVColorWheel + * @since 3.0.0 + * + * @param {number} [s=1] - The saturation, in the range 0 - 1. + * @param {number} [v=1] - The value, in the range 0 - 1. + * + * @return {array} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. + */ +var HSVColorWheel = function (s, v) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } - return texture; - }, + var colors = []; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer - * @since 3.0.0 - * - * @param {integer} width - [description] - * @param {integer} height - [description] - * @param {WebGLFramebuffer} renderTexture - [description] - * @param {boolean} addDepthStencilBuffer - [description] - * - * @return {WebGLFramebuffer} [description] - */ - createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) + for (var c = 0; c <= 359; c++) { - var gl = this.gl; - var framebuffer = gl.createFramebuffer(); - var complete = 0; + colors.push(HSVToRGB(c / 359, s, v)); + } - this.setFramebuffer(framebuffer); + return colors; +}; - if (addDepthStencilBuffer) - { - var depthStencilBuffer = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); - } +module.exports = HSVColorWheel; - renderTexture.isRenderTexture = true; - renderTexture.isAlphaPremultiplied = false; - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); +/***/ }), +/* 499 */ +/***/ (function(module, exports, __webpack_require__) { - complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (complete !== gl.FRAMEBUFFER_COMPLETE) - { - var errors = { - 36054: 'Incomplete Attachment', - 36055: 'Missing Attachment', - 36057: 'Incomplete Dimensions', - 36061: 'Framebuffer Unsupported' - }; - throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); - } +var Linear = __webpack_require__(229); - framebuffer.renderTexture = renderTexture; +/** + * Interpolates color values + * + * @namespace Phaser.Display.Color.Interpolate + * @since 3.0.0 + */ - this.setFramebuffer(null); +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @since 3.0.0 + * + * @param {number} r1 - Red value. + * @param {number} g1 - Blue value. + * @param {number} b1 - Green value. + * @param {number} r2 - Red value. + * @param {number} g2 - Blue value. + * @param {number} b2 - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - return framebuffer; - }, + var t = index / length; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram - * @since 3.0.0 - * - * @param {string} vertexShader - [description] - * @param {string} fragmentShader - [description] - * - * @return {WebGLProgram} [description] - */ - createProgram: function (vertexShader, fragmentShader) - { - var gl = this.gl; - var program = gl.createProgram(); - var vs = gl.createShader(gl.VERTEX_SHADER); - var fs = gl.createShader(gl.FRAGMENT_SHADER); + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; - gl.shaderSource(vs, vertexShader); - gl.shaderSource(fs, fragmentShader); - gl.compileShader(vs); - gl.compileShader(fs); +/** + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @since 3.0.0 + * + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {Phaser.Display.Color} color2 - The second Color object. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var ColorWithColor = function (color1, color2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) - { - throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); - } - if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) - { - throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); - } + return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); +}; - gl.attachShader(program, vs); - gl.attachShader(program, fs); - gl.linkProgram(program); +/** + * Interpolates between the Color object and color values over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithRGB + * @since 3.0.0 + * + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {number} r - Red value. + * @param {number} g - Blue value. + * @param {number} b - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {ColorObject} An object containing the interpolated color values. + */ +var ColorWithRGB = function (color, r, g, b, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) - { - throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); - } + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; - return program; - }, +module.exports = { - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - [description] - * @param {integer} bufferUsage - [description] - * - * @return {WebGLBuffer} [description] - */ - createVertexBuffer: function (initialDataOrSize, bufferUsage) - { - var gl = this.gl; - var vertexBuffer = gl.createBuffer(); + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor - this.setVertexBuffer(vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - this.setVertexBuffer(null); +}; - return vertexBuffer; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer - * @since 3.0.0 - * - * @param {ArrayBuffer} initialDataOrSize - [description] - * @param {integer} bufferUsage - [description] - * - * @return {WebGLBuffer} [description] - */ - createIndexBuffer: function (initialDataOrSize, bufferUsage) - { - var gl = this.gl; - var indexBuffer = gl.createBuffer(); +/***/ }), +/* 500 */ +/***/ (function(module, exports, __webpack_require__) { - this.setIndexBuffer(indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); - this.setIndexBuffer(null); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - return indexBuffer; - }, +var Between = __webpack_require__(231); +var Color = __webpack_require__(36); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture - * @since 3.0.0 - * - * @param {WebGLTexture} texture - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteTexture: function (texture) - { - this.gl.deleteTexture(texture); - return this; - }, +/** + * Creates a new Color object where the r, g, and b values have been set to random values + * based on the given min max values. + * + * @function Phaser.Display.Color.RandomRGB + * @since 3.0.0 + * + * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) + * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) + * + * @return {Phaser.Display.Color} A Color object. + */ +var RandomRGB = function (min, max) +{ + if (min === undefined) { min = 0; } + if (max === undefined) { max = 255; } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteFramebuffer: function (framebuffer) - { - this.gl.deleteFramebuffer(framebuffer); - return this; - }, + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteProgram: function (program) - { - this.gl.deleteProgram(program); - return this; - }, +module.exports = RandomRGB; + + +/***/ }), +/* 501 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * Converts an RGB color value to HSV (hue, saturation and value). + * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.RGBToHSV + * @since 3.0.0 + * + * @param {integer} r - The red color value. A number between 0 and 255. + * @param {integer} g - The green color value. A number between 0 and 255. + * @param {integer} b - The blue color value. A number between 0 and 255. + * + * @return {object} An object with the properties `h`, `s` and `v`. + */ +var RGBToHSV = function (r, g, b) +{ + r /= 255; + g /= 255; + b /= 255; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer - * @since 3.0.0 - * - * @param {WebGLBuffer} vertexBuffer - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - deleteBuffer: function (buffer) - { - this.gl.deleteBuffer(buffer); - return this; - }, + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var d = max - min; - /* Rendering Functions */ + // achromatic by default + var h = 0; + var s = (max === 0) ? 0 : d / max; + var v = max; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - preRenderCamera: function (camera) + if (max !== min) { - var resolution = this.config.resolution; - - this.pushScissor(camera.x * resolution, camera.y * resolution, camera.width * resolution, camera.height * resolution); - - if (camera.backgroundColor.alphaGL > 0) + if (max === r) { - var color = camera.backgroundColor; - var FlatTintPipeline = this.pipelines.FlatTintPipeline; - - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1.0), - color.alphaGL, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); - - FlatTintPipeline.flush(); + h = (g - b) / d + ((g < b) ? 6 : 0); } - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - postRenderCamera: function (camera) - { - if (camera._fadeAlpha > 0 || camera._flashAlpha > 0) + else if (max === g) { - var FlatTintPipeline = this.pipelines.FlatTintPipeline; - - // Fade - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0), - camera._fadeAlpha, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); - - // Flash - FlatTintPipeline.batchFillRect( - 0, 0, 1, 1, 0, - camera.x, camera.y, camera.width, camera.height, - Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0), - camera._flashAlpha, - 1, 0, 0, 1, 0, 0, - [ 1, 0, 0, 1, 0, 0 ] - ); - - FlatTintPipeline.flush(); + h = (b - r) / d + 2; + } + else if (max === b) + { + h = (r - g) / d + 4; } - this.popScissor(); - }, + h /= 6; + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender - * @since 3.0.0 - */ - preRender: function () - { - if (this.contextLost) { return; } + return { h: h, s: s, v: v }; +}; - var gl = this.gl; - var color = this.config.backgroundColor; - var pipelines = this.pipelines; +module.exports = RGBToHSV; - // Bind custom framebuffer here - gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL); - if (this.config.clearBeforeRender) - { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); } +/***/ }), +/* 502 */ +/***/ (function(module, exports, __webpack_require__) { - for (var key in pipelines) - { - pipelines[key].onPreRender(); - } - }, +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#render - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - [description] - * @param {Phaser.GameObjects.GameObject} children - [description] - * @param {number} interpolationPercentage - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - render: function (scene, children, interpolationPercentage, camera) - { - if (this.contextLost) { return; } +var ComponentToHex = __webpack_require__(226); - var list = children.list; - var childCount = list.length; - var pipelines = this.pipelines; +/** + * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. + * + * @function Phaser.Display.Color.RGBToString + * @since 3.0.0 + * + * @param {integer} r - The red color value. A number between 0 and 255. + * @param {integer} g - The green color value. A number between 0 and 255. + * @param {integer} b - The blue color value. A number between 0 and 255. + * @param {integer} [a=255] - The alpha value. A number between 0 and 255. + * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. + * + * @return {string} A string-based representation of the color values. + */ +var RGBToString = function (r, g, b, a, prefix) +{ + if (a === undefined) { a = 255; } + if (prefix === undefined) { prefix = '#'; } - for (var key in pipelines) - { - pipelines[key].onRender(scene, camera); - } + if (prefix === '#') + { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; - this.preRenderCamera(camera); +module.exports = RGBToString; - for (var index = 0; index < childCount; ++index) - { - var child = list[index]; - if (!child.willRender()) - { - continue; - } +/***/ }), +/* 503 */ +/***/ (function(module, exports, __webpack_require__) { - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (child.mask) - { - child.mask.preRenderWebGL(this, child, camera); - } +/** + * @namespace Phaser.Display.Masks + */ - child.renderWebGL(this, child, interpolationPercentage, camera); +module.exports = { - if (child.mask) - { - child.mask.postRenderWebGL(this, child); - } - } + BitmapMask: __webpack_require__(504), + GeometryMask: __webpack_require__(505) - this.flush(); - this.setBlendMode(CONST.BlendModes.NORMAL); - this.postRenderCamera(camera); - }, +}; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender - * @since 3.0.0 - */ - postRender: function () - { - if (this.contextLost) { return; } - // Unbind custom framebuffer here +/***/ }), +/* 504 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.snapshotState.callback) - { - this.snapshotState.callback(WebGLSnapshot(this.canvas, this.snapshotState.type, this.snapshotState.encoder)); - this.snapshotState.callback = null; - } +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - var pipelines = this.pipelines; +var Class = __webpack_require__(0); - for (var key in pipelines) - { - pipelines[key].onPostRender(); - } - }, +/** + * @classdesc + * [description] + * + * @class BitmapMask + * @memberOf Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {[type]} renderable - [description] + */ +var BitmapMask = new Class({ + + initialize: - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot - * @since 3.0.0 - * - * @param {function} callback - [description] - * @param {string} type - [description] - * @param {float} encoderOptions - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - snapshot: function (callback, type, encoderOptions) + function BitmapMask (scene, renderable) { - this.snapshotState.callback = callback; - this.snapshotState.type = type; - this.snapshotState.encoder = encoderOptions; - return this; - }, + var renderer = scene.sys.game.renderer; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture - * @since 3.0.0 - * - * @param {HTMLCanvasElement} srcCanvas - [description] - * @param {WebGLTexture} dstTexture - [description] - * @param {boolean} shouldReallocate - [description] - * @param {integer} scaleMode - [description] - * - * @return {WebGLTexture} [description] - */ - canvasToTexture: function (srcCanvas, dstTexture, shouldReallocate) - { - var gl = this.gl; + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#bitmapMask + * @type {[type]} + * @since 3.0.0 + */ + this.bitmapMask = renderable; - if (!dstTexture) - { - var wrapping = gl.CLAMP_TO_EDGE; + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskRenderTarget + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.maskRenderTarget = null; - if (IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height)) - { - wrapping = gl.REPEAT; - } + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainRenderTarget + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.mainRenderTarget = null; - dstTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true); - } - else - { - this.setTexture2D(dstTexture, 0); + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskTexture + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.maskTexture = null; - if (!shouldReallocate) - { - gl.texSubImage2D(0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); - } - else - { - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); - dstTexture.width = srcCanvas.width; - dstTexture.height = srcCanvas.height; - } + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainTexture + * @type {[type]} + * @default null + * @since 3.0.0 + */ + this.mainTexture = null; - this.setTexture2D(null, 0); - } + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#dirty + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.dirty = true; - return dstTexture; - }, + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer + * @type {WebGLFramebuffer} + * @since 3.0.0 + */ + this.mainFramebuffer = null; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter - * @since 3.0.0 - * - * @param {integer} texture - [description] - * @param {integer} filter - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setTextureFilter: function (texture, filter) - { - var gl = this.gl; - var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer + * @type {WebGLFramebuffer} + * @since 3.0.0 + */ + this.maskFramebuffer = null; - this.setTexture2D(texture, 0); + /** + * [description] + * + * @name Phaser.Display.Masks.BitmapMask#invertAlpha + * @type {boolean} + * @since 3.1.2 + */ + this.invertAlpha = false; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); + if (renderer.gl) + { + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; - this.setTexture2D(null, 0); + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); + + renderer.onContextRestored(function (renderer) + { + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; - return this; - }, + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setFloat1: function (program, name, x) - { - this.setProgram(program); - this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); - return this; + }, this); + } }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 + * @method Phaser.Display.Masks.BitmapMask#setBitmap * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderable - [description] */ - setFloat2: function (program, name, x, y) + setBitmap: function (renderable) { - this.setProgram(program); - this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); - return this; + this.bitmapMask = renderable; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 + * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} z - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} maskedObject - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ - setFloat3: function (program, name, x, y, z) + preRenderWebGL: function (renderer, maskedObject, camera) { - this.setProgram(program); - this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); - return this; + renderer.pipelines.BitmapMaskPipeline.beginMask(this, maskedObject, camera); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 + * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} z - [description] - * @param {float} w - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setFloat4: function (program, name, x, y, z, w) + postRenderWebGL: function (renderer) { - this.setProgram(program); - this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); - return this; + renderer.pipelines.BitmapMaskPipeline.endMask(this); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 + * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ - setInt1: function (program, name, x) + preRenderCanvas: function () { - this.setProgram(program); - this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); - return this; + // NOOP }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 + * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setInt2: function (program, name, x, y) + postRenderCanvas: function () { - this.setProgram(program); - this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); - return this; - }, + // NOOP + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] - */ - setInt3: function (program, name, x, y, z) +}); + +module.exports = BitmapMask; + + +/***/ }), +/* 505 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * [description] + * + * @class GeometryMask + * @memberOf Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - [description] + * @param {[type]} graphicsGeometry - [description] + */ +var GeometryMask = new Class({ + + initialize: + + function GeometryMask (scene, graphicsGeometry) { - this.setProgram(program); - this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); - return this; + /** + * [description] + * + * @name Phaser.Display.Masks.GeometryMask#geometryMask + * @type {Phaser.GameObjects.Graphics} + * @since 3.0.0 + */ + this.geometryMask = graphicsGeometry; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 + * @method Phaser.Display.Masks.GeometryMask#setShape * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {integer} x - [description] - * @param {integer} y - [description] - * @param {integer} z - [description] - * @param {integer} w - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description] */ - setInt4: function (program, name, x, y, z, w) + setShape: function (graphicsGeometry) { - this.setProgram(program); - this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); - return this; + this.geometryMask = graphicsGeometry; }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 + * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setMatrix2: function (program, name, transpose, matrix) + preRenderWebGL: function (renderer, mask, camera) { - this.setProgram(program); - this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var gl = renderer.gl; + var geometryMask = this.geometryMask; + + // Force flushing before drawing to stencil buffer + renderer.flush(); + + // Enable and setup GL state to write to stencil buffer + gl.enable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.NOTEQUAL, 1, 1); + gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); + + // Write stencil buffer + geometryMask.renderWebGL(renderer, geometryMask, 0.0, camera); + renderer.flush(); + + // Use stencil buffer to affect next rendering object + gl.colorMask(true, true, true, true); + gl.stencilFunc(gl.EQUAL, 1, 1); + gl.stencilOp(gl.INVERT, gl.INVERT, gl.INVERT); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 + * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] */ - setMatrix3: function (program, name, transpose, matrix) + postRenderWebGL: function (renderer) { - this.setProgram(program); - this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var gl = renderer.gl; + + // Force flush before disabling stencil test + renderer.flush(); + gl.disable(gl.STENCIL_TEST); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 + * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas * @since 3.0.0 * - * @param {WebGLProgram} program - [description] - * @param {string} name - [description] - * @param {boolean} transpose - [description] - * @param {Float32Array} matrix - [description] - * - * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] + * @param {[type]} renderer - [description] + * @param {[type]} mask - [description] + * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - setMatrix4: function (program, name, transpose, matrix) + preRenderCanvas: function (renderer, mask, camera) { - this.setProgram(program); - this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); - return this; + var geometryMask = this.geometryMask; + + renderer.currentContext.save(); + + geometryMask.renderCanvas(renderer, geometryMask, 0.0, camera, null, true); + + renderer.currentContext.clip(); }, /** * [description] * - * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy + * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas * @since 3.0.0 + * + * @param {[type]} renderer - [description] */ - destroy: function () + postRenderCanvas: function (renderer) { - // Clear-up anything that should be cleared :) - for (var key in this.pipelines) - { - this.pipelines[key].destroy(); - delete this.pipelines[key]; - } - - for (var index = 0; index < this.nativeTextures.length; ++index) - { - this.deleteTexture(this.nativeTextures[index]); - delete this.nativeTextures[index]; - } - - if (this.hasExtension('WEBGL_lose_context')) - { - this.getExtension('WEBGL_lose_context').loseContext(); - } - - delete this.gl; - delete this.game; - - this.contextLost = true; - this.extensions = {}; - this.nativeTextures.length = 0; + renderer.currentContext.restore(); } }); -module.exports = WebGLRenderer; +module.exports = GeometryMask; /***/ }), -/* 507 */ -/***/ (function(module, exports) { +/* 506 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -89014,289 +90758,212 @@ module.exports = WebGLRenderer; */ /** - * [description] - * - * @function Phaser.Renderer.Snapshot.WebGL - * @since 3.0.0 - * - * @param {HTMLCanvasElement} sourceCanvas - [description] - * @param {string} [type='image/png'] - [description] - * @param {float} [encoderOptions=0.92] - [description] - * - * @return {Image} [description] + * @namespace Phaser.DOM */ -var WebGLSnapshot = function (sourceCanvas, type, encoderOptions) -{ - if (!type) { type = 'image/png'; } - if (!encoderOptions) { encoderOptions = 0.92; } - - var gl = sourceCanvas.getContext('experimental-webgl'); - var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); - gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - - // CanvasPool? - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - var imageData; - - canvas.width = gl.drawingBufferWidth; - canvas.height = gl.drawingBufferHeight; - - imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); - var data = imageData.data; - - for (var y = 0; y < canvas.height; y += 1) - { - for (var x = 0; x < canvas.width; x += 1) - { - var si = ((canvas.height - y) * canvas.width + x) * 4; - var di = (y * canvas.width + x) * 4; - data[di + 0] = pixels[si + 0]; - data[di + 1] = pixels[si + 1]; - data[di + 2] = pixels[si + 2]; - data[di + 3] = pixels[si + 3]; - } - } - - ctx.putImageData(imageData, 0, 0); - - var src = canvas.toDataURL(type, encoderOptions); - var image = new Image(); +module.exports = { - image.src = src; + AddToDOM: __webpack_require__(124), + DOMContentLoaded: __webpack_require__(232), + ParseXML: __webpack_require__(233), + RemoveFromDOM: __webpack_require__(234), + RequestAnimationFrame: __webpack_require__(235) - return image; }; -module.exports = WebGLSnapshot; - /***/ }), -/* 508 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var Class = __webpack_require__(0); -var ShaderSourceFS = __webpack_require__(509); -var ShaderSourceVS = __webpack_require__(510); -var WebGLPipeline = __webpack_require__(126); - -/** - * @classdesc - * [description] - * - * @class BitmapMaskPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] - */ -var BitmapMaskPipeline = new Class({ - - Extends: WebGLPipeline, - - initialize: - - function BitmapMaskPipeline (game, gl, renderer) - { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: ShaderSourceFS, - vertexCapacity: 3, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2, - - vertices: new Float32Array([ - -1, +1, -1, -7, +7, +1 - ]).buffer, +/* 507 */ +/***/ (function(module, exports) { - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - } - ] - }); +// shim for using process in browser +var process = module.exports = {}; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#maxQuads - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.maxQuads = 1; +var cachedSetTimeout; +var cachedClearTimeout; - /** - * [description] - * - * @name Phaser.Renderer.WebGL.BitmapMaskPipeline#resolutionDirty - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.resolutionDirty = true; - }, +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#onBind - * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] - */ - onBind: function () - { - WebGLPipeline.prototype.onBind.call(this); - var renderer = this.renderer; - var program = this.program; - - if (this.resolutionDirty) - { - renderer.setFloat2(program, 'uResolution', this.width, this.height); - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uMaskSampler', 1); - this.resolutionDirty = false; +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); } + } - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#resize - * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.BitmapMaskPipeline} [description] - */ - resize: function (width, height, resolution) - { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.resolutionDirty = true; - return this; - }, - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#beginMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - [description] - * @param {Phaser.GameObjects.GameObject} maskedObject - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - beginMask: function (mask, maskedObject, camera) - { - var bitmapMask = mask.bitmapMask; - var renderer = this.renderer; - var gl = this.gl; - var visible = bitmapMask.visible; +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - if (bitmapMask && gl) - { - // First we clear the mask framebuffer - renderer.setFramebuffer(mask.maskFramebuffer); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} - // We render out mask source - bitmapMask.visible = true; - bitmapMask.renderWebGL(renderer, bitmapMask, 0.0, camera); - bitmapMask.visible = visible; - renderer.flush(); +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - // Bind and clear our main source (masked object) - renderer.setFramebuffer(mask.mainFramebuffer); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } } - }, - - /** - * [description] - * - * @method Phaser.Renderer.WebGL.BitmapMaskPipeline#endMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - [description] - */ - endMask: function (mask) - { - var bitmapMask = mask.bitmapMask; - var renderer = this.renderer; - var gl = this.gl; + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - if (bitmapMask) - { - // Return to default framebuffer - renderer.setFramebuffer(null); - - // Bind bitmap mask pipeline and draw - renderer.setPipeline(this); - - renderer.setTexture2D(mask.maskTexture, 1); - renderer.setTexture2D(mask.mainTexture, 0); - - // Finally draw a triangle filling the whole screen - gl.drawArrays(this.topology, 0, 3); +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; -}); +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; -module.exports = BitmapMaskPipeline; +function noop() {} +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; -/***/ }), -/* 509 */ -/***/ (function(module, exports) { +process.listeners = function (name) { return [] } -module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uMaskSampler;\r\n\r\nvoid main()\r\n{\r\n vec2 uv = gl_FragCoord.xy / uResolution;\r\n vec4 mainColor = texture2D(uMainSampler, uv);\r\n vec4 maskColor = texture2D(uMaskSampler, uv);\r\n float alpha = maskColor.a * mainColor.a;\r\n gl_FragColor = vec4(mainColor.rgb * alpha, alpha);\r\n}\r\n" +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; -/***/ }), -/* 510 */ -/***/ (function(module, exports) { +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; -module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision mediump float;\r\n\r\nattribute vec2 inPosition;\r\n\r\nvoid main()\r\n{\r\n gl_Position = vec4(inPosition, 0.0, 1.0);\r\n}\r\n" /***/ }), -/* 511 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89306,1246 +90973,1162 @@ module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision med */ var Class = __webpack_require__(0); -var Commands = __webpack_require__(127); -var Earcut = __webpack_require__(235); -var ModelViewProjection = __webpack_require__(236); -var ShaderSourceFS = __webpack_require__(512); -var ShaderSourceVS = __webpack_require__(513); -var Utils = __webpack_require__(42); -var WebGLPipeline = __webpack_require__(126); - -var Point = function (x, y, width, rgb, alpha) -{ - this.x = x; - this.y = y; - this.width = width; - this.rgb = rgb; - this.alpha = alpha; -}; - -var Path = function (x, y, width, rgb, alpha) -{ - this.points = []; - this.pointsLength = 1; - this.points[0] = new Point(x, y, width, rgb, alpha); -}; +var EE = __webpack_require__(14); +var PluginManager = __webpack_require__(12); -var currentMatrix = new Float32Array([ 1, 0, 0, 1, 0, 0 ]); -var matrixStack = new Float32Array(6 * 1000); -var matrixStackLength = 0; -var pathArray = []; +/** + * @namespace Phaser.Events + */ /** * @classdesc - * [description] + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. * - * @class FlatTintPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberOf Phaser.Renderer.WebGL + * @class EventEmitter + * @extends EventEmitter + * @memberOf Phaser.Events * @constructor * @since 3.0.0 - * - * @param {Phaser.Game} game - [description] - * @param {WebGLRenderingContext} gl - [description] - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description] */ -var FlatTintPipeline = new Class({ - - Extends: WebGLPipeline, +var EventEmitter = new Class({ - Mixins: [ - ModelViewProjection - ], + Extends: EE, initialize: - function FlatTintPipeline (game, gl, renderer) + function EventEmitter () { - WebGLPipeline.call(this, { - game: game, - gl: gl, - renderer: renderer, - topology: gl.TRIANGLES, - vertShader: ShaderSourceVS, - fragShader: ShaderSourceFS, - vertexCapacity: 12000, - - vertexSize: - Float32Array.BYTES_PER_ELEMENT * 2 + - Uint8Array.BYTES_PER_ELEMENT * 4, - - attributes: [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: Float32Array.BYTES_PER_ELEMENT * 2 - } - ] - }); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#vertexViewU32 - * @type {Uint32Array} - * @since 3.0.0 - */ - this.vertexViewU32 = new Uint32Array(this.vertexData); - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#tempTriangle - * @type {array} - * @since 3.0.0 - */ - this.tempTriangle = [ - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0}, - {x: 0, y: 0, width: 0, rgb: 0xFFFFFF, alpha: 1.0} - ]; - - /** - * [description] - * - * @name Phaser.Renderer.WebGL.FlatTintPipeline#polygonCache - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.polygonCache = []; - - this.mvpInit(); + EE.call(this); }, /** - * [description] + * Removes all listeners. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#onBind + * @method Phaser.Events.EventEmitter#shutdown * @since 3.0.0 - * - * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] */ - onBind: function () + shutdown: function () { - WebGLPipeline.prototype.onBind.call(this); - this.mvpUpdate(); - - return this; + this.removeAllListeners(); }, /** - * [description] + * Removes all listeners. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#resize + * @method Phaser.Events.EventEmitter#destroy * @since 3.0.0 - * - * @param {number} width - [description] - * @param {number} height - [description] - * @param {number} resolution - [description] - * - * @return {Phaser.Renderer.WebGL.FlatTintPipeline} [description] */ - resize: function (width, height, resolution) + destroy: function () { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); - - return this; - }, + this.removeAllListeners(); + } - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillRect - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x - [description] - * @param {float} y - [description] - * @param {float} width - [description] - * @param {float} height - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) - { - this.renderer.setPipeline(this); +}); - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = this.vertexCount * this.vertexComponentCount; - var xw = x + width; - var yh = y + height; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tx0 = x * a + y * c + e; - var ty0 = x * b + y * d + f; - var tx1 = x * a + yh * c + e; - var ty1 = x * b + yh * d + f; - var tx2 = xw * a + yh * c + e; - var ty2 = xw * b + yh * d + f; - var tx3 = xw * a + y * c + e; - var ty3 = xw * b + y * d + f; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); +/** + * @namespace EventEmitter + */ - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; - vertexViewF32[vertexOffset + 9] = tx0; - vertexViewF32[vertexOffset + 10] = ty0; - vertexViewU32[vertexOffset + 11] = tint; - vertexViewF32[vertexOffset + 12] = tx2; - vertexViewF32[vertexOffset + 13] = ty2; - vertexViewU32[vertexOffset + 14] = tint; - vertexViewF32[vertexOffset + 15] = tx3; - vertexViewF32[vertexOffset + 16] = ty3; - vertexViewU32[vertexOffset + 17] = tint; +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method EventEmitter#eventNames + * + * @return {array} + */ - this.vertexCount += 6; - }, +/** + * Return the listeners registered for a given event. + * + * @method EventEmitter#listeners + * + * @param {string|symbol} event - The event name. + * + * @return {array} The registered listeners. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillTriangle - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x0 - [description] - * @param {float} y0 - [description] - * @param {float} x1 - [description] - * @param {float} y1 - [description] - * @param {float} x2 - [description] - * @param {float} y2 - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) - { - this.renderer.setPipeline(this); +/** + * Return the number of listeners listening to a given event. + * + * @method EventEmitter#listenerCount + * + * @param {string|symbol} event - The event name. + * + * @return {number} The number of listeners. + */ - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - } +/** + * Calls each of the listeners registered for a given event. + * + * @method EventEmitter#emit + * + * @param {string|symbol} event - The event name. + * + * @return {Boolean} `true` if the event had listeners, else `false`. + */ - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = this.vertexCount * this.vertexComponentCount; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tx0 = x0 * a + y0 * c + e; - var ty0 = x0 * b + y0 * d + f; - var tx1 = x1 * a + y1 * c + e; - var ty1 = x1 * b + y1 * d + f; - var tx2 = x2 * a + y2 * c + e; - var ty2 = x2 * b + y2 * d + f; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); +/** + * Add a listener for a given event. + * + * @method EventEmitter#on + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; +/** + * Add a listener for a given event. + * + * @method EventEmitter#addListener + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ - this.vertexCount += 3; - }, +/** + * Add a one-time listener for a given event. + * + * @method EventEmitter#once + * + * @param {string|symbol} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {EventEmitter} `this`. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokeTriangle - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} x0 - [description] - * @param {float} y0 - [description] - * @param {float} x1 - [description] - * @param {float} y1 - [description] - * @param {float} x2 - [description] - * @param {float} y2 - [description] - * @param {float} lineWidth - [description] - * @param {integer} lineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a - [description] - * @param {float} b - [description] - * @param {float} c - [description] - * @param {float} d - [description] - * @param {float} e - [description] - * @param {float} f - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix) - { - var tempTriangle = this.tempTriangle; +/** + * Remove the listeners of a given event. + * + * @method EventEmitter#removeListener + * + * @param {string|symbol} event - The event name. + * @param {function} fn - Only remove the listeners that match this function. + * @param {*} context - Only remove the listeners that have this context. + * @param {boolean} once - Only remove one-time listeners. + * + * @return {EventEmitter} `this`. + */ - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - tempTriangle[0].rgb = lineColor; - tempTriangle[0].alpha = lineAlpha; - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - tempTriangle[1].rgb = lineColor; - tempTriangle[1].alpha = lineAlpha; - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; - tempTriangle[2].rgb = lineColor; - tempTriangle[2].alpha = lineAlpha; - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; - tempTriangle[3].rgb = lineColor; - tempTriangle[3].alpha = lineAlpha; +/** + * Remove the listeners of a given event. + * + * @method EventEmitter#off + * + * @param {string|symbol} event - The event name. + * @param {function} fn - Only remove the listeners that match this function. + * @param {*} context - Only remove the listeners that have this context. + * @param {boolean} once - Only remove one-time listeners. + * + * @return {EventEmitter} `this`. + */ - this.batchStrokePath( - srcX, srcY, srcScaleX, srcScaleY, srcRotation, - tempTriangle, lineWidth, lineColor, lineAlpha, - a, b, c, d, e, f, - false, - currentMatrix - ); - }, +/** + * Remove all listeners, or those of the specified event. + * + * @method EventEmitter#removeAllListeners + * + * @param {string|symbol} [event] - The event name. + * + * @return {EventEmitter} `this`. + */ - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchFillPath - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} path - [description] - * @param {integer} fillColor - [description] - * @param {float} fillAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) - { - this.renderer.setPipeline(this); +PluginManager.register('EventEmitter', EventEmitter, 'events'); - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; - var v0, v1, v2; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset = 0; - var x0, y0, x1, y1, x2, y2; - var tx0, ty0, tx1, ty1, tx2, ty2; - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var tint = Utils.getTintAppendFloatAlphaAndSwap(fillColor, fillAlpha); +module.exports = EventEmitter; - for (var pathIndex = 0; pathIndex < length; ++pathIndex) - { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); - } - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; +/***/ }), +/* 509 */ +/***/ (function(module, exports, __webpack_require__) { - for (var index = 0; index < length; index += 3) - { - v0 = polygonIndexArray[index + 0] * 2; - v1 = polygonIndexArray[index + 1] * 2; - v2 = polygonIndexArray[index + 2] * 2; +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - } +var AddToDOM = __webpack_require__(124); +var AnimationManager = __webpack_require__(197); +var CacheManager = __webpack_require__(200); +var CanvasPool = __webpack_require__(19); +var Class = __webpack_require__(0); +var Config = __webpack_require__(510); +var CreateRenderer = __webpack_require__(511); +var DataManager = __webpack_require__(79); +var DebugHeader = __webpack_require__(519); +var Device = __webpack_require__(520); +var DOMContentLoaded = __webpack_require__(232); +var EventEmitter = __webpack_require__(14); +var InputManager = __webpack_require__(240); +var NOOP = __webpack_require__(3); +var PluginManager = __webpack_require__(12); +var SceneManager = __webpack_require__(252); +var SoundManagerCreator = __webpack_require__(256); +var TextureManager = __webpack_require__(263); +var TimeStep = __webpack_require__(543); +var VisibilityHandler = __webpack_require__(544); - vertexOffset = this.vertexCount * this.vertexComponentCount; +/** + * @classdesc + * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible + * for handling the boot process, parsing the configuration values, creating the renderer, + * and setting-up all of the global Phaser systems, such as sound and input. + * Once that is complete it will start the Scene Manager and then begin the main game loop. + * + * You should generally avoid accessing any of the systems created by Game, and instead use those + * made available to you via the Phaser.Scene Systems class instead. + * + * @class Game + * @memberOf Phaser + * @constructor + * @since 3.0.0 + * + * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. + */ +var Game = new Class({ - x0 = polygonCache[v0 + 0]; - y0 = polygonCache[v0 + 1]; - x1 = polygonCache[v1 + 0]; - y1 = polygonCache[v1 + 1]; - x2 = polygonCache[v2 + 0]; - y2 = polygonCache[v2 + 1]; + initialize: - tx0 = x0 * a + y0 * c + e; - ty0 = x0 * b + y0 * d + f; - tx1 = x1 * a + y1 * c + e; - ty1 = x1 * b + y1 * d + f; - tx2 = x2 * a + y2 * c + e; - ty2 = x2 * b + y2 * d + f; + function Game (config) + { + /** + * The parsed Game Configuration object. + * + * The values stored within this object are read-only and should not be changed at run-time. + * + * @name Phaser.Game#config + * @type {Phaser.Boot.Config} + * @readOnly + * @since 3.0.0 + */ + this.config = new Config(config); - vertexViewF32[vertexOffset + 0] = tx0; - vertexViewF32[vertexOffset + 1] = ty0; - vertexViewU32[vertexOffset + 2] = tint; - vertexViewF32[vertexOffset + 3] = tx1; - vertexViewF32[vertexOffset + 4] = ty1; - vertexViewU32[vertexOffset + 5] = tint; - vertexViewF32[vertexOffset + 6] = tx2; - vertexViewF32[vertexOffset + 7] = ty2; - vertexViewU32[vertexOffset + 8] = tint; + /** + * A reference to either the Canvas or WebGL Renderer that this Game is using. + * + * @name Phaser.Game#renderer + * @type {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = null; - this.vertexCount += 3; - } + /** + * A reference to the HTML Canvas Element on which the renderer is drawing. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; - polygonCache.length = 0; - }, + /** + * A reference to the Canvas Rendering Context belonging to the Canvas Element this game is rendering to. + * + * @name Phaser.Game#context + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.context = null; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchStrokePath - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {array} path - [description] - * @param {float} lineWidth - [description] - * @param {integer} lineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a - [description] - * @param {float} b - [description] - * @param {float} c - [description] - * @param {float} d - [description] - * @param {float} e - [description] - * @param {float} f - [description] - * @param {boolean} isLastPath - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchStrokePath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, isLastPath, currentMatrix) - { - this.renderer.setPipeline(this); + /** + * A flag indicating when this Game instance has finished its boot process. + * + * @name Phaser.Game#isBooted + * @type {boolean} + * @readOnly + * @since 3.0.0 + */ + this.isBooted = false; - var point0, point1; - var pathLength = path.length; - var polylines = this.polygonCache; - var last, curr; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var vertexOffset; - var line; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + /** + * A flag indicating if this Game is currently running its game step or not. + * + * @name Phaser.Game#isRunning + * @type {boolean} + * @readOnly + * @since 3.0.0 + */ + this.isRunning = false; - for (var pathIndex = 0; pathIndex + 1 < pathLength; pathIndex += 1) - { - point0 = path[pathIndex]; - point1 = path[pathIndex + 1]; + /** + * An Event Emitter which is used to broadcast game-level events from the global systems. + * + * @name Phaser.Game#events + * @type {EventEmitter} + * @since 3.0.0 + */ + this.events = new EventEmitter(); - line = this.batchLine( - srcX, srcY, srcScaleX, srcScaleY, srcRotation, - point0.x, point0.y, - point1.x, point1.y, - point0.width / 2, point1.width / 2, - point0.rgb, point1.rgb, lineAlpha, - a, b, c, d, e, f, - currentMatrix - ); + /** + * An instance of the Animation Manager. + * + * The Animation Manager is a global system responsible for managing all animations used within your game. + * + * @name Phaser.Game#anims + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.anims = new AnimationManager(this); - polylines.push(line); - } + /** + * An instance of the Texture Manager. + * + * The Texture Manager is a global system responsible for managing all textures being used by your game. + * + * @name Phaser.Game#textures + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.textures = new TextureManager(this); - /* Render joints */ - for (var index = 1, polylinesLength = polylines.length; index < polylinesLength; ++index) - { - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } + /** + * An instance of the Cache Manager. + * + * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. + * + * @name Phaser.Game#cache + * @type {Phaser.Cache.CacheManager} + * @since 3.0.0 + */ + this.cache = new CacheManager(this); - last = polylines[index - 1] || polylines[polylinesLength - 1]; - curr = polylines[index]; - vertexOffset = this.vertexCount * this.vertexComponentCount; + /** + * [description] + * + * @name Phaser.Game#registry + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.registry = new DataManager(this); - vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0]; - vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1]; - vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha); - vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0]; - vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1]; - vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha); - vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0]; - vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1]; - vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha); - vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0]; - vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1]; - vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha); - vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0]; - vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1]; - vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha); - vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0]; - vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1]; - vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha); + /** + * An instance of the Input Manager. + * + * The Input Manager is a global system responsible for the capture of browser-level input events. + * + * @name Phaser.Game#input + * @type {Phaser.Input.InputManager} + * @since 3.0.0 + */ + this.input = new InputManager(this, this.config); - this.vertexCount += 6; - } + /** + * An instance of the Scene Manager. + * + * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. + * + * @name Phaser.Game#scene + * @type {Phaser.Scenes.SceneManager} + * @since 3.0.0 + */ + this.scene = new SceneManager(this, this.config.sceneConfig); - polylines.length = 0; - }, + /** + * A reference to the Device inspector. + * + * Contains information about the device running this game, such as OS, browser vendor and feature support. + * Used by various systems to determine capabilities and code paths. + * + * @name Phaser.Game#device + * @type {Phaser.Device} + * @since 3.0.0 + */ + this.device = Device; - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchLine - * @since 3.0.0 - * - * @param {float} srcX - [description] - * @param {float} srcY - [description] - * @param {float} srcScaleX - [description] - * @param {float} srcScaleY - [description] - * @param {float} srcRotation - [description] - * @param {float} ax - [description] - * @param {float} ay - [description] - * @param {float} bx - [description] - * @param {float} by - [description] - * @param {float} aLineWidth - [description] - * @param {float} bLineWidth - [description] - * @param {integer} aLineColor - [description] - * @param {integer} bLineColor - [description] - * @param {float} lineAlpha - [description] - * @param {float} a1 - [description] - * @param {float} b1 - [description] - * @param {float} c1 - [description] - * @param {float} d1 - [description] - * @param {float} e1 - [description] - * @param {float} f1 - [description] - * @param {Float32Array} currentMatrix - [description] - */ - batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix) - { - this.renderer.setPipeline(this); + /** + * An instance of the base Sound Manager. + * + * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. + * + * @name Phaser.Game#sound + * @type {Phaser.BaseSoundManager} + * @since 3.0.0 + */ + this.sound = SoundManagerCreator.create(this); - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - var renderer = this.renderer; - var resolution = renderer.config.resolution; // eslint-disable-line no-unused-vars - var a0 = currentMatrix[0]; - var b0 = currentMatrix[1]; - var c0 = currentMatrix[2]; - var d0 = currentMatrix[3]; - var e0 = currentMatrix[4]; - var f0 = currentMatrix[5]; - var a = a1 * a0 + b1 * c0; - var b = a1 * b0 + b1 * d0; - var c = c1 * a0 + d1 * c0; - var d = c1 * b0 + d1 * d0; - var e = e1 * a0 + f1 * c0 + e0; - var f = e1 * b0 + f1 * d0 + f0; - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - var dx = bx - ax; - var dy = by - ay; - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; - var x0 = lx0 * a + ly0 * c + e; - var y0 = lx0 * b + ly0 * d + f; - var x1 = lx1 * a + ly1 * c + e; - var y1 = lx1 * b + ly1 * d + f; - var x2 = lx2 * a + ly2 * c + e; - var y2 = lx2 * b + ly2 * d + f; - var x3 = lx3 * a + ly3 * c + e; - var y3 = lx3 * b + ly3 * d + f; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; - var aTint = getTint(aLineColor, lineAlpha); - var bTint = getTint(bLineColor, lineAlpha); - var vertexOffset = this.vertexCount * this.vertexComponentCount; + /** + * An instance of the Time Step. + * + * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing + * them and calculating delta values. It then automatically calls the game step. + * + * @name Phaser.Game#loop + * @type {Phaser.Boot.TimeStep} + * @since 3.0.0 + */ + this.loop = new TimeStep(this, this.config.fps); - vertexViewF32[vertexOffset + 0] = x0; - vertexViewF32[vertexOffset + 1] = y0; - vertexViewU32[vertexOffset + 2] = bTint; - vertexViewF32[vertexOffset + 3] = x1; - vertexViewF32[vertexOffset + 4] = y1; - vertexViewU32[vertexOffset + 5] = aTint; - vertexViewF32[vertexOffset + 6] = x2; - vertexViewF32[vertexOffset + 7] = y2; - vertexViewU32[vertexOffset + 8] = bTint; - vertexViewF32[vertexOffset + 9] = x1; - vertexViewF32[vertexOffset + 10] = y1; - vertexViewU32[vertexOffset + 11] = aTint; - vertexViewF32[vertexOffset + 12] = x3; - vertexViewF32[vertexOffset + 13] = y3; - vertexViewU32[vertexOffset + 14] = aTint; - vertexViewF32[vertexOffset + 15] = x2; - vertexViewF32[vertexOffset + 16] = y2; - vertexViewU32[vertexOffset + 17] = bTint; + /** + * An instance of the Plugin Manager. + * + * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install + * those plugins into Scenes as required. + * + * @name Phaser.Game#plugins + * @type {Phaser.Boot.PluginManager} + * @since 3.0.0 + */ + this.plugins = new PluginManager(this, this.config); - this.vertexCount += 6; + /** + * The `onStepCallback` is a callback that is fired each time the Time Step ticks. + * It is set automatically when the Game boot process has completed. + * + * @name Phaser.Game#onStepCallback + * @type {function} + * @private + * @since 3.0.0 + */ + this.onStepCallback = NOOP; - return [ - x0, y0, bLineColor, - x1, y1, aLineColor, - x2, y2, bLineColor, - x3, y3, aLineColor - ]; + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); }, /** - * [description] + * Game boot event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchGraphics - * @since 3.0.0 + * This is an internal event dispatched when the game has finished booting, but before it is ready to start running. + * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. * - * @param {Phaser.GameObjects.Graphics} graphics - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @event Phaser.Game#boot */ - batchGraphics: function (graphics, camera) - { - if (graphics.commandBuffer.length <= 0) { return; } - - this.renderer.setPipeline(this); - - var cameraScrollX = camera.scrollX * graphics.scrollFactorX; - var cameraScrollY = camera.scrollY * graphics.scrollFactorY; - var srcX = graphics.x - cameraScrollX; - var srcY = graphics.y - cameraScrollY; - var srcScaleX = graphics.scaleX; - var srcScaleY = graphics.scaleY; - var srcRotation = -graphics.rotation; - var commands = graphics.commandBuffer; - var lineAlpha = 1.0; - var fillAlpha = 1.0; - var lineColor = 0; - var fillColor = 0; - var lineWidth = 1.0; - var cameraMatrix = camera.matrix.matrix; - var lastPath = null; - var iteration = 0; - var iterStep = 0.01; - var tx = 0; - var ty = 0; - var ta = 0; - var x = 0; - var y = 0; - var radius = 0; - var startAngle = 0; - var endAngle = 0; - var anticlockwise = 0; - var path = null; - var sin = Math.sin; - var cos = Math.cos; - var sr = sin(srcRotation); - var cr = cos(srcRotation); - var sra = cr * srcScaleX; - var srb = -sr * srcScaleX; - var src = sr * srcScaleY; - var srd = cr * srcScaleY; - var sre = srcX; - var srf = srcY; - var cma = cameraMatrix[0]; - var cmb = cameraMatrix[1]; - var cmc = cameraMatrix[2]; - var cmd = cameraMatrix[3]; - var cme = cameraMatrix[4]; - var cmf = cameraMatrix[5]; - var mva = sra * cma + srb * cmc; - var mvb = sra * cmb + srb * cmd; - var mvc = src * cma + srd * cmc; - var mvd = src * cmb + srd * cmd; - var mve = sre * cma + srf * cmc + cme; - var mvf = sre * cmb + srf * cmd + cmf; - - var pathArrayIndex; - var pathArrayLength; - - pathArray.length = 0; - - for (var cmdIndex = 0, cmdLength = commands.length; cmdIndex < cmdLength; ++cmdIndex) - { - cmd = commands[cmdIndex]; - - switch (cmd) - { - case Commands.ARC: - iteration = 0; - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - radius = commands[cmdIndex + 3]; - startAngle = commands[cmdIndex + 4]; - endAngle = commands[cmdIndex + 5]; - anticlockwise = commands[cmdIndex + 6]; - if (anticlockwise) - { - ta = endAngle; - endAngle = startAngle; - startAngle = -ta; - } - - while (iteration < 1) - { - ta = (endAngle - startAngle) * iteration + startAngle; - tx = x + cos(ta) * radius; - ty = y + sin(ta) * radius; + /** + * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, + * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. + * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. + * + * @method Phaser.Game#boot + * @protected + * @fires Phaser.Game#boot + * @since 3.0.0 + */ + boot: function () + { + this.isBooted = true; - if (iteration === 0) - { - lastPath = new Path(tx, ty, lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - } - else - { - lastPath.points.push(new Point(tx, ty, lineWidth, lineColor, lineAlpha)); - } + this.config.preBoot(this); - iteration += iterStep; - } - cmdIndex += 6; - break; + CreateRenderer(this); - case Commands.LINE_STYLE: - lineWidth = commands[cmdIndex + 1]; - lineColor = commands[cmdIndex + 2]; - lineAlpha = commands[cmdIndex + 3]; - cmdIndex += 3; - break; + DebugHeader(this); - case Commands.FILL_STYLE: - fillColor = commands[cmdIndex + 1]; - fillAlpha = commands[cmdIndex + 2]; - cmdIndex += 2; - break; + AddToDOM(this.canvas, this.config.parent); - case Commands.BEGIN_PATH: - pathArray.length = 0; - break; + this.events.emit('boot'); - case Commands.CLOSE_PATH: - if (lastPath !== null && lastPath.points.length > 0) - { - var firstPoint = lastPath.points[0]; - var lastPoint = lastPath.points[lastPath.points.length - 1]; - lastPath.points.push(firstPoint); - lastPath = new Path(lastPoint.x, lastPoint.y, lastPoint.width, lastPoint.rgb, lastPoint.alpha); - pathArray.push(lastPath); - } - break; + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready, so it will emit this event + this.events.once('ready', this.start, this); + }, - case Commands.FILL_PATH: - for (pathArrayIndex = 0, pathArrayLength = pathArray.length; - pathArrayIndex < pathArrayLength; - ++pathArrayIndex) - { - this.batchFillPath( + /** + * Called automatically by Game.boot once all of the global systems have finished setting themselves up. + * By this point the Game is now ready to start the main loop running. + * It will also enable the Visibility Handler. + * + * @method Phaser.Game#start + * @protected + * @since 3.0.0 + */ + start: function () + { + this.isRunning = true; - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.config.postBoot(this); - /* Rectangle properties */ - pathArray[pathArrayIndex].points, - fillColor, - fillAlpha, + if (this.renderer) + { + this.loop.start(this.step.bind(this)); + } + else + { + this.loop.start(this.headlessStep.bind(this)); + } - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - } - break; + VisibilityHandler(this.events); - case Commands.STROKE_PATH: - for (pathArrayIndex = 0, pathArrayLength = pathArray.length; - pathArrayIndex < pathArrayLength; - ++pathArrayIndex) - { - path = pathArray[pathArrayIndex]; - this.batchStrokePath( + this.events.on('hidden', this.onHidden, this); + this.events.on('visible', this.onVisible, this); + this.events.on('blur', this.onBlur, this); + this.events.on('focus', this.onFocus, this); + }, - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + /** + * Game Pre-Render event. + * + * This event is dispatched immediately before any of the Scenes have started to render. + * The renderer will already have been initialized this frame, clearing itself and preparing to receive + * the Scenes for rendering, but it won't have actually drawn anything yet. + * + * @event Phaser.Game#prerenderEvent + * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. + */ - /* Rectangle properties */ - path.points, - lineWidth, - lineColor, - lineAlpha, + /** + * Game Post-Render event. + * + * This event is dispatched right at the end of the render process. + * Every Scene will have rendered and drawn to the canvas. + * + * @event Phaser.Game#postrenderEvent + * @param {Phaser.Renderer.CanvasRenderer|Phaser.Renderer.WebGLRenderer} renderer - A reference to the current renderer. + */ - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - path === this._lastPath, - currentMatrix - ); - } - break; - - case Commands.FILL_RECT: - this.batchFillRect( + /** + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) + * + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * + * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * + * @method Phaser.Game#step + * @fires Phaser.Game#prerenderEvent + * @fires Phaser.Game#postrenderEvent + * @since 3.0.0 + * + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + step: function (time, delta) + { + // Global Managers - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.input.update(time, delta); - /* Rectangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - fillColor, - fillAlpha, + this.sound.update(time, delta); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 4; - break; + // Scenes - case Commands.FILL_TRIANGLE: - this.batchFillTriangle( + this.onStepCallback(); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.scene.update(time, delta); - /* Triangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5], - commands[cmdIndex + 6], - fillColor, - fillAlpha, + // Render - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 6; - break; + var renderer = this.renderer; - case Commands.STROKE_TRIANGLE: - this.batchStrokeTriangle( + renderer.preRender(); - /* Graphics Game Object Properties */ - srcX, srcY, srcScaleX, srcScaleY, srcRotation, + this.events.emit('prerender', renderer); - /* Triangle properties */ - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5], - commands[cmdIndex + 6], - lineWidth, - lineColor, - lineAlpha, + this.scene.render(renderer); - /* Transform */ - mva, mvb, mvc, mvd, mve, mvf, - currentMatrix - ); - - cmdIndex += 6; - break; + renderer.postRender(); - case Commands.LINE_TO: - if (lastPath !== null) - { - lastPath.points.push(new Point(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha)); - } - else - { - lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - } - cmdIndex += 2; - break; + this.events.emit('postrender', renderer); + }, - case Commands.MOVE_TO: - lastPath = new Path(commands[cmdIndex + 1], commands[cmdIndex + 2], lineWidth, lineColor, lineAlpha); - pathArray.push(lastPath); - cmdIndex += 2; - break; + /** + * A special version of the Game Step for the HEADLESS renderer only. + * + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) + * + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * + * This process emits `prerender` and `postrender` events, even though nothing actually displays. + * + * @method Phaser.Game#headlessStep + * @fires Phaser.Game#prerenderEvent + * @fires Phaser.Game#postrenderEvent + * @since 3.2.0 + * + * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + headlessStep: function (time, delta) + { + // Global Managers - case Commands.LINE_FX_TO: - if (lastPath !== null) - { - lastPath.points.push(new Point( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - )); - } - else - { - lastPath = new Path( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - ); - pathArray.push(lastPath); - } - cmdIndex += 5; - break; + this.input.update(time, delta); - case Commands.MOVE_FX_TO: - lastPath = new Path( - commands[cmdIndex + 1], - commands[cmdIndex + 2], - commands[cmdIndex + 3], - commands[cmdIndex + 4], - commands[cmdIndex + 5] - ); - pathArray.push(lastPath); - cmdIndex += 5; - break; + this.sound.update(time, delta); - case Commands.SAVE: - matrixStack[matrixStackLength + 0] = currentMatrix[0]; - matrixStack[matrixStackLength + 1] = currentMatrix[1]; - matrixStack[matrixStackLength + 2] = currentMatrix[2]; - matrixStack[matrixStackLength + 3] = currentMatrix[3]; - matrixStack[matrixStackLength + 4] = currentMatrix[4]; - matrixStack[matrixStackLength + 5] = currentMatrix[5]; - matrixStackLength += 6; - break; + // Scenes - case Commands.RESTORE: - matrixStackLength -= 6; - currentMatrix[0] = matrixStack[matrixStackLength + 0]; - currentMatrix[1] = matrixStack[matrixStackLength + 1]; - currentMatrix[2] = matrixStack[matrixStackLength + 2]; - currentMatrix[3] = matrixStack[matrixStackLength + 3]; - currentMatrix[4] = matrixStack[matrixStackLength + 4]; - currentMatrix[5] = matrixStack[matrixStackLength + 5]; - break; + this.onStepCallback(); - case Commands.TRANSLATE: - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - currentMatrix[4] = currentMatrix[0] * x + currentMatrix[2] * y + currentMatrix[4]; - currentMatrix[5] = currentMatrix[1] * x + currentMatrix[3] * y + currentMatrix[5]; - cmdIndex += 2; - break; + this.scene.update(time, delta); - case Commands.SCALE: - x = commands[cmdIndex + 1]; - y = commands[cmdIndex + 2]; - currentMatrix[0] *= x; - currentMatrix[1] *= x; - currentMatrix[2] *= y; - currentMatrix[3] *= y; - cmdIndex += 2; - break; + // Render - case Commands.ROTATE: - y = commands[cmdIndex + 1]; - x = sin(y); - y = cos(y); - sra = currentMatrix[0]; - srb = currentMatrix[1]; - src = currentMatrix[2]; - srd = currentMatrix[3]; - currentMatrix[0] = y * sra + x * src; - currentMatrix[1] = y * srb + x * srd; - currentMatrix[2] = -x * sra + y * src; - currentMatrix[3] = -x * srb + y * srd; - cmdIndex += 1; - break; + this.events.emit('prerender'); - default: - // eslint-disable-next-line no-console - console.error('Phaser: Invalid Graphics Command ID ' + cmd); - break; - } - } + this.events.emit('postrender'); }, - // Stubs - /** - * [description] + * Game Pause event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawStaticTilemapLayer - * @since 3.0.0 + * This event is dispatched when the game loop enters a paused state, usually as a result of the Visibility Handler. * - * @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @event Phaser.Game#pauseEvent */ - drawStaticTilemapLayer: function () - { - }, /** - * [description] + * Called automatically by the Visibility Handler. + * This will pause the main loop and then emit a pause event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawEmitterManager + * @method Phaser.Game#onHidden + * @protected + * @fires Phaser.Game#pauseEvent * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmittermanager} emitterManager - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - drawEmitterManager: function () + onHidden: function () { + this.loop.pause(); + + this.events.emit('pause'); }, /** - * [description] + * Game Resume event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#drawBlitter - * @since 3.0.0 + * This event is dispatched when the game loop leaves a paused state and resumes running. * - * @param {Phaser.GameObjects.Blitter} blitter - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @event Phaser.Game#resumeEvent */ - drawBlitter: function () - { - }, /** - * [description] + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchSprite + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Game#resumeEvent * @since 3.0.0 - * - * @param {Phaser.GameObjects.Sprite} sprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - batchSprite: function () + onVisible: function () { + this.loop.resume(); + + this.events.emit('resume'); }, /** - * [description] + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'blurred' state, which pauses it. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchMesh + * @method Phaser.Game#onBlur + * @protected * @since 3.0.0 - * - * @param {Phaser.GameObjects.Mesh} mesh - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - batchMesh: function () + onBlur: function () { + this.loop.blur(); }, /** - * [description] + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'focused' state, which resumes it. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchBitmapText + * @method Phaser.Game#onFocus + * @protected * @since 3.0.0 - * - * @param {Phaser.GameObjects.BitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - batchBitmapText: function () + onFocus: function () { + this.loop.focus(); }, /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicBitmapText - * @since 3.0.0 + * Game Resize event. * - * @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @event Phaser.Game#resizeEvent + * @param {number} width - The new width of the Game. + * @param {number} height - The new height of the Game. */ - batchDynamicBitmapText: function () - { - }, /** - * [description] + * Updates the Game Config with the new width and height values given. + * Then resizes the Renderer and Input Manager scale. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchText - * @since 3.0.0 + * @method Phaser.Game#resize + * @since 3.2.0 * - * @param {Phaser.GameObjects.Text} text - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. */ - batchText: function () + resize: function (width, height) { + this.config.width = width; + this.config.height = height; + + this.renderer.resize(width, height); + + this.input.resize(); + + this.scene.resize(width, height); + + this.events.emit('resize', width, height); }, /** - * [description] + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchDynamicTilemapLayer + * @method Phaser.Game#destroy * @since 3.0.0 - * - * @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] */ - batchDynamicTilemapLayer: function () + destroy: function (removeCanvas) { - }, + this.loop.destroy(); - /** - * [description] - * - * @method Phaser.Renderer.WebGL.FlatTintPipeline#batchTileSprite - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TileSprite} tileSprite - [description] - * @param {Phaser.Cameras.Scene2D.Camera} camera - [description] - */ - batchTileSprite: function () + this.scene.destroy(); + + this.renderer.destroy(); + + this.events.emit('destroy'); + + this.events.removeAllListeners(); + + this.onStepCallback = null; + + if (removeCanvas) + { + CanvasPool.remove(this.canvas); + } + } + +}); + +module.exports = Game; + + +/***/ }), +/* 510 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(22); +var GetValue = __webpack_require__(4); +var MATH = __webpack_require__(16); +var NOOP = __webpack_require__(3); +var Plugins = __webpack_require__(236); +var ValueToColor = __webpack_require__(116); + +/** + * This callback type is completely empty, a no-operation. + * + * @callback NOOP + */ + +/** + * @typedef {object} FPSConfig + * + * @property {integer} [min=10] - [description] + * @property {integer} [target=60] - [description] + * @property {boolean} [forceSetTimeOut=false] - [description] + * @property {integer} [deltaHistory=10] - [description] + * @property {integer} [panicMax=120] - [description] + */ + +/** + * @typedef {object} LoaderConfig + * + * @property {string} [baseURL] - [description] + * @property {string} [path] - [description] + * @property {boolean} [enableParallel=true] - [description] + * @property {integer} [maxParallelDownloads=4] - [description] + * @property {string|undefined} [crossOrigin=undefined] - [description] + * @property {string} [responseType] - [description] + * @property {boolean} [async=true] - [description] + * @property {string} [user] - [description] + * @property {string} [password] - [description] + * @property {integer} [timeout=0] - [description] + */ + +/** + * @typedef {object} GameConfig + * + * @property {integer|string} [width=1024] - [description] + * @property {integer|string} [height=768] - [description] + * @property {number} [zoom=1] - [description] + * @property {number} [resolution=1] - [description] + * @property {number} [type=CONST.AUTO] - [description] + * @property {object} [?parent=null] - [description] + * @property {HTMLCanvasElement} [?canvas=null] - [description] + * @property {string} [?canvasStyle=null] - [description] + * @property {object} [?scene=null] - [description] + * @property {array} [seed] - [description] + * @property {string} [title=''] - [description] + * @property {string} [url='http://phaser.io'] - [description] + * @property {string} [version=''] - [description] + * @property {object} [input] - [description] + * @property {boolean} [input.keyboard=true] - [description] + * @property {object} [input.keyboard.target=window] - [description] + * @property {boolean} [input.mouse=true] - [description] + * @property {object} [?input.mouse.target=null] - [description] + * @property {boolean} [input.touch=true] - [description] + * @property {object} [?input.touch.target=null] - [description] + * @property {object} [?input.touch.capture=true] - [description] + * @property {boolean} [input.gamepad=false] - [description] + * @property {boolean} [disableContextMenu=false] - [description] + * @property {boolean} [banner=false] - [description] + * @property {boolean} [banner.hidePhaser=false] - [description] + * @property {string} [banner.text='#ffffff'] - [description] + * @property {array} [banner.background] - [description] + * @property {FPSConfig} [?fps] - [description] + * @property {boolean} [pixelArt=false] - [description] + * @property {boolean} [autoResize=false] - [description] + * @property {boolean} [roundPixels=false] - [description] + * @property {boolean} [transparent=false] - [description] + * @property {boolean} [clearBeforeRender=true] - [description] + * @property {string|number} [backgroundColor=0x000000] - [description] + * @property {object} [?callbacks] - [description] + * @property {function} [callbacks.preBoot=NOOP] - [description] + * @property {function} [callbacks.postBoot=NOOP] - [description] + * @property {LoaderConfig} [?loader] - [description] + * @property {object} [?images] - [description] + * @property {string} [images.default] - [description] + * @property {string} [images.missing] - [description] + */ + +/** + * @classdesc + * [description] + * + * @class Config + * @memberOf Phaser.Boot + * @constructor + * @since 3.0.0 + * + * @param {object} [GameConfig] - The configuration object for your Phaser Game instance. + * + */ +var Config = new Class({ + + initialize: + + function Config (config) { + if (config === undefined) { config = {}; } + + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; + + var defaultBannerTextColor = '#ffffff'; + + this.width = GetValue(config, 'width', 1024); + this.height = GetValue(config, 'height', 768); + this.zoom = GetValue(config, 'zoom', 1); + + this.resolution = GetValue(config, 'resolution', 1); + + this.renderType = GetValue(config, 'type', CONST.AUTO); + + this.parent = GetValue(config, 'parent', null); + this.canvas = GetValue(config, 'canvas', null); + this.canvasStyle = GetValue(config, 'canvasStyle', null); + + this.sceneConfig = GetValue(config, 'scene', null); + + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); + + MATH.RND.init(this.seed); + + this.gameTitle = GetValue(config, 'title', ''); + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); + this.gameVersion = GetValue(config, 'version', ''); + + // Input + this.inputKeyboard = GetValue(config, 'input.keyboard', true); + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + + this.inputMouse = GetValue(config, 'input.mouse', true); + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + + this.inputTouch = GetValue(config, 'input.touch', true); + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + + this.inputGamepad = GetValue(config, 'input.gamepad', false); + + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + + this.audio = GetValue(config, 'audio'); + + // If you do: { banner: false } it won't display any banner at all + this.hideBanner = (GetValue(config, 'banner', null) === false); + + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } + + // Frame Rate config + // fps: { + // min: 10, + // target: 60, + // forceSetTimeOut: false, + // deltaHistory: 10 + // } + + this.fps = GetValue(config, 'fps', null); + + this.pixelArt = GetValue(config, 'pixelArt', false); + this.autoResize = GetValue(config, 'autoResize', false); + this.roundPixels = GetValue(config, 'roundPixels', false); + this.transparent = GetValue(config, 'transparent', false); + this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true); + + var bgc = GetValue(config, 'backgroundColor', 0); + + this.backgroundColor = ValueToColor(bgc); + + if (bgc === 0 && this.transparent) + { + this.backgroundColor.alpha = 0; + } + + // Callbacks + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + + // Physics + // physics: { + // system: 'impact', + // setBounds: true, + // gravity: 0, + // cellSize: 64 + // } + this.physics = GetValue(config, 'physics', {}); + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + + // Loader Defaults + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + this.loaderPath = GetValue(config, 'loader.path', ''); + this.loaderEnableParallel = GetValue(config, 'loader.enableParallel', true); + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 4); + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + this.loaderAsync = GetValue(config, 'loader.async', true); + this.loaderUser = GetValue(config, 'loader.user', ''); + this.loaderPassword = GetValue(config, 'loader.password', ''); + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + + // Scene Plugins + this.defaultPlugins = GetValue(config, 'plugins', Plugins.DefaultScene); + + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); } }); -module.exports = FlatTintPipeline; +module.exports = Config; + + +/***/ }), +/* 511 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var CanvasInterpolation = __webpack_require__(224); +var CanvasPool = __webpack_require__(19); +var CONST = __webpack_require__(22); +var Features = __webpack_require__(125); + +/** + * Called automatically by Phaser.Game and responsible for creating the renderer it will use. + * + * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. + * + * @function Phaser.Boot.CreateRenderer + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. + */ +var CreateRenderer = function (game) +{ + var config = game.config; + + // Game either requested Canvas, + // or requested AUTO or WEBGL but the browser doesn't support it, so fall back to Canvas + + if (config.renderType !== CONST.HEADLESS) + { + if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL)) + { + if (Features.canvas) + { + // They requested Canvas and their browser supports it + config.renderType = CONST.CANVAS; + } + else + { + throw new Error('Cannot create Canvas or WebGL context, aborting.'); + } + } + else + { + // Game requested WebGL and browser says it supports it + config.renderType = CONST.WEBGL; + } + } + + // Pixel Art mode? + if (config.pixelArt) + { + CanvasPool.disableSmoothing(); + } + + // Does the game config provide its own canvas element to use? + if (config.canvas) + { + game.canvas = config.canvas; + } + else + { + game.canvas = CanvasPool.create(game, config.width, config.height, config.renderType); + } + + // Does the game config provide some canvas css styles to use? + if (config.canvasStyle) + { + game.canvas.style = config.canvasStyle; + } + + // Pixel Art mode? + if (config.pixelArt) + { + CanvasInterpolation.setCrisp(game.canvas); + } + + // Zoomed? + if (config.zoom !== 1) + { + game.canvas.style.width = (config.width * config.zoom).toString() + 'px'; + game.canvas.style.height = (config.height * config.zoom).toString() + 'px'; + } + + if (config.renderType === CONST.HEADLESS) + { + // Nothing more to do here + return; + } + + var CanvasRenderer; + var WebGLRenderer; + + if (true) + { + CanvasRenderer = __webpack_require__(367); + WebGLRenderer = __webpack_require__(372); + + // Let the config pick the renderer type, both are included + if (config.renderType === CONST.WEBGL) + { + game.renderer = new WebGLRenderer(game); + game.context = null; + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } + } + + if (false) + { + WebGLRenderer = require('../renderer/webgl/WebGLRenderer'); + + // Force the type to WebGL, regardless what was requested + config.renderType = CONST.WEBGL; + game.renderer = new WebGLRenderer(game); + game.context = null; + } + + if (false) + { + CanvasRenderer = require('../renderer/canvas/CanvasRenderer'); + + // Force the type to Canvas, regardless what was requested + config.renderType = CONST.CANVAS; + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; + } +}; + +module.exports = CreateRenderer; /***/ }), /* 512 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(outTint.rgb * outTint.a, outTint.a);\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uMaskSampler;\r\nuniform bool uInvertMaskAlpha;\r\n\r\nvoid main()\r\n{\r\n vec2 uv = gl_FragCoord.xy / uResolution;\r\n vec4 mainColor = texture2D(uMainSampler, uv);\r\n vec4 maskColor = texture2D(uMaskSampler, uv);\r\n float alpha = mainColor.a;\r\n\r\n if (!uInvertMaskAlpha)\r\n {\r\n alpha *= (maskColor.a);\r\n }\r\n else\r\n {\r\n alpha *= (1.0 - maskColor.a);\r\n }\r\n \r\n gl_FragColor = vec4(mainColor.rgb * alpha, alpha);\r\n}\r\n" /***/ }), /* 513 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec4 inTint;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main () {\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTint = inTint;\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_BITMAP_MASK_VS\r\n\r\nprecision mediump float;\r\n\r\nattribute vec2 inPosition;\r\n\r\nvoid main()\r\n{\r\n gl_Position = vec4(inPosition, 0.0, 1.0);\r\n}\r\n" /***/ }), /* 514 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_FORWARD_DIFFUSE_FS\r\n\r\nprecision mediump float;\r\n\r\nstruct Light\r\n{\r\n vec2 position;\r\n vec3 color;\r\n float intensity;\r\n float radius;\r\n};\r\n\r\nconst int kMaxLights = %LIGHT_COUNT%;\r\n\r\nuniform vec4 uCamera; /* x, y, rotation, zoom */\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uNormSampler;\r\nuniform vec3 uAmbientLightColor;\r\nuniform Light uLights[kMaxLights];\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main()\r\n{\r\n vec3 finalColor = vec3(0.0, 0.0, 0.0);\r\n vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);\r\n vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;\r\n vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));\r\n vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;\r\n\r\n for (int index = 0; index < kMaxLights; ++index)\r\n {\r\n Light light = uLights[index];\r\n vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);\r\n vec3 lightNormal = normalize(lightDir);\r\n float distToSurf = length(lightDir) * uCamera.w;\r\n float diffuseFactor = max(dot(normal, lightNormal), 0.0);\r\n float radius = (light.radius / res.x * uCamera.w) * uCamera.w;\r\n float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);\r\n vec3 diffuse = light.color * diffuseFactor;\r\n finalColor += (attenuation * diffuse) * light.intensity;\r\n }\r\n\r\n vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);\r\n gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);\r\n\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main() {\r\n gl_FragColor = vec4(outTint.rgb * outTint.a, outTint.a);\r\n}\r\n" /***/ }), /* 515 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform sampler2D uMainSampler;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main() \r\n{\r\n vec4 texel = texture2D(uMainSampler, outTexCoord);\r\n texel *= vec4(outTint.rgb * outTint.a, outTint.a);\r\n gl_FragColor = texel;\r\n}\r\n" +module.exports = "#define SHADER_NAME PHASER_FLAT_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec4 inTint;\r\n\r\nvarying vec4 outTint;\r\n\r\nvoid main () {\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTint = inTint;\r\n}\r\n" /***/ }), /* 516 */ /***/ (function(module, exports) { -module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec2 inTexCoord;\r\nattribute vec4 inTint;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main () \r\n{\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTexCoord = inTexCoord;\r\n outTint = inTint;\r\n}\r\n\r\n" +module.exports = "#define SHADER_NAME PHASER_FORWARD_DIFFUSE_FS\r\n\r\nprecision mediump float;\r\n\r\nstruct Light\r\n{\r\n vec2 position;\r\n vec3 color;\r\n float intensity;\r\n float radius;\r\n};\r\n\r\nconst int kMaxLights = %LIGHT_COUNT%;\r\n\r\nuniform vec4 uCamera; /* x, y, rotation, zoom */\r\nuniform vec2 uResolution;\r\nuniform sampler2D uMainSampler;\r\nuniform sampler2D uNormSampler;\r\nuniform vec3 uAmbientLightColor;\r\nuniform Light uLights[kMaxLights];\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main()\r\n{\r\n vec3 finalColor = vec3(0.0, 0.0, 0.0);\r\n vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);\r\n vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;\r\n vec3 normal = normalize(vec3(normalMap * 2.0 - 1.0));\r\n vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;\r\n\r\n for (int index = 0; index < kMaxLights; ++index)\r\n {\r\n Light light = uLights[index];\r\n vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);\r\n vec3 lightNormal = normalize(lightDir);\r\n float distToSurf = length(lightDir) * uCamera.w;\r\n float diffuseFactor = max(dot(normal, lightNormal), 0.0);\r\n float radius = (light.radius / res.x * uCamera.w) * uCamera.w;\r\n float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);\r\n vec3 diffuse = light.color * diffuseFactor;\r\n finalColor += (attenuation * diffuse) * light.intensity;\r\n }\r\n\r\n vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);\r\n gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);\r\n\r\n}\r\n" /***/ }), /* 517 */ +/***/ (function(module, exports) { + +module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_FS\r\n\r\nprecision mediump float;\r\n\r\nuniform sampler2D uMainSampler;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main() \r\n{\r\n vec4 texel = texture2D(uMainSampler, outTexCoord);\r\n texel *= vec4(outTint.rgb * outTint.a, outTint.a);\r\n gl_FragColor = texel;\r\n}\r\n" + +/***/ }), +/* 518 */ +/***/ (function(module, exports) { + +module.exports = "#define SHADER_NAME PHASER_TEXTURE_TINT_VS\r\n\r\nprecision mediump float;\r\n\r\nuniform mat4 uProjectionMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uModelMatrix;\r\n\r\nattribute vec2 inPosition;\r\nattribute vec2 inTexCoord;\r\nattribute vec4 inTint;\r\n\r\nvarying vec2 outTexCoord;\r\nvarying vec4 outTint;\r\n\r\nvoid main () \r\n{\r\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);\r\n outTexCoord = inTexCoord;\r\n outTint = inTint;\r\n}\r\n\r\n" + +/***/ }), +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90575,7 +92158,16 @@ var DebugHeader = function (game) return; } - var renderType = (config.renderType === CONST.CANVAS) ? 'Canvas' : 'WebGL'; + var renderType = 'WebGL'; + + if (config.renderType === CONST.CANVAS) + { + renderType = 'Canvas'; + } + else if (config.renderType === CONST.HEADLESS) + { + renderType = 'Headless'; + } var audioConfig = config.audio; var deviceAudio = game.device.audio; @@ -90664,7 +92256,7 @@ module.exports = DebugHeader; /***/ }), -/* 518 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90686,18 +92278,18 @@ module.exports = { os: __webpack_require__(67), browser: __webpack_require__(82), - features: __webpack_require__(124), - input: __webpack_require__(519), - audio: __webpack_require__(520), - video: __webpack_require__(521), - fullscreen: __webpack_require__(522), - canvasFeatures: __webpack_require__(234) + features: __webpack_require__(125), + input: __webpack_require__(521), + audio: __webpack_require__(522), + video: __webpack_require__(523), + fullscreen: __webpack_require__(524), + canvasFeatures: __webpack_require__(237) }; /***/ }), -/* 519 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90777,7 +92369,7 @@ module.exports = init(); /***/ }), -/* 520 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90903,7 +92495,7 @@ module.exports = init(); /***/ }), -/* 521 */ +/* 523 */ /***/ (function(module, exports) { /** @@ -90989,7 +92581,7 @@ module.exports = init(); /***/ }), -/* 522 */ +/* 524 */ /***/ (function(module, exports) { /** @@ -91088,7 +92680,7 @@ module.exports = init(); /***/ }), -/* 523 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91097,7 +92689,7 @@ module.exports = init(); * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(524); +var AdvanceKeyCombo = __webpack_require__(526); /** * Used internally by the KeyCombo class. @@ -91168,7 +92760,7 @@ module.exports = ProcessKeyCombo; /***/ }), -/* 524 */ +/* 526 */ /***/ (function(module, exports) { /** @@ -91209,7 +92801,7 @@ module.exports = AdvanceKeyCombo; /***/ }), -/* 525 */ +/* 527 */ /***/ (function(module, exports) { /** @@ -91243,7 +92835,7 @@ module.exports = ResetKeyCombo; /***/ }), -/* 526 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91265,7 +92857,7 @@ module.exports = KeyMap; /***/ }), -/* 527 */ +/* 529 */ /***/ (function(module, exports) { /** @@ -91304,10 +92896,14 @@ var ProcessKeyDown = function (key, event) key.shiftKey = event.shiftKey; key.location = event.location; - key.isDown = true; - key.isUp = false; - key.timeDown = event.timeStamp; - key.duration = 0; + if (key.isDown === false) + { + key.isDown = true; + key.isUp = false; + key.timeDown = event.timeStamp; + key.duration = 0; + } + key.repeats++; key._justDown = true; @@ -91320,7 +92916,7 @@ module.exports = ProcessKeyDown; /***/ }), -/* 528 */ +/* 530 */ /***/ (function(module, exports) { /** @@ -91370,7 +92966,7 @@ module.exports = ProcessKeyUp; /***/ }), -/* 529 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91380,7 +92976,7 @@ module.exports = ProcessKeyUp; */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(253); +var UppercaseFirst = __webpack_require__(254); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -91432,7 +93028,7 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 530 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91478,7 +93074,7 @@ module.exports = GetScenePlugins; /***/ }), -/* 531 */ +/* 533 */ /***/ (function(module, exports) { /** @@ -91526,7 +93122,7 @@ module.exports = InjectionMap; /***/ }), -/* 532 */ +/* 534 */ /***/ (function(module, exports) { /** @@ -91559,7 +93155,7 @@ module.exports = Canvas; /***/ }), -/* 533 */ +/* 535 */ /***/ (function(module, exports) { /** @@ -91592,7 +93188,7 @@ module.exports = Image; /***/ }), -/* 534 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91601,7 +93197,7 @@ module.exports = Image; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -91631,7 +93227,7 @@ var JSONArray = function (texture, sourceIndex, json) texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); // By this stage frames is a fully parsed array - var frames = (Array.isArray(json.textures)) ? json.textures[0].frames : json.frames; + var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames; var newFrame; @@ -91697,7 +93293,7 @@ module.exports = JSONArray; /***/ }), -/* 535 */ +/* 537 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91706,7 +93302,7 @@ module.exports = JSONArray; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -91794,7 +93390,7 @@ module.exports = JSONHash; /***/ }), -/* 536 */ +/* 538 */ /***/ (function(module, exports) { /** @@ -91867,7 +93463,7 @@ module.exports = Pyxel; /***/ }), -/* 537 */ +/* 539 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91979,7 +93575,7 @@ module.exports = SpriteSheet; /***/ }), -/* 538 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92162,7 +93758,7 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 539 */ +/* 541 */ /***/ (function(module, exports) { /** @@ -92245,7 +93841,7 @@ module.exports = StarlingXML; /***/ }), -/* 540 */ +/* 542 */ /***/ (function(module, exports) { /** @@ -92412,7 +94008,7 @@ TextureImporter: /***/ }), -/* 541 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92424,7 +94020,7 @@ TextureImporter: var Class = __webpack_require__(0); var GetValue = __webpack_require__(4); var NOOP = __webpack_require__(3); -var RequestAnimationFrame = __webpack_require__(232); +var RequestAnimationFrame = __webpack_require__(235); // Frame Rate config // fps: { @@ -93034,7 +94630,7 @@ module.exports = TimeStep; /***/ }), -/* 542 */ +/* 544 */ /***/ (function(module, exports) { /** @@ -93148,7 +94744,7 @@ module.exports = VisibilityHandler; /***/ }), -/* 543 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93163,10 +94759,10 @@ module.exports = VisibilityHandler; var GameObjects = { - DisplayList: __webpack_require__(544), + DisplayList: __webpack_require__(546), GameObjectCreator: __webpack_require__(13), GameObjectFactory: __webpack_require__(9), - UpdateList: __webpack_require__(545), + UpdateList: __webpack_require__(547), Components: __webpack_require__(11), @@ -93177,7 +94773,7 @@ var GameObjects = { Group: __webpack_require__(69), Image: __webpack_require__(70), Particles: __webpack_require__(137), - PathFollower: __webpack_require__(289), + PathFollower: __webpack_require__(290), RenderTexture: __webpack_require__(139), Sprite3D: __webpack_require__(81), Sprite: __webpack_require__(37), @@ -93188,36 +94784,36 @@ var GameObjects = { // Game Object Factories Factories: { - Blitter: __webpack_require__(628), - DynamicBitmapText: __webpack_require__(629), - Graphics: __webpack_require__(630), - Group: __webpack_require__(631), - Image: __webpack_require__(632), - Particles: __webpack_require__(633), - PathFollower: __webpack_require__(634), - RenderTexture: __webpack_require__(635), - Sprite3D: __webpack_require__(636), - Sprite: __webpack_require__(637), - StaticBitmapText: __webpack_require__(638), - Text: __webpack_require__(639), - TileSprite: __webpack_require__(640), - Zone: __webpack_require__(641) + Blitter: __webpack_require__(631), + DynamicBitmapText: __webpack_require__(632), + Graphics: __webpack_require__(633), + Group: __webpack_require__(634), + Image: __webpack_require__(635), + Particles: __webpack_require__(636), + PathFollower: __webpack_require__(637), + RenderTexture: __webpack_require__(638), + Sprite3D: __webpack_require__(639), + Sprite: __webpack_require__(640), + StaticBitmapText: __webpack_require__(641), + Text: __webpack_require__(642), + TileSprite: __webpack_require__(643), + Zone: __webpack_require__(644) }, Creators: { - Blitter: __webpack_require__(642), - DynamicBitmapText: __webpack_require__(643), - Graphics: __webpack_require__(644), - Group: __webpack_require__(645), - Image: __webpack_require__(646), - Particles: __webpack_require__(647), - RenderTexture: __webpack_require__(648), - Sprite3D: __webpack_require__(649), - Sprite: __webpack_require__(650), - StaticBitmapText: __webpack_require__(651), - Text: __webpack_require__(652), - TileSprite: __webpack_require__(653), - Zone: __webpack_require__(654) + Blitter: __webpack_require__(645), + DynamicBitmapText: __webpack_require__(646), + Graphics: __webpack_require__(647), + Group: __webpack_require__(648), + Image: __webpack_require__(649), + Particles: __webpack_require__(650), + RenderTexture: __webpack_require__(651), + Sprite3D: __webpack_require__(652), + Sprite: __webpack_require__(653), + StaticBitmapText: __webpack_require__(654), + Text: __webpack_require__(655), + TileSprite: __webpack_require__(656), + Zone: __webpack_require__(657) } }; @@ -93226,25 +94822,25 @@ if (true) { // WebGL only Game Objects GameObjects.Mesh = __webpack_require__(88); - GameObjects.Quad = __webpack_require__(143); + GameObjects.Quad = __webpack_require__(142); - GameObjects.Factories.Mesh = __webpack_require__(658); - GameObjects.Factories.Quad = __webpack_require__(659); + GameObjects.Factories.Mesh = __webpack_require__(661); + GameObjects.Factories.Quad = __webpack_require__(662); - GameObjects.Creators.Mesh = __webpack_require__(660); - GameObjects.Creators.Quad = __webpack_require__(661); + GameObjects.Creators.Mesh = __webpack_require__(663); + GameObjects.Creators.Quad = __webpack_require__(664); - GameObjects.Light = __webpack_require__(291); + GameObjects.Light = __webpack_require__(293); - __webpack_require__(292); - __webpack_require__(662); + __webpack_require__(294); + __webpack_require__(665); } module.exports = GameObjects; /***/ }), -/* 544 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93256,7 +94852,7 @@ module.exports = GameObjects; var Class = __webpack_require__(0); var List = __webpack_require__(86); var PluginManager = __webpack_require__(12); -var StableSort = __webpack_require__(266); +var StableSort = __webpack_require__(267); /** * @classdesc @@ -93416,7 +95012,7 @@ module.exports = DisplayList; /***/ }), -/* 545 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93686,7 +95282,7 @@ module.exports = UpdateList; /***/ }), -/* 546 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93695,7 +95291,7 @@ module.exports = UpdateList; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(268); +var ParseXMLBitmapFont = __webpack_require__(269); var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing) { @@ -93720,7 +95316,7 @@ module.exports = ParseFromAtlas; /***/ }), -/* 547 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93914,245 +95510,10 @@ ParseRetroFont.TEXT_SET11 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()\':;0123456789'; module.exports = ParseRetroFont; -/***/ }), -/* 548 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var renderWebGL = __webpack_require__(3); -var renderCanvas = __webpack_require__(3); - -if (true) -{ - renderWebGL = __webpack_require__(549); -} - -if (true) -{ - renderCanvas = __webpack_require__(550); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 549 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GameObject = __webpack_require__(1); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.BitmapText#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.BitmapText} gameObject - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var BitmapTextWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera) -{ - var text = gameObject.text; - var textLength = text.length; - - if (GameObject.RENDER_MASK !== gameObject.renderFlags || textLength === 0 || (gameObject.cameraFilter > 0 && (gameObject.cameraFilter & camera._id))) - { - return; - } - - this.pipeline.batchBitmapText(this, camera); -}; - -module.exports = BitmapTextWebGLRenderer; - - /***/ }), /* 550 */ /***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ - -var GameObject = __webpack_require__(1); - -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.BitmapText#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera) -{ - var text = src.text; - var textLength = text.length; - - if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) - { - return; - } - - var textureFrame = src.frame; - - var cameraScrollX = camera.scrollX * src.scrollFactorX; - var cameraScrollY = camera.scrollY * src.scrollFactorY; - - var chars = src.fontData.chars; - var lineHeight = src.fontData.lineHeight; - - var xAdvance = 0; - var yAdvance = 0; - - var indexCount = 0; - var charCode = 0; - - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; - - var x = 0; - var y = 0; - - var lastGlyph = null; - var lastCharCode = 0; - - var ctx = renderer.currentContext; - var image = src.frame.source.image; - - var textureX = textureFrame.cutX; - var textureY = textureFrame.cutY; - - var scale = (src.fontSize / src.fontData.size); - - // Blend Mode - if (renderer.currentBlendMode !== src.blendMode) - { - renderer.currentBlendMode = src.blendMode; - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - } - - // Alpha - if (renderer.currentAlpha !== src.alpha) - { - renderer.currentAlpha = src.alpha; - ctx.globalAlpha = src.alpha; - } - - // Smoothing - if (renderer.currentScaleMode !== src.scaleMode) - { - renderer.currentScaleMode = src.scaleMode; - } - - ctx.save(); - ctx.translate((src.x - cameraScrollX) + src.frame.x, (src.y - cameraScrollY) + src.frame.y); - ctx.rotate(src.rotation); - ctx.translate(-src.displayOriginX, -src.displayOriginY); - ctx.scale(src.scaleX, src.scaleY); - - // ctx.fillStyle = 'rgba(255,0,255,0.5)'; - - for (var index = 0; index < textLength; ++index) - { - charCode = text.charCodeAt(index); - - if (charCode === 10) - { - xAdvance = 0; - indexCount = 0; - yAdvance += lineHeight; - lastGlyph = null; - continue; - } - - glyph = chars[charCode]; - - if (!glyph) - { - continue; - } - - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; - - glyphW = glyph.width; - glyphH = glyph.height; - - x = indexCount + glyph.xOffset + xAdvance; - y = glyph.yOffset + yAdvance; - - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } - - x *= scale; - y *= scale; - - xAdvance += glyph.xAdvance; - indexCount += 1; - lastGlyph = glyph; - lastCharCode = charCode; - - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } - - ctx.save(); - ctx.translate(x, y); - ctx.scale(scale, scale); - - // ctx.fillRect(0, 0, glyphW, glyphH); - ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); - ctx.restore(); - } - - ctx.restore(); -}; - -module.exports = BitmapTextCanvasRenderer; - - -/***/ }), -/* 551 */ -/***/ (function(module, exports, __webpack_require__) { - /** * @author Richard Davey * @copyright 2018 Photon Storm Ltd. @@ -94164,12 +95525,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(552); + renderWebGL = __webpack_require__(551); } if (true) { - renderCanvas = __webpack_require__(553); + renderCanvas = __webpack_require__(552); } module.exports = { @@ -94180,6 +95541,48 @@ module.exports = { }; +/***/ }), +/* 551 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GameObject = __webpack_require__(1); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.BitmapText#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.BitmapText} gameObject - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var BitmapTextWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera) +{ + var text = gameObject.text; + var textLength = text.length; + + if (GameObject.RENDER_MASK !== gameObject.renderFlags || textLength === 0 || (gameObject.cameraFilter > 0 && (gameObject.cameraFilter & camera._id))) + { + return; + } + + this.pipeline.batchBitmapText(this, camera); +}; + +module.exports = BitmapTextWebGLRenderer; + + /***/ }), /* 552 */ /***/ (function(module, exports, __webpack_require__) { @@ -94192,6 +95595,217 @@ module.exports = { var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.BitmapText#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera) +{ + var text = src.text; + var textLength = text.length; + + if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) + { + return; + } + + var textureFrame = src.frame; + + var chars = src.fontData.chars; + var lineHeight = src.fontData.lineHeight; + + var xAdvance = 0; + var yAdvance = 0; + + var indexCount = 0; + var charCode = 0; + + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + + var x = 0; + var y = 0; + + var lastGlyph = null; + var lastCharCode = 0; + + var ctx = renderer.currentContext; + var image = src.frame.source.image; + + var textureX = textureFrame.cutX; + var textureY = textureFrame.cutY; + + var scale = (src.fontSize / src.fontData.size); + + // Blend Mode + if (renderer.currentBlendMode !== src.blendMode) + { + renderer.currentBlendMode = src.blendMode; + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; + } + + // Alpha + if (renderer.currentAlpha !== src.alpha) + { + renderer.currentAlpha = src.alpha; + ctx.globalAlpha = src.alpha; + } + + // Smoothing + if (renderer.currentScaleMode !== src.scaleMode) + { + renderer.currentScaleMode = src.scaleMode; + } + + var roundPixels = renderer.config.roundPixels; + + var tx = (src.x - camera.scrollX * src.scrollFactorX) + src.frame.x; + var ty = (src.y - camera.scrollY * src.scrollFactorY) + src.frame.y; + + if (roundPixels) + { + tx |= 0; + ty |= 0; + } + + ctx.save(); + + ctx.translate(tx, ty); + + ctx.rotate(src.rotation); + + ctx.translate(-src.displayOriginX, -src.displayOriginY); + + ctx.scale(src.scaleX, src.scaleY); + + for (var index = 0; index < textLength; ++index) + { + charCode = text.charCodeAt(index); + + if (charCode === 10) + { + xAdvance = 0; + indexCount = 0; + yAdvance += lineHeight; + lastGlyph = null; + continue; + } + + glyph = chars[charCode]; + + if (!glyph) + { + continue; + } + + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; + + glyphW = glyph.width; + glyphH = glyph.height; + + x = indexCount + glyph.xOffset + xAdvance; + y = glyph.yOffset + yAdvance; + + if (lastGlyph !== null) + { + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } + + x *= scale; + y *= scale; + + xAdvance += glyph.xAdvance; + indexCount += 1; + lastGlyph = glyph; + lastCharCode = charCode; + + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) + { + continue; + } + + if (roundPixels) + { + x |= 0; + y |= 0; + } + + ctx.save(); + + ctx.translate(x, y); + + ctx.scale(scale, scale); + + ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); + + ctx.restore(); + } + + ctx.restore(); +}; + +module.exports = BitmapTextCanvasRenderer; + + +/***/ }), +/* 553 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var renderWebGL = __webpack_require__(3); +var renderCanvas = __webpack_require__(3); + +if (true) +{ + renderWebGL = __webpack_require__(554); +} + +if (true) +{ + renderCanvas = __webpack_require__(555); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 554 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var GameObject = __webpack_require__(1); + /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -94220,7 +95834,7 @@ module.exports = BlitterWebGLRenderer; /***/ }), -/* 553 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94303,7 +95917,7 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 554 */ +/* 556 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94648,7 +96262,7 @@ module.exports = Bob; /***/ }), -/* 555 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94662,12 +96276,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(556); + renderWebGL = __webpack_require__(558); } if (true) { - renderCanvas = __webpack_require__(557); + renderCanvas = __webpack_require__(559); } module.exports = { @@ -94679,7 +96293,7 @@ module.exports = { /***/ }), -/* 556 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94721,7 +96335,7 @@ module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 557 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94814,9 +96428,13 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc } ctx.save(); + ctx.translate(src.x, src.y); + ctx.rotate(src.rotation); + ctx.translate(-src.displayOriginX, -src.displayOriginY); + ctx.scale(src.scaleX, src.scaleY); if (src.cropWidth > 0 && src.cropHeight > 0) @@ -94827,6 +96445,8 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc ctx.clip(); } + var roundPixels = renderer.config.roundPixels; + for (var index = 0; index < textLength; ++index) { // Reset the scale (in case the callback changed it) @@ -94884,13 +96504,19 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc x -= cameraScrollX; y -= cameraScrollY; + if (roundPixels) + { + x |= 0; + y |= 0; + } + ctx.save(); + ctx.translate(x, y); + ctx.rotate(rotation); - ctx.scale(scale, scale); - // ctx.fillStyle = 'rgba(0,255,0,0.2)'; - // ctx.fillRect(0, 0, glyphW, glyphH); + ctx.scale(scale, scale); ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); @@ -94914,7 +96540,7 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 558 */ +/* 560 */ /***/ (function(module, exports) { /** @@ -94948,7 +96574,7 @@ module.exports = Area; /***/ }), -/* 559 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94978,7 +96604,7 @@ module.exports = Clone; /***/ }), -/* 560 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95009,7 +96635,7 @@ module.exports = ContainsPoint; /***/ }), -/* 561 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95045,7 +96671,7 @@ module.exports = ContainsRect; /***/ }), -/* 562 */ +/* 564 */ /***/ (function(module, exports) { /** @@ -95075,7 +96701,7 @@ module.exports = CopyFrom; /***/ }), -/* 563 */ +/* 565 */ /***/ (function(module, exports) { /** @@ -95110,7 +96736,7 @@ module.exports = Equals; /***/ }), -/* 564 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95148,7 +96774,7 @@ module.exports = GetBounds; /***/ }), -/* 565 */ +/* 567 */ /***/ (function(module, exports) { /** @@ -95181,7 +96807,7 @@ module.exports = Offset; /***/ }), -/* 566 */ +/* 568 */ /***/ (function(module, exports) { /** @@ -95213,7 +96839,7 @@ module.exports = OffsetPoint; /***/ }), -/* 567 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95227,15 +96853,15 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(568); + renderWebGL = __webpack_require__(570); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(273); + renderCanvas = __webpack_require__(274); } if (true) { - renderCanvas = __webpack_require__(273); + renderCanvas = __webpack_require__(274); } module.exports = { @@ -95247,7 +96873,7 @@ module.exports = { /***/ }), -/* 568 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95286,7 +96912,7 @@ module.exports = GraphicsWebGLRenderer; /***/ }), -/* 569 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95300,12 +96926,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(570); + renderWebGL = __webpack_require__(572); } if (true) { - renderCanvas = __webpack_require__(571); + renderCanvas = __webpack_require__(573); } module.exports = { @@ -95317,7 +96943,7 @@ module.exports = { /***/ }), -/* 570 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95356,7 +96982,7 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 571 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95395,7 +97021,7 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 572 */ +/* 574 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95610,7 +97236,7 @@ module.exports = GravityWell; /***/ }), -/* 573 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95622,17 +97248,17 @@ module.exports = GravityWell; var BlendModes = __webpack_require__(45); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DeathZone = __webpack_require__(574); -var EdgeZone = __webpack_require__(575); -var EmitterOp = __webpack_require__(576); +var DeathZone = __webpack_require__(576); +var EdgeZone = __webpack_require__(577); +var EmitterOp = __webpack_require__(578); var GetFastValue = __webpack_require__(2); var GetRandomElement = __webpack_require__(138); -var HasAny = __webpack_require__(288); +var HasAny = __webpack_require__(289); var HasValue = __webpack_require__(72); -var Particle = __webpack_require__(610); -var RandomZone = __webpack_require__(611); +var Particle = __webpack_require__(612); +var RandomZone = __webpack_require__(613); var Rectangle = __webpack_require__(8); -var StableSort = __webpack_require__(266); +var StableSort = __webpack_require__(267); var Vector2 = __webpack_require__(6); var Wrap = __webpack_require__(50); @@ -97591,7 +99217,7 @@ module.exports = ParticleEmitter; /***/ }), -/* 574 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97669,7 +99295,7 @@ module.exports = DeathZone; /***/ }), -/* 575 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97908,7 +99534,7 @@ module.exports = EdgeZone; /***/ }), -/* 576 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97918,7 +99544,7 @@ module.exports = EdgeZone; */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(275); +var FloatBetween = __webpack_require__(276); var GetEaseFunction = __webpack_require__(71); var GetFastValue = __webpack_require__(2); var Wrap = __webpack_require__(50); @@ -98467,7 +100093,7 @@ module.exports = EmitterOp; /***/ }), -/* 577 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98476,18 +100102,18 @@ module.exports = EmitterOp; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Back = __webpack_require__(276); -var Bounce = __webpack_require__(277); -var Circular = __webpack_require__(278); -var Cubic = __webpack_require__(279); -var Elastic = __webpack_require__(280); -var Expo = __webpack_require__(281); -var Linear = __webpack_require__(282); -var Quadratic = __webpack_require__(283); -var Quartic = __webpack_require__(284); -var Quintic = __webpack_require__(285); -var Sine = __webpack_require__(286); -var Stepped = __webpack_require__(287); +var Back = __webpack_require__(277); +var Bounce = __webpack_require__(278); +var Circular = __webpack_require__(279); +var Cubic = __webpack_require__(280); +var Elastic = __webpack_require__(281); +var Expo = __webpack_require__(282); +var Linear = __webpack_require__(283); +var Quadratic = __webpack_require__(284); +var Quartic = __webpack_require__(285); +var Quintic = __webpack_require__(286); +var Sine = __webpack_require__(287); +var Stepped = __webpack_require__(288); // EaseMap module.exports = { @@ -98548,7 +100174,7 @@ module.exports = { /***/ }), -/* 578 */ +/* 580 */ /***/ (function(module, exports) { /** @@ -98579,7 +100205,7 @@ module.exports = In; /***/ }), -/* 579 */ +/* 581 */ /***/ (function(module, exports) { /** @@ -98610,7 +100236,7 @@ module.exports = Out; /***/ }), -/* 580 */ +/* 582 */ /***/ (function(module, exports) { /** @@ -98650,7 +100276,7 @@ module.exports = InOut; /***/ }), -/* 581 */ +/* 583 */ /***/ (function(module, exports) { /** @@ -98695,7 +100321,7 @@ module.exports = In; /***/ }), -/* 582 */ +/* 584 */ /***/ (function(module, exports) { /** @@ -98738,7 +100364,7 @@ module.exports = Out; /***/ }), -/* 583 */ +/* 585 */ /***/ (function(module, exports) { /** @@ -98802,7 +100428,7 @@ module.exports = InOut; /***/ }), -/* 584 */ +/* 586 */ /***/ (function(module, exports) { /** @@ -98830,7 +100456,7 @@ module.exports = In; /***/ }), -/* 585 */ +/* 587 */ /***/ (function(module, exports) { /** @@ -98858,7 +100484,7 @@ module.exports = Out; /***/ }), -/* 586 */ +/* 588 */ /***/ (function(module, exports) { /** @@ -98893,7 +100519,7 @@ module.exports = InOut; /***/ }), -/* 587 */ +/* 589 */ /***/ (function(module, exports) { /** @@ -98921,7 +100547,7 @@ module.exports = In; /***/ }), -/* 588 */ +/* 590 */ /***/ (function(module, exports) { /** @@ -98949,7 +100575,7 @@ module.exports = Out; /***/ }), -/* 589 */ +/* 591 */ /***/ (function(module, exports) { /** @@ -98984,7 +100610,7 @@ module.exports = InOut; /***/ }), -/* 590 */ +/* 592 */ /***/ (function(module, exports) { /** @@ -99039,7 +100665,7 @@ module.exports = In; /***/ }), -/* 591 */ +/* 593 */ /***/ (function(module, exports) { /** @@ -99094,7 +100720,7 @@ module.exports = Out; /***/ }), -/* 592 */ +/* 594 */ /***/ (function(module, exports) { /** @@ -99156,7 +100782,7 @@ module.exports = InOut; /***/ }), -/* 593 */ +/* 595 */ /***/ (function(module, exports) { /** @@ -99184,7 +100810,7 @@ module.exports = In; /***/ }), -/* 594 */ +/* 596 */ /***/ (function(module, exports) { /** @@ -99212,7 +100838,7 @@ module.exports = Out; /***/ }), -/* 595 */ +/* 597 */ /***/ (function(module, exports) { /** @@ -99247,7 +100873,7 @@ module.exports = InOut; /***/ }), -/* 596 */ +/* 598 */ /***/ (function(module, exports) { /** @@ -99275,7 +100901,7 @@ module.exports = Linear; /***/ }), -/* 597 */ +/* 599 */ /***/ (function(module, exports) { /** @@ -99303,7 +100929,7 @@ module.exports = In; /***/ }), -/* 598 */ +/* 600 */ /***/ (function(module, exports) { /** @@ -99331,7 +100957,7 @@ module.exports = Out; /***/ }), -/* 599 */ +/* 601 */ /***/ (function(module, exports) { /** @@ -99366,7 +100992,7 @@ module.exports = InOut; /***/ }), -/* 600 */ +/* 602 */ /***/ (function(module, exports) { /** @@ -99394,7 +101020,7 @@ module.exports = In; /***/ }), -/* 601 */ +/* 603 */ /***/ (function(module, exports) { /** @@ -99422,7 +101048,7 @@ module.exports = Out; /***/ }), -/* 602 */ +/* 604 */ /***/ (function(module, exports) { /** @@ -99457,7 +101083,7 @@ module.exports = InOut; /***/ }), -/* 603 */ +/* 605 */ /***/ (function(module, exports) { /** @@ -99485,7 +101111,7 @@ module.exports = In; /***/ }), -/* 604 */ +/* 606 */ /***/ (function(module, exports) { /** @@ -99513,7 +101139,7 @@ module.exports = Out; /***/ }), -/* 605 */ +/* 607 */ /***/ (function(module, exports) { /** @@ -99548,7 +101174,7 @@ module.exports = InOut; /***/ }), -/* 606 */ +/* 608 */ /***/ (function(module, exports) { /** @@ -99587,7 +101213,7 @@ module.exports = In; /***/ }), -/* 607 */ +/* 609 */ /***/ (function(module, exports) { /** @@ -99626,7 +101252,7 @@ module.exports = Out; /***/ }), -/* 608 */ +/* 610 */ /***/ (function(module, exports) { /** @@ -99665,7 +101291,7 @@ module.exports = InOut; /***/ }), -/* 609 */ +/* 611 */ /***/ (function(module, exports) { /** @@ -99707,7 +101333,7 @@ module.exports = Stepped; /***/ }), -/* 610 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99718,7 +101344,7 @@ module.exports = Stepped; var Class = __webpack_require__(0); var DegToRad = __webpack_require__(35); -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); /** * @classdesc @@ -100308,7 +101934,7 @@ module.exports = Particle; /***/ }), -/* 611 */ +/* 613 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100381,7 +102007,7 @@ module.exports = RandomZone; /***/ }), -/* 612 */ +/* 614 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100395,12 +102021,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(613); + renderWebGL = __webpack_require__(615); } if (true) { - renderCanvas = __webpack_require__(614); + renderCanvas = __webpack_require__(616); } module.exports = { @@ -100412,7 +102038,7 @@ module.exports = { /***/ }), -/* 613 */ +/* 615 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100453,7 +102079,7 @@ module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 614 */ +/* 616 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100511,6 +102137,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; } + var roundPixels = renderer.config.roundPixels; + for (var index = 0; index < length; ++index) { var particle = particles[index]; @@ -100532,13 +102160,27 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol var x = -ox; var y = -oy; + var tx = particle.x - cameraScrollX * particle.scrollFactorX; + var ty = particle.y - cameraScrollY * particle.scrollFactorY; + + if (roundPixels) + { + tx |= 0; + ty |= 0; + } + ctx.globalAlpha = alpha; ctx.save(); - ctx.translate(particle.x - cameraScrollX * particle.scrollFactorX, particle.y - cameraScrollY * particle.scrollFactorY); + + ctx.translate(tx, ty); + ctx.rotate(particle.rotation); + ctx.scale(particle.scaleX, particle.scaleY); + ctx.drawImage(frame.source.image, cd.sx, cd.sy, cd.sWidth, cd.sHeight, x, y, cd.dWidth, cd.dHeight); + ctx.restore(); } @@ -100550,62 +102192,26 @@ module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 615 */ -/***/ (function(module, exports) { - -var RenderTextureWebGL = { - - fill: function (color) - { - return this; - }, - - clear: function () - { - this.renderer.setFramebuffer(this.framebuffer); - var gl = this.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - this.renderer.setFramebuffer(null); - return this; - }, - - draw: function (texture, x, y) - { - this.renderer.setFramebuffer(this.framebuffer); - this.renderer.pipelines.TextureTintPipeline.drawTexture(texture, x, y, 0, 0, texture.width, texture.height, this.currentMatrix); - this.renderer.setFramebuffer(null); - return this; - }, - - drawFrame: function (texture, x, y, frame) - { - this.renderer.setFramebuffer(this.framebuffer); - this.renderer.pipelines.TextureTintPipeline.drawTexture(texture, frame.x, frame.y, frame.width, frame.height, texture.width, texture.height, this.currentMatrix); - this.renderer.setFramebuffer(null); - return this; - } - -}; - -module.exports = RenderTextureWebGL; - - -/***/ }), -/* 616 */ +/* 617 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var renderWebGL = __webpack_require__(3); var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(617); + renderWebGL = __webpack_require__(618); } if (true) { - renderCanvas = __webpack_require__(618); + renderCanvas = __webpack_require__(619); } module.exports = { @@ -100617,11 +102223,31 @@ module.exports = { /***/ }), -/* 617 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.RenderTexture#renderWebgl + * @since 3.2.0 + * @private + * + * @param {Phaser.Renderer.WebGLRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.RenderTexture} renderTexture - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ var RenderTextureWebGLRenderer = function (renderer, renderTexture, interpolationPercentage, camera) { if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id))) @@ -100642,7 +102268,7 @@ var RenderTextureWebGLRenderer = function (renderer, renderTexture, interpolatio renderTexture.displayOriginX, renderTexture.displayOriginY, 0, 0, renderTexture.texture.width, renderTexture.texture.height, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0, 0, + 0, 0, camera ); }; @@ -100651,11 +102277,31 @@ module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 618 */ +/* 619 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObject = __webpack_require__(1); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.RenderTexture#renderCanvas + * @since 3.2.0 + * @private + * + * @param {Phaser.Renderer.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.RenderTexture} renderTexture - The Game Object being rendered in this call. + * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolationPercentage, camera) { if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id))) @@ -100663,13 +102309,149 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati return; } + var ctx = renderer.currentContext; + + if (renderer.currentBlendMode !== renderTexture.blendMode) + { + renderer.currentBlendMode = renderTexture.blendMode; + ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode]; + } + + if (renderer.currentAlpha !== renderTexture.alpha) + { + renderer.currentAlpha = renderTexture.alpha; + ctx.globalAlpha = renderTexture.alpha; + } + + if (renderer.currentScaleMode !== renderTexture.scaleMode) + { + renderer.currentScaleMode = renderTexture.scaleMode; + } + + var dx = 0; + var dy = 0; + + var fx = 1; + var fy = 1; + + if (renderTexture.flipX) + { + fx = -1; + dx -= renderTexture.canvas.width - renderTexture.displayOriginX; + } + else + { + dx -= renderTexture.displayOriginX; + } + + if (renderTexture.flipY) + { + fy = -1; + dy -= renderTexture.canvas.height - renderTexture.displayOriginY; + } + else + { + dy -= renderTexture.displayOriginY; + } + + ctx.save(); + ctx.translate(renderTexture.x - camera.scrollX * renderTexture.scrollFactorX, renderTexture.y - camera.scrollY * renderTexture.scrollFactorY); + ctx.rotate(renderTexture.rotation); + ctx.scale(renderTexture.scaleX, renderTexture.scaleY); + ctx.scale(fx, fy); + ctx.drawImage(renderTexture.canvas, dx, dy); + ctx.restore(); }; module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 619 */ +/* 620 */ +/***/ (function(module, exports) { + +var RenderTextureCanvas = { + + fill: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')'; + this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); + return this; + }, + + clear: function () + { + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + return this; + }, + + draw: function (texture, frame, x, y) + { + var matrix = this.currentMatrix; + + this.context.globalAlpha = this.globalAlpha; + this.context.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + this.context.drawImage(texture.source[frame.sourceIndex].image, frame.x, frame.y, frame.width, frame.height, x, y, frame.width, frame.height); + + return this; + } + +}; + +module.exports = RenderTextureCanvas; + + +/***/ }), +/* 621 */ +/***/ (function(module, exports) { + +var RenderTextureWebGL = { + + fill: function (rgb) + { + var ur = ((rgb >> 16)|0) & 0xff; + var ug = ((rgb >> 8)|0) & 0xff; + var ub = (rgb|0) & 0xff; + + this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + this.renderer.setFramebuffer(null); + return this; + }, + + clear: function () + { + this.renderer.setFramebuffer(this.framebuffer); + var gl = this.gl; + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + this.renderer.setFramebuffer(null); + return this; + }, + + draw: function (texture, frame, x, y) + { + var glTexture = texture.source[frame.sourceIndex].glTexture; + var tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16); + this.renderer.setFramebuffer(this.framebuffer); + this.renderer.pipelines.TextureTintPipeline.drawTexture(glTexture, x, y, tint, this.globalAlpha, frame.x, frame.y, frame.width, frame.height, this.currentMatrix); + this.renderer.setFramebuffer(null); + return this; + } + +}; + +module.exports = RenderTextureWebGL; + + +/***/ }), +/* 622 */ /***/ (function(module, exports) { /** @@ -100748,7 +102530,7 @@ module.exports = GetTextSize; /***/ }), -/* 620 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100762,12 +102544,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(621); + renderWebGL = __webpack_require__(624); } if (true) { - renderCanvas = __webpack_require__(622); + renderCanvas = __webpack_require__(625); } module.exports = { @@ -100779,7 +102561,7 @@ module.exports = { /***/ }), -/* 621 */ +/* 624 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100824,7 +102606,7 @@ module.exports = TextWebGLRenderer; /***/ }), -/* 622 */ +/* 625 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100884,13 +102666,27 @@ var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.save(); - // ctx.scale(1.0 / resolution, 1.0 / resolution); - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; + + if (renderer.config.roundPixels) + { + tx |= 0; + ty |= 0; + } + + ctx.translate(tx, ty); + ctx.rotate(src.rotation); + ctx.scale(src.scaleX, src.scaleY); + ctx.translate(canvas.width * (src.flipX ? 1 : 0), canvas.height * (src.flipY ? 1 : 0)); + ctx.scale(src.flipX ? -1 : 1, src.flipY ? -1 : 1); + ctx.drawImage(canvas, 0, 0, canvas.width, canvas.height, -src.displayOriginX, -src.displayOriginY, canvas.width, canvas.height); + ctx.restore(); }; @@ -100898,7 +102694,7 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 623 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100910,7 +102706,7 @@ module.exports = TextCanvasRenderer; var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); -var MeasureText = __webpack_require__(624); +var MeasureText = __webpack_require__(627); // Key: [ Object Key, Default Value ] @@ -101813,7 +103609,7 @@ module.exports = TextStyle; /***/ }), -/* 624 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101822,7 +103618,7 @@ module.exports = TextStyle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CanvasPool = __webpack_require__(21); +var CanvasPool = __webpack_require__(19); /** * Calculates the ascent, descent and fontSize of a given font style. @@ -101942,7 +103738,7 @@ module.exports = MeasureText; /***/ }), -/* 625 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101956,12 +103752,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(626); + renderWebGL = __webpack_require__(629); } if (true) { - renderCanvas = __webpack_require__(627); + renderCanvas = __webpack_require__(630); } module.exports = { @@ -101973,7 +103769,7 @@ module.exports = { /***/ }), -/* 626 */ +/* 629 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102014,7 +103810,7 @@ module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 627 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102049,6 +103845,8 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, var ctx = renderer.currentContext; var frame = src.frame; + src.updateTileTexture(); + // Blend Mode if (renderer.currentBlendMode !== src.blendMode) @@ -102075,12 +103873,29 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, var dx = frame.x - (src.originX * src.width); var dy = frame.y - (src.originY * src.height); + var tx = src.x - camera.scrollX * src.scrollFactorX; + var ty = src.y - camera.scrollY * src.scrollFactorY; + + if (renderer.config.roundPixels) + { + dx |= 0; + dy |= 0; + tx |= 0; + ty |= 0; + } + ctx.save(); + ctx.translate(dx, dy); - ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); + + ctx.translate(tx, ty); + ctx.fillStyle = src.canvasPattern; + ctx.translate(-this.tilePositionX, -this.tilePositionY); + ctx.fillRect(this.tilePositionX, this.tilePositionY, src.width, src.height); + ctx.restore(); }; @@ -102088,7 +103903,7 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 628 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102130,7 +103945,7 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) /***/ }), -/* 629 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102173,7 +103988,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 630 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102212,7 +104027,7 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 631 */ +/* 634 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102258,7 +104073,7 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 632 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102300,7 +104115,7 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 633 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102346,7 +104161,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) /***/ }), -/* 634 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102356,7 +104171,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) */ var GameObjectFactory = __webpack_require__(9); -var PathFollower = __webpack_require__(289); +var PathFollower = __webpack_require__(290); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -102394,12 +104209,33 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 635 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + var GameObjectFactory = __webpack_require__(9); var RenderTexture = __webpack_require__(139); +/** + * Creates a new Render Texture Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#renderTexture + * @since 3.2.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {integer} [width=32] - The width of the Render Texture. + * @param {integer} [height=32] - The height of the Render Texture. + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. + */ GameObjectFactory.register('renderTexture', function (x, y, width, height) { return this.displayList.add(new RenderTexture(this.scene, x, y, width, height)); @@ -102407,7 +104243,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height) /***/ }), -/* 636 */ +/* 639 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102455,7 +104291,7 @@ GameObjectFactory.register('sprite3D', function (x, y, z, key, frame) /***/ }), -/* 637 */ +/* 640 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102502,7 +104338,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 638 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102545,7 +104381,7 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size) /***/ }), -/* 639 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102587,7 +104423,7 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 640 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102631,7 +104467,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 641 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102673,7 +104509,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 642 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102683,7 +104519,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) */ var Blitter = __webpack_require__(132); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); @@ -102715,7 +104551,7 @@ GameObjectCreator.register('blitter', function (config) /***/ }), -/* 643 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102725,7 +104561,7 @@ GameObjectCreator.register('blitter', function (config) */ var BitmapText = __webpack_require__(133); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); @@ -102759,7 +104595,7 @@ GameObjectCreator.register('dynamicBitmapText', function (config) /***/ }), -/* 644 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102792,7 +104628,7 @@ GameObjectCreator.register('graphics', function (config) /***/ }), -/* 645 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102825,7 +104661,7 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 646 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102834,7 +104670,7 @@ GameObjectCreator.register('group', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Image = __webpack_require__(70); @@ -102867,7 +104703,7 @@ GameObjectCreator.register('image', function (config) /***/ }), -/* 647 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102924,15 +104760,32 @@ GameObjectCreator.register('particles', function (config) /***/ }), -/* 648 */ +/* 651 */ /***/ (function(module, exports, __webpack_require__) { -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var RenderTexture = __webpack_require__(139); +/** + * Creates a new Render Texture Game Object and returns it. + * + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#renderTexture + * @since 3.2.0 + * + * @param {object} config - [description] + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. + */ GameObjectCreator.register('renderTexture', function (config) { var x = GetAdvancedValue(config, 'x', 0); @@ -102948,7 +104801,7 @@ GameObjectCreator.register('renderTexture', function (config) /***/ }), -/* 649 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102957,8 +104810,8 @@ GameObjectCreator.register('renderTexture', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +var BuildGameObject = __webpack_require__(20); +var BuildGameObjectAnimation = __webpack_require__(292); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Sprite3D = __webpack_require__(81); @@ -102997,7 +104850,7 @@ GameObjectCreator.register('sprite3D', function (config) /***/ }), -/* 650 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103006,8 +104859,8 @@ GameObjectCreator.register('sprite3D', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); -var BuildGameObjectAnimation = __webpack_require__(142); +var BuildGameObject = __webpack_require__(20); +var BuildGameObjectAnimation = __webpack_require__(292); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Sprite = __webpack_require__(37); @@ -103046,7 +104899,7 @@ GameObjectCreator.register('sprite', function (config) /***/ }), -/* 651 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103056,7 +104909,7 @@ GameObjectCreator.register('sprite', function (config) */ var BitmapText = __webpack_require__(131); -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); @@ -103092,7 +104945,7 @@ GameObjectCreator.register('bitmapText', function (config) /***/ }), -/* 652 */ +/* 655 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103101,7 +104954,7 @@ GameObjectCreator.register('bitmapText', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var Text = __webpack_require__(140); @@ -103171,7 +105024,7 @@ GameObjectCreator.register('text', function (config) /***/ }), -/* 653 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103180,7 +105033,7 @@ GameObjectCreator.register('text', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var TileSprite = __webpack_require__(141); @@ -103217,7 +105070,7 @@ GameObjectCreator.register('tileSprite', function (config) /***/ }), -/* 654 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103256,7 +105109,7 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 655 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103270,12 +105123,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(656); + renderWebGL = __webpack_require__(659); } if (true) { - renderCanvas = __webpack_require__(657); + renderCanvas = __webpack_require__(660); } module.exports = { @@ -103287,7 +105140,7 @@ module.exports = { /***/ }), -/* 656 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103326,7 +105179,7 @@ module.exports = MeshWebGLRenderer; /***/ }), -/* 657 */ +/* 660 */ /***/ (function(module, exports) { /** @@ -103355,7 +105208,7 @@ module.exports = MeshCanvasRenderer; /***/ }), -/* 658 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103405,7 +105258,7 @@ if (true) /***/ }), -/* 659 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103414,7 +105267,7 @@ if (true) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Quad = __webpack_require__(143); +var Quad = __webpack_require__(142); var GameObjectFactory = __webpack_require__(9); /** @@ -103451,7 +105304,7 @@ if (true) /***/ }), -/* 660 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103460,7 +105313,7 @@ if (true) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); var GetValue = __webpack_require__(4); @@ -103498,7 +105351,7 @@ GameObjectCreator.register('mesh', function (config) /***/ }), -/* 661 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103507,10 +105360,10 @@ GameObjectCreator.register('mesh', function (config) * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var BuildGameObject = __webpack_require__(19); +var BuildGameObject = __webpack_require__(20); var GameObjectCreator = __webpack_require__(13); var GetAdvancedValue = __webpack_require__(10); -var Quad = __webpack_require__(143); +var Quad = __webpack_require__(142); /** * Creates a new Quad Game Object and returns it. @@ -103542,7 +105395,7 @@ GameObjectCreator.register('quad', function (config) /***/ }), -/* 662 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103552,7 +105405,7 @@ GameObjectCreator.register('quad', function (config) */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(292); +var LightsManager = __webpack_require__(294); var PluginManager = __webpack_require__(12); /** @@ -103637,7 +105490,7 @@ module.exports = LightsPlugin; /***/ }), -/* 663 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103646,29 +105499,29 @@ module.exports = LightsPlugin; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); -Circle.Area = __webpack_require__(664); -Circle.Circumference = __webpack_require__(183); -Circle.CircumferencePoint = __webpack_require__(104); -Circle.Clone = __webpack_require__(665); +Circle.Area = __webpack_require__(667); +Circle.Circumference = __webpack_require__(184); +Circle.CircumferencePoint = __webpack_require__(105); +Circle.Clone = __webpack_require__(668); Circle.Contains = __webpack_require__(32); -Circle.ContainsPoint = __webpack_require__(666); -Circle.ContainsRect = __webpack_require__(667); -Circle.CopyFrom = __webpack_require__(668); -Circle.Equals = __webpack_require__(669); -Circle.GetBounds = __webpack_require__(670); -Circle.GetPoint = __webpack_require__(181); -Circle.GetPoints = __webpack_require__(182); -Circle.Offset = __webpack_require__(671); -Circle.OffsetPoint = __webpack_require__(672); -Circle.Random = __webpack_require__(105); +Circle.ContainsPoint = __webpack_require__(669); +Circle.ContainsRect = __webpack_require__(670); +Circle.CopyFrom = __webpack_require__(671); +Circle.Equals = __webpack_require__(672); +Circle.GetBounds = __webpack_require__(673); +Circle.GetPoint = __webpack_require__(182); +Circle.GetPoints = __webpack_require__(183); +Circle.Offset = __webpack_require__(674); +Circle.OffsetPoint = __webpack_require__(675); +Circle.Random = __webpack_require__(106); module.exports = Circle; /***/ }), -/* 664 */ +/* 667 */ /***/ (function(module, exports) { /** @@ -103696,7 +105549,7 @@ module.exports = Area; /***/ }), -/* 665 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103705,7 +105558,7 @@ module.exports = Area; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); /** * Creates a new Circle instance based on the values contained in the given source. @@ -103726,7 +105579,7 @@ module.exports = Clone; /***/ }), -/* 666 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103757,7 +105610,7 @@ module.exports = ContainsPoint; /***/ }), -/* 667 */ +/* 670 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103793,7 +105646,7 @@ module.exports = ContainsRect; /***/ }), -/* 668 */ +/* 671 */ /***/ (function(module, exports) { /** @@ -103823,7 +105676,7 @@ module.exports = CopyFrom; /***/ }), -/* 669 */ +/* 672 */ /***/ (function(module, exports) { /** @@ -103857,7 +105710,7 @@ module.exports = Equals; /***/ }), -/* 670 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103895,7 +105748,7 @@ module.exports = GetBounds; /***/ }), -/* 671 */ +/* 674 */ /***/ (function(module, exports) { /** @@ -103928,7 +105781,7 @@ module.exports = Offset; /***/ }), -/* 672 */ +/* 675 */ /***/ (function(module, exports) { /** @@ -103960,7 +105813,7 @@ module.exports = OffsetPoint; /***/ }), -/* 673 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103969,7 +105822,7 @@ module.exports = OffsetPoint; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); /** * [description] @@ -103991,7 +105844,7 @@ module.exports = CircleToCircle; /***/ }), -/* 674 */ +/* 677 */ /***/ (function(module, exports) { /** @@ -104045,7 +105898,7 @@ module.exports = CircleToRectangle; /***/ }), -/* 675 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104055,7 +105908,7 @@ module.exports = CircleToRectangle; */ var Rectangle = __webpack_require__(8); -var RectangleToRectangle = __webpack_require__(295); +var RectangleToRectangle = __webpack_require__(297); /** * [description] @@ -104088,7 +105941,7 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 676 */ +/* 679 */ /***/ (function(module, exports) { /** @@ -104189,7 +106042,7 @@ module.exports = LineToRectangle; /***/ }), -/* 677 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104198,7 +106051,7 @@ module.exports = LineToRectangle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PointToLine = __webpack_require__(297); +var PointToLine = __webpack_require__(299); /** * [description] @@ -104230,7 +106083,7 @@ module.exports = PointToLineSegment; /***/ }), -/* 678 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104241,8 +106094,8 @@ module.exports = PointToLineSegment; var LineToLine = __webpack_require__(89); var Contains = __webpack_require__(33); -var ContainsArray = __webpack_require__(144); -var Decompose = __webpack_require__(298); +var ContainsArray = __webpack_require__(143); +var Decompose = __webpack_require__(300); /** * [description] @@ -104323,7 +106176,7 @@ module.exports = RectangleToTriangle; /***/ }), -/* 679 */ +/* 682 */ /***/ (function(module, exports) { /** @@ -104363,7 +106216,7 @@ module.exports = RectangleToValues; /***/ }), -/* 680 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104372,8 +106225,8 @@ module.exports = RectangleToValues; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var LineToCircle = __webpack_require__(296); -var Contains = __webpack_require__(53); +var LineToCircle = __webpack_require__(298); +var Contains = __webpack_require__(54); /** * [description] @@ -104426,7 +106279,7 @@ module.exports = TriangleToCircle; /***/ }), -/* 681 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104435,7 +106288,7 @@ module.exports = TriangleToCircle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(53); +var Contains = __webpack_require__(54); var LineToLine = __webpack_require__(89); /** @@ -104480,7 +106333,7 @@ module.exports = TriangleToLine; /***/ }), -/* 682 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104489,8 +106342,8 @@ module.exports = TriangleToLine; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ContainsArray = __webpack_require__(144); -var Decompose = __webpack_require__(299); +var ContainsArray = __webpack_require__(143); +var Decompose = __webpack_require__(301); var LineToLine = __webpack_require__(89); /** @@ -104568,7 +106421,7 @@ module.exports = TriangleToTriangle; /***/ }), -/* 683 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104577,39 +106430,39 @@ module.exports = TriangleToTriangle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(300); +var Line = __webpack_require__(302); -Line.Angle = __webpack_require__(54); -Line.BresenhamPoints = __webpack_require__(191); -Line.CenterOn = __webpack_require__(684); -Line.Clone = __webpack_require__(685); -Line.CopyFrom = __webpack_require__(686); -Line.Equals = __webpack_require__(687); -Line.GetMidPoint = __webpack_require__(688); -Line.GetNormal = __webpack_require__(689); -Line.GetPoint = __webpack_require__(301); -Line.GetPoints = __webpack_require__(108); -Line.Height = __webpack_require__(690); -Line.Length = __webpack_require__(65); -Line.NormalAngle = __webpack_require__(302); -Line.NormalX = __webpack_require__(691); -Line.NormalY = __webpack_require__(692); -Line.Offset = __webpack_require__(693); -Line.PerpSlope = __webpack_require__(694); -Line.Random = __webpack_require__(110); -Line.ReflectAngle = __webpack_require__(695); -Line.Rotate = __webpack_require__(696); -Line.RotateAroundPoint = __webpack_require__(697); -Line.RotateAroundXY = __webpack_require__(145); -Line.SetToAngle = __webpack_require__(698); -Line.Slope = __webpack_require__(699); -Line.Width = __webpack_require__(700); +Line.Angle = __webpack_require__(55); +Line.BresenhamPoints = __webpack_require__(192); +Line.CenterOn = __webpack_require__(687); +Line.Clone = __webpack_require__(688); +Line.CopyFrom = __webpack_require__(689); +Line.Equals = __webpack_require__(690); +Line.GetMidPoint = __webpack_require__(691); +Line.GetNormal = __webpack_require__(692); +Line.GetPoint = __webpack_require__(303); +Line.GetPoints = __webpack_require__(109); +Line.Height = __webpack_require__(693); +Line.Length = __webpack_require__(66); +Line.NormalAngle = __webpack_require__(304); +Line.NormalX = __webpack_require__(694); +Line.NormalY = __webpack_require__(695); +Line.Offset = __webpack_require__(696); +Line.PerpSlope = __webpack_require__(697); +Line.Random = __webpack_require__(111); +Line.ReflectAngle = __webpack_require__(698); +Line.Rotate = __webpack_require__(699); +Line.RotateAroundPoint = __webpack_require__(700); +Line.RotateAroundXY = __webpack_require__(144); +Line.SetToAngle = __webpack_require__(701); +Line.Slope = __webpack_require__(702); +Line.Width = __webpack_require__(703); module.exports = Line; /***/ }), -/* 684 */ +/* 687 */ /***/ (function(module, exports) { /** @@ -104649,7 +106502,7 @@ module.exports = CenterOn; /***/ }), -/* 685 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104658,7 +106511,7 @@ module.exports = CenterOn; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Line = __webpack_require__(300); +var Line = __webpack_require__(302); /** * [description] @@ -104679,7 +106532,7 @@ module.exports = Clone; /***/ }), -/* 686 */ +/* 689 */ /***/ (function(module, exports) { /** @@ -104708,7 +106561,7 @@ module.exports = CopyFrom; /***/ }), -/* 687 */ +/* 690 */ /***/ (function(module, exports) { /** @@ -104742,7 +106595,7 @@ module.exports = Equals; /***/ }), -/* 688 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104778,7 +106631,7 @@ module.exports = GetMidPoint; /***/ }), -/* 689 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104788,7 +106641,7 @@ module.exports = GetMidPoint; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); var Point = __webpack_require__(5); /** @@ -104818,7 +106671,7 @@ module.exports = GetNormal; /***/ }), -/* 690 */ +/* 693 */ /***/ (function(module, exports) { /** @@ -104846,7 +106699,7 @@ module.exports = Height; /***/ }), -/* 691 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104856,7 +106709,7 @@ module.exports = Height; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -104877,7 +106730,7 @@ module.exports = NormalX; /***/ }), -/* 692 */ +/* 695 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104887,7 +106740,7 @@ module.exports = NormalX; */ var MATH_CONST = __webpack_require__(16); -var Angle = __webpack_require__(54); +var Angle = __webpack_require__(55); /** * [description] @@ -104908,7 +106761,7 @@ module.exports = NormalY; /***/ }), -/* 693 */ +/* 696 */ /***/ (function(module, exports) { /** @@ -104944,7 +106797,7 @@ module.exports = Offset; /***/ }), -/* 694 */ +/* 697 */ /***/ (function(module, exports) { /** @@ -104972,7 +106825,7 @@ module.exports = PerpSlope; /***/ }), -/* 695 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104981,8 +106834,8 @@ module.exports = PerpSlope; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Angle = __webpack_require__(54); -var NormalAngle = __webpack_require__(302); +var Angle = __webpack_require__(55); +var NormalAngle = __webpack_require__(304); /** * Returns the reflected angle between two lines. @@ -105008,7 +106861,7 @@ module.exports = ReflectAngle; /***/ }), -/* 696 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105017,7 +106870,7 @@ module.exports = ReflectAngle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(145); +var RotateAroundXY = __webpack_require__(144); /** * [description] @@ -105042,7 +106895,7 @@ module.exports = Rotate; /***/ }), -/* 697 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105051,7 +106904,7 @@ module.exports = Rotate; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(145); +var RotateAroundXY = __webpack_require__(144); /** * [description] @@ -105074,7 +106927,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 698 */ +/* 701 */ /***/ (function(module, exports) { /** @@ -105112,7 +106965,7 @@ module.exports = SetToAngle; /***/ }), -/* 699 */ +/* 702 */ /***/ (function(module, exports) { /** @@ -105140,7 +106993,7 @@ module.exports = Slope; /***/ }), -/* 700 */ +/* 703 */ /***/ (function(module, exports) { /** @@ -105168,7 +107021,7 @@ module.exports = Width; /***/ }), -/* 701 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105179,27 +107032,27 @@ module.exports = Width; var Point = __webpack_require__(5); -Point.Ceil = __webpack_require__(702); -Point.Clone = __webpack_require__(703); -Point.CopyFrom = __webpack_require__(704); -Point.Equals = __webpack_require__(705); -Point.Floor = __webpack_require__(706); -Point.GetCentroid = __webpack_require__(707); -Point.GetMagnitude = __webpack_require__(303); -Point.GetMagnitudeSq = __webpack_require__(304); -Point.GetRectangleFromPoints = __webpack_require__(708); -Point.Interpolate = __webpack_require__(709); -Point.Invert = __webpack_require__(710); -Point.Negative = __webpack_require__(711); -Point.Project = __webpack_require__(712); -Point.ProjectUnit = __webpack_require__(713); -Point.SetMagnitude = __webpack_require__(714); +Point.Ceil = __webpack_require__(705); +Point.Clone = __webpack_require__(706); +Point.CopyFrom = __webpack_require__(707); +Point.Equals = __webpack_require__(708); +Point.Floor = __webpack_require__(709); +Point.GetCentroid = __webpack_require__(710); +Point.GetMagnitude = __webpack_require__(305); +Point.GetMagnitudeSq = __webpack_require__(306); +Point.GetRectangleFromPoints = __webpack_require__(711); +Point.Interpolate = __webpack_require__(712); +Point.Invert = __webpack_require__(713); +Point.Negative = __webpack_require__(714); +Point.Project = __webpack_require__(715); +Point.ProjectUnit = __webpack_require__(716); +Point.SetMagnitude = __webpack_require__(717); module.exports = Point; /***/ }), -/* 702 */ +/* 705 */ /***/ (function(module, exports) { /** @@ -105227,7 +107080,7 @@ module.exports = Ceil; /***/ }), -/* 703 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105257,7 +107110,7 @@ module.exports = Clone; /***/ }), -/* 704 */ +/* 707 */ /***/ (function(module, exports) { /** @@ -105286,7 +107139,7 @@ module.exports = CopyFrom; /***/ }), -/* 705 */ +/* 708 */ /***/ (function(module, exports) { /** @@ -105315,7 +107168,7 @@ module.exports = Equals; /***/ }), -/* 706 */ +/* 709 */ /***/ (function(module, exports) { /** @@ -105343,7 +107196,7 @@ module.exports = Floor; /***/ }), -/* 707 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105404,7 +107257,7 @@ module.exports = GetCentroid; /***/ }), -/* 708 */ +/* 711 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105472,7 +107325,7 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 709 */ +/* 712 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105511,7 +107364,7 @@ module.exports = Interpolate; /***/ }), -/* 710 */ +/* 713 */ /***/ (function(module, exports) { /** @@ -105539,7 +107392,7 @@ module.exports = Invert; /***/ }), -/* 711 */ +/* 714 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105572,7 +107425,7 @@ module.exports = Negative; /***/ }), -/* 712 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105582,7 +107435,7 @@ module.exports = Negative; */ var Point = __webpack_require__(5); -var GetMagnitudeSq = __webpack_require__(304); +var GetMagnitudeSq = __webpack_require__(306); /** * [description] @@ -105616,7 +107469,7 @@ module.exports = Project; /***/ }), -/* 713 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105658,7 +107511,7 @@ module.exports = ProjectUnit; /***/ }), -/* 714 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105667,7 +107520,7 @@ module.exports = ProjectUnit; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetMagnitude = __webpack_require__(303); +var GetMagnitude = __webpack_require__(305); /** * [description] @@ -105700,7 +107553,7 @@ module.exports = SetMagnitude; /***/ }), -/* 715 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105709,19 +107562,19 @@ module.exports = SetMagnitude; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(305); +var Polygon = __webpack_require__(307); -Polygon.Clone = __webpack_require__(716); -Polygon.Contains = __webpack_require__(146); -Polygon.ContainsPoint = __webpack_require__(717); -Polygon.GetAABB = __webpack_require__(718); -Polygon.GetNumberArray = __webpack_require__(719); +Polygon.Clone = __webpack_require__(719); +Polygon.Contains = __webpack_require__(145); +Polygon.ContainsPoint = __webpack_require__(720); +Polygon.GetAABB = __webpack_require__(721); +Polygon.GetNumberArray = __webpack_require__(722); module.exports = Polygon; /***/ }), -/* 716 */ +/* 719 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105730,7 +107583,7 @@ module.exports = Polygon; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Polygon = __webpack_require__(305); +var Polygon = __webpack_require__(307); /** * [description] @@ -105751,7 +107604,7 @@ module.exports = Clone; /***/ }), -/* 717 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105760,7 +107613,7 @@ module.exports = Clone; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(146); +var Contains = __webpack_require__(145); /** * [description] @@ -105782,7 +107635,7 @@ module.exports = ContainsPoint; /***/ }), -/* 718 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105836,7 +107689,7 @@ module.exports = GetAABB; /***/ }), -/* 719 */ +/* 722 */ /***/ (function(module, exports) { /** @@ -105875,7 +107728,7 @@ module.exports = GetNumberArray; /***/ }), -/* 720 */ +/* 723 */ /***/ (function(module, exports) { /** @@ -105903,7 +107756,7 @@ module.exports = Area; /***/ }), -/* 721 */ +/* 724 */ /***/ (function(module, exports) { /** @@ -105934,7 +107787,7 @@ module.exports = Ceil; /***/ }), -/* 722 */ +/* 725 */ /***/ (function(module, exports) { /** @@ -105967,7 +107820,7 @@ module.exports = CeilAll; /***/ }), -/* 723 */ +/* 726 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105997,7 +107850,7 @@ module.exports = Clone; /***/ }), -/* 724 */ +/* 727 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106028,7 +107881,7 @@ module.exports = ContainsPoint; /***/ }), -/* 725 */ +/* 728 */ /***/ (function(module, exports) { /** @@ -106070,7 +107923,7 @@ module.exports = ContainsRect; /***/ }), -/* 726 */ +/* 729 */ /***/ (function(module, exports) { /** @@ -106099,7 +107952,7 @@ module.exports = CopyFrom; /***/ }), -/* 727 */ +/* 730 */ /***/ (function(module, exports) { /** @@ -106133,7 +107986,7 @@ module.exports = Equals; /***/ }), -/* 728 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106142,7 +107995,7 @@ module.exports = Equals; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(147); +var GetAspectRatio = __webpack_require__(146); // Fits the target rectangle into the source rectangle. // Preserves aspect ratio. @@ -106184,7 +108037,7 @@ module.exports = FitInside; /***/ }), -/* 729 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106193,7 +108046,7 @@ module.exports = FitInside; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetAspectRatio = __webpack_require__(147); +var GetAspectRatio = __webpack_require__(146); // Fits the target rectangle around the source rectangle. // Preserves aspect ration. @@ -106235,7 +108088,7 @@ module.exports = FitOutside; /***/ }), -/* 730 */ +/* 733 */ /***/ (function(module, exports) { /** @@ -106266,7 +108119,7 @@ module.exports = Floor; /***/ }), -/* 731 */ +/* 734 */ /***/ (function(module, exports) { /** @@ -106299,7 +108152,7 @@ module.exports = FloorAll; /***/ }), -/* 732 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106337,7 +108190,7 @@ module.exports = GetCenter; /***/ }), -/* 733 */ +/* 736 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106376,7 +108229,7 @@ module.exports = GetSize; /***/ }), -/* 734 */ +/* 737 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106385,7 +108238,7 @@ module.exports = GetSize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CenterOn = __webpack_require__(307); +var CenterOn = __webpack_require__(309); // Increases the size of the Rectangle object by the specified amounts. // The center point of the Rectangle object stays the same, and its size increases @@ -106417,7 +108270,7 @@ module.exports = Inflate; /***/ }), -/* 735 */ +/* 738 */ /***/ (function(module, exports) { /** @@ -106467,7 +108320,7 @@ module.exports = MergePoints; /***/ }), -/* 736 */ +/* 739 */ /***/ (function(module, exports) { /** @@ -106511,7 +108364,7 @@ module.exports = MergeRect; /***/ }), -/* 737 */ +/* 740 */ /***/ (function(module, exports) { /** @@ -106553,7 +108406,7 @@ module.exports = MergeXY; /***/ }), -/* 738 */ +/* 741 */ /***/ (function(module, exports) { /** @@ -106586,7 +108439,7 @@ module.exports = Offset; /***/ }), -/* 739 */ +/* 742 */ /***/ (function(module, exports) { /** @@ -106618,7 +108471,7 @@ module.exports = OffsetPoint; /***/ }), -/* 740 */ +/* 743 */ /***/ (function(module, exports) { /** @@ -106652,7 +108505,7 @@ module.exports = Overlaps; /***/ }), -/* 741 */ +/* 744 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106707,7 +108560,7 @@ module.exports = PerimeterPoint; /***/ }), -/* 742 */ +/* 745 */ /***/ (function(module, exports) { /** @@ -106744,7 +108597,7 @@ module.exports = Scale; /***/ }), -/* 743 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106786,7 +108639,7 @@ module.exports = Union; /***/ }), -/* 744 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106795,38 +108648,38 @@ module.exports = Union; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); -Triangle.Area = __webpack_require__(745); -Triangle.BuildEquilateral = __webpack_require__(746); -Triangle.BuildFromPolygon = __webpack_require__(747); -Triangle.BuildRight = __webpack_require__(748); -Triangle.CenterOn = __webpack_require__(749); -Triangle.Centroid = __webpack_require__(310); -Triangle.CircumCenter = __webpack_require__(750); -Triangle.CircumCircle = __webpack_require__(751); -Triangle.Clone = __webpack_require__(752); -Triangle.Contains = __webpack_require__(53); -Triangle.ContainsArray = __webpack_require__(144); -Triangle.ContainsPoint = __webpack_require__(753); -Triangle.CopyFrom = __webpack_require__(754); -Triangle.Decompose = __webpack_require__(299); -Triangle.Equals = __webpack_require__(755); -Triangle.GetPoint = __webpack_require__(308); -Triangle.GetPoints = __webpack_require__(309); -Triangle.InCenter = __webpack_require__(312); -Triangle.Perimeter = __webpack_require__(756); -Triangle.Offset = __webpack_require__(311); -Triangle.Random = __webpack_require__(111); -Triangle.Rotate = __webpack_require__(757); -Triangle.RotateAroundPoint = __webpack_require__(758); -Triangle.RotateAroundXY = __webpack_require__(148); +Triangle.Area = __webpack_require__(748); +Triangle.BuildEquilateral = __webpack_require__(749); +Triangle.BuildFromPolygon = __webpack_require__(750); +Triangle.BuildRight = __webpack_require__(751); +Triangle.CenterOn = __webpack_require__(752); +Triangle.Centroid = __webpack_require__(312); +Triangle.CircumCenter = __webpack_require__(753); +Triangle.CircumCircle = __webpack_require__(754); +Triangle.Clone = __webpack_require__(755); +Triangle.Contains = __webpack_require__(54); +Triangle.ContainsArray = __webpack_require__(143); +Triangle.ContainsPoint = __webpack_require__(756); +Triangle.CopyFrom = __webpack_require__(757); +Triangle.Decompose = __webpack_require__(301); +Triangle.Equals = __webpack_require__(758); +Triangle.GetPoint = __webpack_require__(310); +Triangle.GetPoints = __webpack_require__(311); +Triangle.InCenter = __webpack_require__(314); +Triangle.Perimeter = __webpack_require__(759); +Triangle.Offset = __webpack_require__(313); +Triangle.Random = __webpack_require__(112); +Triangle.Rotate = __webpack_require__(760); +Triangle.RotateAroundPoint = __webpack_require__(761); +Triangle.RotateAroundXY = __webpack_require__(147); module.exports = Triangle; /***/ }), -/* 745 */ +/* 748 */ /***/ (function(module, exports) { /** @@ -106865,7 +108718,7 @@ module.exports = Area; /***/ }), -/* 746 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106874,7 +108727,7 @@ module.exports = Area; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); // Builds an equilateral triangle. // In the equilateral triangle, all the sides are the same length (congruent) @@ -106915,7 +108768,7 @@ module.exports = BuildEquilateral; /***/ }), -/* 747 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106924,8 +108777,8 @@ module.exports = BuildEquilateral; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var EarCut = __webpack_require__(235); -var Triangle = __webpack_require__(55); +var EarCut = __webpack_require__(238); +var Triangle = __webpack_require__(56); /** * [description] @@ -106988,7 +108841,7 @@ module.exports = BuildFromPolygon; /***/ }), -/* 748 */ +/* 751 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106997,7 +108850,7 @@ module.exports = BuildFromPolygon; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); // Builds a right triangle, with one 90 degree angle and two acute angles // The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) @@ -107037,7 +108890,7 @@ module.exports = BuildRight; /***/ }), -/* 749 */ +/* 752 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107046,8 +108899,8 @@ module.exports = BuildRight; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Centroid = __webpack_require__(310); -var Offset = __webpack_require__(311); +var Centroid = __webpack_require__(312); +var Offset = __webpack_require__(313); /** * [description] @@ -107080,7 +108933,7 @@ module.exports = CenterOn; /***/ }), -/* 750 */ +/* 753 */ /***/ (function(module, exports) { /** @@ -107148,7 +109001,7 @@ module.exports = CircumCenter; /***/ }), -/* 751 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107157,7 +109010,7 @@ module.exports = CircumCenter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); // Adapted from https://gist.github.com/mutoo/5617691 @@ -107229,7 +109082,7 @@ module.exports = CircumCircle; /***/ }), -/* 752 */ +/* 755 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107238,7 +109091,7 @@ module.exports = CircumCircle; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Triangle = __webpack_require__(55); +var Triangle = __webpack_require__(56); /** * [description] @@ -107259,7 +109112,7 @@ module.exports = Clone; /***/ }), -/* 753 */ +/* 756 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107268,7 +109121,7 @@ module.exports = Clone; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Contains = __webpack_require__(53); +var Contains = __webpack_require__(54); /** * [description] @@ -107290,7 +109143,7 @@ module.exports = ContainsPoint; /***/ }), -/* 754 */ +/* 757 */ /***/ (function(module, exports) { /** @@ -107319,7 +109172,7 @@ module.exports = CopyFrom; /***/ }), -/* 755 */ +/* 758 */ /***/ (function(module, exports) { /** @@ -107355,7 +109208,7 @@ module.exports = Equals; /***/ }), -/* 756 */ +/* 759 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107364,7 +109217,7 @@ module.exports = Equals; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Length = __webpack_require__(65); +var Length = __webpack_require__(66); // The 2D area of a triangle. The area value is always non-negative. @@ -107391,7 +109244,7 @@ module.exports = Perimeter; /***/ }), -/* 757 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107400,8 +109253,8 @@ module.exports = Perimeter; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(148); -var InCenter = __webpack_require__(312); +var RotateAroundXY = __webpack_require__(147); +var InCenter = __webpack_require__(314); /** * [description] @@ -107425,7 +109278,7 @@ module.exports = Rotate; /***/ }), -/* 758 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107434,7 +109287,7 @@ module.exports = Rotate; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RotateAroundXY = __webpack_require__(148); +var RotateAroundXY = __webpack_require__(147); /** * [description] @@ -107457,7 +109310,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 759 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107472,20 +109325,20 @@ module.exports = RotateAroundPoint; module.exports = { - Gamepad: __webpack_require__(760), - InputManager: __webpack_require__(239), - InputPlugin: __webpack_require__(765), - InteractiveObject: __webpack_require__(313), - Keyboard: __webpack_require__(766), - Mouse: __webpack_require__(771), - Pointer: __webpack_require__(248), - Touch: __webpack_require__(772) + Gamepad: __webpack_require__(763), + InputManager: __webpack_require__(240), + InputPlugin: __webpack_require__(768), + InteractiveObject: __webpack_require__(315), + Keyboard: __webpack_require__(769), + Mouse: __webpack_require__(774), + Pointer: __webpack_require__(249), + Touch: __webpack_require__(775) }; /***/ }), -/* 760 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107500,17 +109353,17 @@ module.exports = { module.exports = { - Axis: __webpack_require__(242), - Button: __webpack_require__(243), - Gamepad: __webpack_require__(241), - GamepadManager: __webpack_require__(240), + Axis: __webpack_require__(243), + Button: __webpack_require__(244), + Gamepad: __webpack_require__(242), + GamepadManager: __webpack_require__(241), - Configs: __webpack_require__(761) + Configs: __webpack_require__(764) }; /***/ }), -/* 761 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107525,15 +109378,15 @@ module.exports = { module.exports = { - DUALSHOCK_4: __webpack_require__(762), - SNES_USB: __webpack_require__(763), - XBOX_360: __webpack_require__(764) + DUALSHOCK_4: __webpack_require__(765), + SNES_USB: __webpack_require__(766), + XBOX_360: __webpack_require__(767) }; /***/ }), -/* 762 */ +/* 765 */ /***/ (function(module, exports) { /** @@ -107584,7 +109437,7 @@ module.exports = { /***/ }), -/* 763 */ +/* 766 */ /***/ (function(module, exports) { /** @@ -107624,7 +109477,7 @@ module.exports = { /***/ }), -/* 764 */ +/* 767 */ /***/ (function(module, exports) { /** @@ -107676,7 +109529,7 @@ module.exports = { /***/ }), -/* 765 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107685,19 +109538,19 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Circle = __webpack_require__(63); +var Circle = __webpack_require__(64); var CircleContains = __webpack_require__(32); var Class = __webpack_require__(0); -var DistanceBetween = __webpack_require__(41); +var DistanceBetween = __webpack_require__(42); var Ellipse = __webpack_require__(135); var EllipseContains = __webpack_require__(68); var EventEmitter = __webpack_require__(14); -var InteractiveObject = __webpack_require__(313); +var InteractiveObject = __webpack_require__(315); var PluginManager = __webpack_require__(12); var Rectangle = __webpack_require__(8); var RectangleContains = __webpack_require__(33); -var Triangle = __webpack_require__(55); -var TriangleContains = __webpack_require__(53); +var Triangle = __webpack_require__(56); +var TriangleContains = __webpack_require__(54); /** * @classdesc @@ -107865,6 +109718,17 @@ var InputPlugin = new Class({ */ this._temp = []; + /** + * Used to temporarily store the results of the Hit Test dropZones + * + * @name Phaser.Input.InputPlugin#_tempZones + * @type {array} + * @private + * @default [] + * @since 3.0.0 + */ + this._tempZones = []; + /** * A list of all Game Objects that have been set to be interactive. * @@ -107995,8 +109859,6 @@ var InputPlugin = new Class({ { current.splice(index, 1); - // TODO: Clear from _draggable, _drag and _over too - this.clear(gameObject); } } @@ -108014,9 +109876,9 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#clear * @since 3.0.0 * - * @param {[type]} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] * - * @return {[type]} [description] + * @return {Phaser.GameObjects.GameObject} [description] */ clear: function (gameObject) { @@ -108030,6 +109892,28 @@ var InputPlugin = new Class({ gameObject.input = null; + // Clear from _draggable, _drag and _over + var index = this._draggable.indexOf(gameObject); + + if (index > -1) + { + this._draggable.splice(index, 1); + } + + index = this._drag[0].indexOf(gameObject); + + if (index > -1) + { + this._drag[0].splice(index, 1); + } + + index = this._over[0].indexOf(gameObject); + + if (index > -1) + { + this._over[0].splice(index, 1); + } + return gameObject; }, @@ -108039,7 +109923,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#disable * @since 3.0.0 * - * @param {[type]} gameObject - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] */ disable: function (gameObject) { @@ -108052,14 +109936,17 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#enable * @since 3.0.0 * - * @param {[type]} gameObject - [description] - * @param {[type]} shape - [description] - * @param {[type]} callback - [description] + * @param {Phaser.GameObjects.GameObject} gameObject - [description] + * @param {object} shape - [description] + * @param {function} callback - [description] + * @param {boolean} [dropZone=false] - [description] * - * @return {[type]} [description] + * @return {Phaser.Input.InputPlugin} This Input Plugin. */ - enable: function (gameObject, shape, callback) + enable: function (gameObject, shape, callback, dropZone) { + if (dropZone === undefined) { dropZone = false; } + if (gameObject.input) { // If it is already has an InteractiveObject then just enable it and return @@ -108070,6 +109957,8 @@ var InputPlugin = new Class({ // Create an InteractiveObject and enable it this.setHitArea(gameObject, shape, callback); } + + gameObject.input.dropZone = dropZone; return this; }, @@ -108080,9 +109969,9 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#hitTestPointer * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * - * @return {[type]} [description] + * @return {array} [description] */ hitTestPointer: function (pointer) { @@ -108094,7 +109983,20 @@ var InputPlugin = new Class({ // Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'output' array. // All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well. - return this.manager.hitTest(pointer.x, pointer.y, this._list, camera); + var over = this.manager.hitTest(pointer.x, pointer.y, this._list, camera); + + // Filter out the drop zones + for (var i = 0; i < over.length; i++) + { + var obj = over[i]; + + if (obj.input.dropZone) + { + this._tempZones.push(obj); + } + } + + return over; } else { @@ -108108,7 +110010,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processDownEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -108147,10 +110049,10 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processDragEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] - * @param {[type]} time - [description] + * @param {number} pointer - [description] + * @param {number} time - [description] * - * @return {[type]} [description] + * @return {integer} [description] */ processDragEvents: function (pointer, time) { @@ -108161,7 +110063,6 @@ var InputPlugin = new Class({ } var i; - var c; var gameObject; var list; var input; @@ -108205,7 +110106,7 @@ var InputPlugin = new Class({ { pointer.dragState = 0; - return; + return 0; } else if (draglist.length > 1) { @@ -108276,22 +110177,13 @@ var InputPlugin = new Class({ pointer.dragState = 4; - return; + return 1; } // 4 = Pointer actively dragging the draglist and has moved if (pointer.dragState === 4 && pointer.justMoved) { - // Let's filter out currentlyOver for dropZones only - var dropZones = []; - - for (c = 0; c < currentlyOver.length; c++) - { - if (currentlyOver[c].input.dropZone) - { - dropZones.push(currentlyOver[c]); - } - } + var dropZones = this._tempZones; list = this._drag[pointer.id]; @@ -108417,7 +110309,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processMoveEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -108460,7 +110352,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processOverOutEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] * * @return {[type]} [description] */ @@ -108474,6 +110366,7 @@ var InputPlugin = new Class({ var justOver = []; var stillOver = []; var previouslyOver = this._over[pointer.id]; + var currentlyDragging = this._drag[pointer.id]; // Go through all objects the pointer was previously over, and see if it still is. // Splits the previouslyOver array into two parts: justOut and stillOver @@ -108482,7 +110375,7 @@ var InputPlugin = new Class({ { gameObject = previouslyOver[i]; - if (currentlyOver.indexOf(gameObject) === -1) + if (currentlyOver.indexOf(gameObject) === -1 && currentlyDragging.indexOf(gameObject) === -1) { // Not in the currentlyOver array, so must be outside of this object now justOut.push(gameObject); @@ -108575,7 +110468,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#processUpEvents * @since 3.0.0 * - * @param {[type]} pointer - [description] + * @param {Phaser.Input.Pointer} pointer - [description] */ processUpEvents: function (pointer) { @@ -108598,6 +110491,8 @@ var InputPlugin = new Class({ this.emit('gameobjectup', pointer, gameObject); } + + return currentlyOver.length; }, /** @@ -109079,10 +110974,8 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#update * @since 3.0.0 * - * @param {[type]} time - [description] - * @param {[type]} delta - [description] - * - * @return {[type]} [description] + * @param {number} time - [description] + * @param {number} delta - [description] */ update: function (time, delta) { @@ -109116,14 +111009,27 @@ var InputPlugin = new Class({ return; } + // Always reset this array + this._tempZones = []; + + // _temp contains a hit tested and camera culled list of IO objects this._temp = this.hitTestPointer(pointer); this.sortGameObjects(this._temp); + this.sortGameObjects(this._tempZones); - if (this.topOnly && this._temp.length) + if (this.topOnly) { // Only the top-most one counts now, so safely ignore the rest - this._temp.splice(1); + if (this._temp.length) + { + this._temp.splice(1); + } + + if (this._tempZones.length) + { + this._tempZones.splice(1); + } } var total = this.processDragEvents(pointer, time); @@ -109140,7 +111046,7 @@ var InputPlugin = new Class({ if (pointer.justUp) { - this.processUpEvents(pointer); + total += this.processUpEvents(pointer); } if (pointer.justMoved) @@ -109258,7 +111164,7 @@ module.exports = InputPlugin; /***/ }), -/* 766 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109273,23 +111179,23 @@ module.exports = InputPlugin; module.exports = { - KeyboardManager: __webpack_require__(244), + KeyboardManager: __webpack_require__(245), - Key: __webpack_require__(245), + Key: __webpack_require__(246), KeyCodes: __webpack_require__(128), - KeyCombo: __webpack_require__(246), + KeyCombo: __webpack_require__(247), - JustDown: __webpack_require__(767), - JustUp: __webpack_require__(768), - DownDuration: __webpack_require__(769), - UpDuration: __webpack_require__(770) + JustDown: __webpack_require__(770), + JustUp: __webpack_require__(771), + DownDuration: __webpack_require__(772), + UpDuration: __webpack_require__(773) }; /***/ }), -/* 767 */ +/* 770 */ /***/ (function(module, exports) { /** @@ -109328,7 +111234,7 @@ module.exports = JustDown; /***/ }), -/* 768 */ +/* 771 */ /***/ (function(module, exports) { /** @@ -109367,7 +111273,7 @@ module.exports = JustUp; /***/ }), -/* 769 */ +/* 772 */ /***/ (function(module, exports) { /** @@ -109399,7 +111305,7 @@ module.exports = DownDuration; /***/ }), -/* 770 */ +/* 773 */ /***/ (function(module, exports) { /** @@ -109431,7 +111337,7 @@ module.exports = UpDuration; /***/ }), -/* 771 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109447,14 +111353,14 @@ module.exports = UpDuration; /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(247) + MouseManager: __webpack_require__(248) }; /* eslint-enable */ /***/ }), -/* 772 */ +/* 775 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109470,14 +111376,14 @@ module.exports = { /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(249) + TouchManager: __webpack_require__(250) }; /* eslint-enable */ /***/ }), -/* 773 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109492,21 +111398,21 @@ module.exports = { module.exports = { - FileTypes: __webpack_require__(774), + FileTypes: __webpack_require__(777), File: __webpack_require__(18), FileTypesManager: __webpack_require__(7), - GetURL: __webpack_require__(149), - LoaderPlugin: __webpack_require__(790), - MergeXHRSettings: __webpack_require__(150), - XHRLoader: __webpack_require__(314), + GetURL: __webpack_require__(148), + LoaderPlugin: __webpack_require__(793), + MergeXHRSettings: __webpack_require__(149), + XHRLoader: __webpack_require__(316), XHRSettings: __webpack_require__(90) }; /***/ }), -/* 774 */ +/* 777 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109544,33 +111450,33 @@ module.exports = { module.exports = { - AnimationJSONFile: __webpack_require__(775), - AtlasJSONFile: __webpack_require__(776), - AudioFile: __webpack_require__(315), - AudioSprite: __webpack_require__(777), - BinaryFile: __webpack_require__(778), - BitmapFontFile: __webpack_require__(779), - GLSLFile: __webpack_require__(780), - HTML5AudioFile: __webpack_require__(316), - HTMLFile: __webpack_require__(781), - ImageFile: __webpack_require__(57), - JSONFile: __webpack_require__(56), - MultiAtlas: __webpack_require__(782), - PluginFile: __webpack_require__(783), - ScriptFile: __webpack_require__(784), - SpriteSheetFile: __webpack_require__(785), - SVGFile: __webpack_require__(786), - TextFile: __webpack_require__(319), - TilemapCSVFile: __webpack_require__(787), - TilemapJSONFile: __webpack_require__(788), - UnityAtlasFile: __webpack_require__(789), - XMLFile: __webpack_require__(317) + AnimationJSONFile: __webpack_require__(778), + AtlasJSONFile: __webpack_require__(779), + AudioFile: __webpack_require__(317), + AudioSprite: __webpack_require__(780), + BinaryFile: __webpack_require__(781), + BitmapFontFile: __webpack_require__(782), + GLSLFile: __webpack_require__(783), + HTML5AudioFile: __webpack_require__(318), + HTMLFile: __webpack_require__(784), + ImageFile: __webpack_require__(58), + JSONFile: __webpack_require__(57), + MultiAtlas: __webpack_require__(785), + PluginFile: __webpack_require__(786), + ScriptFile: __webpack_require__(787), + SpriteSheetFile: __webpack_require__(788), + SVGFile: __webpack_require__(789), + TextFile: __webpack_require__(321), + TilemapCSVFile: __webpack_require__(790), + TilemapJSONFile: __webpack_require__(791), + UnityAtlasFile: __webpack_require__(792), + XMLFile: __webpack_require__(319) }; /***/ }), -/* 775 */ +/* 778 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109580,7 +111486,7 @@ module.exports = { */ var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(57); /** * An Animation JSON File. @@ -109652,7 +111558,7 @@ module.exports = AnimationJSONFile; /***/ }), -/* 776 */ +/* 779 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109662,8 +111568,8 @@ module.exports = AnimationJSONFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var JSONFile = __webpack_require__(56); +var ImageFile = __webpack_require__(58); +var JSONFile = __webpack_require__(57); /** * An Atlas JSON File. @@ -109730,7 +111636,7 @@ module.exports = AtlasJSONFile; /***/ }), -/* 777 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109739,10 +111645,10 @@ module.exports = AtlasJSONFile; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AudioFile = __webpack_require__(315); +var AudioFile = __webpack_require__(317); var CONST = __webpack_require__(17); var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); +var JSONFile = __webpack_require__(57); /** * Adds an Audio Sprite file to the current load queue. @@ -109804,7 +111710,7 @@ FileTypesManager.register('audioSprite', function (key, urls, json, config, audi /***/ }), -/* 778 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109910,7 +111816,7 @@ module.exports = BinaryFile; /***/ }), -/* 779 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109920,8 +111826,8 @@ module.exports = BinaryFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var XMLFile = __webpack_require__(317); +var ImageFile = __webpack_require__(58); +var XMLFile = __webpack_require__(319); /** * An Bitmap Font File. @@ -109988,7 +111894,7 @@ module.exports = BitmapFontFile; /***/ }), -/* 780 */ +/* 783 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110094,7 +112000,7 @@ module.exports = GLSLFile; /***/ }), -/* 781 */ +/* 784 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110258,7 +112164,7 @@ module.exports = HTMLFile; /***/ }), -/* 782 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110268,9 +112174,9 @@ module.exports = HTMLFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var JSONFile = __webpack_require__(56); -var NumberArray = __webpack_require__(318); +var ImageFile = __webpack_require__(58); +var JSONFile = __webpack_require__(57); +var NumberArray = __webpack_require__(320); /** * Adds a Multi File Texture Atlas to the current load queue. @@ -110347,7 +112253,7 @@ FileTypesManager.register('multiatlas', function (key, textureURLs, atlasURLs, t /***/ }), -/* 783 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110386,6 +112292,14 @@ var PluginFile = new Class({ function PluginFile (key, url, path, xhrSettings) { + // If the url variable refers to a class, add the plugin directly + if (typeof url === 'function') + { + this.key = key; + window[key] = url; + window[key].register(PluginManager); + } + var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', ''); var fileConfig = { @@ -110463,7 +112377,7 @@ module.exports = PluginFile; /***/ }), -/* 784 */ +/* 787 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110575,7 +112489,7 @@ module.exports = ScriptFile; /***/ }), -/* 785 */ +/* 788 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110585,7 +112499,7 @@ module.exports = ScriptFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); +var ImageFile = __webpack_require__(58); /** * A Sprite Sheet File. @@ -110652,7 +112566,7 @@ module.exports = SpriteSheetFile; /***/ }), -/* 786 */ +/* 789 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110807,7 +112721,7 @@ module.exports = SVGFile; /***/ }), -/* 787 */ +/* 790 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110820,7 +112734,7 @@ var Class = __webpack_require__(0); var CONST = __webpack_require__(17); var File = __webpack_require__(18); var FileTypesManager = __webpack_require__(7); -var TILEMAP_FORMATS = __webpack_require__(20); +var TILEMAP_FORMATS = __webpack_require__(21); /** * @classdesc @@ -110914,7 +112828,7 @@ module.exports = TilemapCSVFile; /***/ }), -/* 788 */ +/* 791 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110924,8 +112838,8 @@ module.exports = TilemapCSVFile; */ var FileTypesManager = __webpack_require__(7); -var JSONFile = __webpack_require__(56); -var TILEMAP_FORMATS = __webpack_require__(20); +var JSONFile = __webpack_require__(57); +var TILEMAP_FORMATS = __webpack_require__(21); /** * A Tilemap File. @@ -111029,7 +112943,7 @@ module.exports = TilemapJSONFile; /***/ }), -/* 789 */ +/* 792 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111039,8 +112953,8 @@ module.exports = TilemapJSONFile; */ var FileTypesManager = __webpack_require__(7); -var ImageFile = __webpack_require__(57); -var TextFile = __webpack_require__(319); +var ImageFile = __webpack_require__(58); +var TextFile = __webpack_require__(321); /** * An Atlas JSON File. @@ -111108,7 +113022,7 @@ module.exports = UnityAtlasFile; /***/ }), -/* 790 */ +/* 793 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111119,11 +113033,11 @@ module.exports = UnityAtlasFile; var Class = __webpack_require__(0); var CONST = __webpack_require__(17); -var CustomSet = __webpack_require__(61); +var CustomSet = __webpack_require__(62); var EventEmitter = __webpack_require__(14); var FileTypesManager = __webpack_require__(7); var GetFastValue = __webpack_require__(2); -var ParseXMLBitmapFont = __webpack_require__(268); +var ParseXMLBitmapFont = __webpack_require__(269); var PluginManager = __webpack_require__(12); var XHRSettings = __webpack_require__(90); @@ -111769,7 +113683,7 @@ var LoaderPlugin = new Class({ // Yup, add them to the Texture Manager // Is the data JSON Hash or JSON Array? - if (Array.isArray(data[0].frames)) + if (Array.isArray(data[0].textures) || Array.isArray(data[0].frames)) { textures.addAtlasJSONArray(key, images, data); } @@ -112090,7 +114004,7 @@ module.exports = LoaderPlugin; /***/ }), -/* 791 */ +/* 794 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112109,58 +114023,58 @@ var Extend = __webpack_require__(23); var PhaserMath = { // Collections of functions - Angle: __webpack_require__(792), - Distance: __webpack_require__(800), - Easing: __webpack_require__(803), - Fuzzy: __webpack_require__(804), - Interpolation: __webpack_require__(810), - Pow2: __webpack_require__(813), - Snap: __webpack_require__(815), + Angle: __webpack_require__(795), + Distance: __webpack_require__(803), + Easing: __webpack_require__(806), + Fuzzy: __webpack_require__(807), + Interpolation: __webpack_require__(813), + Pow2: __webpack_require__(816), + Snap: __webpack_require__(818), // Single functions - Average: __webpack_require__(819), - Bernstein: __webpack_require__(321), - Between: __webpack_require__(228), - CatmullRom: __webpack_require__(122), - CeilTo: __webpack_require__(820), - Clamp: __webpack_require__(60), + Average: __webpack_require__(822), + Bernstein: __webpack_require__(323), + Between: __webpack_require__(231), + CatmullRom: __webpack_require__(123), + CeilTo: __webpack_require__(823), + Clamp: __webpack_require__(61), DegToRad: __webpack_require__(35), - Difference: __webpack_require__(821), - Factorial: __webpack_require__(322), - FloatBetween: __webpack_require__(275), - FloorTo: __webpack_require__(822), - FromPercent: __webpack_require__(64), - GetSpeed: __webpack_require__(823), - IsEven: __webpack_require__(824), - IsEvenStrict: __webpack_require__(825), - Linear: __webpack_require__(227), - MaxAdd: __webpack_require__(826), - MinSub: __webpack_require__(827), - Percent: __webpack_require__(828), - RadToDeg: __webpack_require__(218), - RandomXY: __webpack_require__(829), - RandomXYZ: __webpack_require__(206), - RandomXYZW: __webpack_require__(207), - Rotate: __webpack_require__(323), - RotateAround: __webpack_require__(185), - RotateAroundDistance: __webpack_require__(112), - RoundAwayFromZero: __webpack_require__(324), - RoundTo: __webpack_require__(830), - SinCosTableGenerator: __webpack_require__(831), - SmootherStep: __webpack_require__(192), - SmoothStep: __webpack_require__(193), - TransformXY: __webpack_require__(250), - Within: __webpack_require__(832), + Difference: __webpack_require__(824), + Factorial: __webpack_require__(324), + FloatBetween: __webpack_require__(276), + FloorTo: __webpack_require__(825), + FromPercent: __webpack_require__(65), + GetSpeed: __webpack_require__(826), + IsEven: __webpack_require__(827), + IsEvenStrict: __webpack_require__(828), + Linear: __webpack_require__(230), + MaxAdd: __webpack_require__(829), + MinSub: __webpack_require__(830), + Percent: __webpack_require__(831), + RadToDeg: __webpack_require__(219), + RandomXY: __webpack_require__(832), + RandomXYZ: __webpack_require__(207), + RandomXYZW: __webpack_require__(208), + Rotate: __webpack_require__(325), + RotateAround: __webpack_require__(186), + RotateAroundDistance: __webpack_require__(113), + RoundAwayFromZero: __webpack_require__(326), + RoundTo: __webpack_require__(833), + SinCosTableGenerator: __webpack_require__(834), + SmootherStep: __webpack_require__(193), + SmoothStep: __webpack_require__(194), + TransformXY: __webpack_require__(251), + Within: __webpack_require__(835), Wrap: __webpack_require__(50), // Vector classes Vector2: __webpack_require__(6), Vector3: __webpack_require__(51), - Vector4: __webpack_require__(119), - Matrix3: __webpack_require__(210), - Matrix4: __webpack_require__(118), - Quaternion: __webpack_require__(209), - RotateVec3: __webpack_require__(208) + Vector4: __webpack_require__(120), + Matrix3: __webpack_require__(211), + Matrix4: __webpack_require__(119), + Quaternion: __webpack_require__(210), + RotateVec3: __webpack_require__(209) }; @@ -112174,7 +114088,7 @@ module.exports = PhaserMath; /***/ }), -/* 792 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112189,22 +114103,22 @@ module.exports = PhaserMath; module.exports = { - Between: __webpack_require__(793), - BetweenY: __webpack_require__(794), - BetweenPoints: __webpack_require__(795), - BetweenPointsY: __webpack_require__(796), - Reverse: __webpack_require__(797), - RotateTo: __webpack_require__(798), - ShortestBetween: __webpack_require__(799), - Normalize: __webpack_require__(320), - Wrap: __webpack_require__(162), - WrapDegrees: __webpack_require__(163) + Between: __webpack_require__(796), + BetweenY: __webpack_require__(797), + BetweenPoints: __webpack_require__(798), + BetweenPointsY: __webpack_require__(799), + Reverse: __webpack_require__(800), + RotateTo: __webpack_require__(801), + ShortestBetween: __webpack_require__(802), + Normalize: __webpack_require__(322), + Wrap: __webpack_require__(161), + WrapDegrees: __webpack_require__(162) }; /***/ }), -/* 793 */ +/* 796 */ /***/ (function(module, exports) { /** @@ -112235,7 +114149,7 @@ module.exports = Between; /***/ }), -/* 794 */ +/* 797 */ /***/ (function(module, exports) { /** @@ -112266,7 +114180,7 @@ module.exports = BetweenY; /***/ }), -/* 795 */ +/* 798 */ /***/ (function(module, exports) { /** @@ -112295,7 +114209,7 @@ module.exports = BetweenPoints; /***/ }), -/* 796 */ +/* 799 */ /***/ (function(module, exports) { /** @@ -112324,7 +114238,7 @@ module.exports = BetweenPointsY; /***/ }), -/* 797 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112333,7 +114247,7 @@ module.exports = BetweenPointsY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Normalize = __webpack_require__(320); +var Normalize = __webpack_require__(322); /** * [description] @@ -112354,7 +114268,7 @@ module.exports = Reverse; /***/ }), -/* 798 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112421,7 +114335,7 @@ module.exports = RotateTo; /***/ }), -/* 799 */ +/* 802 */ /***/ (function(module, exports) { /** @@ -112467,7 +114381,7 @@ module.exports = ShortestBetween; /***/ }), -/* 800 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112482,15 +114396,15 @@ module.exports = ShortestBetween; module.exports = { - Between: __webpack_require__(41), - Power: __webpack_require__(801), - Squared: __webpack_require__(802) + Between: __webpack_require__(42), + Power: __webpack_require__(804), + Squared: __webpack_require__(805) }; /***/ }), -/* 801 */ +/* 804 */ /***/ (function(module, exports) { /** @@ -112524,7 +114438,7 @@ module.exports = DistancePower; /***/ }), -/* 802 */ +/* 805 */ /***/ (function(module, exports) { /** @@ -112558,7 +114472,7 @@ module.exports = DistanceSquared; /***/ }), -/* 803 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112573,24 +114487,24 @@ module.exports = DistanceSquared; module.exports = { - Back: __webpack_require__(276), - Bounce: __webpack_require__(277), - Circular: __webpack_require__(278), - Cubic: __webpack_require__(279), - Elastic: __webpack_require__(280), - Expo: __webpack_require__(281), - Linear: __webpack_require__(282), - Quadratic: __webpack_require__(283), - Quartic: __webpack_require__(284), - Quintic: __webpack_require__(285), - Sine: __webpack_require__(286), - Stepped: __webpack_require__(287) + Back: __webpack_require__(277), + Bounce: __webpack_require__(278), + Circular: __webpack_require__(279), + Cubic: __webpack_require__(280), + Elastic: __webpack_require__(281), + Expo: __webpack_require__(282), + Linear: __webpack_require__(283), + Quadratic: __webpack_require__(284), + Quartic: __webpack_require__(285), + Quintic: __webpack_require__(286), + Sine: __webpack_require__(287), + Stepped: __webpack_require__(288) }; /***/ }), -/* 804 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112605,17 +114519,17 @@ module.exports = { module.exports = { - Ceil: __webpack_require__(805), - Equal: __webpack_require__(806), - Floor: __webpack_require__(807), - GreaterThan: __webpack_require__(808), - LessThan: __webpack_require__(809) + Ceil: __webpack_require__(808), + Equal: __webpack_require__(809), + Floor: __webpack_require__(810), + GreaterThan: __webpack_require__(811), + LessThan: __webpack_require__(812) }; /***/ }), -/* 805 */ +/* 808 */ /***/ (function(module, exports) { /** @@ -112646,7 +114560,7 @@ module.exports = Ceil; /***/ }), -/* 806 */ +/* 809 */ /***/ (function(module, exports) { /** @@ -112678,7 +114592,7 @@ module.exports = Equal; /***/ }), -/* 807 */ +/* 810 */ /***/ (function(module, exports) { /** @@ -112709,7 +114623,7 @@ module.exports = Floor; /***/ }), -/* 808 */ +/* 811 */ /***/ (function(module, exports) { /** @@ -112741,7 +114655,7 @@ module.exports = GreaterThan; /***/ }), -/* 809 */ +/* 812 */ /***/ (function(module, exports) { /** @@ -112773,7 +114687,7 @@ module.exports = LessThan; /***/ }), -/* 810 */ +/* 813 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112787,17 +114701,16 @@ module.exports = LessThan; */ module.exports = { - - Bezier: __webpack_require__(811), - CatmullRom: __webpack_require__(812), - CubicBezier: __webpack_require__(216), - Linear: __webpack_require__(226) - + Bezier: __webpack_require__(814), + CatmullRom: __webpack_require__(815), + CubicBezier: __webpack_require__(217), + Linear: __webpack_require__(229), + QuadraticBezier: __webpack_require__(222) }; /***/ }), -/* 811 */ +/* 814 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112806,7 +114719,7 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Bernstein = __webpack_require__(321); +var Bernstein = __webpack_require__(323); /** * [description] @@ -112836,7 +114749,7 @@ module.exports = BezierInterpolation; /***/ }), -/* 812 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112845,7 +114758,7 @@ module.exports = BezierInterpolation; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var CatmullRom = __webpack_require__(122); +var CatmullRom = __webpack_require__(123); /** * [description] @@ -112893,7 +114806,7 @@ module.exports = CatmullRomInterpolation; /***/ }), -/* 813 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112908,15 +114821,15 @@ module.exports = CatmullRomInterpolation; module.exports = { - GetNext: __webpack_require__(290), - IsSize: __webpack_require__(125), - IsValue: __webpack_require__(814) + GetNext: __webpack_require__(291), + IsSize: __webpack_require__(126), + IsValue: __webpack_require__(817) }; /***/ }), -/* 814 */ +/* 817 */ /***/ (function(module, exports) { /** @@ -112944,7 +114857,7 @@ module.exports = IsValuePowerOfTwo; /***/ }), -/* 815 */ +/* 818 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112959,15 +114872,15 @@ module.exports = IsValuePowerOfTwo; module.exports = { - Ceil: __webpack_require__(816), - Floor: __webpack_require__(817), - To: __webpack_require__(818) + Ceil: __webpack_require__(819), + Floor: __webpack_require__(820), + To: __webpack_require__(821) }; /***/ }), -/* 816 */ +/* 819 */ /***/ (function(module, exports) { /** @@ -113007,7 +114920,7 @@ module.exports = SnapCeil; /***/ }), -/* 817 */ +/* 820 */ /***/ (function(module, exports) { /** @@ -113047,7 +114960,7 @@ module.exports = SnapFloor; /***/ }), -/* 818 */ +/* 821 */ /***/ (function(module, exports) { /** @@ -113087,7 +115000,7 @@ module.exports = SnapTo; /***/ }), -/* 819 */ +/* 822 */ /***/ (function(module, exports) { /** @@ -113122,7 +115035,7 @@ module.exports = Average; /***/ }), -/* 820 */ +/* 823 */ /***/ (function(module, exports) { /** @@ -113157,7 +115070,7 @@ module.exports = CeilTo; /***/ }), -/* 821 */ +/* 824 */ /***/ (function(module, exports) { /** @@ -113186,7 +115099,7 @@ module.exports = Difference; /***/ }), -/* 822 */ +/* 825 */ /***/ (function(module, exports) { /** @@ -113221,7 +115134,7 @@ module.exports = FloorTo; /***/ }), -/* 823 */ +/* 826 */ /***/ (function(module, exports) { /** @@ -113250,7 +115163,7 @@ module.exports = GetSpeed; /***/ }), -/* 824 */ +/* 827 */ /***/ (function(module, exports) { /** @@ -113281,7 +115194,7 @@ module.exports = IsEven; /***/ }), -/* 825 */ +/* 828 */ /***/ (function(module, exports) { /** @@ -113310,7 +115223,7 @@ module.exports = IsEvenStrict; /***/ }), -/* 826 */ +/* 829 */ /***/ (function(module, exports) { /** @@ -113340,7 +115253,7 @@ module.exports = MaxAdd; /***/ }), -/* 827 */ +/* 830 */ /***/ (function(module, exports) { /** @@ -113370,7 +115283,7 @@ module.exports = MinSub; /***/ }), -/* 828 */ +/* 831 */ /***/ (function(module, exports) { /** @@ -113429,7 +115342,7 @@ module.exports = Percent; /***/ }), -/* 829 */ +/* 832 */ /***/ (function(module, exports) { /** @@ -113465,7 +115378,7 @@ module.exports = RandomXY; /***/ }), -/* 830 */ +/* 833 */ /***/ (function(module, exports) { /** @@ -113500,7 +115413,7 @@ module.exports = RoundTo; /***/ }), -/* 831 */ +/* 834 */ /***/ (function(module, exports) { /** @@ -113554,7 +115467,7 @@ module.exports = SinCosTableGenerator; /***/ }), -/* 832 */ +/* 835 */ /***/ (function(module, exports) { /** @@ -113584,7 +115497,7 @@ module.exports = Within; /***/ }), -/* 833 */ +/* 836 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113599,22 +115512,22 @@ module.exports = Within; module.exports = { - ArcadePhysics: __webpack_require__(834), - Body: __webpack_require__(331), - Collider: __webpack_require__(332), - Factory: __webpack_require__(325), - Group: __webpack_require__(328), - Image: __webpack_require__(326), + ArcadePhysics: __webpack_require__(837), + Body: __webpack_require__(333), + Collider: __webpack_require__(334), + Factory: __webpack_require__(327), + Group: __webpack_require__(330), + Image: __webpack_require__(328), Sprite: __webpack_require__(91), - StaticBody: __webpack_require__(339), - StaticGroup: __webpack_require__(329), - World: __webpack_require__(330) + StaticBody: __webpack_require__(341), + StaticGroup: __webpack_require__(331), + World: __webpack_require__(332) }; /***/ }), -/* 834 */ +/* 837 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113624,12 +115537,12 @@ module.exports = { */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(325); +var Factory = __webpack_require__(327); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(103); +var Merge = __webpack_require__(104); var PluginManager = __webpack_require__(12); -var World = __webpack_require__(330); -var DistanceBetween = __webpack_require__(41); +var World = __webpack_require__(332); +var DistanceBetween = __webpack_require__(42); var DegToRad = __webpack_require__(35); // All methods in this class are available under `this.physics` in a Scene. @@ -114085,7 +115998,7 @@ module.exports = ArcadePhysics; /***/ }), -/* 835 */ +/* 838 */ /***/ (function(module, exports) { /** @@ -114160,7 +116073,7 @@ module.exports = Acceleration; /***/ }), -/* 836 */ +/* 839 */ /***/ (function(module, exports) { /** @@ -114234,7 +116147,7 @@ module.exports = Angular; /***/ }), -/* 837 */ +/* 840 */ /***/ (function(module, exports) { /** @@ -114326,7 +116239,7 @@ module.exports = Bounce; /***/ }), -/* 838 */ +/* 841 */ /***/ (function(module, exports) { /** @@ -114450,7 +116363,7 @@ module.exports = Debug; /***/ }), -/* 839 */ +/* 842 */ /***/ (function(module, exports) { /** @@ -114525,7 +116438,7 @@ module.exports = Drag; /***/ }), -/* 840 */ +/* 843 */ /***/ (function(module, exports) { /** @@ -114635,7 +116548,7 @@ module.exports = Enable; /***/ }), -/* 841 */ +/* 844 */ /***/ (function(module, exports) { /** @@ -114710,7 +116623,7 @@ module.exports = Friction; /***/ }), -/* 842 */ +/* 845 */ /***/ (function(module, exports) { /** @@ -114785,7 +116698,7 @@ module.exports = Gravity; /***/ }), -/* 843 */ +/* 846 */ /***/ (function(module, exports) { /** @@ -114827,7 +116740,7 @@ module.exports = Immovable; /***/ }), -/* 844 */ +/* 847 */ /***/ (function(module, exports) { /** @@ -114867,7 +116780,7 @@ module.exports = Mass; /***/ }), -/* 845 */ +/* 848 */ /***/ (function(module, exports) { /** @@ -114946,7 +116859,7 @@ module.exports = Size; /***/ }), -/* 846 */ +/* 849 */ /***/ (function(module, exports) { /** @@ -115041,7 +116954,7 @@ module.exports = Velocity; /***/ }), -/* 847 */ +/* 850 */ /***/ (function(module, exports) { /** @@ -115082,7 +116995,7 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 848 */ +/* 851 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115091,9 +117004,9 @@ module.exports = ProcessTileCallbacks; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TileCheckX = __webpack_require__(849); -var TileCheckY = __webpack_require__(851); -var TileIntersectsBody = __webpack_require__(338); +var TileCheckX = __webpack_require__(852); +var TileCheckY = __webpack_require__(854); +var TileIntersectsBody = __webpack_require__(340); /** * The core separation function to separate a physics body and a tile. @@ -115195,7 +117108,7 @@ module.exports = SeparateTile; /***/ }), -/* 849 */ +/* 852 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115204,7 +117117,7 @@ module.exports = SeparateTile; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(850); +var ProcessTileSeparationX = __webpack_require__(853); /** * Check the body against the given tile on the X axis. @@ -115270,7 +117183,7 @@ module.exports = TileCheckX; /***/ }), -/* 850 */ +/* 853 */ /***/ (function(module, exports) { /** @@ -115315,7 +117228,7 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 851 */ +/* 854 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115324,7 +117237,7 @@ module.exports = ProcessTileSeparationX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(852); +var ProcessTileSeparationY = __webpack_require__(855); /** * Check the body against the given tile on the Y axis. @@ -115390,7 +117303,7 @@ module.exports = TileCheckY; /***/ }), -/* 852 */ +/* 855 */ /***/ (function(module, exports) { /** @@ -115435,7 +117348,7 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 853 */ +/* 856 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115444,7 +117357,7 @@ module.exports = ProcessTileSeparationY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapX = __webpack_require__(333); +var GetOverlapX = __webpack_require__(335); /** * [description] @@ -115522,7 +117435,7 @@ module.exports = SeparateX; /***/ }), -/* 854 */ +/* 857 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115531,7 +117444,7 @@ module.exports = SeparateX; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var GetOverlapY = __webpack_require__(334); +var GetOverlapY = __webpack_require__(336); /** * [description] @@ -115609,7 +117522,7 @@ module.exports = SeparateY; /***/ }), -/* 855 */ +/* 858 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115622,24 +117535,24 @@ module.exports = SeparateY; module.exports = { - Acceleration: __webpack_require__(961), - BodyScale: __webpack_require__(962), - BodyType: __webpack_require__(963), - Bounce: __webpack_require__(964), - CheckAgainst: __webpack_require__(965), - Collides: __webpack_require__(966), - Debug: __webpack_require__(967), - Friction: __webpack_require__(968), - Gravity: __webpack_require__(969), - Offset: __webpack_require__(970), - SetGameObject: __webpack_require__(971), - Velocity: __webpack_require__(972) + Acceleration: __webpack_require__(964), + BodyScale: __webpack_require__(965), + BodyType: __webpack_require__(966), + Bounce: __webpack_require__(967), + CheckAgainst: __webpack_require__(968), + Collides: __webpack_require__(969), + Debug: __webpack_require__(970), + Friction: __webpack_require__(971), + Gravity: __webpack_require__(972), + Offset: __webpack_require__(973), + SetGameObject: __webpack_require__(974), + Velocity: __webpack_require__(975) }; /***/ }), -/* 856 */ +/* 859 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115709,7 +117622,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 857 */ +/* 860 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115722,24 +117635,24 @@ var Common = __webpack_require__(38); module.exports = { - Bounce: __webpack_require__(978), - Collision: __webpack_require__(979), - Force: __webpack_require__(980), - Friction: __webpack_require__(981), - Gravity: __webpack_require__(982), - Mass: __webpack_require__(983), - Static: __webpack_require__(984), - Sensor: __webpack_require__(985), - SetBody: __webpack_require__(986), - Sleep: __webpack_require__(987), - Transform: __webpack_require__(988), - Velocity: __webpack_require__(989) + Bounce: __webpack_require__(981), + Collision: __webpack_require__(982), + Force: __webpack_require__(983), + Friction: __webpack_require__(984), + Gravity: __webpack_require__(985), + Mass: __webpack_require__(986), + Static: __webpack_require__(987), + Sensor: __webpack_require__(988), + SetBody: __webpack_require__(989), + Sleep: __webpack_require__(990), + Transform: __webpack_require__(991), + Velocity: __webpack_require__(992) }; /***/ }), -/* 858 */ +/* 861 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115749,9 +117662,9 @@ module.exports = { */ var Bodies = __webpack_require__(92); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); var Class = __webpack_require__(0); -var Components = __webpack_require__(857); +var Components = __webpack_require__(860); var GetFastValue = __webpack_require__(2); var HasValue = __webpack_require__(72); var Vertices = __webpack_require__(93); @@ -116066,7 +117979,7 @@ module.exports = MatterTileBody; /***/ }), -/* 859 */ +/* 862 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116081,8 +117994,8 @@ var Detector = {}; module.exports = Detector; -var SAT = __webpack_require__(860); -var Pair = __webpack_require__(365); +var SAT = __webpack_require__(863); +var Pair = __webpack_require__(376); var Bounds = __webpack_require__(95); (function() { @@ -116179,7 +118092,7 @@ var Bounds = __webpack_require__(95); /***/ }), -/* 860 */ +/* 863 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116455,7 +118368,7 @@ var Vector = __webpack_require__(94); /***/ }), -/* 861 */ +/* 864 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116464,34 +118377,34 @@ var Vector = __webpack_require__(94); * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Matter = __webpack_require__(949); +var Matter = __webpack_require__(952); -Matter.Body = __webpack_require__(59); -Matter.Composite = __webpack_require__(151); -Matter.World = __webpack_require__(863); +Matter.Body = __webpack_require__(60); +Matter.Composite = __webpack_require__(150); +Matter.World = __webpack_require__(866); -Matter.Detector = __webpack_require__(859); -Matter.Grid = __webpack_require__(950); -Matter.Pairs = __webpack_require__(951); -Matter.Pair = __webpack_require__(365); -Matter.Query = __webpack_require__(991); -Matter.Resolver = __webpack_require__(952); -Matter.SAT = __webpack_require__(860); +Matter.Detector = __webpack_require__(862); +Matter.Grid = __webpack_require__(953); +Matter.Pairs = __webpack_require__(954); +Matter.Pair = __webpack_require__(376); +Matter.Query = __webpack_require__(994); +Matter.Resolver = __webpack_require__(955); +Matter.SAT = __webpack_require__(863); -Matter.Constraint = __webpack_require__(165); +Matter.Constraint = __webpack_require__(166); Matter.Common = __webpack_require__(38); -Matter.Engine = __webpack_require__(953); -Matter.Events = __webpack_require__(164); -Matter.Sleeping = __webpack_require__(342); -Matter.Plugin = __webpack_require__(862); +Matter.Engine = __webpack_require__(956); +Matter.Events = __webpack_require__(165); +Matter.Sleeping = __webpack_require__(344); +Matter.Plugin = __webpack_require__(865); Matter.Bodies = __webpack_require__(92); -Matter.Composites = __webpack_require__(946); +Matter.Composites = __webpack_require__(949); -Matter.Axes = __webpack_require__(856); +Matter.Axes = __webpack_require__(859); Matter.Bounds = __webpack_require__(95); -Matter.Svg = __webpack_require__(993); +Matter.Svg = __webpack_require__(996); Matter.Vector = __webpack_require__(94); Matter.Vertices = __webpack_require__(93); @@ -116508,7 +118421,7 @@ module.exports = Matter; /***/ }), -/* 862 */ +/* 865 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116858,7 +118771,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 863 */ +/* 866 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116878,8 +118791,8 @@ var World = {}; module.exports = World; -var Composite = __webpack_require__(151); -var Constraint = __webpack_require__(165); +var Composite = __webpack_require__(150); +var Constraint = __webpack_require__(166); var Common = __webpack_require__(38); (function() { @@ -116994,7 +118907,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 864 */ +/* 867 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117009,16 +118922,16 @@ var Common = __webpack_require__(38); module.exports = { - SceneManager: __webpack_require__(251), - ScenePlugin: __webpack_require__(865), - Settings: __webpack_require__(254), + SceneManager: __webpack_require__(252), + ScenePlugin: __webpack_require__(868), + Settings: __webpack_require__(255), Systems: __webpack_require__(129) }; /***/ }), -/* 865 */ +/* 868 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117181,7 +119094,7 @@ var ScenePlugin = new Class({ { if (this.settings.status !== CONST.RUNNING) { - this.manager.queueOp('start', key); + this.manager.queueOp('start', key, data); } else { @@ -117400,25 +119313,102 @@ var ScenePlugin = new Class({ }, /** - * [description] + * Swaps the position of two scenes in the Scenes list. + * This controls the order in which they are rendered and updated. * * @method Phaser.Scenes.ScenePlugin#swapPosition - * @since 3.0.0 + * @since 3.2.0 * - * @param {string} key - [description] + * @param {string} keyA - The first Scene to swap. + * @param {string} [keyB] - The second Scene to swap. If none is given it defaults to this Scene. * * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. */ - swapPosition: function (key) + swapPosition: function (keyA, keyB) { - if (key && key !== this.key) + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) { - this.manager.swapPosition(this.key, key); + this.manager.swapPosition(keyA, keyB); } return this; }, + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly above Scene A. + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveAbove + * @since 3.2.0 + * + * @param {string} keyA - The Scene that Scene B will be moved to be above. + * @param {string} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. + */ + moveAbove: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) + { + this.manager.moveAbove(keyA, keyB); + } + + return this; + }, + + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly below Scene A. + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveBelow + * @since 3.2.0 + * + * @param {string} keyA - The Scene that Scene B will be moved to be below. + * @param {string} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object. + */ + moveBelow: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) + { + this.manager.moveBelow(keyA, keyB); + } + + return this; + }, + + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it wil + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.ScenePlugin#remove + * @since 3.2.0 + * + * @param {string|Phaser.Scene} scene - The Scene to be removed. + * + * @return {Phaser.Scenes.SceneManager} This SceneManager. + */ + remove: function (key) + { + if (key === undefined) { key = this.key; } + + this.manager.remove(key); + + return this; + }, + /** * [description] * @@ -117540,7 +119530,7 @@ module.exports = ScenePlugin; /***/ }), -/* 866 */ +/* 869 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117582,25 +119572,25 @@ module.exports = ScenePlugin; module.exports = { - SoundManagerCreator: __webpack_require__(255), + SoundManagerCreator: __webpack_require__(256), BaseSound: __webpack_require__(85), BaseSoundManager: __webpack_require__(84), - WebAudioSound: __webpack_require__(261), - WebAudioSoundManager: __webpack_require__(260), + WebAudioSound: __webpack_require__(262), + WebAudioSoundManager: __webpack_require__(261), - HTML5AudioSound: __webpack_require__(257), - HTML5AudioSoundManager: __webpack_require__(256), + HTML5AudioSound: __webpack_require__(258), + HTML5AudioSoundManager: __webpack_require__(257), - NoAudioSound: __webpack_require__(259), - NoAudioSoundManager: __webpack_require__(258) + NoAudioSound: __webpack_require__(260), + NoAudioSoundManager: __webpack_require__(259) }; /***/ }), -/* 867 */ +/* 870 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117616,16 +119606,16 @@ module.exports = { module.exports = { List: __webpack_require__(86), - Map: __webpack_require__(113), - ProcessQueue: __webpack_require__(335), - RTree: __webpack_require__(336), - Set: __webpack_require__(61) + Map: __webpack_require__(114), + ProcessQueue: __webpack_require__(337), + RTree: __webpack_require__(338), + Set: __webpack_require__(62) }; /***/ }), -/* 868 */ +/* 871 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117640,19 +119630,19 @@ module.exports = { module.exports = { - Parsers: __webpack_require__(263), + Parsers: __webpack_require__(264), - FilterMode: __webpack_require__(869), + FilterMode: __webpack_require__(872), Frame: __webpack_require__(130), - Texture: __webpack_require__(264), - TextureManager: __webpack_require__(262), - TextureSource: __webpack_require__(265) + Texture: __webpack_require__(265), + TextureManager: __webpack_require__(263), + TextureSource: __webpack_require__(266) }; /***/ }), -/* 869 */ +/* 872 */ /***/ (function(module, exports) { /** @@ -117691,7 +119681,7 @@ module.exports = CONST; /***/ }), -/* 870 */ +/* 873 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117707,29 +119697,29 @@ module.exports = CONST; module.exports = { Components: __webpack_require__(96), - Parsers: __webpack_require__(900), + Parsers: __webpack_require__(903), - Formats: __webpack_require__(20), - ImageCollection: __webpack_require__(350), - ParseToTilemap: __webpack_require__(156), + Formats: __webpack_require__(21), + ImageCollection: __webpack_require__(352), + ParseToTilemap: __webpack_require__(155), Tile: __webpack_require__(44), - Tilemap: __webpack_require__(354), - TilemapCreator: __webpack_require__(917), - TilemapFactory: __webpack_require__(918), + Tilemap: __webpack_require__(356), + TilemapCreator: __webpack_require__(920), + TilemapFactory: __webpack_require__(921), Tileset: __webpack_require__(100), LayerData: __webpack_require__(75), MapData: __webpack_require__(76), - ObjectLayer: __webpack_require__(352), + ObjectLayer: __webpack_require__(354), - DynamicTilemapLayer: __webpack_require__(355), - StaticTilemapLayer: __webpack_require__(356) + DynamicTilemapLayer: __webpack_require__(357), + StaticTilemapLayer: __webpack_require__(358) }; /***/ }), -/* 871 */ +/* 874 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117794,7 +119784,7 @@ module.exports = Copy; /***/ }), -/* 872 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117806,7 +119796,7 @@ module.exports = Copy; var TileToWorldX = __webpack_require__(98); var TileToWorldY = __webpack_require__(99); var GetTilesWithin = __webpack_require__(15); -var ReplaceByIndex = __webpack_require__(343); +var ReplaceByIndex = __webpack_require__(345); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -117881,7 +119871,7 @@ module.exports = CreateFromTiles; /***/ }), -/* 873 */ +/* 876 */ /***/ (function(module, exports) { /** @@ -117949,7 +119939,7 @@ module.exports = CullTiles; /***/ }), -/* 874 */ +/* 877 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118003,7 +119993,7 @@ module.exports = Fill; /***/ }), -/* 875 */ +/* 878 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118052,7 +120042,7 @@ module.exports = FilterTiles; /***/ }), -/* 876 */ +/* 879 */ /***/ (function(module, exports) { /** @@ -118139,7 +120129,7 @@ module.exports = FindByIndex; /***/ }), -/* 877 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118186,7 +120176,7 @@ module.exports = FindTile; /***/ }), -/* 878 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118230,7 +120220,7 @@ module.exports = ForEachTile; /***/ }), -/* 879 */ +/* 882 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118271,7 +120261,7 @@ module.exports = GetTileAtWorldXY; /***/ }), -/* 880 */ +/* 883 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118280,9 +120270,9 @@ module.exports = GetTileAtWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Geom = __webpack_require__(293); +var Geom = __webpack_require__(295); var GetTilesWithin = __webpack_require__(15); -var Intersects = __webpack_require__(294); +var Intersects = __webpack_require__(296); var NOOP = __webpack_require__(3); var TileToWorldX = __webpack_require__(98); var TileToWorldY = __webpack_require__(99); @@ -118370,7 +120360,7 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 881 */ +/* 884 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118422,7 +120412,7 @@ module.exports = GetTilesWithinWorldXY; /***/ }), -/* 882 */ +/* 885 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118431,7 +120421,7 @@ module.exports = GetTilesWithinWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var HasTileAt = __webpack_require__(344); +var HasTileAt = __webpack_require__(346); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -118461,7 +120451,7 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 883 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118470,7 +120460,7 @@ module.exports = HasTileAtWorldXY; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var PutTileAt = __webpack_require__(153); +var PutTileAt = __webpack_require__(152); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -118503,7 +120493,7 @@ module.exports = PutTileAtWorldXY; /***/ }), -/* 884 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118513,7 +120503,7 @@ module.exports = PutTileAtWorldXY; */ var CalculateFacesWithin = __webpack_require__(34); -var PutTileAt = __webpack_require__(153); +var PutTileAt = __webpack_require__(152); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -118567,7 +120557,7 @@ module.exports = PutTilesAt; /***/ }), -/* 885 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118624,7 +120614,7 @@ module.exports = Randomize; /***/ }), -/* 886 */ +/* 889 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118633,7 +120623,7 @@ module.exports = Randomize; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RemoveTileAt = __webpack_require__(345); +var RemoveTileAt = __webpack_require__(347); var WorldToTileX = __webpack_require__(39); var WorldToTileY = __webpack_require__(40); @@ -118666,7 +120656,7 @@ module.exports = RemoveTileAtWorldXY; /***/ }), -/* 887 */ +/* 890 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118676,7 +120666,7 @@ module.exports = RemoveTileAtWorldXY; */ var GetTilesWithin = __webpack_require__(15); -var Color = __webpack_require__(222); +var Color = __webpack_require__(225); /** * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to @@ -118751,7 +120741,7 @@ module.exports = RenderDebug; /***/ }), -/* 888 */ +/* 891 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118762,7 +120752,7 @@ module.exports = RenderDebug; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on the given tile or tiles within a layer by index. You can pass in either a @@ -118812,7 +120802,7 @@ module.exports = SetCollision; /***/ }), -/* 889 */ +/* 892 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118823,7 +120813,7 @@ module.exports = SetCollision; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on a range of tiles in a layer whose index is between the specified `start` and @@ -118878,7 +120868,7 @@ module.exports = SetCollisionBetween; /***/ }), -/* 890 */ +/* 893 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118889,7 +120879,7 @@ module.exports = SetCollisionBetween; var SetTileCollision = __webpack_require__(43); var CalculateFacesWithin = __webpack_require__(34); -var SetLayerCollisionIndex = __webpack_require__(154); +var SetLayerCollisionIndex = __webpack_require__(153); /** * Sets collision on all tiles in the given layer, except for tiles that have an index specified in @@ -118933,7 +120923,7 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 891 */ +/* 894 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119007,7 +120997,7 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 892 */ +/* 895 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119065,7 +121055,7 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 893 */ +/* 896 */ /***/ (function(module, exports) { /** @@ -119112,7 +121102,7 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 894 */ +/* 897 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119154,7 +121144,7 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 895 */ +/* 898 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119198,7 +121188,7 @@ module.exports = Shuffle; /***/ }), -/* 896 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119248,7 +121238,7 @@ module.exports = SwapByIndex; /***/ }), -/* 897 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119291,7 +121281,7 @@ module.exports = TileToWorldXY; /***/ }), -/* 898 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119370,7 +121360,7 @@ module.exports = WeightedRandomize; /***/ }), -/* 899 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119415,7 +121405,7 @@ module.exports = WorldToTileXY; /***/ }), -/* 900 */ +/* 903 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119430,18 +121420,18 @@ module.exports = WorldToTileXY; module.exports = { - Parse: __webpack_require__(346), - Parse2DArray: __webpack_require__(155), - ParseCSV: __webpack_require__(347), + Parse: __webpack_require__(348), + Parse2DArray: __webpack_require__(154), + ParseCSV: __webpack_require__(349), - Impact: __webpack_require__(353), - Tiled: __webpack_require__(348) + Impact: __webpack_require__(355), + Tiled: __webpack_require__(350) }; /***/ }), -/* 901 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119450,10 +121440,10 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Base64Decode = __webpack_require__(902); +var Base64Decode = __webpack_require__(905); var GetFastValue = __webpack_require__(2); var LayerData = __webpack_require__(75); -var ParseGID = __webpack_require__(349); +var ParseGID = __webpack_require__(351); var Tile = __webpack_require__(44); /** @@ -119567,7 +121557,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 902 */ +/* 905 */ /***/ (function(module, exports) { /** @@ -119610,7 +121600,7 @@ module.exports = Base64Decode; /***/ }), -/* 903 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119662,7 +121652,7 @@ module.exports = ParseImageLayers; /***/ }), -/* 904 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119672,8 +121662,8 @@ module.exports = ParseImageLayers; */ var Tileset = __webpack_require__(100); -var ImageCollection = __webpack_require__(350); -var ParseObject = __webpack_require__(351); +var ImageCollection = __webpack_require__(352); +var ParseObject = __webpack_require__(353); /** * Tilesets & Image Collections @@ -119767,7 +121757,7 @@ module.exports = ParseTilesets; /***/ }), -/* 905 */ +/* 908 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119810,7 +121800,7 @@ module.exports = Pick; /***/ }), -/* 906 */ +/* 909 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119820,8 +121810,8 @@ module.exports = Pick; */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(351); -var ObjectLayer = __webpack_require__(352); +var ParseObject = __webpack_require__(353); +var ObjectLayer = __webpack_require__(354); /** * [description] @@ -119869,7 +121859,7 @@ module.exports = ParseObjectLayers; /***/ }), -/* 907 */ +/* 910 */ /***/ (function(module, exports) { /** @@ -119942,7 +121932,7 @@ module.exports = BuildTilesetIndex; /***/ }), -/* 908 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120015,7 +122005,7 @@ module.exports = AssignTileProperties; /***/ }), -/* 909 */ +/* 912 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120099,7 +122089,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 910 */ +/* 913 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120150,7 +122140,7 @@ module.exports = ParseTilesets; /***/ }), -/* 911 */ +/* 914 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120164,12 +122154,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(912); + renderWebGL = __webpack_require__(915); } if (true) { - renderCanvas = __webpack_require__(913); + renderCanvas = __webpack_require__(916); } module.exports = { @@ -120181,7 +122171,7 @@ module.exports = { /***/ }), -/* 912 */ +/* 915 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120222,7 +122212,7 @@ module.exports = DynamicTilemapLayerWebGLRenderer; /***/ }), -/* 913 */ +/* 916 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120314,7 +122304,7 @@ module.exports = DynamicTilemapLayerCanvasRenderer; /***/ }), -/* 914 */ +/* 917 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120328,12 +122318,12 @@ var renderCanvas = __webpack_require__(3); if (true) { - renderWebGL = __webpack_require__(915); + renderWebGL = __webpack_require__(918); } if (true) { - renderCanvas = __webpack_require__(916); + renderCanvas = __webpack_require__(919); } module.exports = { @@ -120345,7 +122335,7 @@ module.exports = { /***/ }), -/* 915 */ +/* 918 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120386,7 +122376,7 @@ module.exports = StaticTilemapLayerWebGLRenderer; /***/ }), -/* 916 */ +/* 919 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120459,7 +122449,7 @@ module.exports = StaticTilemapLayerCanvasRenderer; /***/ }), -/* 917 */ +/* 920 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120469,7 +122459,7 @@ module.exports = StaticTilemapLayerCanvasRenderer; */ var GameObjectCreator = __webpack_require__(13); -var ParseToTilemap = __webpack_require__(156); +var ParseToTilemap = __webpack_require__(155); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -120519,7 +122509,7 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 918 */ +/* 921 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120529,7 +122519,7 @@ GameObjectCreator.register('tilemap', function (config) */ var GameObjectFactory = __webpack_require__(9); -var ParseToTilemap = __webpack_require__(156); +var ParseToTilemap = __webpack_require__(155); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -120585,7 +122575,7 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 919 */ +/* 922 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120600,14 +122590,14 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt module.exports = { - Clock: __webpack_require__(920), - TimerEvent: __webpack_require__(357) + Clock: __webpack_require__(923), + TimerEvent: __webpack_require__(359) }; /***/ }), -/* 920 */ +/* 923 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120618,7 +122608,7 @@ module.exports = { var Class = __webpack_require__(0); var PluginManager = __webpack_require__(12); -var TimerEvent = __webpack_require__(357); +var TimerEvent = __webpack_require__(359); /** * @classdesc @@ -120975,7 +122965,7 @@ module.exports = Clock; /***/ }), -/* 921 */ +/* 924 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120990,18 +122980,18 @@ module.exports = Clock; module.exports = { - Builders: __webpack_require__(922), + Builders: __webpack_require__(925), - TweenManager: __webpack_require__(924), - Tween: __webpack_require__(160), - TweenData: __webpack_require__(161), - Timeline: __webpack_require__(362) + TweenManager: __webpack_require__(927), + Tween: __webpack_require__(159), + TweenData: __webpack_require__(160), + Timeline: __webpack_require__(364) }; /***/ }), -/* 922 */ +/* 925 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121019,19 +123009,19 @@ module.exports = { GetBoolean: __webpack_require__(73), GetEaseFunction: __webpack_require__(71), GetNewValue: __webpack_require__(101), - GetProps: __webpack_require__(358), - GetTargets: __webpack_require__(157), - GetTweens: __webpack_require__(359), - GetValueOp: __webpack_require__(158), - NumberTweenBuilder: __webpack_require__(360), - TimelineBuilder: __webpack_require__(361), + GetProps: __webpack_require__(360), + GetTargets: __webpack_require__(156), + GetTweens: __webpack_require__(361), + GetValueOp: __webpack_require__(157), + NumberTweenBuilder: __webpack_require__(362), + TimelineBuilder: __webpack_require__(363), TweenBuilder: __webpack_require__(102) }; /***/ }), -/* 923 */ +/* 926 */ /***/ (function(module, exports) { /** @@ -121103,7 +123093,7 @@ module.exports = [ /***/ }), -/* 924 */ +/* 927 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121113,9 +123103,9 @@ module.exports = [ */ var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(360); +var NumberTweenBuilder = __webpack_require__(362); var PluginManager = __webpack_require__(12); -var TimelineBuilder = __webpack_require__(361); +var TimelineBuilder = __webpack_require__(363); var TWEEN_CONST = __webpack_require__(87); var TweenBuilder = __webpack_require__(102); @@ -121757,7 +123747,7 @@ module.exports = TweenManager; /***/ }), -/* 925 */ +/* 928 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121772,15 +123762,15 @@ module.exports = TweenManager; module.exports = { - Array: __webpack_require__(926), - Objects: __webpack_require__(930), - String: __webpack_require__(934) + Array: __webpack_require__(929), + Objects: __webpack_require__(933), + String: __webpack_require__(937) }; /***/ }), -/* 926 */ +/* 929 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121795,23 +123785,23 @@ module.exports = { module.exports = { - FindClosestInSorted: __webpack_require__(927), + FindClosestInSorted: __webpack_require__(930), GetRandomElement: __webpack_require__(138), - NumberArray: __webpack_require__(318), - NumberArrayStep: __webpack_require__(928), - QuickSelect: __webpack_require__(337), - Range: __webpack_require__(274), - RemoveRandomElement: __webpack_require__(929), - RotateLeft: __webpack_require__(189), - RotateRight: __webpack_require__(190), + NumberArray: __webpack_require__(320), + NumberArrayStep: __webpack_require__(931), + QuickSelect: __webpack_require__(339), + Range: __webpack_require__(275), + RemoveRandomElement: __webpack_require__(932), + RotateLeft: __webpack_require__(190), + RotateRight: __webpack_require__(191), Shuffle: __webpack_require__(80), - SpliceOne: __webpack_require__(363) + SpliceOne: __webpack_require__(365) }; /***/ }), -/* 927 */ +/* 930 */ /***/ (function(module, exports) { /** @@ -121859,7 +123849,7 @@ module.exports = FindClosestInSorted; /***/ }), -/* 928 */ +/* 931 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121868,7 +123858,7 @@ module.exports = FindClosestInSorted; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var RoundAwayFromZero = __webpack_require__(324); +var RoundAwayFromZero = __webpack_require__(326); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -121936,7 +123926,7 @@ module.exports = NumberArrayStep; /***/ }), -/* 929 */ +/* 932 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121945,7 +123935,7 @@ module.exports = NumberArrayStep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var SpliceOne = __webpack_require__(363); +var SpliceOne = __webpack_require__(365); /** * Removes a random object from the given array and returns it. @@ -121974,7 +123964,7 @@ module.exports = RemoveRandomElement; /***/ }), -/* 930 */ +/* 933 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -121989,24 +123979,24 @@ module.exports = RemoveRandomElement; module.exports = { - Clone: __webpack_require__(52), + Clone: __webpack_require__(53), Extend: __webpack_require__(23), GetAdvancedValue: __webpack_require__(10), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(931), + GetMinMaxValue: __webpack_require__(934), GetValue: __webpack_require__(4), - HasAll: __webpack_require__(932), - HasAny: __webpack_require__(288), + HasAll: __webpack_require__(935), + HasAny: __webpack_require__(289), HasValue: __webpack_require__(72), - IsPlainObject: __webpack_require__(167), - Merge: __webpack_require__(103), - MergeRight: __webpack_require__(933) + IsPlainObject: __webpack_require__(168), + Merge: __webpack_require__(104), + MergeRight: __webpack_require__(936) }; /***/ }), -/* 931 */ +/* 934 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122016,7 +124006,7 @@ module.exports = { */ var GetValue = __webpack_require__(4); -var Clamp = __webpack_require__(60); +var Clamp = __webpack_require__(61); /** * [description] @@ -122045,7 +124035,7 @@ module.exports = GetMinMaxValue; /***/ }), -/* 932 */ +/* 935 */ /***/ (function(module, exports) { /** @@ -122082,7 +124072,7 @@ module.exports = HasAll; /***/ }), -/* 933 */ +/* 936 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122091,7 +124081,7 @@ module.exports = HasAll; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clone = __webpack_require__(52); +var Clone = __webpack_require__(53); /** * Creates a new Object using all values from obj1. @@ -122125,7 +124115,7 @@ module.exports = MergeRight; /***/ }), -/* 934 */ +/* 937 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122140,16 +124130,16 @@ module.exports = MergeRight; module.exports = { - Format: __webpack_require__(935), - Pad: __webpack_require__(197), - Reverse: __webpack_require__(936), - UppercaseFirst: __webpack_require__(253) + Format: __webpack_require__(938), + Pad: __webpack_require__(198), + Reverse: __webpack_require__(939), + UppercaseFirst: __webpack_require__(254) }; /***/ }), -/* 935 */ +/* 938 */ /***/ (function(module, exports) { /** @@ -122186,7 +124176,7 @@ module.exports = Format; /***/ }), -/* 936 */ +/* 939 */ /***/ (function(module, exports) { /** @@ -122215,7 +124205,7 @@ module.exports = ReverseString; /***/ }), -/* 937 */ +/* 940 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122225,10 +124215,10 @@ module.exports = ReverseString; */ var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(340); -var GetVelocity = __webpack_require__(958); -var TYPE = __webpack_require__(341); -var UpdateMotion = __webpack_require__(959); +var COLLIDES = __webpack_require__(342); +var GetVelocity = __webpack_require__(961); +var TYPE = __webpack_require__(343); +var UpdateMotion = __webpack_require__(962); /** * @classdesc @@ -122809,7 +124799,7 @@ module.exports = Body; /***/ }), -/* 938 */ +/* 941 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122819,7 +124809,7 @@ module.exports = Body; */ var Class = __webpack_require__(0); -var DefaultDefs = __webpack_require__(960); +var DefaultDefs = __webpack_require__(963); /** * @classdesc @@ -123173,7 +125163,7 @@ module.exports = CollisionMap; /***/ }), -/* 939 */ +/* 942 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123183,9 +125173,9 @@ module.exports = CollisionMap; */ var Class = __webpack_require__(0); -var ImpactBody = __webpack_require__(940); -var ImpactImage = __webpack_require__(941); -var ImpactSprite = __webpack_require__(942); +var ImpactBody = __webpack_require__(943); +var ImpactImage = __webpack_require__(944); +var ImpactSprite = __webpack_require__(945); /** * @classdesc @@ -123318,7 +125308,7 @@ module.exports = Factory; /***/ }), -/* 940 */ +/* 943 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123328,7 +125318,7 @@ module.exports = Factory; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(855); +var Components = __webpack_require__(858); /** * @classdesc @@ -123451,7 +125441,7 @@ module.exports = ImpactBody; /***/ }), -/* 941 */ +/* 944 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123461,7 +125451,7 @@ module.exports = ImpactBody; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(855); +var Components = __webpack_require__(858); var Image = __webpack_require__(70); /** @@ -123610,7 +125600,7 @@ module.exports = ImpactImage; /***/ }), -/* 942 */ +/* 945 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123620,7 +125610,7 @@ module.exports = ImpactImage; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(855); +var Components = __webpack_require__(858); var Sprite = __webpack_require__(37); /** @@ -123773,7 +125763,7 @@ module.exports = ImpactSprite; /***/ }), -/* 943 */ +/* 946 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123782,17 +125772,17 @@ module.exports = ImpactSprite; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(937); +var Body = __webpack_require__(940); var Class = __webpack_require__(0); -var COLLIDES = __webpack_require__(340); -var CollisionMap = __webpack_require__(938); +var COLLIDES = __webpack_require__(342); +var CollisionMap = __webpack_require__(941); var EventEmitter = __webpack_require__(14); var GetFastValue = __webpack_require__(2); var HasValue = __webpack_require__(72); -var Set = __webpack_require__(61); -var Solver = __webpack_require__(974); -var TILEMAP_FORMATS = __webpack_require__(20); -var TYPE = __webpack_require__(341); +var Set = __webpack_require__(62); +var Solver = __webpack_require__(977); +var TILEMAP_FORMATS = __webpack_require__(21); +var TYPE = __webpack_require__(343); /** * @classdesc @@ -124764,7 +126754,7 @@ module.exports = World; /***/ }), -/* 944 */ +/* 947 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124775,12 +126765,12 @@ module.exports = World; var Bodies = __webpack_require__(92); var Class = __webpack_require__(0); -var Composites = __webpack_require__(946); -var Constraint = __webpack_require__(165); -var MatterImage = __webpack_require__(947); -var MatterSprite = __webpack_require__(948); -var MatterTileBody = __webpack_require__(858); -var PointerConstraint = __webpack_require__(990); +var Composites = __webpack_require__(949); +var Constraint = __webpack_require__(166); +var MatterImage = __webpack_require__(950); +var MatterSprite = __webpack_require__(951); +var MatterTileBody = __webpack_require__(861); +var PointerConstraint = __webpack_require__(993); /** * @classdesc @@ -125357,7 +127347,7 @@ module.exports = Factory; /***/ }), -/* 945 */ +/* 948 */ /***/ (function(module, exports) { /** @@ -125968,7 +127958,7 @@ function scalar_eq(a,b,precision){ /***/ }), -/* 946 */ +/* 949 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125984,10 +127974,10 @@ var Composites = {}; module.exports = Composites; -var Composite = __webpack_require__(151); -var Constraint = __webpack_require__(165); +var Composite = __webpack_require__(150); +var Constraint = __webpack_require__(166); var Common = __webpack_require__(38); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); var Bodies = __webpack_require__(92); (function() { @@ -126301,7 +128291,7 @@ var Bodies = __webpack_require__(92); /***/ }), -/* 947 */ +/* 950 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -126312,11 +128302,11 @@ var Bodies = __webpack_require__(92); var Bodies = __webpack_require__(92); var Class = __webpack_require__(0); -var Components = __webpack_require__(857); +var Components = __webpack_require__(860); var GameObject = __webpack_require__(1); var GetFastValue = __webpack_require__(2); var Image = __webpack_require__(70); -var Pipeline = __webpack_require__(186); +var Pipeline = __webpack_require__(187); var Vector2 = __webpack_require__(6); /** @@ -126431,7 +128421,7 @@ module.exports = MatterImage; /***/ }), -/* 948 */ +/* 951 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -126440,13 +128430,13 @@ module.exports = MatterImage; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var AnimationComponent = __webpack_require__(364); +var AnimationComponent = __webpack_require__(366); var Bodies = __webpack_require__(92); var Class = __webpack_require__(0); -var Components = __webpack_require__(857); +var Components = __webpack_require__(860); var GameObject = __webpack_require__(1); var GetFastValue = __webpack_require__(2); -var Pipeline = __webpack_require__(186); +var Pipeline = __webpack_require__(187); var Sprite = __webpack_require__(37); var Vector2 = __webpack_require__(6); @@ -126568,7 +128558,7 @@ module.exports = MatterSprite; /***/ }), -/* 949 */ +/* 952 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -126581,7 +128571,7 @@ var Matter = {}; module.exports = Matter; -var Plugin = __webpack_require__(862); +var Plugin = __webpack_require__(865); var Common = __webpack_require__(38); (function() { @@ -126660,7 +128650,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 950 */ +/* 953 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -126673,8 +128663,8 @@ var Grid = {}; module.exports = Grid; -var Pair = __webpack_require__(365); -var Detector = __webpack_require__(859); +var Pair = __webpack_require__(376); +var Detector = __webpack_require__(862); var Common = __webpack_require__(38); (function() { @@ -126987,7 +128977,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 951 */ +/* 954 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -127000,7 +128990,7 @@ var Pairs = {}; module.exports = Pairs; -var Pair = __webpack_require__(365); +var Pair = __webpack_require__(376); var Common = __webpack_require__(38); (function() { @@ -127152,7 +129142,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 952 */ +/* 955 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -127509,7 +129499,7 @@ var Bounds = __webpack_require__(95); /***/ }), -/* 953 */ +/* 956 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -127526,17 +129516,17 @@ var Engine = {}; module.exports = Engine; -var World = __webpack_require__(863); -var Sleeping = __webpack_require__(342); -var Resolver = __webpack_require__(952); -var Pairs = __webpack_require__(951); -var Metrics = __webpack_require__(992); -var Grid = __webpack_require__(950); -var Events = __webpack_require__(164); -var Composite = __webpack_require__(151); -var Constraint = __webpack_require__(165); +var World = __webpack_require__(866); +var Sleeping = __webpack_require__(344); +var Resolver = __webpack_require__(955); +var Pairs = __webpack_require__(954); +var Metrics = __webpack_require__(995); +var Grid = __webpack_require__(953); +var Events = __webpack_require__(165); +var Composite = __webpack_require__(150); +var Constraint = __webpack_require__(166); var Common = __webpack_require__(38); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); (function() { @@ -128024,7 +130014,7 @@ var Body = __webpack_require__(59); /***/ }), -/* 954 */ +/* 957 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128037,15 +130027,15 @@ var Body = __webpack_require__(59); var Bodies = __webpack_require__(92); var Class = __webpack_require__(0); -var Composite = __webpack_require__(151); -var Engine = __webpack_require__(953); +var Composite = __webpack_require__(150); +var Engine = __webpack_require__(956); var EventEmitter = __webpack_require__(14); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MatterBody = __webpack_require__(59); -var MatterEvents = __webpack_require__(164); -var MatterWorld = __webpack_require__(863); -var MatterTileBody = __webpack_require__(858); +var MatterBody = __webpack_require__(60); +var MatterEvents = __webpack_require__(165); +var MatterWorld = __webpack_require__(866); +var MatterTileBody = __webpack_require__(861); /** * @classdesc @@ -128736,7 +130726,7 @@ module.exports = World; /***/ }), -/* 955 */ +/* 958 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** @@ -128745,7 +130735,7 @@ module.exports = World; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -__webpack_require__(366); +__webpack_require__(377); var CONST = __webpack_require__(22); var Extend = __webpack_require__(23); @@ -128756,33 +130746,34 @@ var Extend = __webpack_require__(23); var Phaser = { - Actions: __webpack_require__(168), - Animation: __webpack_require__(438), - Cache: __webpack_require__(439), - Cameras: __webpack_require__(440), + Actions: __webpack_require__(169), + Animation: __webpack_require__(449), + Cache: __webpack_require__(450), + Cameras: __webpack_require__(451), Class: __webpack_require__(0), - Create: __webpack_require__(451), - Curves: __webpack_require__(457), - Data: __webpack_require__(460), - Display: __webpack_require__(462), - DOM: __webpack_require__(495), - EventEmitter: __webpack_require__(497), - Game: __webpack_require__(498), - GameObjects: __webpack_require__(543), - Geom: __webpack_require__(293), - Input: __webpack_require__(759), - Loader: __webpack_require__(773), - Math: __webpack_require__(791), - Physics: __webpack_require__(956), - Scene: __webpack_require__(252), - Scenes: __webpack_require__(864), - Sound: __webpack_require__(866), - Structs: __webpack_require__(867), - Textures: __webpack_require__(868), - Tilemaps: __webpack_require__(870), - Time: __webpack_require__(919), - Tweens: __webpack_require__(921), - Utils: __webpack_require__(925) + Create: __webpack_require__(462), + Curves: __webpack_require__(468), + Data: __webpack_require__(471), + Display: __webpack_require__(473), + DOM: __webpack_require__(506), + EventEmitter: __webpack_require__(508), + Game: __webpack_require__(509), + GameObjects: __webpack_require__(545), + Geom: __webpack_require__(295), + Input: __webpack_require__(762), + Loader: __webpack_require__(776), + Math: __webpack_require__(794), + Physics: __webpack_require__(959), + Renderer: __webpack_require__(1000), + Scene: __webpack_require__(253), + Scenes: __webpack_require__(867), + Sound: __webpack_require__(869), + Structs: __webpack_require__(870), + Textures: __webpack_require__(871), + Tilemaps: __webpack_require__(873), + Time: __webpack_require__(922), + Tweens: __webpack_require__(924), + Utils: __webpack_require__(928) }; @@ -128802,10 +130793,10 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(166))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(167))) /***/ }), -/* 956 */ +/* 959 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128820,15 +130811,15 @@ global.Phaser = Phaser; module.exports = { - Arcade: __webpack_require__(833), - Impact: __webpack_require__(957), - Matter: __webpack_require__(977) + Arcade: __webpack_require__(836), + Impact: __webpack_require__(960), + Matter: __webpack_require__(980) }; /***/ }), -/* 957 */ +/* 960 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128855,22 +130846,22 @@ module.exports = { module.exports = { - Body: __webpack_require__(937), - COLLIDES: __webpack_require__(340), - CollisionMap: __webpack_require__(938), - Factory: __webpack_require__(939), - Image: __webpack_require__(941), - ImpactBody: __webpack_require__(940), - ImpactPhysics: __webpack_require__(973), - Sprite: __webpack_require__(942), - TYPE: __webpack_require__(341), - World: __webpack_require__(943) + Body: __webpack_require__(940), + COLLIDES: __webpack_require__(342), + CollisionMap: __webpack_require__(941), + Factory: __webpack_require__(942), + Image: __webpack_require__(944), + ImpactBody: __webpack_require__(943), + ImpactPhysics: __webpack_require__(976), + Sprite: __webpack_require__(945), + TYPE: __webpack_require__(343), + World: __webpack_require__(946) }; /***/ }), -/* 958 */ +/* 961 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128879,7 +130870,7 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(60); +var Clamp = __webpack_require__(61); /** * [description] @@ -128926,7 +130917,7 @@ module.exports = GetVelocity; /***/ }), -/* 959 */ +/* 962 */ /***/ (function(module, exports) { /** @@ -129021,7 +131012,7 @@ module.exports = UpdateMotion; /***/ }), -/* 960 */ +/* 963 */ /***/ (function(module, exports) { /** @@ -129092,7 +131083,7 @@ module.exports = { /***/ }), -/* 961 */ +/* 964 */ /***/ (function(module, exports) { /** @@ -129168,7 +131159,7 @@ module.exports = Acceleration; /***/ }), -/* 962 */ +/* 965 */ /***/ (function(module, exports) { /** @@ -129241,7 +131232,7 @@ module.exports = BodyScale; /***/ }), -/* 963 */ +/* 966 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129250,7 +131241,7 @@ module.exports = BodyScale; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(341); +var TYPE = __webpack_require__(343); /** * [description] @@ -129324,7 +131315,7 @@ module.exports = BodyType; /***/ }), -/* 964 */ +/* 967 */ /***/ (function(module, exports) { /** @@ -129402,7 +131393,7 @@ module.exports = Bounce; /***/ }), -/* 965 */ +/* 968 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129411,7 +131402,7 @@ module.exports = Bounce; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var TYPE = __webpack_require__(341); +var TYPE = __webpack_require__(343); /** * [description] @@ -129523,7 +131514,7 @@ module.exports = CheckAgainst; /***/ }), -/* 966 */ +/* 969 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129532,7 +131523,7 @@ module.exports = CheckAgainst; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(340); +var COLLIDES = __webpack_require__(342); /** * [description] @@ -129670,7 +131661,7 @@ module.exports = Collides; /***/ }), -/* 967 */ +/* 970 */ /***/ (function(module, exports) { /** @@ -129794,7 +131785,7 @@ module.exports = Debug; /***/ }), -/* 968 */ +/* 971 */ /***/ (function(module, exports) { /** @@ -129870,7 +131861,7 @@ module.exports = Friction; /***/ }), -/* 969 */ +/* 972 */ /***/ (function(module, exports) { /** @@ -129931,7 +131922,7 @@ module.exports = Gravity; /***/ }), -/* 970 */ +/* 973 */ /***/ (function(module, exports) { /** @@ -129980,7 +131971,7 @@ module.exports = Offset; /***/ }), -/* 971 */ +/* 974 */ /***/ (function(module, exports) { /** @@ -130055,7 +132046,7 @@ module.exports = SetGameObject; /***/ }), -/* 972 */ +/* 975 */ /***/ (function(module, exports) { /** @@ -130154,7 +132145,7 @@ module.exports = Velocity; /***/ }), -/* 973 */ +/* 976 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130164,11 +132155,11 @@ module.exports = Velocity; */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(939); +var Factory = __webpack_require__(942); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(103); +var Merge = __webpack_require__(104); var PluginManager = __webpack_require__(12); -var World = __webpack_require__(943); +var World = __webpack_require__(946); /** * @classdesc @@ -130333,7 +132324,7 @@ module.exports = ImpactPhysics; /***/ }), -/* 974 */ +/* 977 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130342,9 +132333,9 @@ module.exports = ImpactPhysics; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var COLLIDES = __webpack_require__(340); -var SeperateX = __webpack_require__(975); -var SeperateY = __webpack_require__(976); +var COLLIDES = __webpack_require__(342); +var SeperateX = __webpack_require__(978); +var SeperateY = __webpack_require__(979); /** * Impact Physics Solver @@ -130407,7 +132398,7 @@ module.exports = Solver; /***/ }), -/* 975 */ +/* 978 */ /***/ (function(module, exports) { /** @@ -130463,7 +132454,7 @@ module.exports = SeperateX; /***/ }), -/* 976 */ +/* 979 */ /***/ (function(module, exports) { /** @@ -130548,7 +132539,7 @@ module.exports = SeperateY; /***/ }), -/* 977 */ +/* 980 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130563,20 +132554,20 @@ module.exports = SeperateY; module.exports = { - Factory: __webpack_require__(944), - Image: __webpack_require__(947), - Matter: __webpack_require__(861), - MatterPhysics: __webpack_require__(994), - PolyDecomp: __webpack_require__(945), - Sprite: __webpack_require__(948), - TileBody: __webpack_require__(858), - World: __webpack_require__(954) + Factory: __webpack_require__(947), + Image: __webpack_require__(950), + Matter: __webpack_require__(864), + MatterPhysics: __webpack_require__(997), + PolyDecomp: __webpack_require__(948), + Sprite: __webpack_require__(951), + TileBody: __webpack_require__(861), + World: __webpack_require__(957) }; /***/ }), -/* 978 */ +/* 981 */ /***/ (function(module, exports) { /** @@ -130616,7 +132607,7 @@ module.exports = Bounce; /***/ }), -/* 979 */ +/* 982 */ /***/ (function(module, exports) { /** @@ -130704,7 +132695,7 @@ module.exports = Collision; /***/ }), -/* 980 */ +/* 983 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130713,7 +132704,7 @@ module.exports = Collision; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); /** * [description] @@ -130851,7 +132842,7 @@ module.exports = Force; /***/ }), -/* 981 */ +/* 984 */ /***/ (function(module, exports) { /** @@ -130937,7 +132928,7 @@ module.exports = Friction; /***/ }), -/* 982 */ +/* 985 */ /***/ (function(module, exports) { /** @@ -130977,7 +132968,7 @@ module.exports = Gravity; /***/ }), -/* 983 */ +/* 986 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130986,7 +132977,7 @@ module.exports = Gravity; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); /** * [description] @@ -131036,7 +133027,7 @@ module.exports = Mass; /***/ }), -/* 984 */ +/* 987 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131045,7 +133036,7 @@ module.exports = Mass; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); /** * [description] @@ -131091,7 +133082,7 @@ module.exports = Static; /***/ }), -/* 985 */ +/* 988 */ /***/ (function(module, exports) { /** @@ -131144,7 +133135,7 @@ module.exports = Sensor; /***/ }), -/* 986 */ +/* 989 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131154,7 +133145,7 @@ module.exports = Sensor; */ var Bodies = __webpack_require__(92); -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); var GetFastValue = __webpack_require__(2); /** @@ -131363,7 +133354,7 @@ module.exports = SetBody; /***/ }), -/* 987 */ +/* 990 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131372,7 +133363,7 @@ module.exports = SetBody; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var MatterEvents = __webpack_require__(164); +var MatterEvents = __webpack_require__(165); /** * [description] @@ -131484,7 +133475,7 @@ module.exports = Sleep; /***/ }), -/* 988 */ +/* 991 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131493,10 +133484,10 @@ module.exports = Sleep; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); var MATH_CONST = __webpack_require__(16); -var WrapAngle = __webpack_require__(162); -var WrapAngleDegrees = __webpack_require__(163); +var WrapAngle = __webpack_require__(161); +var WrapAngleDegrees = __webpack_require__(162); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -131776,7 +133767,7 @@ module.exports = Transform; /***/ }), -/* 989 */ +/* 992 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131785,7 +133776,7 @@ module.exports = Transform; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Body = __webpack_require__(59); +var Body = __webpack_require__(60); /** * [description] @@ -131876,7 +133867,7 @@ module.exports = Velocity; /***/ }), -/* 990 */ +/* 993 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131887,12 +133878,12 @@ module.exports = Velocity; var Bounds = __webpack_require__(95); var Class = __webpack_require__(0); -var Composite = __webpack_require__(151); -var Constraint = __webpack_require__(165); -var Detector = __webpack_require__(859); +var Composite = __webpack_require__(150); +var Constraint = __webpack_require__(166); +var Detector = __webpack_require__(862); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(103); -var Sleeping = __webpack_require__(342); +var Merge = __webpack_require__(104); +var Sleeping = __webpack_require__(344); var Vector2 = __webpack_require__(6); var Vertices = __webpack_require__(93); @@ -132167,7 +134158,7 @@ module.exports = PointerConstraint; /***/ }), -/* 991 */ +/* 994 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132183,7 +134174,7 @@ var Query = {}; module.exports = Query; var Vector = __webpack_require__(94); -var SAT = __webpack_require__(860); +var SAT = __webpack_require__(863); var Bounds = __webpack_require__(95); var Bodies = __webpack_require__(92); var Vertices = __webpack_require__(93); @@ -132285,7 +134276,7 @@ var Vertices = __webpack_require__(93); /***/ }), -/* 992 */ +/* 995 */ /***/ (function(module, exports, __webpack_require__) { // @if DEBUG @@ -132298,7 +134289,7 @@ var Metrics = {}; module.exports = Metrics; -var Composite = __webpack_require__(151); +var Composite = __webpack_require__(150); var Common = __webpack_require__(38); (function() { @@ -132384,7 +134375,7 @@ var Common = __webpack_require__(38); /***/ }), -/* 993 */ +/* 996 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132609,7 +134600,7 @@ var Bounds = __webpack_require__(95); })(); /***/ }), -/* 994 */ +/* 997 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132619,16 +134610,16 @@ var Bounds = __webpack_require__(95); */ var Class = __webpack_require__(0); -var Factory = __webpack_require__(944); +var Factory = __webpack_require__(947); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(4); -var MatterAttractors = __webpack_require__(995); -var MatterLib = __webpack_require__(949); -var MatterWrap = __webpack_require__(996); -var Merge = __webpack_require__(103); -var Plugin = __webpack_require__(862); +var MatterAttractors = __webpack_require__(998); +var MatterLib = __webpack_require__(952); +var MatterWrap = __webpack_require__(999); +var Merge = __webpack_require__(104); +var Plugin = __webpack_require__(865); var PluginManager = __webpack_require__(12); -var World = __webpack_require__(954); +var World = __webpack_require__(957); /** * @classdesc @@ -132838,10 +134829,10 @@ module.exports = MatterPhysics; /***/ }), -/* 995 */ +/* 998 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(861); +var Matter = __webpack_require__(864); /** * An attractors plugin for matter.js. @@ -132979,10 +134970,10 @@ module.exports = MatterAttractors; */ /***/ }), -/* 996 */ +/* 999 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(861); +var Matter = __webpack_require__(864); /** * A coordinate wrapping plugin for matter.js. @@ -133160,6 +135151,130 @@ module.exports = MatterWrap; * @memberof Matter.Composite */ +/***/ }), +/* 1000 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer + */ + +module.exports = { + + Canvas: __webpack_require__(1001), + Snapshot: __webpack_require__(1002), + WebGL: __webpack_require__(1003) + +}; + + +/***/ }), +/* 1001 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.Canvas + */ + +module.exports = { + + CanvasRenderer: __webpack_require__(367), + BlitImage: __webpack_require__(368), + DrawImage: __webpack_require__(370), + GetBlendModes: __webpack_require__(371) + +}; + + +/***/ }), +/* 1002 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.Snapshot + */ + +module.exports = { + + Canvas: __webpack_require__(369), + WebGL: __webpack_require__(373) + +}; + + +/***/ }), +/* 1003 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.WebGL + */ + +module.exports = { + + Utils: __webpack_require__(41), + WebGLPipeline: __webpack_require__(103), + WebGLRenderer: __webpack_require__(372), + Pipelines: __webpack_require__(1004), + + // Constants + BYTE: 0, + SHORT: 1, + UNSIGNED_BYTE: 2, + UNSIGNED_SHORT: 3, + FLOAT: 4 + +}; + + +/***/ }), +/* 1004 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ + +/** + * @namespace Phaser.Renderer.WebGL.Pipelines + */ + +module.exports = { + + BitmapMaskPipeline: __webpack_require__(374), + FlatTintPipeline: __webpack_require__(375), + ForwardDiffuseLightPipeline: __webpack_require__(163), + TextureTintPipeline: __webpack_require__(164) + +}; + + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/dist/phaser.min.js b/dist/phaser.min.js index 230d77d11a..cf5aafc30a 100644 --- a/dist/phaser.min.js +++ b/dist/phaser.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Phaser",[],e):"object"==typeof exports?exports.Phaser=e():t.Phaser=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=955)}([function(t,e){function i(t,e,i,n){for(var r in e)if(e.hasOwnProperty(r)){var o=(u=e,c=r,f=void 0,p=void 0,p=(d=i)?u[c]:Object.getOwnPropertyDescriptor(u,c),!d&&p.value&&"object"==typeof p.value&&(p=p.value),!!(p&&(f=p,f.get&&"function"==typeof f.get||f.set&&"function"==typeof f.set))&&(void 0===p.enumerable&&(p.enumerable=!0),void 0===p.configurable&&(p.configurable=!0),p));if(!1!==o){if(a=(n||t).prototype,h=r,l=void 0,(l=Object.getOwnPropertyDescriptor(a,h))&&(l.value&&"object"==typeof l.value&&(l=l.value),!1===l.configurable)){if(s.ignoreFinals)continue;throw new Error("cannot override final property '"+r+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,r,o)}else t.prototype[r]=e[r]}var a,h,l,u,c,d,f,p}function n(t,e){if(e){Array.isArray(e)||(e=[e]);for(var n=0;n0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},transformMat3:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},transformMat4:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[4]*i+n[12],this.y=n[1]*e+n[5]*i+n[13],this},reset:function(){return this.x=0,this.y=0,this}});n.ZERO=new n,t.exports=n},function(t,e){var i={},n={install:function(t){for(var e in i)t[e]=i[e]},register:function(t,e){i[t]=e},destroy:function(){i={}}};t.exports=n},function(t,e,i){var n=i(0),s=i(33),r=i(106),o=i(184),a=i(107),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(){return{x1:this.x,y1:this.y,x2:this.right,y2:this.y}},getLineB:function(){return{x1:this.right,y1:this.y,x2:this.right,y2:this.bottom}},getLineC:function(){return{x1:this.right,y1:this.bottom,x2:this.x,y2:this.bottom}},getLineD:function(){return{x1:this.x,y1:this.bottom,x2:this.x,y2:this.y}},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.displayList,this.updateList},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList;var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){},destroy:function(){this.scene=null,this.displayList=null,this.updateList=null}});r.register=function(t,e){r.prototype.hasOwnProperty(t)||(r.prototype[t]=e)},s.register("GameObjectFactory",r,"add"),t.exports=r},function(t,e,i){var n=i(16),s=i(4);t.exports=function(t,e,i){var r=s(t,e,null);if(null===r)return i;if(Array.isArray(r))return n.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return n.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return n.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},function(t,e,i){t.exports={Alpha:i(381),Animation:i(364),BlendMode:i(382),ComputedSize:i(383),Depth:i(384),Flip:i(385),GetBounds:i(386),MatrixStack:i(387),Origin:i(388),Pipeline:i(186),ScaleMode:i(389),ScrollFactor:i(390),Size:i(391),Texture:i(392),Tint:i(393),ToJSON:i(394),Transform:i(395),TransformMatrix:i(187),Visible:i(396)}},function(t,e,i){var n={},s=new(i(0))({initialize:function(t){this.game=t,t.events.once("boot",this.boot,this)},boot:function(){this.game.events.once("destroy",this.destroy,this)},installGlobal:function(t,e){for(var i=t.game,n=t.scene,s=t.settings.map,r=0;ro.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var u=[],c=e;c0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},function(t,e,i){var n=i(97),s=i(15);t.exports=function(t,e,i,r,o){for(var a=null,h=null,l=null,u=null,c=s(t,e,i,r,null,o),d=0;d0;e--){var n=Math.floor(i.random()*(e+1)),s=t[e];t[e]=t[n],t[n]=s}return t},i.choose=function(t){return t[Math.floor(i.random()*t.length)]},i.isElement=function(t){return t instanceof HTMLElement},i.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isFunction=function(t){return"function"==typeof t},i.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},i.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},i.clamp=function(t,e,i){return ti?i:t},i.sign=function(t){return t<0?-1:1},i.now=function(){if(window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-i._nowStartTime},i.random=function(e,i){return e=void 0!==e?e:0,i=void 0!==i?i:1,e+t()*(i-e)};var t=function(){return i._seed=(9301*i._seed+49297)%233280,i._seed/233280};i.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.info=function(){console&&i.logLevel>0&&i.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warn=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.nextId=function(){return i._nextId++},i.map=function(t,e){if(t.map)return t.map(e);for(var i=[],n=0;n>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return this.getLeft(t)+this.width/2},getCenterY:function(t){return this.getTop(t)+this.height/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){(void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){(void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight-(this.height-this.baseHeight),this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.tilemapLayer;return t?t.tileset:null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e){t.exports={SKIP_CHECK:-1,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}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z;return this.x=i*o-n*r,this.y=n*s-e*o,this.z=e*r-i*s,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this},transformMat3:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=e*s[0]+i*s[3]+n*s[6],this.y=e*s[1]+i*s[4]+n*s[7],this.z=e*s[2]+i*s[5]+n*s[8],this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=e*s[0]+i*s[4]+n*s[8]+s[12],o=e*s[1]+i*s[5]+n*s[9]+s[13],a=e*s[2]+i*s[6]+n*s[10]+s[14],h=e*s[3]+i*s[7]+n*s[11]+s[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,l=a*i+o*e-s*n,u=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+l*-o-u*-r,this.y=l*a+c*-r+u*-s-h*-o,this.z=u*a+c*-o+h*-r-l*-s,this},project:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=s[0],o=s[1],a=s[2],h=s[3],l=s[4],u=s[5],c=s[6],d=s[7],f=s[8],p=s[9],g=s[10],v=s[11],y=s[12],m=s[13],x=s[14],b=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*b,this.y=(e*o+i*u+n*p+m)*b,this.z=(e*a+i*c+n*g+x)*b,this},unproject:function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,o=this.x-i,a=r-this.y-1-n,h=this.z;return this.x=2*o/s-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});t.exports=n},function(t,e){t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},function(t,e){t.exports=function(t,e,i){var n=t.x3-t.x1,s=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,l=n*n+s*s,u=n*r+s*o,c=n*a+s*h,d=r*r+o*o,f=r*a+o*h,p=l*d-u*u,g=0===p?0:1/p,v=(d*c-u*f)*g,y=(l*f-u*c)*g;return v>=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},function(t,e,i){var n=i(0),s=i(53),r=i(308),o=i(309),a=i(111),h=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r,this},getLineA:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2}},getLineB:function(){return{x1:this.x2,y1:this.y2,x2:this.x3,y2:this.y3}},getLineC:function(){return{x1:this.x3,y1:this.y3,x2:this.x1,y2:this.y1}},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=h},function(t,e,i){var n=i(0),s=i(17),r=i(18),o=i(7),a=i(2),h=new n({Extends:r,initialize:function(t,e,i,n){var o="string"==typeof t?t:a(t,"key",""),h={type:"json",extension:a(t,"extension","json"),responseType:"text",key:o,url:a(t,"file",e),path:i,xhrSettings:a(t,"xhr",n)};r.call(this,h),"object"==typeof h.url&&(this.data=h.url,this.state=s.FILE_POPULATED)},onProcess:function(t){this.state=s.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText),this.onComplete(),t(this)}});o.register("json",function(t,e,i){if(Array.isArray(t))for(var n=0;n0&&r.rotateAbout(o.position,i,t.position,o.position)}},n.setVelocity=function(t,e){t.positionPrev.x=t.position.x-e.x,t.positionPrev.y=t.position.y-e.y,t.velocity.x=e.x,t.velocity.y=e.y,t.speed=r.magnitude(t.velocity)},n.setAngularVelocity=function(t,e){t.anglePrev=t.angle-e,t.angularVelocity=e,t.angularSpeed=Math.abs(t.angularVelocity)},n.translate=function(t,e){n.setPosition(t,r.add(t.position,e))},n.rotate=function(t,e,i){if(i){var s=Math.cos(e),r=Math.sin(e),o=t.position.x-i.x,a=t.position.y-i.y;n.setPosition(t,{x:i.x+(o*s-a*r),y:i.y+(o*r+a*s)}),n.setAngle(t,t.angle+e)}else n.setAngle(t,t.angle+e)},n.scale=function(t,i,r,o){o=o||t.position;for(var a=0;a0&&(f.position.x+=t.velocity.x,f.position.y+=t.velocity.y),0!==t.angularVelocity&&(s.rotate(f.vertices,t.angularVelocity,t.position),l.rotate(f.axes,t.angularVelocity),d>0&&r.rotateAbout(f.position,t.angularVelocity,t.position,f.position)),h.update(f.bounds,f.vertices,t.velocity)}},n.applyForce=function(t,e,i){t.force.x+=i.x,t.force.y+=i.y;var n=e.x-t.position.x,s=e.y-t.position.y;t.torque+=n*i.y-s*i.x};var e=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new n;return t.entries.forEach(function(t){e.set(t)}),this.entries.forEach(function(t){e.set(t)}),e},intersect:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)&&e.set(i)}),e},difference:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)||e.set(i)}),e},size:{get:function(){return this.entries.length},set:function(t){return this.entries.length=t}}});t.exports=n},function(t,e){t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(0),s=i(32),r=i(181),o=i(182),a=i(105),h=new n({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=h},function(t,e,i){var n=i(60);t.exports=function(t,e,i){return(i-e)*(t=n(t,0,1))}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e,i){var n=i(0),s=i(121),r=i(8),o=i(6),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var n=Math.max(1,Math.round(i/e));return s(this.getSpacedPoints(n),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],n=this.getPoint(0,this._tmpVec2A),s=0;i.push(0);for(var r=1;r<=t;r++)s+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(n),i.push(s),n.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++){var n=this.getUtoTmapping(i/t,null,t);e.push(this.getPoint(n))}return e},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=t-1e-4,n=t+1e-4;return i<0&&(i=0),n>1&&(n=1),this.getPoint(i,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var n,s=this.getLengths(i),r=0,o=s.length;n=e?Math.min(e,s[o-1]):t*s[o-1];for(var a,h=0,l=o-1;h<=l;)if((a=s[r=Math.floor(h+(l-h)/2)]-n)<0)h=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(s[r=l]===n)return r/(o-1);var u=s[r];return(r+(n-u)/(s[r+1]-u))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},function(t,e,i){(function(e){var i={android:!1,chromeOS:!1,cocoonJS:!1,cocoonJSApp:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){var t=navigator.userAgent;/Windows/.test(t)?i.windows=!0:/Mac OS/.test(t)?i.macOS=!0:/Linux/.test(t)?i.linux=!0:/Android/.test(t)?i.android=!0:/iP[ao]d|iPhone/i.test(t)?(i.iOS=!0,navigator.appVersion.match(/OS (\d+)/),i.iOSVersion=parseInt(RegExp.$1,10)):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?i.kindle=!0:/CrOS/.test(t)&&(i.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(i.android=!1,i.iOS=!1,i.macOS=!1,i.windows=!0,i.windowsPhone=!0);var n=/Silk/.test(t);if((i.windows||i.macOS||i.linux&&!n||i.chromeOS)&&(i.desktop=!0),(i.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(i.desktop=!1),navigator.standalone&&(i.webApp=!0),void 0!==window.cordova&&(i.cordova=!0),void 0!==e&&void 0!==e.versions.node&&(i.node=!0),i.node&&"object"==typeof e.versions&&(i.nodeWebkit=!!e.versions["node-webkit"],i.electron=!!e.versions.electron),navigator.isCocoonJS){i.cocoonJS=!0;try{i.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){i.cocoonJSApp=!1}}return void 0!==window.ejecta&&(i.ejecta=!0),/Crosswalk/.test(t)&&(i.crosswalk=!0),i.iPhone=-1!==t.toLowerCase().indexOf("iphone"),i.iPad=-1!==t.toLowerCase().indexOf("ipad"),i.pixelRatio=window.devicePixelRatio||1,i}()}).call(e,i(496))},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var n=i(168),s=i(0),r=i(2),o=i(4),a=i(274),h=i(61),l=i(37),u=new s({initialize:function(t,e,i){void 0!==i||Array.isArray(e)||"object"!=typeof e||(i=e,e=null),this.scene=t,this.children=new h(e),this.isParent=!0,this.classType=r(i,"classType",l),this.active=r(i,"active",!0),this.maxSize=r(i,"maxSize",-1),this.defaultKey=r(i,"defaultKey",null),this.defaultFrame=r(i,"defaultFrame",null),this.runChildUpdate=r(i,"runChildUpdate",!1),this.createCallback=r(i,"createCallback",null),this.removeCallback=r(i,"removeCallback",null),this.createMultipleCallback=r(i,"createMultipleCallback",null),i&&this.createMultiple(i)},create:function(t,e,i,n,s){if(void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),this.isFull())return null;var r=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(r),r.preUpdate&&this.scene.sys.updateList.add(r),r.visible=s,this.add(r),r},createMultiple:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i=0&&t=0&&e0){this.blockSet=!1;var i=this;if(this.events.emit("changedata",this.parent,t,e,function(e){i.blockSet=!0,i.list[t]=e,i.events.emit("setdata",i.parent,t,e)}),this.blockSet)return this}return this.list[t]=e,this.events.emit("setdata",this.parent,t,e),this},each:function(t,e){for(var i=[this.parent,null,void 0],n=1;n0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e,i){var n=i(0),s=i(1),r=i(37),o=i(6),a=i(119),h=new n({Extends:s,initialize:function(t,e,i,n,h,l){s.call(this,t,"Sprite3D"),this.gameObject=new r(t,0,0,h,l),this.position=new a(e,i,n),this.size=new o(this.gameObject.width,this.gameObject.height),this.scale=new o(1,1),this.adjustScaleX=!0,this.adjustScaleY=!0,this._visible=!0},project:function(t){var e=this.position,i=this.gameObject;t.project(e,i),t.getPointSize(e,this.size,this.scale),this.scale.x<=0||this.scale.y<=0?i.setVisible(!1):(i.visible||i.setVisible(!0),this.adjustScaleX&&(i.scaleX=this.scale.x),this.adjustScaleY&&(i.scaleY=this.scale.y),i.setDepth(-1*i.z))},setVisible:function(t){return this.visible=t,this},visible:{get:function(){return this._visible},set:function(t){this._visible=t,this.gameObject.visible=t}},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},z:{get:function(){return this.position.z},set:function(t){this.position.z=t}}});t.exports=h},function(t,e,i){var n,s=i(67),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0};t.exports=(n=navigator.userAgent,/Edge\/\d+/.test(n)?r.edge=!0:/Chrome\/(\d+)/.test(n)&&!s.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10)):/Firefox\D+(\d+)/.test(n)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(n)&&s.iOS?r.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(n)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Opera/.test(n)?r.opera=!0:/Safari/.test(n)&&!s.windowsPhone?r.safari=!0:/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(n)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(n)&&(r.silk=!0),r)},function(t,e){t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},function(t,e,i){var n=i(0),s=i(14),r=i(3),o=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.once("destroy",this.destroy,this),this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.locked&&this.unlock()},add:r,addAudioSprite:function(t,e){var i=this.add(t,e);i.spritemap=this.game.cache.json.get(t).spritemap;for(var n in i.spritemap)if(i.spritemap.hasOwnProperty(n)){var s=i.spritemap[n];i.addMarker({name:n,start:s.start,duration:s.end-s.start,config:e})}return i},play:function(t,e){var i=this.add(t);return i.once("ended",i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var n=this.addAudioSprite(t);return n.once("ended",n.destroy,n),n.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var n=this.sounds[i];n.key===t&&(n.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound(function(t){t.pause()}),this.emit("pauseall",this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit("resumeall",this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit("stopall",this)},unlock:r,onBlur:r,onFocus:r,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit("unlocked",this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach(function(i){i.update(t,e)})},destroy:function(){this.removeAllListeners(),this.forEachActiveSound(function(t){t.destroy()}),this.sounds.length=0,this.sounds=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach(function(n,s){n.pendingRemove||t.call(e||i,n,s,i.sounds)})},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("rate",this,t)}},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("detune",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(14),r=i(23),o=i(3),a=new n({Extends:s,initialize:function(t,e,i){s.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={delay:0},this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.config=r(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(console.error("addMarker - Marker with name '"+t.name+"' already exists for sound '"+this.key+"'!"),!1):(t=r(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0}},t),this.markers[t.name]=t,!0))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(this.markers[t.name]=r(!0,this.markers[t.name],t),!0):(console.error("updateMarker - Marker with name '"+t.name+"' does not exist for sound '"+this.key+"'!"),!1))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return console.error("Sound marker name has to be a string!"),!1;if(t){if(!this.markers[t])return console.error("No marker with name '"+t+"' found for sound '"+this.key+"'!"),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=r(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!0,!0)},resume:function(){return!(!this.isPaused||this.isPlaying)&&(this.isPlaying=!0,this.isPaused=!1,!0)},stop:function(){return!(!this.isPaused&&!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),!0)},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:o,destroy:function(){this.pendingRemove||(this.pendingRemove=!0,this.manager=null,this.key="",this.removeAllListeners(),this.isPlaying=!1,this.isPaused=!1,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)},setRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e}});Object.defineProperty(a.prototype,"rate",{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.setRate(),this.emit("rate",this,t)}}),Object.defineProperty(a.prototype,"detune",{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.setRate(),this.emit("detune",this,t)}}),t.exports=a},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.list=[],this.position=0},add:function(t){return-1===this.getIndex(t)&&this.list.push(t),t},addAt:function(t,e){return void 0===e&&(e=0),0===this.list.length?this.add(t):(e>=0&&e<=this.list.length&&-1===this.getIndex(t)&&this.list.splice(e,0,t),t)},addMultiple:function(t){if(Array.isArray(t))for(var e=0;en?1:0},getByKey:function(t,e){for(var i=0;ithis.list.length)return null;var i=t+Math.floor(Math.random()*e);return this.list[i]},getFirst:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.list.length);for(var s=i;s=this.list.length)throw new Error("List.moveTo: The supplied index is out of bounds");return this.list.splice(i,1),this.list.splice(e,0,t),t},remove:function(t){var e=this.list.indexOf(t);return-1!==e&&this.list.splice(e,1),t},removeAt:function(t){var e=this.list[t];return e&&this.children.splice(t,1),e},removeBetween:function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.list.length);var i=e-t;if(i>0&&i<=e)return this.list.splice(t,i);if(0===i&&0===this.list.length)return[];throw new Error("List.removeBetween: Range Error, numeric values are outside the acceptable range")},removeAll:function(){for(var t=this.list.length;t--;)this.remove(this.list[t]);return this},bringToTop:function(t){return this.getIndex(t)0&&(this.remove(t),this.addAt(t,0)),t},moveUp:function(t){var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getAt(e-1);i&&this.swap(t,i)}return t},reverse:function(){return this.list.reverse(),this},shuffle:function(){for(var t=this.list.length-1;t>0;t--){var e=Math.floor(Math.random()*(t+1)),i=this.list[t];this.list[t]=this.list[e],this.list[e]=i}return this},replace:function(t,e){var i=this.getIndex(t);if(-1!==i)return this.remove(t),this.addAt(e,i),t},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e){for(var i=0;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=n},function(t,e){t.exports={CREATED:0,INIT:1,DELAY:2,OFFSET_DELAY:3,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING_ADD:20,PAUSED:21,LOOP_DELAY:22,ACTIVE:23,COMPLETE_DELAY:24,PENDING_REMOVE:25,REMOVED:26}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(655),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Size,s.Texture,s.Transform,s.Visible,s.ScrollFactor,o],initialize:function(t,e,i,n,s,o,a,h,l){if(r.call(this,t,"Mesh"),this.setTexture(h,l),this.setPosition(e,i),this.setSizeToFrame(),this.setOrigin(),this.initPipeline("TextureTintPipeline"),n.length!==s.length)throw new Error("Mesh Vertex count must match UV count");var u,c=n.length/2|0;if(o.length>0&&o.length0&&a.length=0&&g<=1&&v>=0&&v<=1&&(i.x=s+g*(o-s),i.y=r+g*(a-r),!0)}},function(t,e){t.exports=function(t,e,i,n,s){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),{responseType:t,async:e,user:i,password:n,timeout:s,header:void 0,headerValue:void 0,overrideMimeType:void 0}}},function(t,e,i){var n=i(0),s=i(327),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){var n={};t.exports=n;var s=i(93),r=i(38),o=i(59),a=i(95),h=i(94),l=i(945);n.rectangle=function(t,e,i,n,a){a=a||{};var h={label:"Rectangle Body",position:{x:t,y:e},vertices:s.fromPath("L 0 0 L "+i+" 0 L "+i+" "+n+" L 0 "+n)};if(a.chamfer){var l=a.chamfer;h.vertices=s.chamfer(h.vertices,l.radius,l.quality,l.qualityMin,l.qualityMax),delete a.chamfer}return o.create(r.extend({},h,a))},n.trapezoid=function(t,e,i,n,a,h){h=h||{};var l,u=i*(a*=.5),c=u+(1-2*a)*i,d=c+u;l=a<.5?"L 0 0 L "+u+" "+-n+" L "+c+" "+-n+" L "+d+" 0":"L 0 0 L "+c+" "+-n+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:t,y:e},vertices:s.fromPath(l)};if(h.chamfer){var p=h.chamfer;f.vertices=s.chamfer(f.vertices,p.radius,p.quality,p.qualityMin,p.qualityMax),delete h.chamfer}return o.create(r.extend({},f,h))},n.circle=function(t,e,i,s,o){s=s||{};var a={label:"Circle Body",circleRadius:i};o=o||25;var h=Math.ceil(Math.max(10,Math.min(o,i)));return h%2==1&&(h+=1),n.polygon(t,e,h,i,r.extend({},a,s))},n.polygon=function(t,e,i,a,h){if(h=h||{},i<3)return n.circle(t,e,a,h);for(var l=2*Math.PI/i,u="",c=.5*l,d=0;d0&&s.area(A)1?(f=o.create(r.extend({parts:p.slice(0)},n)),o.setPosition(f,{x:t,y:e}),f):p[0]}},function(t,e,i){var n={};t.exports=n;var s=i(94),r=i(38);n.create=function(t,e){for(var i=[],n=0;n0)return!1}return!0},n.scale=function(t,e,i,r){if(1===e&&1===i)return t;var o,a;r=r||n.centre(t);for(var h=0;h=0?h-1:t.length-1],u=t[h],c=t[(h+1)%t.length],d=e[h0&&(r|=2),3===r)return!1;return 0!==r||null},n.hull=function(t){var e,i,n=[],r=[];for((t=t.slice(0)).sort(function(t,e){var i=t.x-e.x;return 0!==i?i:t.y-e.y}),i=0;i=2&&s.cross3(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)}for(i=t.length-1;i>=0;i-=1){for(e=t[i];n.length>=2&&s.cross3(n[n.length-2],n[n.length-1],e)<=0;)n.pop();n.push(e)}return n.pop(),r.pop(),n.concat(r)}},function(t,e){var i={};t.exports=i,i.create=function(t,e){return{x:t||0,y:e||0}},i.clone=function(t){return{x:t.x,y:t.y}},i.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},i.rotate=function(t,e,i){var n=Math.cos(e),s=Math.sin(e);i||(i={});var r=t.x*n-t.y*s;return i.y=t.x*s+t.y*n,i.x=r,i},i.rotateAbout=function(t,e,i,n){var s=Math.cos(e),r=Math.sin(e);n||(n={});var o=i.x+((t.x-i.x)*s-(t.y-i.y)*r);return n.y=i.y+((t.x-i.x)*r+(t.y-i.y)*s),n.x=o,n},i.normalise=function(t){var e=i.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},i.dot=function(t,e){return t.x*e.x+t.y*e.y},i.cross=function(t,e){return t.x*e.y-t.y*e.x},i.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},i.add=function(t,e,i){return i||(i={}),i.x=t.x+e.x,i.y=t.y+e.y,i},i.sub=function(t,e,i){return i||(i={}),i.x=t.x-e.x,i.y=t.y-e.y,i},i.mult=function(t,e){return{x:t.x*e,y:t.y*e}},i.div=function(t,e){return{x:t.x/e,y:t.y/e}},i.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},i.neg=function(t){return{x:-t.x,y:-t.y}},i.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},i._temp=[i.create(),i.create(),i.create(),i.create(),i.create(),i.create()]},function(t,e){var i={};t.exports=i,i.create=function(t){var e={min:{x:0,y:0},max:{x:0,y:0}};return t&&i.update(e,t),e},i.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var n=0;nt.max.x&&(t.max.x=s.x),s.xt.max.y&&(t.max.y=s.y),s.y0?t.max.x+=i.x:t.min.x+=i.x,i.y>0?t.max.y+=i.y:t.min.y+=i.y)},i.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},i.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},i.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},i.shift=function(t,e){var i=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+n}},function(t,e,i){t.exports={CalculateFacesAt:i(152),CalculateFacesWithin:i(34),Copy:i(871),CreateFromTiles:i(872),CullTiles:i(873),Fill:i(874),FilterTiles:i(875),FindByIndex:i(876),FindTile:i(877),ForEachTile:i(878),GetTileAt:i(97),GetTileAtWorldXY:i(879),GetTilesWithin:i(15),GetTilesWithinShape:i(880),GetTilesWithinWorldXY:i(881),HasTileAt:i(344),HasTileAtWorldXY:i(882),IsInLayerBounds:i(74),PutTileAt:i(153),PutTileAtWorldXY:i(883),PutTilesAt:i(884),Randomize:i(885),RemoveTileAt:i(345),RemoveTileAtWorldXY:i(886),RenderDebug:i(887),ReplaceByIndex:i(343),SetCollision:i(888),SetCollisionBetween:i(889),SetCollisionByExclusion:i(890),SetCollisionByProperty:i(891),SetCollisionFromCollisionGroup:i(892),SetTileIndexCallback:i(893),SetTileLocationCallback:i(894),Shuffle:i(895),SwapByIndex:i(896),TileToWorldX:i(98),TileToWorldXY:i(897),TileToWorldY:i(99),WeightedRandomize:i(898),WorldToTileX:i(39),WorldToTileXY:i(899),WorldToTileY:i(40)}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),n(t,e,s)){var r=s.data[e][t];return null===r?null:-1===r.index?i?r:null:r}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o,a){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o={}),void 0===a&&(a={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=n,this.tileMargin=s,this.tileSpacing=r,this.tileProperties=o,this.tileData=a,this.image=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&t1?2-s:s,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},function(t,e,i){var n=i(78),s=i(5);t.exports=function(t,e,i){if(void 0===i&&(i=new s),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=n(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},function(t,e,i){var n=i(65),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=n(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,l=t.y2,u=0;u=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(s*a+o*h),e}},function(t,e){t.exports=function(t,e,i,n,s){var r=n+Math.atan2(t.y-i,t.x-e);return t.x=e+s*Math.cos(r),t.y=i+s*Math.sin(r),t}},function(t,e,i){var n=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e-y||T>-m||w-y||A>-m||S-y||T>-m||w-y||A>-m||S-v&&A*n+C*r+h>-y&&(A+v)*i+(C+y)*s+a0?this:(this._fadeRed=e,this._fadeGreen=i,this._fadeBlue=n,t<=0&&(t=Number.MIN_VALUE),this._fadeDuration=t,this._fadeAlpha=Number.MIN_VALUE,this)},flash:function(t,e,i,n,s){return!s&&this._flashAlpha>0?this:(void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),this._flashRed=e,this._flashGreen=i,this._flashBlue=n,t<=0&&(t=Number.MIN_VALUE),this._flashDuration=t,this._flashAlpha=1,this)},getWorldPoint:function(t,e,i){void 0===i&&(i=new h);var n=this.matrix.matrix,s=n[0],r=n[1],o=n[2],a=n[3],l=n[4],u=n[5],c=s*a-r*o;if(!c)return i.x=t,i.y=e,i;var d=a*(c=1/c),f=-r*c,p=-o*c,g=s*c,v=(o*u-a*l)*c,y=(r*l-s*u)*c,m=Math.cos(this.rotation),x=Math.sin(this.rotation),b=this.zoom,w=this.scrollX,T=this.scrollY,S=t+(w*m-T*x)*b,A=e+(w*x+T*m)*b;return i.x=S*d+A*p+v,i.y=S*f+A*g+y,i},ignore:function(t){if(t instanceof Array)for(var e=0;eu&&(this.scrollX=u),this.scrollYc&&(this.scrollY=c)}this.roundPixels&&(this.scrollX=Math.round(this.scrollX),this.scrollY=Math.round(this.scrollY)),r.loadIdentity(),r.scale(e,e),r.translate(this.x+o,this.y+a),r.rotate(this.rotation),r.scale(s,s),r.translate(-o,-a),r.translate(this._shakeOffsetX,this._shakeOffsetY)},removeBounds:function(){return this.useBounds=!1,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=s(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=a(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n){return this._bounds.setTo(t,e,i,n),this.useBounds=!0,this},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t){return this.scene=t,this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setZoom:function(t){return void 0===t&&(t=1),this.zoom=t,this},shake:function(t,e,i){return void 0===e&&(e=.05),i||0===this._shakeOffsetX&&0===this._shakeOffsetY?(this._shakeDuration=t,this._shakeIntensity=e,this._shakeOffsetX=0,this._shakeOffsetY=0,this):this},startFollow:function(t,e){return this._follow=t,void 0!==e&&(this.roundPixels=e),this},stopFollow:function(){return this._follow=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},resetFX:function(){return this._flashAlpha=0,this._fadeAlpha=0,this._shakeOffsetX=0,this._shakeOffsetY=0,this._shakeDuration=0,this},update:function(t,e){if(this._flashAlpha>0&&(this._flashAlpha-=e/this._flashDuration,this._flashAlpha<0&&(this._flashAlpha=0)),this._fadeAlpha>0&&this._fadeAlpha<1&&(this._fadeAlpha+=e/this._fadeDuration,this._fadeAlpha>=1&&(this._fadeAlpha=1)),this._shakeDuration>0){var i=this._shakeIntensity;this._shakeDuration-=e,this._shakeDuration<=0?(this._shakeOffsetX=0,this._shakeOffsetY=0):(this._shakeOffsetX=(Math.random()*i*this.width*2-i*this.width)*this.zoom,this._shakeOffsetY=(Math.random()*i*this.height*2-i*this.height)*this.zoom,this.roundPixels&&(this._shakeOffsetX|=0,this._shakeOffsetY|=0))}},destroy:function(){this._bounds=void 0,this.matrix=void 0,this.culledObjects=[],this.scene=void 0}});t.exports=l},function(t,e,i){var n=i(200),s=i(202),r=i(204),o=i(205);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):n(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var n=i(0),s=i(118),r=i(206),o=i(207),a=i(208),h=i(61),l=i(81),u=i(6),c=i(51),d=i(119),f=new c,p=new d,g=new c,v=new c,y=new s,m=new n({initialize:function(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,this.name="",this.direction=new c(0,0,-1),this.up=new c(0,1,0),this.position=new c,this.pixelScale=128,this.projection=new s,this.view=new s,this.combined=new s,this.invProjectionView=new s,this.near=1,this.far=100,this.ray={origin:new c,direction:new c},this.viewportWidth=0,this.viewportHeight=0,this.billboardMatrixDirty=!0,this.children=new h},setPosition:function(t,e,i){return this.position.set(t,e,i),this.update()},setScene:function(t){return this.scene=t,this},setPixelScale:function(t){return this.pixelScale=t,this.update()},add:function(t){return this.children.set(t),this.updateChildren(),t},remove:function(t){return this.displayList.remove(t.gameObject),this.updateList.remove(t.gameObject),this.children.delete(t),this},clear:function(){for(var t=this.getChildren(),e=0;e0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return Math.sqrt(e*e+i*i+n*n+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return e*e+i*i+n*n+s*s},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,l=a*i+o*e-s*n,u=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+l*-o-u*-r,this.y=l*a+c*-r+u*-s-h*-o,this.z=u*a+c*-o+h*-r-l*-s,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});n.prototype.sub=n.prototype.subtract,n.prototype.mul=n.prototype.multiply,n.prototype.div=n.prototype.divide,n.prototype.dist=n.prototype.distance,n.prototype.distSq=n.prototype.distanceSq,n.prototype.len=n.prototype.length,n.prototype.lenSq=n.prototype.lengthSq,t.exports=n},function(t,e){var i,n="";t.exports={disable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!1),t},enable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!0),t},getPrefix:i=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e,i){var n=i(0),s=i(42),r=new n({initialize:function(t){this.name="WebGLPipeline",this.game=t.game,this.view=t.game.canvas,this.resolution=t.game.config.resolution,this.width=t.game.config.width*this.resolution,this.height=t.game.config.height*this.resolution,this.gl=t.gl,this.vertexCount=0,this.vertexCapacity=t.vertexCapacity,this.renderer=t.renderer,this.vertexData=t.vertices?t.vertices:new ArrayBuffer(t.vertexCapacity*t.vertexSize),this.vertexBuffer=this.renderer.createVertexBuffer(t.vertices?t.vertices:this.vertexData.byteLength,this.gl.STREAM_DRAW),this.program=this.renderer.createProgram(t.vertShader,t.fragShader),this.attributes=t.attributes,this.vertexSize=t.vertexSize,this.topology=t.topology,this.bytes=new Uint8Array(this.vertexData),this.vertexComponentCount=s.getComponentCount(t.attributes,this.gl),this.flushLocked=!1},shouldFlush:function(){return this.vertexCount>=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this},bind:function(){var t=this.gl,e=this.vertexBuffer,i=this.attributes,n=this.program,s=this.renderer,r=this.vertexSize;s.setProgram(n),s.setVertexBuffer(e);for(var o=0;o=0?(t.enableVertexAttribArray(h),t.vertexAttribPointer(h,a.size,a.type,a.normalized,r,a.offset)):t.disableVertexAttribArray(h)}return this},onBind:function(){return this},onPreRender:function(){return this},onRender:function(){return this},onPostRender:function(){return this},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t=this.gl,e=this.vertexCount,i=this.topology,n=this.vertexSize;if(0!==e)return t.bufferSubData(t.ARRAY_BUFFER,0,this.bytes.subarray(0,e*n)),t.drawArrays(i,0,e),this.vertexCount=0,this.flushLocked=!1,this;this.flushLocked=!1},destroy:function(){var t=this.gl;return t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),delete this.program,delete this.vertexBuffer,delete this.gl,this}});t.exports=r},function(t,e){t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,LINE_FX_TO:12,MOVE_FX_TO:13,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18}},function(t,e){t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221}},function(t,e,i){var n=i(0),s=i(83),r=i(529),o=i(530),a=i(233),h=i(254),l=new n({initialize:function(t,e){this.scene=t,this.game,this.config=e,this.settings=h.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList},init:function(t){this.settings.status=s.INIT,this.game=t,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.installGlobal(this,a.Global),e.installLocal(this,a.CoreScene),e.installLocal(this,o(this)),e.installLocal(this,r(this)),this.events.emit("boot",this),this.settings.isBooted=!0},install:function(t){Array.isArray(t)||(t=[t]),this.plugins.installLocal(this,t)},step:function(t,e){this.events.emit("preupdate",t,e),this.events.emit("update",t,e),this.scene.update.call(this.scene,t,e),this.events.emit("postupdate",t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.cameras.render(t,e),this.events.emit("render",t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(){return this.settings.active&&(this.settings.status=s.PAUSED,this.settings.active=!1,this.events.emit("pause",this)),this},resume:function(){return this.settings.active||(this.settings.status=s.RUNNING,this.settings.active=!0,this.events.emit("resume",this)),this},sleep:function(){return this.settings.status=s.SLEEPING,this.settings.active=!1,this.settings.visible=!1,this.events.emit("sleep",this),this},wake:function(){return this.settings.status=s.RUNNING,this.settings.active=!0,this.settings.visible=!0,this.events.emit("wake",this),this},isSleeping:function(){return this.settings.status===s.SLEEPING},isActive:function(){return this.settings.status===s.RUNNING},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t){return t?this.resume():this.pause()},start:function(t){this.settings.status=s.START,this.settings.data=t,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this)},shutdown:function(){this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this)}});t.exports=l},function(t,e,i){var n=i(0),s=i(23),r=new n({initialize:function(t,e,i,n,s,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX=n,this.cutY=s,this.cutWidth=r,this.cutHeight=o,this.x=0,this.y=0,this.width=r,this.height=o,this.halfWidth=Math.floor(.5*r),this.halfHeight=Math.floor(.5*o),this.centerX=Math.floor(r/2),this.centerY=Math.floor(o/2),this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.data={cut:{x:n,y:s,w:r,h:o,r:n+r,b:s+o},trim:!1,sourceSize:{w:r,h:o},spriteSourceSize:{x:0,y:0,w:r,h:o},uvs:{x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},radius:.5*Math.sqrt(r*r+o*o),drawImage:{sx:n,sy:s,sWidth:r,sHeight:o,dWidth:r,dHeight:o}},this.updateUVs()},setTrim:function(t,e,i,n,s,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=n,a.w=s,a.h=r,this.x=i,this.y=n,this.width=s,this.height=r,this.halfWidth=.5*s,this.halfHeight=.5*r,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.updateUVs()},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.sWidth=i,s.sHeight=n,s.dWidth=i,s.dHeight=n;var r=this.source.width,o=this.source.height,a=this.data.uvs;return a.x0=t/r,a.y0=e/o,a.x1=t/r,a.y1=(e+n)/o,a.x2=(t+i)/r,a.y2=(e+n)/o,a.x3=(t+i)/r,a.y3=e/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height,i=this.data.uvs;return i.x3=(this.cutX+this.cutHeight)/t,i.y3=(this.cutY+this.cutWidth)/e,i.x2=this.cutX/t,i.y2=(this.cutY+this.cutWidth)/e,i.x1=this.cutX/t,i.y1=this.cutY/e,i.x0=(this.cutX+this.cutHeight)/t,i.y0=this.cutY/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},uvs:{get:function(){return this.data.uvs}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(267),a=i(546),h=i(547),l=i(548),u=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.ScaleMode,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,l],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"BitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds()},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return Array.isArray(t)&&(t=t.join("\n")),this.text=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});u.ParseRetroFont=h,u.ParseFromAtlas=a,t.exports=u},function(t,e,i){var n=i(551),s=i(554),r=i(0),o=i(11),a=i(130),h=i(1),l=i(86),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,n],initialize:function(t,e,i,n,s){h.call(this,t,"Blitter"),this.setTexture(n,s),this.setPosition(e,i),this.initPipeline("TextureTintPipeline"),this.children=new l,this.renderList=[],this.dirty=!1},create:function(t,e,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new s(this,t,e,i,n);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,n){for(var s=this.createMultiple(e,i,n),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0}});t.exports=u},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(267),a=i(555),h=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"DynamicBitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds(),this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return Array.isArray(t)&&(t=t.join("\n")),this.text=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});t.exports=h},function(t,e,i){var n=i(114),s=i(0),r=i(127),o=i(11),a=i(269),h=i(1),l=i(4),u=i(16),c=i(567),d=new s({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.Transform,o.Visible,o.ScrollFactor,c],initialize:function(t,e){var i=l(e,"x",0),n=l(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,n),this.initPipeline("FlatTintPipeline"),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.setDefaultStyles(e)},setDefaultStyles:function(t){return l(t,"lineStyle",null)&&(this.defaultStrokeWidth=l(t,"lineStyle.width",1),this.defaultStrokeColor=l(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=l(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),l(t,"fillStyle",null)&&(this.defaultFillColor=l(t,"fillStyle.color",16777215),this.defaultFillAlpha=l(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,u.PI2),this.closePath(),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,u.PI2),this.closePath(),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,n){return this.commandBuffer.push(r.FILL_RECT,t,e,i,n),this},strokeRect:function(t,e,i,n){var s=this._lineWidth/2,r=t-s,o=t+s;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+n),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+n),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.closePath(),this.beginPath(),this.moveTo(r,e+n),this.lineTo(o+i,e+n),this.strokePath(),this.closePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,n,s,o),this},strokeTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,n,s,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,n){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,n),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},lineFxTo:function(t,e,i,n){return this.commandBuffer.push(r.LINE_FX_TO,t,e,i,n,1),this},moveFxTo:function(t,e,i,n){return this.commandBuffer.push(r.MOVE_FX_TO,t,e,i,n,1),this},strokePoints:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var n,s,r=this.scene.sys;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),d.TargetCamera.setViewport(0,0,e,i),d.TargetCamera.scrollX=this.x,d.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var o=(n=r.textures.get(t)).getSourceImage();o instanceof HTMLCanvasElement&&(s=o.getContext("2d"))}else s=(n=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d");else t instanceof HTMLCanvasElement&&(s=t.getContext("2d"));return s&&(this.renderCanvas(r.game.renderer,this,0,d.TargetCamera,s),r.game.renderer.gl&&n&&(n.source[0].glTexture=r.game.renderer.canvasToTexture(s.canvas,n.source[0].glTexture,!0,0))),this}});d.TargetCamera=new n(0,0,0,0),t.exports=d},function(t,e,i){var n=i(0),s=i(68),r=i(270),o=i(271),a=i(109),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(5);t.exports=function(t,e,i){void 0===i&&(i=new n);var s=t.width/2,r=t.height/2;return i.x=t.x+s*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(572),a=i(86),h=i(573),l=i(612),u=new n({Extends:r,Mixins:[s.Depth,s.Visible,s.Pipeline,l],initialize:function(t,e,i,n){if(r.call(this,t,"ParticleEmitterManager"),this.blendMode=-1,this.timeScale=1,this.texture=null,this.frame=null,this.frameNames=[],null===i||"object"!=typeof i&&!Array.isArray(i)||(n=i,i=null),this.setTexture(e,i),this.initPipeline("TextureTintPipeline"),this.emitters=new a(this),this.wells=new a(this),n){Array.isArray(n)||(n=[n]);for(var s=0;s0?e.defaultFrame=i[0]:e.defaultFrame=this.defaultFrame,this},addEmitter:function(t){return this.emitters.add(t)},createEmitter:function(t){return this.addEmitter(new h(this,t))},addGravityWell:function(t){return this.wells.add(t)},createGravityWell:function(t){return this.addGravityWell(new o(t))},emitParticle:function(t,e,i){for(var n=this.emitters.list,s=0;sl){if(0===c){for(var g=f;g.length&&(g=g.slice(0,-1),!((p=e.measureText(g).width)<=l)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var v=d.substr(g.length);u[c]=v,h+=g}var y=u[c].length?c:c+1,m=u.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=m+" "+(s[o+1]||""),r=s.length;break}h+=f,l-=p}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var n="",s=t.split(this.splitRegExp),r=0;ro?(h>0&&(n+="\n"),n+=a[h]+" ",o=i-l):(o-=u,n+=a[h]+" ")}r0&&(a+=u.lineSpacing*p),i.rtl?o=d-o:"right"===i.align?o+=u.width-u.lineWidths[p]:"center"===i.align&&(o+=(u.width-u.lineWidths[p])/2),this.autoRound&&(o=Math.round(o),a=Math.round(a)),i.strokeThickness&&(this.style.syncShadow(e,i.shadowStroke),e.strokeText(l[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(l[p],o,a));return e.restore(),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this.text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t},preDestroy:function(){this.style.rtl&&u(this.canvas),s.remove(this.canvas)}});t.exports=f},function(t,e,i){var n=i(21),s=i(0),r=i(11),o=i(1),a=i(290),h=i(625),l=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Origin,r.Pipeline,r.ScaleMode,r.ScrollFactor,r.Size,r.Texture,r.Tint,r.Transform,r.Visible,h],initialize:function(t,e,i,s,r,h,l){var u=t.sys.game.renderer;o.call(this,t,"TileSprite"),this.tilePositionX=0,this.tilePositionY=0,this.dirty=!0,this.tileTexture=null,this.renderer=u,this.setTexture(h,l),this.setPosition(e,i),this.setSize(s,r),this.setOriginFromFrame(),this.initPipeline("TextureTintPipeline"),this.potWidth=a(this.frame.width),this.potHeight=a(this.frame.height),this.canvasPattern=null,this.canvasBuffer=n.create2D(null,this.potWidth,this.potHeight),this.canvasBufferCtx=this.canvasBuffer.getContext("2d"),this.updateTileTexture(),t.sys.game.renderer.onContextRestored(function(t){var e=t.gl;this.tileTexture=null,this.dirty=!0,this.tileTexture=t.createTexture2D(0,e.LINEAR,e.LINEAR,e.REPEAT,e.REPEAT,e.RGBA,this.canvasBuffer,this.potWidth,this.potHeight)},this)},updateTileTexture:function(){this.dirty&&(this.canvasBufferCtx.drawImage(this.frame.source.image,this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight,0,0,this.potWidth,this.potHeight),this.renderer.gl?this.tileTexture=this.renderer.canvasToTexture(this.canvasBuffer,this.tileTexture,null===this.tileTexture,this.scaleMode):this.canvasPattern=this.canvasBufferCtx.createPattern(this.canvasBuffer,"repeat"),this.dirty=!1)},destroy:function(){this.renderer&&this.renderer.deleteTexture(this.tileTexture),n.remove(this.canvasBuffer),this.canvasPattern=null,this.canvasBufferCtx=null,this.canvasBuffer=null,this.renderer=null,this.visible=!1}});t.exports=l},function(t,e,i){var n=i(10);t.exports=function(t,e){var i=n(e,"anims",null);if(null===i)return t;if("string"==typeof i)t.anims.play(i);else if("object"==typeof i){var s=t.anims,r=n(i,"key",void 0),o=n(i,"startFrame",void 0),a=n(i,"delay",0),h=n(i,"repeat",0),l=n(i,"repeatDelay",0),u=n(i,"yoyo",!1),c=n(i,"play",!1),d=n(i,"delayedPlay",0);s.delay(a),s.repeat(h),s.repeatDelay(l),s.yoyo(u),c?s.play(r,o):d>0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(0),s=i(88),r=new n({Extends:s,initialize:function(t,e,i,n,r){s.call(this,t,e,i,[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,1,1,1,0],[16777215,16777215,16777215,16777215,16777215,16777215],[1,1,1,1,1,1],n,r),this.resetPosition()},topLeftX:{get:function(){return this.x+this.vertices[0]},set:function(t){this.vertices[0]=t-this.x,this.vertices[6]=t-this.x}},topLeftY:{get:function(){return this.y+this.vertices[1]},set:function(t){this.vertices[1]=t-this.y,this.vertices[7]=t-this.y}},topRightX:{get:function(){return this.x+this.vertices[10]},set:function(t){this.vertices[10]=t-this.x}},topRightY:{get:function(){return this.y+this.vertices[11]},set:function(t){this.vertices[11]=t-this.y}},bottomLeftX:{get:function(){return this.x+this.vertices[2]},set:function(t){this.vertices[2]=t-this.x}},bottomLeftY:{get:function(){return this.y+this.vertices[3]},set:function(t){this.vertices[3]=t-this.y}},bottomRightX:{get:function(){return this.x+this.vertices[4]},set:function(t){this.vertices[4]=t-this.x,this.vertices[8]=t-this.x}},bottomRightY:{get:function(){return this.y+this.vertices[5]},set:function(t){this.vertices[5]=t-this.y,this.vertices[9]=t-this.y}},topLeftAlpha:{get:function(){return this.alphas[0]},set:function(t){this.alphas[0]=t,this.alphas[3]=t}},topRightAlpha:{get:function(){return this.alphas[5]},set:function(t){this.alphas[5]=t}},bottomLeftAlpha:{get:function(){return this.alphas[1]},set:function(t){this.alphas[1]=t}},bottomRightAlpha:{get:function(){return this.alphas[2]},set:function(t){this.alphas[2]=t,this.alphas[4]=t}},topLeftColor:{get:function(){return this.colors[0]},set:function(t){this.colors[0]=t,this.colors[3]=t}},topRightColor:{get:function(){return this.colors[5]},set:function(t){this.colors[5]=t}},bottomLeftColor:{get:function(){return this.colors[1]},set:function(t){this.colors[1]=t}},bottomRightColor:{get:function(){return this.colors[2]},set:function(t){this.colors[2]=t,this.colors[4]=t}},setTopLeft:function(t,e){return this.topLeftX=t,this.topLeftY=e,this},setTopRight:function(t,e){return this.topRightX=t,this.topRightY=e,this},setBottomLeft:function(t,e){return this.bottomLeftX=t,this.bottomLeftY=e,this},setBottomRight:function(t,e){return this.bottomRightX=t,this.bottomRightY=e,this},resetPosition:function(){var t=this.x,e=this.y,i=Math.floor(this.width/2),n=Math.floor(this.height/2);return this.setTopLeft(t-i,e-n),this.setTopRight(t+i,e-n),this.setBottomLeft(t-i,e+n),this.setBottomRight(t+i,e+n),this},resetAlpha:function(){var t=this.alphas;return t[0]=1,t[1]=1,t[2]=1,t[3]=1,t[4]=1,t[5]=1,this},resetColors:function(){var t=this.colors;return t[0]=16777215,t[1]=16777215,t[2]=16777215,t[3]=16777215,t[4]=16777215,t[5]=16777215,this},reset:function(){return this.resetPosition(),this.resetAlpha(),this.resetColors()}});t.exports=r},function(t,e){t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=[]);for(var s,r,o,a,h,l,u=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=u*u+c*c,g=u*d+c*f,v=d*d+f*f,y=p*v-g*g,m=0===y?0:1/y,x=t.x1,b=t.y1,w=0;w=0&&r>=0&&s+r<1&&(n.push({x:e[w].x,y:e[w].y}),i)));w++);return n}},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*s-a*r+e,t.y1=o*r+a*s+i,o=t.x2-e,a=t.y2-i,t.x2=o*s-a*r+e,t.y2=o*r+a*s+i,t}},function(t,e){t.exports=function(t,e,i){for(var n=!1,s=-1,r=t.points.length-1;++s0&&(n.totalDuration+=n.t2*n.repeat),n.totalDuration>t&&(t=n.totalDuration)}this.duration=t,this.loopCounter=-1===this.loop?999999999999:this.loop,this.loopCounter>0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){for(var t=this.data,e=this.totalTargets,i=0;i0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&(t.params[1]=this.targets,t.func.apply(t.scope,t.params)),this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},pause:function(){if(this.state!==o.PAUSED)return this.paused=!0,this._pausedState=this.state,this.state=o.PAUSED,this},play:function(t){if(this.state!==o.ACTIVE){this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?(e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.ACTIVE):(this.countdown=this.calculatedOffset,this.state=o.OFFSET_DELAY)):this.paused?(this.paused=!1,this.parent.makeActive(this)):(this.resetTweenData(t),this.state=o.ACTIVE,e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)))}},resetTweenData:function(t){for(var e=this.data,i=0;i0?(n.elapsed=n.delay,n.state=o.DELAY):n.state=o.PENDING_RENDER}},resume:function(){return this.state===o.PAUSED&&(this.paused=!1,this.state=this._pausedState),this},seek:function(t){for(var e=this.data,i=0;i=s.totalDuration?(r=1,o=s.duration):n>s.delay&&n<=s.t1?(r=(n=Math.max(0,n-s.delay))/s.t1,o=s.duration*r):n>s.t1&&ns.repeatDelay&&(r=n/s.t1,o=s.duration*r)),s.progress=r,s.elapsed=o;var a=s.ease(s.progress);s.current=s.start+(s.end-s.start)*a,s.target[s.key]=s.current}},setCallback:function(t,e,i,n){return this.callbacks[t]={func:e,scope:n,params:i},this},stop:function(t){void 0!==t&&this.seek(t),this.state=o.PENDING_REMOVE},update:function(t,e){if(this.state===o.PAUSED)return!1;switch(this.useFrames&&(e=1*this.parent.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var i=!1,n=0;n0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var s=t.callbacks.onRepeat;return s&&(s.params[1]=e.target,s.func.apply(s.scope,s.params)),e.start=e.getStartValue(e.target,e.key,e.start),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},setStateFromStart:function(t,e,i){if(e.repeatCounter>0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var n=t.callbacks.onRepeat;return n&&(n.params[1]=e.target,n.func.apply(n.scope,n.params)),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},updateTweenData:function(t,e,i){switch(e.state){case o.PLAYING_FORWARD:case o.PLAYING_BACKWARD:if(!e.target){e.state=o.COMPLETE;break}var n=e.elapsed,s=e.duration,r=0;(n+=i)>s&&(r=n-s,n=s);var a,h=e.state===o.PLAYING_FORWARD,l=n/s;a=h?e.ease(l):e.ease(1-l),e.current=e.start+(e.end-e.start)*a,e.target[e.key]=e.current,e.elapsed=n,e.progress=l;var u=t.callbacks.onUpdate;u&&(u.params[1]=e.target,u.func.apply(u.scope,u.params)),1===l&&(h?e.hold>0?(e.elapsed=e.hold-r,e.state=o.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,r):e.state=this.setStateFromStart(t,e,r));break;case o.DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PENDING_RENDER);break;case o.REPEAT_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PLAYING_FORWARD);break;case o.HOLD_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case o.PENDING_RENDER:e.target?(e.start=e.getStartValue(e.target,e.key,e.target[e.key]),e.end=e.getEndValue(e.target,e.key,e.start),e.current=e.start,e.target[e.key]=e.start,e.state=o.PLAYING_FORWARD):e.state=o.COMPLETE}return e.state!==o.COMPLETE}});a.TYPES=["onComplete","onLoop","onRepeat","onStart","onUpdate","onYoyo"],r.register("tween",function(t){return this.scene.sys.tweens.add(t)}),s.register("tween",function(t){return this.scene.sys.tweens.create(t)}),t.exports=a},function(t,e){t.exports=function(t,e,i,n,s,r,o,a,h,l,u,c,d){return{target:t,key:e,getEndValue:i,getStartValue:n,ease:s,duration:0,totalDuration:0,delay:0,yoyo:a,hold:0,repeat:0,repeatDelay:0,flipX:c,flipY:d,progress:0,elapsed:0,repeatCounter:0,start:0,current:0,end:0,t1:0,t2:0,gen:{delay:r,duration:o,hold:h,repeat:l,repeatDelay:u},state:0}}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n={};t.exports=n;var s=i(38);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var o={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===e.length&&e.stiffness>.1?(o.type="pin",o.anchors=!1):e.stiffness<.9&&(o.type="spring"),e.render=l.extend(o,e.render),e},n.preSolveAll=function(t){for(var e=0;e0&&(c.position.x+=l.x,c.position.y+=l.y),0!==l.angle&&(s.rotate(c.vertices,l.angle,i.position),h.rotate(c.axes,l.angle),u>0&&r.rotateAbout(c.position,l.angle,i.position,c.position)),a.update(c.bounds,c.vertices,i.velocity)}l.angle*=n._warming,l.x*=n._warming,l.y*=n._warming}}}},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){t.exports=function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0}},function(t,e,i){t.exports={Angle:i(376),Call:i(377),GetFirst:i(378),GridAlign:i(379),IncAlpha:i(397),IncX:i(398),IncXY:i(399),IncY:i(400),PlaceOnCircle:i(401),PlaceOnEllipse:i(402),PlaceOnLine:i(403),PlaceOnRectangle:i(404),PlaceOnTriangle:i(405),PlayAnimation:i(406),RandomCircle:i(407),RandomEllipse:i(408),RandomLine:i(409),RandomRectangle:i(410),RandomTriangle:i(411),Rotate:i(412),RotateAround:i(413),RotateAroundDistance:i(414),ScaleX:i(415),ScaleXY:i(416),ScaleY:i(417),SetAlpha:i(418),SetBlendMode:i(419),SetDepth:i(420),SetHitArea:i(421),SetOrigin:i(422),SetRotation:i(423),SetScale:i(424),SetScaleX:i(425),SetScaleY:i(426),SetTint:i(427),SetVisible:i(428),SetX:i(429),SetXY:i(430),SetY:i(431),ShiftPosition:i(432),Shuffle:i(433),SmootherStep:i(434),SmoothStep:i(435),Spread:i(436),ToggleVisible:i(437)}},function(t,e,i){var n=i(170),s=[];s[n.BOTTOM_CENTER]=i(171),s[n.BOTTOM_LEFT]=i(172),s[n.BOTTOM_RIGHT]=i(173),s[n.CENTER]=i(174),s[n.LEFT_CENTER]=i(176),s[n.RIGHT_CENTER]=i(177),s[n.TOP_CENTER]=i(178),s[n.TOP_LEFT]=i(179),s[n.TOP_RIGHT]=i(180);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e){t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},function(t,e,i){var n=i(24),s=i(46),r=i(25),o=i(47);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(26),r=i(25),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(28),r=i(25),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(175),s=i(46),r=i(49);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),n(t,s(e)+i,r(e)+o),t}},function(t,e,i){var n=i(47),s=i(48);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(49),s=i(26),r=i(48),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(49),s=i(28),r=i(48),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(46),s=i(30),r=i(47),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(26),s=i(30),r=i(27),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)-a),t}},function(t,e,i){var n=i(28),s=i(30),r=i(29),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(104),s=i(64),r=i(16),o=i(5);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=s(e,0,r.PI2);return n(t,a,i)}},function(t,e,i){var n=i(183),s=i(104),r=i(64),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;n-h&&(c-=h,n+=l),f0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var n=this.frames.slice(0,t),s=this.frames.slice(t);this.frames=n.concat(i,s)}this.updateFrameSequence()}return this},checkFrame:function(t){return t0){o.isLast=!0,o.nextFrame=l[0],l[0].prevFrame=o;var v=1/(l.length-1);for(a=0;a=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,t._timeScale=1,t.frameRate=this.frameRate,t.duration=this.duration,t.msPerFrame=this.msPerFrame,t.skipMissedFrames=this.skipMissedFrames,t._delay=this.delay,t._repeat=this.repeat,t._repeatDelay=this.repeatDelay,t._yoyo=this.yoyo,t._callbackArgs[1]=this,t._updateParams=t._callbackArgs.concat(this.onUpdateParams)),t.updateFrame(this.frames[e])},nextFrame:function(t){var e=t.currentFrame;e.isLast?this.yoyo?(t.forward=!1,t.updateFrame(e.prevFrame),this.getNextTick(t)):t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.nextFrame),this.getNextTick(t))},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.prevFrame),this.getNextTick(t))},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=1e3*t._repeatDelay):(t.repeatCounter--,t.forward=!0,t.updateFrame(t.currentFrame.nextFrame),this.getNextTick(t),t.pendingRepeat=!1,this.onRepeat&&this.onRepeat.apply(this.callbackScope,t._callbackArgs.concat(this.onRepeatParams)))},setFrame:function(t){t.forward?this.nextFrame(t):this.previousFrame(t)},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showOnStart:this.showOnStart,hideOnComplete:this.hideOnComplete};return this.frames.forEach(function(e){t.frames.push(e.toJSON())}),t},updateFrameSequence:function(){for(var t=this.frames.length,e=1/(t-1),i=0;i1&&(n.prevFrame=this.frames[i-1],n.nextFrame=this.frames[i+1])}return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){}});t.exports=o},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.onUpdate=null},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0,this.onUpdate=void 0}});t.exports=n},function(t,e,i){var n=i(194),s=i(0),r=i(113),o=i(14),a=i(4),h=i(197),l=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.paused=!1,this.name="AnimationManager",t.events.once("boot",this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once("destroy",this.destroy,this)},add:function(t,e){if(!this.anims.has(t))return e.key=t,this.anims.set(t,e),this.emit("add",t,e),this;console.warn("Animation with key",t,"already exists")},create:function(t){var e=t.key;if(e&&!this.anims.has(e)){var i=new n(this,e,t);return this.anims.set(e,i),this.emit("add",e,i),i}console.warn("Invalid Animation Key, or Key already in use: "+e)},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var n=0;n=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(0),s=i(113),r=i(14),o=new n({initialize:function(){this.entries=new s,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit("add",this,t,e),this},has:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit("remove",this,t,e.data)),this},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=o},function(t,e,i){var n=i(198),s=new(i(0))({initialize:function(t){this.game=t,this.binary=new n,this.bitmapFont=new n,this.json=new n,this.physics=new n,this.shader=new n,this.audio=new n,this.text=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once("destroy",this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new n),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","text","obj","tilemap","xml"],e=0;e16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(36);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var n=i(36);t.exports=function(t){var e=new n,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var s=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(s,r,o,255*a)}return e}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,n=2*Math.random()-1,s=Math.sqrt(1-n*n)*e;return t.x=Math.cos(i)*s,t.y=Math.sin(i)*s,t.z=n*e,t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},function(t,e,i){var n=i(51),s=i(118),r=i(209),o=new s,a=new r,h=new n;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},function(t,e,i){var n=i(0),s=i(51),r=i(210),o=new Int8Array([1,2,0]),a=new Float32Array([0,0,0]),h=new s(1,0,0),l=new s(0,1,0),u=new s,c=new r,d=new n({initialize:function(t,e,i,n){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},set:function(t,e,i,n){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(u.copy(h).cross(t).length()<1e-6&&u.copy(l).cross(t),u.normalize(),this.setAxisAngle(u,Math.PI)):i>.999999?(this.x=0,this.y=0,this.z=0,this.w=1,this):(u.copy(t).cross(e),this.x=u.x,this.y=u.y,this.z=u.z,this.w=1+i,this.normalize())},setAxes:function(t,e,i){var n=c.val;return n[0]=e.x,n[3]=e.y,n[6]=e.z,n[1]=i.x,n[4]=i.y,n[7]=i.z,n[2]=-t.x,n[5]=-t.y,n[8]=-t.z,this.fromMat3(c).normalize()},identity:function(){return this.x=0,this.y=0,this.z=0,this.w=1,this},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=Math.cos(e),this},multiply:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.x=e*h+s*r+i*a-n*o,this.y=i*h+s*o+n*r-e*a,this.z=n*h+s*a+e*o-i*r,this.w=s*h-e*r-i*o-n*a,this},slerp:function(t,e){var i=this.x,n=this.y,s=this.z,r=this.w,o=t.x,a=t.y,h=t.z,l=t.w,u=i*o+n*a+s*h+r*l;u<0&&(u=-u,o=-o,a=-a,h=-h,l=-l);var c=1-e,d=e;if(1-u>1e-6){var f=Math.acos(u),p=Math.sin(f);c=Math.sin((1-e)*f)/p,d=Math.sin(e*f)/p}return this.x=c*i+d*o,this.y=c*n+d*a,this.z=c*s+d*h,this.w=c*r+d*l,this},invert:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n,r=s?1/s:0;return this.x=-t*r,this.y=-e*r,this.z=-i*r,this.w=n*r,this},conjugate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+s*r,this.y=i*o+n*r,this.z=n*o-i*r,this.w=s*o-e*r,this},rotateY:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o-n*r,this.y=i*o+s*r,this.z=n*o+e*r,this.w=s*o-i*r,this},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+i*r,this.y=i*o-e*r,this.z=n*o+s*r,this.w=s*o-n*r,this},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(Math.abs(1-t*t-e*e-i*i)),this},fromMat3:function(t){var e,i=t.val,n=i[0]+i[4]+i[8];if(n>0)e=Math.sqrt(n+1),this.w=.5*e,e=.5/e,this.x=(i[7]-i[5])*e,this.y=(i[2]-i[6])*e,this.z=(i[3]-i[1])*e;else{var s=0;i[4]>i[0]&&(s=1),i[8]>i[3*s+s]&&(s=2);var r=o[s],h=o[r];e=Math.sqrt(i[3*s+s]-i[3*r+r]-i[3*h+h]+1),a[s]=.5*e,e=.5/e,a[r]=(i[3*r+s]+i[3*s+r])*e,a[h]=(i[3*h+s]+i[3*s+h])*e,this.x=a[0],this.y=a[1],this.z=a[2],this.w=(i[3*h+r]-i[3*r+h])*e}return this}});t.exports=d},function(t,e,i){var n=new(i(0))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new n(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=n,this},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*r-o*h,c=-l*s+o*a,d=h*s-r*a,f=e*u+i*c+n*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*i+n*h)*f,t[2]=(o*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*a)*f,t[5]=(-o*e+n*s)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*s)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return t[0]=r*l-o*h,t[1]=n*h-i*l,t[2]=i*o-n*r,t[3]=o*a-s*l,t[4]=e*l-n*a,t[5]=n*s-e*o,t[6]=s*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*s,this},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*(l*r-o*h)+i*(-l*s+o*a)+n*(h*s-r*a)},multiply:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=t.val,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=c[6],x=c[7],b=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*n+f*o+p*l,e[2]=d*s+f*a+p*u,e[3]=g*i+v*r+y*h,e[4]=g*n+v*o+y*l,e[5]=g*s+v*a+y*u,e[6]=m*i+x*r+b*h,e[7]=m*n+x*o+b*l,e[8]=m*s+x*a+b*u,this},translate:function(t){var e=this.val,i=t.x,n=t.y;return e[6]=i*e[0]+n*e[3]+e[6],e[7]=i*e[1]+n*e[4]+e[7],e[8]=i*e[2]+n*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),l=Math.cos(t);return e[0]=l*i+h*r,e[1]=l*n+h*o,e[2]=l*s+h*a,e[3]=l*r-h*i,e[4]=l*o-h*n,e[5]=l*a-h*s,this},scale:function(t){var e=this.val,i=t.x,n=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=n*e[3],e[4]=n*e[4],e[5]=n*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,o=i+i,a=n+n,h=e*r,l=e*o,u=e*a,c=i*o,d=i*a,f=n*a,p=s*r,g=s*o,v=s*a,y=this.val;return y[0]=1-(c+f),y[3]=l+v,y[6]=u-g,y[1]=l-v,y[4]=1-(h+f),y[7]=d+p,y[2]=u+g,y[5]=d-p,y[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],h=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],v=e[13],y=e[14],m=e[15],x=n*h-s*a,b=n*l-r*a,w=n*u-o*a,T=s*l-r*h,S=s*u-o*h,A=r*u-o*l,C=c*v-d*g,M=c*y-f*g,E=c*m-p*g,_=d*y-f*v,P=d*m-p*v,L=f*m-p*y,k=x*L-b*P+w*_+T*E-S*M+A*C;return k?(k=1/k,i[0]=(h*L-l*P+u*_)*k,i[1]=(l*E-a*L-u*M)*k,i[2]=(a*P-h*E+u*C)*k,i[3]=(r*P-s*L-o*_)*k,i[4]=(n*L-r*E+o*M)*k,i[5]=(s*E-n*P-o*C)*k,i[6]=(v*A-y*S+m*T)*k,i[7]=(y*w-g*A-m*b)*k,i[8]=(g*S-v*w+m*x)*k,this):null}});t.exports=n},function(t,e,i){var n=i(117),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),n.call(this,t),this.viewportWidth=e,this.viewportHeight=i,this._zoom=1,this.near=0,this.update()},setToOrtho:function(t,e,i){void 0===e&&(e=this.viewportWidth),void 0===i&&(i=this.viewportHeight);var n=this.zoom;return this.up.set(0,t?-1:1,0),this.direction.set(0,0,t?1:-1),this.position.set(n*e/2,n*i/2,0),this.viewportWidth=e,this.viewportHeight=i,this.update()},update:function(){var t=this.viewportWidth,e=this.viewportHeight,i=Math.abs(this.near),n=Math.abs(this.far),s=this.zoom;return 0===t||0===e?this:(this.projection.ortho(s*-t/2,s*t/2,s*-e/2,s*e/2,i,n),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this)},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.update()}}});t.exports=o},function(t,e,i){var n=i(117),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e=80),void 0===i&&(i=0),void 0===s&&(s=0),n.call(this,t),this.viewportWidth=i,this.viewportHeight=s,this.fieldOfView=e*Math.PI/180,this.update()},setFOV:function(t){return this.fieldOfView=t*Math.PI/180,this},update:function(){var t=this.viewportWidth/this.viewportHeight;return this.projection.perspective(this.fieldOfView,t,Math.abs(this.near),Math.abs(this.far)),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this}});t.exports=o},function(t,e,i){var n=i(214),s=i(21),r=i(4);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",n),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),l=r(t,"resizeCanvas",!0),u=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=s.create2D(this,f,p),l=!1,u=!1),l&&(i.width=f,i.height=p);var g=i.getContext("2d");u&&g.clearRect(0,0,f,p),c&&c(i,g);for(var v=0;vi;)n-=i;ni.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(n(a,h.x,l.x,u.x,c.x),n(a,h.y,l.y,u.y,c.y))},toJSON:function(){for(var t=[],e=0;e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}}).call(e,i(486)(t))},function(t,e,i){var n=i(116);t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var s=Math.floor(6*t),r=6*t-s,o=Math.floor(i*(1-e)*255),a=Math.floor(i*(1-r*e)*255),h=Math.floor(i*(1-(1-r)*e)*255),l={r:i=Math.floor(i*=255),g:i,b:i,color:0},u=s%6;return 0===u?(l.g=h,l.b=o):1===u?(l.r=a,l.b=o):2===u?(l.r=o,l.b=h):3===u?(l.r=o,l.g=a):4===u?(l.r=h,l.g=o):5===u&&(l.g=o,l.b=a),l.color=n(l.r,l.g,l.b),l}},function(t,e,i){var n=i(227);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return e<0?n(t[0],t[1],s):e>1?n(t[i],t[i-1],i-s):n(t[r],t[r+1>i?i:r+1],s-r)}},function(t,e){t.exports=function(t,e,i){return(e-t)*i+t}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e,i){var n=i(67);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?n.cordova&&!n.cocoonJS?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},function(t,e){t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},function(t,e){t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0;var t=this;this.step=function e(i){t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.requestAnimationFrame(e)},this.stepTimeout=function e(){var i=Date.now(),n=Math.max(16+t.lastTime-i,0);t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.setTimeout(e,n)}},start:function(t,e){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e){t.exports={Global:["anims","cache","registry","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["CameraManager3D","Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},function(t,e,i){var n,s,r,o=i(21),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create(t,6,1).getContext("2d");if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,l,u,f,g,v=e&&e.length,y=v?e[0]*i:t.length,m=s(t,0,y,i,!0),x=[];if(!m)return x;if(v&&(m=function(t,e,i,n){var o,a,h,l,u,f=[];for(o=0,a=e.length;o80*i){n=h=t[0],a=l=t[1];for(var b=i;bh&&(h=u),f>l&&(l=f);g=Math.max(h-n,l-a)}return o(m,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===A(t,e,i,n)>0)for(r=e;r=e;r-=n)o=w(r,t[r],t[r+1],o);return o&&y(o,o.next)&&(T(o),o=o.next),o}function r(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!y(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(T(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,s,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(o>1)}(s)}(t,n,s,c);for(var p,g,v=t;t.prev!==t.next;)if(p=t.prev,g=t.next,c?h(t,n,s,c):a(t))e.push(p.i/i),e.push(t.i/i),e.push(g.i/i),T(t),t=g.next,v=g.next;else if((t=g)===v){d?1===d?o(t=l(t,e,i),e,i,n,s,c,2):2===d&&u(t,e,i,n,s,c):o(r(t),e,i,n,s,c,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(v(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&v(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function h(t,e,i,n){var s=t.prev,r=t,o=t.next;if(v(s,r,o)>=0)return!1;for(var a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(a,h,e,i,n),d=f(l,u,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function l(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!y(s,r)&&m(s,n,n.next,r)&&x(s,r)&&x(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),T(n),T(n.next),n=t=r),n=n.next}while(n!==t);return n}function u(t,e,i,n,s,a){var h,l,u=t;do{for(var c=u.next.next;c!==u.prev;){if(u.i!==c.i&&(l=c,(h=u).next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&m(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(h,l)&&x(h,l)&&x(l,h)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(h,l))){var d=b(u,c);return u=r(u,u.next),d=r(d,d.next),o(u,e,i,n,s,a),void o(d,e,i,n,s,a)}c=c.next}u=u.next}while(u!==t)}function c(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&a>o){if(o=a,a===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=u&&s!==n.x&&g(ri.x)&&x(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=b(e,t);r(i,i.next)}}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0}function v(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function m(t,e,i,n){return!!(y(t,e)&&y(i,n)||y(t,n)&&y(i,e))||v(t,e,i)>0!=v(t,e,n)>0&&v(i,n,t)>0!=v(i,n,e)>0}function x(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function b(t,e){var i=new S(t.i,t.x,t.y),n=new S(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function w(t,e,i,n){var s=new S(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function T(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},function(t,e){var i={modelMatrixDirty:!1,viewMatrixDirty:!1,projectionMatrixDirty:!1,modelMatrix:null,viewMatrix:null,projectionMatrix:null,mvpInit:function(){return this.modelMatrixDirty=!0,this.viewMatrixDirty=!0,this.projectionMatrixDirty=!0,this.modelMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},mvpUpdate:function(){var t=this.program;return this.modelMatrixDirty&&(this.renderer.setMatrix4(t,"uModelMatrix",!1,this.modelMatrix),this.modelMatrixDirty=!1),this.viewMatrixDirty&&(this.renderer.setMatrix4(t,"uViewMatrix",!1,this.viewMatrix),this.viewMatrixDirty=!1),this.projectionMatrixDirty&&(this.renderer.setMatrix4(t,"uProjectionMatrix",!1,this.projectionMatrix),this.projectionMatrixDirty=!1),this},modelIdentity:function(){var t=this.modelMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.modelMatrixDirty=!0,this},modelScale:function(t,e,i){var n=this.modelMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.modelMatrixDirty=!0,this},modelTranslate:function(t,e,i){var n=this.modelMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.modelMatrixDirty=!0,this},modelRotateX:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],l=e[9],u=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+l*i,e[6]=o*n+u*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=l*n-r*i,e[10]=u*n-o*i,e[11]=c*n-a*i,this.modelMatrixDirty=!0,this},modelRotateY:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],l=e[9],u=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-l*i,e[2]=o*n-u*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+l*n,e[10]=o*i+u*n,e[11]=a*i+c*n,this.modelMatrixDirty=!0,this},modelRotateZ:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5],u=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+l*i,e[2]=o*n+u*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=l*n-r*i,e[6]=u*n-o*i,e[7]=c*n-a*i,this.modelMatrixDirty=!0,this},viewIdentity:function(){var t=this.viewMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.viewMatrixDirty=!0,this},viewScale:function(t,e,i){var n=this.viewMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.viewMatrixDirty=!0,this},viewTranslate:function(t,e,i){var n=this.viewMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.viewMatrixDirty=!0,this},viewRotateX:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],l=e[9],u=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+l*i,e[6]=o*n+u*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=l*n-r*i,e[10]=u*n-o*i,e[11]=c*n-a*i,this.viewMatrixDirty=!0,this},viewRotateY:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],l=e[9],u=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-l*i,e[2]=o*n-u*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+l*n,e[10]=o*i+u*n,e[11]=a*i+c*n,this.viewMatrixDirty=!0,this},viewRotateZ:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5],u=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+l*i,e[2]=o*n+u*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=l*n-r*i,e[6]=u*n-o*i,e[7]=c*n-a*i,this.viewMatrixDirty=!0,this},viewLoad2D:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=0,e[4]=t[2],e[5]=t[3],e[6]=0,e[7]=0,e[8]=t[4],e[9]=t[5],e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this.viewMatrixDirty=!0,this},viewLoad:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this.viewMatrixDirty=!0,this},projIdentity:function(){var t=this.projectionMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.projectionMatrixDirty=!0,this},projOrtho:function(t,e,i,n,s,r){var o=this.projectionMatrix,a=1/(t-e),h=1/(i-n),l=1/(s-r);return o[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*h,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*l,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*h,o[14]=(r+s)*l,o[15]=1,this.projectionMatrixDirty=!0,this},projPersp:function(t,e,i,n){var s=this.projectionMatrix,r=1/Math.tan(t/2),o=1/(i-n);return s[0]=r/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*n*i*o,s[15]=0,this.projectionMatrixDirty=!0,this}};t.exports=i},function(t,e,i){var n=i(0),s=i(514),r=i(238),o=new n({Extends:r,initialize:function(t,e,i){r.call(this,t,e,i,s.replace("%LIGHT_COUNT%",10..toString()))},onBind:function(){r.prototype.onBind.call(this);var t=this.renderer,e=this.program;return this.mvpUpdate(),t.setInt1(e,"uNormSampler",1),t.setFloat2(e,"uResolution",this.width,this.height),this},onRender:function(t,e){var i=t.lights;if(i.culledLights.length=0,i.lights.length<=0||!i.active)return this;var n,s=this.renderer,r=this.program,o=t.lights.cull(e),a=Math.min(o.length,10),h=e.matrix,l={x:0,y:0},u=s.height;for(n=0;n<10;++n)s.setFloat1(r,"uLights["+n+"].radius",0);if(a<=0)return this;for(s.setFloat4(r,"uCamera",e.x,e.y,e.rotation,e.zoom),s.setFloat3(r,"uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),n=0;n0?(n.textures[e-1]&&n.textures[e-1]!==t&&this.pushBatch(),i[i.length-1].textures[e-1]=t):(null!==n.texture&&n.texture!==t&&this.pushBatch(),i[i.length-1].texture=t),this},pushBatch:function(){var t={first:this.vertexCount,texture:null,textures:[]};this.batches.push(t)},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.renderer,r=this.vertexCount,o=this.topology,a=this.vertexSize,h=this.batches,l=0,u=null;if(0===h.length||0===r)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,r*a));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(s.setTexture2D(u.texture,0),n.drawArrays(o,u.first,l)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},onBind:function(){return h.prototype.onBind.call(this),this.mvpUpdate(),0===this.batches.length&&this.pushBatch(),this},resize:function(t,e,i){return h.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},drawStaticTilemapLayer:function(t){if(t.vertexCount>0){var e=this.vertexBuffer,i=this.gl,n=this.renderer,s=t.tileset.image.get();n.currentPipeline&&n.currentPipeline.vertexCount>0&&n.flush(),this.vertexBuffer=t.vertexBuffer,n.setPipeline(this),n.setTexture2D(s.source.glTexture,0),i.drawArrays(this.topology,0,t.vertexCount),this.vertexBuffer=e}this.viewIdentity(),this.modelIdentity()},drawEmitterManager:function(t,e){this.renderer.setPipeline(this);var i=t.emitters.list,n=i.length,s=this.vertexViewF32,r=this.vertexViewU32,o=this.renderer,a=this.maxQuads,h=e.scrollX,l=e.scrollY,u=e.matrix.matrix,c=u[0],d=u[1],f=u[2],p=u[3],g=u[4],v=u[5],y=Math.sin,m=Math.cos,x=this.vertexComponentCount,b=this.vertexCapacity,w=t.defaultFrame.source.glTexture;this.setTexture2D(w,0);for(var T=0;T=b&&(this.flush(),this.setTexture2D(w,0));for(var L=0;L=b&&(this.flush(),this.setTexture2D(w,0))}}}this.setTexture2D(w,0)},drawBlitter:function(t,e){this.renderer.setPipeline(this);for(var i=a.getTintAppendFloatAlpha,n=this.vertexViewF32,s=this.vertexViewU32,r=(this.renderer,t.getRenderList()),o=r.length,h=e.matrix.matrix,l=h[0],u=h[1],c=h[2],d=h[3],f=h[4],p=h[5],g=e.scrollX*t.scrollFactorX,v=e.scrollY*t.scrollFactorY,y=Math.ceil(o/this.maxQuads),m=0,x=t.x-g,b=t.y-v,w=0;w=this.vertexCapacity&&this.flush()}m+=T,o-=T,this.vertexCount>=this.vertexCapacity&&this.flush()}},batchSprite:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n=a.getTintAppendFloatAlpha,s=this.vertexViewF32,r=this.vertexViewU32,o=(this.renderer,e.matrix.matrix),h=t.frame,l=h.texture.source[h.sourceIndex].glTexture,u=!!l.isRenderTexture,c=t.flipX,d=t.flipY^u,f=h.uvs,p=h.width*(c?-1:1),g=h.height*(d?-1:1),v=-t.displayOriginX+h.x+h.width*(c?1:0),y=-t.displayOriginY+h.y+h.height*(d?1:0),m=v+p,x=y+g,b=t.x-e.scrollX*t.scrollFactorX,w=t.y-e.scrollY*t.scrollFactorY,T=t.scaleX,S=t.scaleY,A=-t.rotation,C=t._alphaTL,M=t._alphaTR,E=t._alphaBL,_=t._alphaBR,P=t._tintTL,L=t._tintTR,k=t._tintBL,F=t._tintBR,O=Math.sin(A),R=Math.cos(A),B=R*T,D=-O*T,I=O*S,Y=R*S,z=b,X=w,N=o[0],V=o[1],W=o[2],G=o[3],U=B*N+D*W,j=B*V+D*G,H=I*N+Y*W,q=I*V+Y*G,K=z*N+X*W+o[4],J=z*V+X*G+o[5],Z=v*U+y*H+K,Q=v*j+y*q+J,$=v*U+x*H+K,tt=v*j+x*q+J,et=m*U+x*H+K,it=m*j+x*q+J,nt=m*U+y*H+K,st=m*j+y*q+J,rt=n(P,C),ot=n(L,M),at=n(k,E),ht=n(F,_);this.setTexture2D(l,0),s[(i=this.vertexCount*this.vertexComponentCount)+0]=Z,s[i+1]=Q,s[i+2]=f.x0,s[i+3]=f.y0,r[i+4]=rt,s[i+5]=$,s[i+6]=tt,s[i+7]=f.x1,s[i+8]=f.y1,r[i+9]=at,s[i+10]=et,s[i+11]=it,s[i+12]=f.x2,s[i+13]=f.y2,r[i+14]=ht,s[i+15]=Z,s[i+16]=Q,s[i+17]=f.x0,s[i+18]=f.y0,r[i+19]=rt,s[i+20]=et,s[i+21]=it,s[i+22]=f.x2,s[i+23]=f.y2,r[i+24]=ht,s[i+25]=nt,s[i+26]=st,s[i+27]=f.x3,s[i+28]=f.y3,r[i+29]=ot,this.vertexCount+=6},batchMesh:function(t,e){var i=t.vertices,n=i.length,s=n/2|0;this.renderer.setPipeline(this),this.vertexCount+s>this.vertexCapacity&&this.flush();var r=a.getTintAppendFloatAlpha,o=t.uv,h=t.colors,l=t.alphas,u=this.vertexViewF32,c=this.vertexViewU32,d=(this.renderer,e.matrix.matrix),f=t.frame,p=t.texture.source[f.sourceIndex].glTexture,g=t.x-e.scrollX*t.scrollFactorX,v=t.y-e.scrollY*t.scrollFactorY,y=t.scaleX,m=t.scaleY,x=-t.rotation,b=Math.sin(x),w=Math.cos(x),T=w*y,S=-b*y,A=b*m,C=w*m,M=g,E=v,_=d[0],P=d[1],L=d[2],k=d[3],F=T*_+S*L,O=T*P+S*k,R=A*_+C*L,B=A*P+C*k,D=M*_+E*L+d[4],I=M*P+E*k+d[5],Y=0;this.setTexture2D(p,0),Y=this.vertexCount*this.vertexComponentCount;for(var z=0,X=0;zthis.vertexCapacity&&this.flush();var i,n,s,r,o,h,l,u,c=t.text,d=c.length,f=a.getTintAppendFloatAlpha,p=this.vertexViewF32,g=this.vertexViewU32,v=(this.renderer,e.matrix.matrix),y=e.width+50,m=e.height+50,x=t.frame,b=t.texture.source[x.sourceIndex],w=e.scrollX*t.scrollFactorX,T=e.scrollY*t.scrollFactorY,S=t.fontData,A=S.lineHeight,C=t.fontSize/S.size,M=S.chars,E=t.alpha,_=f(t._tintTL,E),P=f(t._tintTR,E),L=f(t._tintBL,E),k=f(t._tintBR,E),F=t.x,O=t.y,R=x.cutX,B=x.cutY,D=b.width,I=b.height,Y=b.glTexture,z=0,X=0,N=0,V=0,W=null,G=0,U=0,j=0,H=0,q=0,K=0,J=0,Z=0,Q=0,$=0,tt=0,et=0,it=null,nt=0,st=F-w+x.x,rt=O-T+x.y,ot=-t.rotation,at=t.scaleX,ht=t.scaleY,lt=Math.sin(ot),ut=Math.cos(ot),ct=ut*at,dt=-lt*at,ft=lt*ht,pt=ut*ht,gt=st,vt=rt,yt=v[0],mt=v[1],xt=v[2],bt=v[3],wt=ct*yt+dt*xt,Tt=ct*mt+dt*bt,St=ft*yt+pt*xt,At=ft*mt+pt*bt,Ct=gt*yt+vt*xt+v[4],Mt=gt*mt+vt*bt+v[5],Et=0;this.setTexture2D(Y,0);for(var _t=0;_ty||n<-50||n>m)&&(s<-50||s>y||r<-50||r>m)&&(o<-50||o>y||h<-50||h>m)&&(l<-50||l>y||u<-50||u>m)||(this.vertexCount+6>this.vertexCapacity&&this.flush(),p[(Et=this.vertexCount*this.vertexComponentCount)+0]=i,p[Et+1]=n,p[Et+2]=Q,p[Et+3]=tt,g[Et+4]=_,p[Et+5]=s,p[Et+6]=r,p[Et+7]=Q,p[Et+8]=et,g[Et+9]=L,p[Et+10]=o,p[Et+11]=h,p[Et+12]=$,p[Et+13]=et,g[Et+14]=k,p[Et+15]=i,p[Et+16]=n,p[Et+17]=Q,p[Et+18]=tt,g[Et+19]=_,p[Et+20]=o,p[Et+21]=h,p[Et+22]=$,p[Et+23]=et,g[Et+24]=k,p[Et+25]=l,p[Et+26]=u,p[Et+27]=$,p[Et+28]=tt,g[Et+29]=P,this.vertexCount+=6))}}else z=0,N=0,X+=A,it=null},batchDynamicBitmapText:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n,s,r,o,h,l,u,c,d,f,p,g,v,y=t.displayCallback,m=t.text,x=m.length,b=a.getTintAppendFloatAlpha,w=this.vertexViewF32,T=this.vertexViewU32,S=this.renderer,A=e.matrix.matrix,C=t.frame,M=t.texture.source[C.sourceIndex],E=e.scrollX*t.scrollFactorX,_=e.scrollY*t.scrollFactorY,P=t.scrollX,L=t.scrollY,k=t.fontData,F=k.lineHeight,O=t.fontSize/k.size,R=k.chars,B=t.alpha,D=b(t._tintTL,B),I=b(t._tintTR,B),Y=b(t._tintBL,B),z=b(t._tintBR,B),X=t.x,N=t.y,V=C.cutX,W=C.cutY,G=M.width,U=M.height,j=M.glTexture,H=0,q=0,K=0,J=0,Z=null,Q=0,$=0,tt=0,et=0,it=0,nt=0,st=0,rt=0,ot=0,at=0,ht=0,lt=0,ut=null,ct=0,dt=X+C.x,ft=N+C.y,pt=-t.rotation,gt=t.scaleX,vt=t.scaleY,yt=Math.sin(pt),mt=Math.cos(pt),xt=mt*gt,bt=-yt*gt,wt=yt*vt,Tt=mt*vt,St=dt,At=ft,Ct=A[0],Mt=A[1],Et=A[2],_t=A[3],Pt=xt*Ct+bt*Et,Lt=xt*Mt+bt*_t,kt=wt*Ct+Tt*Et,Ft=wt*Mt+Tt*_t,Ot=St*Ct+At*Et+A[4],Rt=St*Mt+At*_t+A[5],Bt=t.cropWidth>0||t.cropHeight>0,Dt=0;this.setTexture2D(j,0),Bt&&S.pushScissor(t.x,t.y,t.cropWidth*t.scaleX,t.cropHeight*t.scaleY);for(var It=0;Itthis.vertexCapacity&&this.flush(),w[(Dt=this.vertexCount*this.vertexComponentCount)+0]=i,w[Dt+1]=n,w[Dt+2]=ot,w[Dt+3]=ht,T[Dt+4]=D,w[Dt+5]=s,w[Dt+6]=r,w[Dt+7]=ot,w[Dt+8]=lt,T[Dt+9]=Y,w[Dt+10]=o,w[Dt+11]=h,w[Dt+12]=at,w[Dt+13]=lt,T[Dt+14]=z,w[Dt+15]=i,w[Dt+16]=n,w[Dt+17]=ot,w[Dt+18]=ht,T[Dt+19]=D,w[Dt+20]=o,w[Dt+21]=h,w[Dt+22]=at,w[Dt+23]=lt,T[Dt+24]=z,w[Dt+25]=l,w[Dt+26]=u,w[Dt+27]=at,w[Dt+28]=ht,T[Dt+29]=I,this.vertexCount+=6}}}else H=0,K=0,q+=F,ut=null;Bt&&S.popScissor()},batchText:function(t,e){var i=a.getTintAppendFloatAlpha;this.batchTexture(t,t.canvasTexture,t.canvasTexture.width,t.canvasTexture.height,t.x,t.y,t.canvasTexture.width,t.canvasTexture.height,t.scaleX,t.scaleY,t.rotation,t.flipX,t.flipY,t.scrollFactorX,t.scrollFactorY,t.displayOriginX,t.displayOriginY,0,0,t.canvasTexture.width,t.canvasTexture.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),0,0,e)},batchDynamicTilemapLayer:function(t,e){for(var i=t.culledTiles,n=i.length,s=t.tileset.image.get().source.glTexture,r=t.tileset,o=t.scrollFactorX,h=t.scrollFactorY,l=t.alpha,u=t.x,c=t.y,d=t.scaleX,f=t.scaleY,p=a.getTintAppendFloatAlpha,g=0;gthis.vertexCapacity&&this.flush(),d^=e.isRenderTexture?1:0,u=-u;var _,P=this.vertexViewF32,L=this.vertexViewU32,k=(this.renderer,E.matrix.matrix),F=o*(c?1:0)-g,O=a*(d?1:0)-v,R=F+o*(c?-1:1),B=O+a*(d?-1:1),D=s-E.scrollX*f,I=r-E.scrollY*p,Y=Math.sin(u),z=Math.cos(u),X=z*h,N=-Y*h,V=Y*l,W=z*l,G=D,U=I,j=k[0],H=k[1],q=k[2],K=k[3],J=X*j+N*q,Z=X*H+N*K,Q=V*j+W*q,$=V*H+W*K,tt=G*j+U*q+k[4],et=G*H+U*K+k[5],it=F*J+O*Q+tt,nt=F*Z+O*$+et,st=F*J+B*Q+tt,rt=F*Z+B*$+et,ot=R*J+B*Q+tt,at=R*Z+B*$+et,ht=R*J+O*Q+tt,lt=R*Z+O*$+et,ut=y/i+C,ct=m/n+M,dt=(y+x)/i+C,ft=(m+b)/n+M;this.setTexture2D(e,0),P[(_=this.vertexCount*this.vertexComponentCount)+0]=it,P[_+1]=nt,P[_+2]=ut,P[_+3]=ct,L[_+4]=w,P[_+5]=st,P[_+6]=rt,P[_+7]=ut,P[_+8]=ft,L[_+9]=T,P[_+10]=ot,P[_+11]=at,P[_+12]=dt,P[_+13]=ft,L[_+14]=S,P[_+15]=it,P[_+16]=nt,P[_+17]=ut,P[_+18]=ct,L[_+19]=w,P[_+20]=ot,P[_+21]=at,P[_+22]=dt,P[_+23]=ft,L[_+24]=S,P[_+25]=ht,P[_+26]=lt,P[_+27]=dt,P[_+28]=ct,L[_+29]=A,this.vertexCount+=6},drawTexture:function(t,e,i,n,s,r,o,a){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var h,l=this.vertexViewF32,u=this.vertexViewU32,c=(this.renderer,e),d=i,f=c+r,p=d+o,g=a[0],v=a[1],y=a[2],m=a[3],x=a[4],b=a[5],w=c*g+d*y+x,T=c*v+d*m+b,S=c*g+p*y+x,A=c*v+p*m+b,C=f*g+p*y+x,M=f*v+p*m+b,E=f*g+d*y+x,_=f*v+d*m+b,P=t.width,L=t.height,k=n/P,F=s/L,O=(n+r)/P,R=(s+o)/L,B=4294967295;this.setTexture2D(t,0),l[(h=this.vertexCount*this.vertexComponentCount)+0]=w,l[h+1]=T,l[h+2]=k,l[h+3]=F,u[h+4]=B,l[h+5]=S,l[h+6]=A,l[h+7]=k,l[h+8]=R,u[h+9]=B,l[h+10]=C,l[h+11]=M,l[h+12]=O,l[h+13]=R,u[h+14]=B,l[h+15]=w,l[h+16]=T,l[h+17]=k,l[h+18]=F,u[h+19]=B,l[h+20]=C,l[h+21]=M,l[h+22]=O,l[h+23]=R,u[h+24]=B,l[h+25]=E,l[h+26]=_,l[h+27]=O,l[h+28]=F,u[h+29]=B,this.vertexCount+=6,this.flush()},batchGraphics:function(){}});t.exports=l},function(t,e,i){var n=i(0),s=i(14),r=i(240),o=i(244),a=i(247),h=i(248),l=i(8),u=i(249),c=i(250),d=new n({initialize:function(t,e){this.game=t,this.canvas,this.config=e,this.enabled=!0,this.events=new s,this.queue=[],this.keyboard=new o(this),this.mouse=new a(this),this.touch=new u(this),this.gamepad=new r(this),this.activePointer=new h(this,0),this.scale={x:1,y:1},this.globalTopOnly=!0,this.ignoreEvents=!1,this.bounds=new l,this._tempPoint={x:0,y:0},this._tempHitTest=[],t.events.once("boot",this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.updateBounds(),this.keyboard.boot(),this.mouse.boot(),this.touch.boot(),this.gamepad.boot(),this.game.events.once("destroy",this.destroy,this)},updateBounds:function(){var t=this.canvas.getBoundingClientRect(),e=this.bounds;e.left=t.left+window.pageXOffset,e.top=t.top+window.pageYOffset,e.width=t.width,e.height=t.height},update:function(t){this.keyboard.update(),this.gamepad.update(),this.ignoreEvents=!1;var e=this.queue.length,i=this.activePointer;if(i.reset(),this.enabled&&0!==e){this.updateBounds(),this.scale.x=this.game.config.width/this.bounds.width,this.scale.y=this.game.config.height/this.bounds.height;for(var n=this.queue.splice(0,e),s=0;s=n.x&&e>=n.y&&t<=n.x+o&&e<=n.y+a))return s;n.getWorldPoint(t,e,r);for(var h=n.cull(i),l={x:0,y:0},u=0;u0?1:-1)}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=0,this.pressed=!1},update:function(t){this.value=t.value,this.value>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",this.pad,this,this.value,t)):this.pressed&&(this.pressed=!1,this.events.emit("up",this.pad,this,this.value,t))}});t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(245),o=i(128),a=i(246),h=i(526),l=i(527),u=i(528),c=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.enabled=!1,this.target,this.keys=[],this.combos=[],this.captures=[],this.queue=[],this.handler},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.enabled&&this.startListeners()},startListeners:function(){var t=this.queue,e=this.captures,i=function(i){i.defaultPrevented||(t.push(i),e[i.keyCode]&&i.preventDefault())};this.handler=i,this.target.addEventListener("keydown",i,!1),this.target.addEventListener("keyup",i,!1)},stopListeners:function(){this.target.removeEventListener("keydown",this.handler),this.target.removeEventListener("keyup",this.handler)},createCursorKeys:function(){return this.addKeys({up:o.UP,down:o.DOWN,left:o.LEFT,right:o.RIGHT,space:o.SPACE,shift:o.SHIFT})},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},addKey:function(t){var e=this.keys;return e[t]||(e[t]=new r(t),this.captures[t]=!0),e[t]},removeKey:function(t){this.keys[t]&&(this.keys[t]=void 0,this.captures[t]=!1)},addKeyCapture:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e=0;i--){var n=this.scenes[i].sys;n.settings.status===s.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this._processing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,n=this.getScene(t),s=this.getAt(i);this.scenes[e]=s,this.scenes[i]=n}}return this},moveUp:function(t){if(this._processing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e=0;t--){this.scenes[t].sys.destroy()}this.scenes=[],this._pending=[],this._start=[],this._queue=[],this.game=null}});t.exports=l},function(t,e,i){var n=i(0),s=i(129),r=new n({initialize:function(t){this.sys=new s(this,t)},update:function(){}});t.exports=r},function(t,e){t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},function(t,e,i){var n=i(83),s=i(4),r=i(531),o={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:n.PENDING,key:s(t,"key",""),active:s(t,"active",!1),visible:s(t,"visible",!0),isBooted:!1,data:{},files:s(t,"files",!1),cameras:s(t,"cameras",null),map:s(t,"map",r),physics:s(t,"physics",{}),loader:s(t,"loader",{}),plugins:s(t,"plugins",!1)}}};t.exports=o},function(t,e,i){var n=i(256),s=i(258),r=i(260),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e&&e.noAudio||!i.webAudio&&!i.audioData?new s(t):!i.webAudio||e&&e.disableWebAudio?new n(t):new r(t)}};t.exports=o},function(t,e,i){var n=i(0),s=i(84),r=i(257),o=new n({Extends:s,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,s.call(this,t)},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=!1,i=function(){e=!0},n=function(){if(e)e=!1;else{document.body.removeEventListener("touchmove",i),document.body.removeEventListener("touchend",n);var s=[];t.game.cache.audio.entries.each(function(t,e){for(var i=0;i0)&&(!!s.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit("pause",this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!s.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit("stop",this),!0))},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s=n)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit("ended",this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},setMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},setVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},setRate:function(){s.prototype.setRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)}});Object.defineProperty(r.prototype,"mute",{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.setMute(),this.emit("mute",this,t))}}),Object.defineProperty(r.prototype,"volume",{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.setVolume(),this.emit("volume",this,t))}}),Object.defineProperty(r.prototype,"rate",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"rate").get.call(this)},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||Object.getOwnPropertyDescriptor(s.prototype,"rate").set.call(this,t)}}),Object.defineProperty(r.prototype,"detune",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"detune").get.call(this)},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||Object.getOwnPropertyDescriptor(s.prototype,"detune").set.call(this,t)}}),Object.defineProperty(r.prototype,"seek",{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit("seek",this,t))}}),Object.defineProperty(r.prototype,"loop",{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit("loop",this,t))}}),t.exports=r},function(t,e,i){var n=i(84),s=i(0),r=i(14),o=i(259),a=i(3),h=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return n.prototype.remove.call(this,t)},removeByKey:function(t){return n.prototype.removeByKey.call(this,t)},pauseAll:a,resumeAll:a,stopAll:a,update:a,destroy:function(){n.prototype.destroy.call(this)},forEachActiveSound:function(t,e){n.prototype.forEachActiveSound.call(this,t,e)}});t.exports=h},function(t,e,i){var n=i(85),s=i(0),r=i(14),o=i(23),a=new s({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!1},updateMarker:function(t){return!1},removeMarker:function(t){return null},play:function(t,e){return!1},pause:function(){return!1},resume:function(){return!1},stop:function(){return!1},destroy:function(){this.manager.remove(this),n.prototype.destroy.call(this)}});t.exports=a},function(t,e,i){var n=i(0),s=i(84),r=i(261),o=new n({Extends:s,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&"ontouchstart"in window,s.call(this,t)},createAudioContext:function(t){var e=t.config.audio;return e&&e.context?(e.context.resume(),e.context):new AudioContext},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=function(){t.context.resume().then(function(){document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),t.unlocked=!0})};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("touchend",e,!1)},onBlur:function(){this.context.suspend()},onFocus:function(){this.context.resume()},destroy:function(){this.destination=null,this.masterVolumeNode.disconnect(),this.masterVolumeNode=null,this.masterMuteNode.disconnect(),this.masterMuteNode=null,this.game.config.audio&&this.game.config.audio.context?this.context.suspend():this.context.close(),this.context=null,s.prototype.destroy.call(this)}});Object.defineProperty(o.prototype,"mute",{get:function(){return 0===this.masterMuteNode.gain.value},set:function(t){this.masterMuteNode.gain.setValueAtTime(t?0:1,0),this.emit("mute",this,t)}}),Object.defineProperty(o.prototype,"volume",{get:function(){return this.masterVolumeNode.gain.value},set:function(t){this.masterVolumeNode.gain.setValueAtTime(t,0),this.emit("volume",this,t)}}),t.exports=o},function(t,e,i){var n=i(0),s=i(85),r=new n({Extends:s,initialize:function(t,e,i){void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),this.audioBuffer?(this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)):console.error("No audio loaded in cache with key: '"+e+"'!")},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit("play",this),!0)},pause:function(){return!(this.manager.context.currentTime=0&&t<=o.width&&e>=0&&e<=o.height){t+=s.cutX,e+=s.cutY;var a=this._tempContext;a.clearRect(0,0,1,1),a.drawImage(o,t,e,1,1,0,0,1,1);var h=a.getImageData(0,0,1,1);return new r(h.data[0],h.data[1],h.data[2],h.data[3])}}return null},setTexture:function(t,e,i){return this.list[e]&&(t.texture=this.list[e],t.frame=t.texture.get(i)),t},each:function(t,e){for(var i=[null],n=1;nl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(ay&&(s=y),r>m&&(r=m);var S=y+g-s,A=m+v-r;o0&&e.cameraFilter&r._id)){var h=r.scrollX*e.scrollFactorX,l=r.scrollY*e.scrollFactorY,u=e.x,c=e.y,d=e.scaleX,f=e.scaleY,p=e.rotation,g=e.commandBuffer,v=o||t.currentContext,y=1,m=1,x=0,b=0,w=1,T=0,S=0,A=0;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,v.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,v.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),v.save(),v.translate(u-h,c-l),v.rotate(p),v.scale(d,f),v.fillStyle="#fff",v.globalAlpha=e.alpha;for(var C=0,M=g.length;C>>16,S=(65280&x)>>>8,A=255&x,v.strokeStyle="rgba("+T+","+S+","+A+","+y+")",v.lineWidth=w,C+=3;break;case n.FILL_STYLE:b=g[C+1],m=g[C+2],T=(16711680&b)>>>16,S=(65280&b)>>>8,A=255&b,v.fillStyle="rgba("+T+","+S+","+A+","+m+")",C+=2;break;case n.BEGIN_PATH:v.beginPath();break;case n.CLOSE_PATH:v.closePath();break;case n.FILL_PATH:a||v.fill();break;case n.STROKE_PATH:a||v.stroke();break;case n.FILL_RECT:a?v.rect(g[C+1],g[C+2],g[C+3],g[C+4]):v.fillRect(g[C+1],g[C+2],g[C+3],g[C+4]),C+=4;break;case n.FILL_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.fill(),C+=6;break;case n.STROKE_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.stroke(),C+=6;break;case n.LINE_TO:v.lineTo(g[C+1],g[C+2]),C+=2;break;case n.MOVE_TO:v.moveTo(g[C+1],g[C+2]),C+=2;break;case n.LINE_FX_TO:v.lineTo(g[C+1],g[C+2]),C+=5;break;case n.MOVE_FX_TO:v.moveTo(g[C+1],g[C+2]),C+=5;break;case n.SAVE:v.save();break;case n.RESTORE:v.restore();break;case n.TRANSLATE:v.translate(g[C+1],g[C+2]),C+=2;break;case n.SCALE:v.scale(g[C+1],g[C+2]),C+=2;break;case n.ROTATE:v.rotate(g[C+1]),C+=1}v.restore()}}},function(t,e,i){var n=i(4),s=i(80),r=function(t,e,i){for(var n=[],s=0;s0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],r):h=new s(t,e,i,a[0],a[1],a[2],r),this.lights.push(h),h},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&(this.lightPool.push(t),this.lights.splice(e,1)),this},shutdown:function(){for(;this.lights.length>0;)this.lightPool.push(this.lights.pop());this.ambientColor={r:.1,g:.1,b:.1},this.culledLights.length=0,this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=a},function(t,e,i){t.exports={Circle:i(663),Ellipse:i(269),Intersects:i(294),Line:i(683),Point:i(701),Polygon:i(715),Rectangle:i(306),Triangle:i(744)}},function(t,e,i){t.exports={CircleToCircle:i(673),CircleToRectangle:i(674),GetRectangleIntersection:i(675),LineToCircle:i(296),LineToLine:i(89),LineToRectangle:i(676),PointToLine:i(297),PointToLineSegment:i(677),RectangleToRectangle:i(295),RectangleToTriangle:i(678),RectangleToValues:i(679),TriangleToCircle:i(680),TriangleToLine:i(681),TriangleToTriangle:i(682)}},function(t,e){t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},function(t,e,i){var n=i(32),s=new(i(5));t.exports=function(t,e,i){if(void 0===i&&(i=s),n(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(n(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,l=r*r+o*o,u=r,c=o;if(l>0){var d=(a*r+h*o)/l;u*=d,c*=d}return i.x=t.x1+u,i.y=t.y1+c,u*u+c*c<=l&&u*r+c*o>=0&&n(e,i.x,i.y)}},function(t,e){t.exports=function(t,e){return(t.x-e.x1)*(e.y2-e.y1)==(e.x2-e.x1)*(t.y-e.y1)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},function(t,e,i){var n=i(0),s=i(301),r=i(108),o=i(110),a=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return o(this,t)},setTo:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this},getPointA:function(){return{x:this.x1,y:this.y1}},getPointB:function(){return{x:this.x2,y:this.y2}},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=a},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},function(t,e,i){var n=i(16),s=i(50),r=i(54);t.exports=function(t){var e=r(t)-n.TAU;return s(e,-Math.PI,Math.PI)}},function(t,e){t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},function(t,e){t.exports=function(t){return t.x*t.x+t.y*t.y}},function(t,e,i){var n=i(0),s=i(146),r=new n({initialize:function(t){this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return s(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],!Array.isArray(t))return this;for(var e,i=Number.MAX_VALUE,n=0;n=1)return i.x=r.x1,i.y=r.y1,i;var h=s(r),l=s(o),u=s(a),c=(h+l+u)*e,d=0;return ch+l?(d=(c-=h+l)/u,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/l,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},function(t,e,i){var n=i(65),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=n(o),u=n(a),c=n(h),d=l+u+c;e||(e=d/i);for(var f=0;fl+u?(g=(p-=l+u)/c,v.x=h.x1+(h.x2-h.x1)*g,v.y=h.y1+(h.y2-h.y1)*g):(g=(p-=l)/u,v.x=a.x1+(a.x2-a.x1)*g,v.y=a.y1+(a.y2-a.y1)*g),r.push(v)}return r}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},function(t,e,i){var n=i(5);function s(t,e,i,n){var s=t-i,r=e-n,o=s*s+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,l=t.y3,u=s(h,l,o,a),c=s(i,r,h,l),d=s(o,a,i,r),f=u+c+d;return e.x=(i*u+o*c+h*d)/f,e.y=(r*u+a*c+l*d)/f,e}},function(t,e){t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragX:0,dragY:0}}},function(t,e,i){var n=i(150);t.exports=function(t,e){var i=n(e,t.xhrSettings),s=new XMLHttpRequest;return s.open("GET",t.src,i.async,i.user,i.password),s.responseType=t.xhrSettings.responseType,s.timeout=i.timeout,i.header&&i.headerValue&&s.setRequestHeader(i.header,i.headerValue),i.overrideMimeType&&s.overrideMimeType(i.overrideMimeType),s.onload=t.onLoad.bind(t),s.onerror=t.onError.bind(t),s.onprogress=t.onProgress.bind(t),s.send(),s}},function(t,e,i){var n=i(0),s=i(22),r=i(18),o=i(7),a=i(2),h=i(316),l=new n({Extends:r,initialize:function(t,e,i,n,s){this.context=s;var o={type:"audio",extension:a(e,"type",""),responseType:"arraybuffer",key:t,url:a(e,"uri",e),path:i,xhrSettings:n};r.call(this,o)},onProcess:function(t){this.state=s.FILE_PROCESSING;var e=this;this.context.decodeAudioData(this.xhrLoader.response,function(i){e.data=i,e.onComplete(),t(e)},function(i){console.error("Error with decoding audio data for '"+this.key+"':",i.message),e.state=s.FILE_ERRORED,t(e)}),this.context=null}});l.create=function(t,e,i,n,s){var r=t.systems.game,o=r.config.audio,a=r.device.audio;if(o&&o.noAudio||!a.webAudio&&!a.audioData)return null;var u=l.findAudioURL(r,i);return u?!a.webAudio||o&&o.disableWebAudio?new h(e,u,t.path,n,r.sound.locked):new l(e,u,t.path,s,r.sound.context):null},o.register("audio",function(t,e,i,n){var s=l.create(this,t,e,i,n);return s&&this.addFile(s),this}),l.findAudioURL=function(t,e){e.constructor!==Array&&(e=[e]);for(var i=0;i=0?t:t+2*Math.PI}},function(t,e,i){var n=i(322);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e){t.exports=function(t,e){var i=t.x,n=t.y;return t.x=i*Math.cos(e)-n*Math.sin(e),t.y=i*Math.sin(e)+n*Math.cos(e),t}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e,i){var n=i(326),s=i(91),r=i(0),o=i(58),a=i(328),h=i(329),l=new r({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,n,s){return this.world.addCollider(t,e,i,n,s)},overlap:function(t,e,i,n,s){return this.world.addOverlap(t,e,i,n,s)},existing:function(t,e){var i=e?o.STATIC_BODY:o.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},image:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticSprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},sprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new a(this.world,this.world.scene,t,e))}});t.exports=l},function(t,e,i){var n=i(0),s=i(327),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){t.exports={Acceleration:i(835),Angular:i(836),Bounce:i(837),Debug:i(838),Drag:i(839),Enable:i(840),Friction:i(841),Gravity:i(842),Immovable:i(843),Mass:i(844),Size:i(845),Velocity:i(846)}},function(t,e,i){var n=i(91),s=i(0),r=i(58),o=i(2),a=i(69),h=new s({Extends:a,initialize:function(t,e,i,s){void 0!==s||Array.isArray(i)||"object"!=typeof i?void 0===s&&(s={}):(s=i,i=null),this.world=t,s.createCallback=this.createCallback,s.removeCallback=this.removeCallback,s.classType=o(s,"classType",n),this.physicsType=r.DYNAMIC_BODY,this.defaults={setCollideWorldBounds:o(s,"collideWorldBounds",!1),setAccelerationX:o(s,"accelerationX",0),setAccelerationY:o(s,"accelerationY",0),setBounceX:o(s,"bounceX",0),setBounceY:o(s,"bounceY",0),setDragX:o(s,"dragX",0),setDragY:o(s,"dragY",0),setGravityX:o(s,"gravityX",0),setGravityY:o(s,"gravityY",0),setFrictionX:o(s,"frictionX",0),setFrictionY:o(s,"frictionY",0),setVelocityX:o(s,"velocityX",0),setVelocityY:o(s,"velocityY",0),setAngularVelocity:o(s,"angularVelocity",0),setAngularAcceleration:o(s,"angularAcceleration",0),setAngularDrag:o(s,"angularDrag",0),setMass:o(s,"mass",1),setImmovable:o(s,"immovable",!1)},a.call(this,e,i,s)},createCallback:function(t){t.body||this.world.enableBody(t,r.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallback:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var n=this.getChildren(),s=0;s0){var l=this.tree,u=this.staticTree;for(o=(r=s.entries).length,t=0;t0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},separate:function(t,e,i,n,s){if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return!1;if(i&&!1===i.call(n,t.gameObject,e.gameObject))return!1;if(t.isCircle&&e.isCircle)return this.separateCircle(t,e,s);if(t.isCircle!==e.isCircle){var r=t.isCircle?e:t,o=t.isCircle?t:e,a={x:r.x,y:r.y,right:r.right,bottom:r.bottom},h=o.center;if((h.ya.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var l=!1,u=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)l.right&&(a=h(d.x,d.y,l.right,l.y)-d.radius):d.y>l.bottom&&(d.xl.right&&(a=h(d.x,d.y,l.right,l.bottom)-d.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-h(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap||e.onOverlap)&&this.emit("overlap",t.gameObject,e.gameObject,t,e),0!==a;var f=t.velocity.x,p=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=f*Math.cos(o)+p*Math.sin(o),b=f*Math.sin(o)-p*Math.cos(o),w=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),S=((g-m)*x+2*m*w)/(g+m),A=(2*g*x+(m-g)*w)/(g+m);return t.immovable||(t.velocity.x=(S*Math.cos(o)-b*Math.sin(o))*t.bounce.x,t.velocity.y=(b*Math.cos(o)+S*Math.sin(o))*t.bounce.y,f=t.velocity.x,p=t.velocity.y),e.immovable||(e.velocity.x=(A*Math.cos(o)-T*Math.sin(o))*e.bounce.x,e.velocity.y=(T*Math.cos(o)+A*Math.sin(o))*e.bounce.y,v=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>f?t.velocity.x*=-1:v<0&&!e.immovable&&f0&&!t.immovable&&y>p?t.velocity.y*=-1:y<0&&!e.immovable&&pMath.PI/2&&(f<0&&!t.immovable&&v0&&!e.immovable&&f>v?e.velocity.x*=-1:p<0&&!t.immovable&&y0&&!e.immovable&&f>y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.delta-a*Math.cos(o),t.y+=t.velocity.y*this.delta-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.delta+a*Math.cos(o),e.y+=e.velocity.y*this.delta+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),!0},intersects:function(t,e){return t!==e&&(t.isCircle?e.isCircle?h(t.center.x,t.center.y,e.center.x,e.center.y)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):e.isCircle?this.circleBodyIntersects(e,t):!(t.right<=e.position.x)&&(!(t.bottom<=e.position.y)&&(!(t.position.x>=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=s(t.center.x,e.left,e.right),n=s(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o,a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;o0},collideHandler:function(t,e,i,n,s,r){if(void 0===e&&t.isParent)return this.collideGroupVsSelf(t,i,n,s,r);if(!t||!e)return!1;if(t.body){if(e.body)return this.collideSpriteVsSprite(t,e,i,n,s,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,n,s,r)}else if(t.isParent){if(e.body)return this.collideSpriteVsGroup(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,n,s,r)}else if(t.isTilemap){if(e.body)return this.collideSpriteVsTilemapLayer(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,n,s,r)}},collideSpriteVsSprite:function(t,e,i,n,s,r){return!(!t.body||!e.body)&&(this.separate(t.body,e.body,n,s,r)&&(i&&i.call(s,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,n,s,r){var o=t.body;if(0!==e.length&&o){var h=this.treeMinMax;h.minX=o.left,h.minY=o.top,h.maxX=o.right,h.maxY=o.bottom;var l=e.physicsType===a.DYNAMIC_BODY?this.tree.search(h):this.staticTree.search(h);if(0!==l.length)for(var u=e.getChildren(),c=0;cc.baseTileWidth){var d=(c.tileWidth-c.baseTileWidth)*e.scaleX;a-=d,l+=d}c.tileHeight>c.baseTileHeight&&(u+=(c.tileHeight-c.baseTileHeight)*e.scaleY);var f,g=e.getTilesWithinWorldXY(a,h,l,u);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},m=0;m0&&(this.facing=r.FACING_RIGHT),this.deltaY()<0?this.facing=r.FACING_UP:this.deltaY()>0&&(this.facing=r.FACING_DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.gameObject.x+=this._dx,this.gameObject.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.world.bounds,i=this.world.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){if(void 0===i&&(i=!0),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&this.gameObject.getCenter){var n=this.gameObject,s=n.displayWidth/2,r=n.displayHeight/2;this.offset.set(s-this.halfWidth,r-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i.setPosition(t,e),i.getTopLeft(this.position),this.prev.copy(this.position),this.rotation=i.angle,this.preRotation=i.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):a(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.radius):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.velocity.x/2,n+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t){return this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this},setVelocityX:function(t){return this.velocity.x=t,this},setVelocityY:function(t){return this.velocity.y=t,this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return this.immovable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=l},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=n,this.collideCallback=s,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(s=t.right-e.x)>r&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()r&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?s=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=s,e.overlapX=s,s}},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(s=t.bottom-e.y)>r&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()r&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?s=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=s,e.overlapY=s,s}},function(t,e,i){var n=new(i(0))({initialize:function(){this._pending=[],this._active=[],this._destroy=[],this._toProcess=0},add:function(t){return this._pending.push(t),this._toProcess++,this},remove:function(t){return this._destroy.push(t),this._toProcess++,this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,n=this._active;for(t=0;t=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,s,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=s||(o=e+Math.ceil((i-e)/s/2)*s,n(t,o,e,i,r),a.push(e,o,o,i))}s.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!p(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),a=g(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,s,r,o,h,l,u,d,f,p,g,v,y,m;for(l=u=1/0,n=e;n<=i-e;n++)s=a(t,0,n,this.toBBox),r=a(t,n,i,this.toBBox),f=s,p=r,void 0,void 0,void 0,void 0,g=Math.max(f.minX,p.minX),v=Math.max(f.minY,p.minY),y=Math.min(f.maxX,p.maxX),m=Math.min(f.maxY,p.maxY),o=Math.max(0,y-g)*Math.max(0,m-v),h=c(s)+c(r),o=e;s--)r=t.children[s],h(u,t.leaf?o(r):r),c+=d(u);return c},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},t.exports=s},function(t,e){var i=function(t,e,r,o,a){for(r=r||0,o=o||t.length-1,a=a||s;o>r;){if(o-r>600){var h=o-r+1,l=e-r+1,u=Math.log(h),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(h-c)/h)*(l-h/2<0?-1:1),f=Math.max(r,Math.floor(e-l*c/h+d)),p=Math.min(o,Math.floor(e+(h-l)*c/h+d));i(t,e,f,p,a)}var g=t[e],v=r,y=o;for(n(t,r,e),a(t[o],g)>0&&n(t,r,o);v0;)y--}0===a(t[r],g)?n(t,r,y):n(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};function n(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function s(t,e){return te?1:0}t.exports=i},function(t,e){t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},function(t,e,i){var n=i(32),s=i(0),r=i(58),o=i(33),a=i(6),h=new s({initialize:function(t,e){this.world=t,this.gameObject=e,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new a,this.position=new a(e.x-e.displayOriginX,e.y-e.displayOriginY),this.width=e.displayWidth,this.height=e.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new a(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=a.ZERO,this.allowGravity=!1,this.gravity=a.ZERO,this.bounce=a.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=r.STATIC_BODY},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){return void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),this.offset.set(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):o(this,t,e)},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=h},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e,i){var n={};t.exports=n;var s=i(164);n._motionWakeThreshold=.18,n._motionSleepThreshold=.08,n._minBias=.9,n.update=function(t,e){for(var i=e*e*e,s=0;s0&&r.motion=r.sleepThreshold&&n.set(r,!0)):r.sleepCounter>0&&(r.sleepCounter-=1)}else n.set(r,!1)}},n.afterCollisions=function(t,e){for(var i=e*e*e,s=0;sn._motionWakeThreshold*i&&n.set(l,!1)}}}},n.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||s.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&s.trigger(t,"sleepEnd"))}},function(t,e,i){var n=i(15);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l-1}return!1}},function(t,e,i){var n=i(44),s=i(74),r=i(152);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!1),void 0===o&&(o=!0),!s(t,e,a))return null;var h=a.data[e][t];return null===h?null:(a.data[e][t]=i?null:new n(a,-1,t,e,h.width,h.height),o&&h&&h.collides&&r(t,e,a),h)}},function(t,e,i){var n=i(20),s=i(155),r=i(347),o=i(348),a=i(353);t.exports=function(t,e,i,h,l,u){var c;switch(e){case n.ARRAY_2D:c=s(t,i,h,l,u);break;case n.CSV:c=r(t,i,h,l,u);break;case n.TILED_JSON:c=o(t,i,u);break;case n.WELTMEISTER:c=a(t,i,u);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},function(t,e,i){var n=i(20),s=i(155);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map(function(t){return t.split(",")}),h=s(t,a,i,r,o);return h.format=n.CSV,h}},function(t,e,i){var n=i(20),s=i(76),r=i(901),o=i(903),a=i(904),h=i(906),l=i(907),u=i(908);t.exports=function(t,e,i){if("orthogonal"!==e.orientation)return console.warn("Only orthogonal map types are supported in this version of Phaser"),null;var c=new s({width:e.width,height:e.height,name:t,tileWidth:e.tilewidth,tileHeight:e.tileheight,orientation:e.orientation,format:n.TILED_JSON,version:e.version,properties:e.properties});c.layers=r(e,i),c.images=o(e);var d=a(e);return c.tilesets=d.tilesets,c.imageCollections=d.imageCollections,c.objects=h(e),c.tiles=l(c),u(c),c}},function(t,e){t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),n=Boolean(536870912&t);t&=536870911;var s=0,r=!1;return e&&i&&n?(s=Math.PI/2,r=!0):e&&i&&!n?(s=Math.PI,r=!1):e&&!i&&n?(s=Math.PI/2,r=!1):!e||i||n?!e&&i&&n?(s=3*Math.PI/2,r=!1):e||!i||n?e||i||!n?e||i||n||(s=0,r=!1):(s=3*Math.PI/2,r=!0):(s=Math.PI,r=!0):(s=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:n,rotation:s,flipped:r}}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&ta&&(a=e.layer[l].width),e.layer[l].height>h&&(h=e.layer[l].height);var u=new s({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:n.WELTMEISTER});return u.layers=r(e,i),u.tilesets=o(e),u}},function(t,e,i){var n=i(0),s=i(35),r=i(355),o=i(23),a=i(20),h=i(75),l=i(323),u=i(356),c=i(44),d=i(96),f=i(100),p=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0},addTilesetImage:function(t,e,i,n,s,r,o){if(void 0===t)return null;if(void 0!==e&&null!==e||(e=t),!this.scene.sys.textures.exists(e))return console.warn('Invalid image key given for tileset: "'+e+'"'),null;var h=this.scene.sys.textures.get(e),l=this.getTilesetIndex(t);if(null===l&&this.format===a.TILED_JSON)return console.warn('No data found in the JSON tilemap from Tiled matching the tileset name: "'+t+'"'),null;if(this.tilesets[l])return this.tilesets[l].setTileSize(i,n),this.tilesets[l].setSpacing(s,r),this.tilesets[l].setImage(h),this.tilesets[l];void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0);var u=new f(t,o,i,n,s,r);return u.setImage(h),this.tilesets.push(u),u},convertLayerToStatic:function(t){if(null===(t=this.getLayer(t)))return null;var e=t.tilemapLayer;if(!(e&&e instanceof r))return null;var i=new u(e.scene,e.tilemap,e.layerIndex,e.tileset,e.x,e.y);return this.scene.sys.displayList.add(i),e.destroy(),i},copy:function(t,e,i,n,s,r,o,a){return a=this.getLayer(a),this._isStaticCall(a,"copy")?this:(null!==a&&d.Copy(t,e,i,n,s,r,o,a),this)},createBlankDynamicLayer:function(t,e,i,n,s,o,a,l){if(void 0===a&&(a=e.tileWidth),void 0===l&&(l=e.tileHeight),void 0===s&&(s=this.width),void 0===o&&(o=this.height),void 0===i&&(i=0),void 0===n&&(n=0),null!==this.getLayerIndex(t))return console.warn("Cannot create blank layer: layer with matching name already exists "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;f0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},function(t,e,i){var n=i(923);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substr(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===n.indexOf(e)&&"_"!==e.substr(0,1)&&i.push({key:e,value:t[e]});return i}},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"tweens",null);return null===e?[]:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(159),s=i(10),r=i(73),o=i(71),a=i(101),h=i(4),l=i(158),u=i(160),c=i(161);t.exports=function(t,e,i){void 0===i&&(i=n);var d=h(e,"from",0),f=h(e,"to",1),p=[{value:d}],g=a(e,"delay",i.delay),v=a(e,"duration",i.duration),y=h(e,"easeParams",i.easeParams),m=o(h(e,"ease",i.ease),y),x=a(e,"hold",i.hold),b=a(e,"repeat",i.repeat),w=a(e,"repeatDelay",i.repeatDelay),T=r(e,"yoyo",i.yoyo),S=[],A=l("value",f),C=c(p[0],"value",A.getEnd,A.getStart,m,g,v,T,x,b,w,!1,!1);C.start=d,C.current=d,C.to=f,S.push(C);var M=new u(t,S,p);M.offset=s(e,"offset",null),M.completeDelay=s(e,"completeDelay",0),M.loop=Math.round(s(e,"loop",0)),M.loopDelay=Math.round(s(e,"loopDelay",0)),M.paused=r(e,"paused",!1),M.useFrames=r(e,"useFrames",!1);for(var E=h(e,"callbackScope",M),_=[M,null],P=u.TYPES,L=0;L0?Math.floor(v/p.length):h(e,"duration",g.duration),g.delay=h(e,"delay",g.delay),g.easeParams=c(e,"easeParams",g.easeParams),g.ease=a(c(e,"ease",g.ease),g.easeParams),g.hold=h(e,"hold",g.hold),g.repeat=h(e,"repeat",g.repeat),g.repeatDelay=h(e,"repeatDelay",g.repeatDelay),g.yoyo=o(e,"yoyo",g.yoyo),g.flipX=o(e,"flipX",g.flipX),g.flipY=o(e,"flipY",g.flipY);for(var y=0;y0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=o.PAUSED,!1)},resetTweens:function(t){for(var e=0;e0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&t.func.apply(t.scope,t.params),this.emit("loop",this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit("complete",this),this.state=o.PENDING_REMOVE}},update:function(t,e){if(this.state!==o.PAUSED){var i=e;switch(this.useFrames&&(e=1*this.manager.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var n=this.totalData,s=0;s=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.nextTick&&this.currentAnim.setFrame(this))},updateFrame:function(t){var e=this.parent;if(this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;i.onUpdate&&i.onUpdate.apply(i.callbackScope,this._updateParams),t.onUpdate&&t.onUpdate(e,t)}},yoyo:function(t){return void 0===t?this._yoyo:(this._yoyo=t,this)},destroy:function(){}});t.exports=n},function(t,e){var i={};t.exports=i,i.create=function(t,e){var n=t.bodyA,s=t.bodyB,r={id:i.id(n,s),bodyA:n,bodyB:s,activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||s.isSensor,timeCreated:e,timeUpdated:e,collision:null,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return i.update(r,t,e),r},i.update=function(t,e,n){if(t.collision=e,e.collided){var s=e.supports,r=t.activeContacts,o=e.parentA,a=e.parentB;t.inverseMass=o.inverseMass+a.inverseMass,t.friction=Math.min(o.friction,a.friction),t.frictionStatic=Math.max(o.frictionStatic,a.frictionStatic),t.restitution=Math.max(o.restitution,a.restitution),t.slop=Math.max(o.slop,a.slop);for(var h=0;h>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,t)for(var e=0;e=0&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e){t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}}},function(t,e){var i={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.scene.sys.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}};t.exports=i},function(t,e){t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},function(t,e,i){var n=i(8),s=i(185),r=i(6),o={getCenter:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,t},getTopLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getTopRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBounds:function(t){void 0===t&&(t=new n),this.getTopLeft(t);var e=t.x,i=t.y;this.getTopRight(t);var s=t.x,r=t.y;this.getBottomLeft(t);var o=t.x,a=t.y;this.getBottomRight(t);var h=t.x,l=t.y;return t.x=Math.min(e,s,o,h),t.y=Math.min(i,r,a,l),t.width=Math.max(e,s,o,h)-t.x,t.height=Math.max(i,r,a,l)-t.y,t}};t.exports=o},function(t,e){var i={matrixStack:null,currentMatrix:null,currentMatrixIndex:0,initMatrixStack:function(){return this.matrixStack=new Float32Array(6e3),this.currentMatrix=new Float32Array([1,0,0,1,0,0]),this.currentMatrixIndex=0,this},save:function(){if(this.currentMatrixIndex>=this.matrixStack.length)return this;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return this.currentMatrixIndex+=6,t[i+0]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=e[3],t[i+4]=e[4],t[i+5]=e[5],this},restore:function(){if(this.currentMatrixIndex<=0)return this;this.currentMatrixIndex-=6;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return e[0]=t[i+0],e[1]=t[i+1],e[2]=t[i+2],e[3]=t[i+3],e[4]=t[i+4],e[5]=t[i+5],this},loadIdentity:function(){return this.setTransform(1,0,0,1,0,0),this},transform:function(t,e,i,n,s,r){var o=this.currentMatrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=a*t+l*e,o[1]=h*t+u*e,o[2]=a*i+l*n,o[3]=h*i+u*n,o[4]=a*s+l*r+c,o[5]=h*s+u*r+d,this},setTransform:function(t,e,i,n,s,r){var o=this.currentMatrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},translate:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3],a=i[4],h=i[5];return i[4]=n*t+r*e+a,i[5]=s*t+o*e+h,this},scale:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3];return i[0]=n*t,i[1]=s*t,i[2]=r*e,i[3]=o*e,this},rotate:function(t){var e=this.currentMatrix,i=e[0],n=e[1],s=e[2],r=e[3],o=Math.sin(t),a=Math.cos(t);return e[0]=i*a+s*o,e[1]=n*a+r*o,e[2]=s*-o+s*a,e[3]=r*-o+r*a,this}};t.exports=i},function(t,e){var i={originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=Math.round(this.originX*this.width),this._displayOriginY=Math.round(this.originY*this.height),this}};t.exports=i},function(t,e,i){var n=i(62),s={_scaleMode:n.DEFAULT,scaleMode:{get:function(){return this._scaleMode},set:function(t){t!==n.LINEAR&&t!==n.NEAREST||(this._scaleMode=t)}},setScaleMode:function(t){return this.scaleMode=t,this}};t.exports=s},function(t,e){var i={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}};t.exports=i},function(t,e){var i={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.frame.realWidth},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return this.scaleY*this.frame.realHeight},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){return void 0===t&&(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=i},function(t,e){var i={texture:null,frame:null,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this.frame.customPivot&&this.setOrigin(this.frame.pivotX,this.frame.pivotY),this}};t.exports=i},function(t,e){var i=function(t){return(t>>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,n,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,n=t,s=t),this._tintTL=i(t),this._tintTR=i(e),this._tintBL=i(n),this._tintBR=i(s),this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t)}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t)}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t)}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t)}},tint:{set:function(t){this.setTint(t,t,t,t)}}};t.exports=n},function(t,e){t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,scaleMode:t.scaleMode,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},function(t,e,i){var n=i(16),s=i(162),r=i(163),o={_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4}},angle:{get:function(){return r(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=r(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=s(t)}},setPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this}};t.exports=o},function(t,e){var i={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}};t.exports=i},function(t,e){t.exports=function(t,e){for(var i=0;i0?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a1)if(0===s){var d=t.length-1;for(o=t[d].x,a=t[d].y,h=d-1;h>=0;h--)l=(c=t[h]).x,u=c.y,c.x=o,c.y=a,o=l,a=u;t[d].x=e,t[d].y=i}else{for(o=t[0].x,a=t[0].y,h=1;h0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.1&&(e.zoom=.1))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(114),CameraManager:i(445)}},function(t,e,i){var n=i(114),s=i(0),r=i(2),o=i(12),a=i(33),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.currentCameraId=1,this.cameras=[],this.cameraPool=[],t.sys.settings.cameras?this.fromJSON(t.sys.settings.cameras):this.add(),this.main=this.cameras[0],this.baseScale=1},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i,s,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===s&&(s=this.scene.sys.game.config.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=null;return this.cameraPool.length>0?(a=this.cameraPool.pop()).setViewport(t,e,i,s):a=new n(t,e,i,s),a.setName(o),a.setScene(this.scene),this.cameras.push(a),r&&(this.main=a),a._id=this.currentCameraId,this.currentCameraId=this.currentCameraId<<1,a},addExisting:function(t){var e=this.cameras.indexOf(t),i=this.cameraPool.indexOf(t);return e<0&&i>=0?(this.cameras.push(t),this.cameraPool.slice(i,1),t):null},fromJSON:function(t){Array.isArray(t)||(t=[t]);for(var e=this.scene.sys.game.config.width,i=this.scene.sys.game.config.height,n=0;n=0;i--){var n=e[i];if(n.inputEnabled&&a(n,t.x,t.y))return n}},remove:function(t){var e=this.cameras.indexOf(t);e>=0&&this.cameras.length>1&&(this.cameraPool.push(this.cameras[e]),this.cameras.splice(e,1),this.main===t&&(this.main=this.cameras[0]))},render:function(t,e,i){for(var n=this.cameras,s=this.baseScale,r=0,o=n.length;r0;)this.cameraPool.push(this.cameras.pop());return this.main=this.add(),this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(211),r=i(212),o=i(12),a=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.cameras=[],t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i){return this.addPerspectiveCamera(t,e,i)},addOrthographicCamera:function(t,e){var i=this.scene.sys.game.config;void 0===t&&(t=i.width),void 0===e&&(e=i.height);var n=new s(this.scene,t,e);return this.cameras.push(n),n},addPerspectiveCamera:function(t,e,i){var n=this.scene.sys.game.config;void 0===t&&(t=80),void 0===e&&(e=n.width),void 0===i&&(i=n.height);var s=new r(this.scene,t,e,i);return this.cameras.push(s),s},getCamera:function(t){return this.cameras.forEach(function(e){if(e.name===t)return e}),null},removeCamera:function(t){var e=this.cameras.indexOf(t);-1!==e&&this.cameras.splice(e,1)},removeAll:function(){for(;this.cameras.length>0;){this.cameras.pop().destroy()}return this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new c);for(var i=t*this.getLength(),n=this.getCurveLengths(),s=0;s=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},getRandomPoint:function(t){return void 0===t&&(t=new c),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new c),t.copy(this.startPoint)},lineTo:function(t,e){t instanceof c?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new u(t))},moveTo:function(t,e){return this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e,i){var n=i(36),s=i(224);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,l=2*i-h;r=s(l,h,t+1/3),o=s(l,h,t),a=s(l,h,t-1/3)}return(new n).setGLTo(r,o,a,1)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){var n=i(225);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n(s/359,t,e));return i}},function(t,e,i){var n=i(226),s=function(t,e,i,s,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var l=h/a;return{r:n(t,s,l),g:n(e,r,l),b:n(i,o,l)}};t.exports={RGBWithRGB:s,ColorWithRGB:function(t,e,i,n,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),s(t.r,t.g,t.b,e,i,n,r,o)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),s(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(228),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e){t.exports=function(t,e,i){t/=255,e/=255,i/=255;var n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n,o=0;return s!==n&&(s===t?o=(e-i)/r+(e1)for(var i=1;i0||n._flashAlpha>0)&&(s.globalCompositeOperation="source-over",s.fillStyle="rgb("+255*n._fadeRed+","+255*n._fadeGreen+","+255*n._fadeBlue+")",s.globalAlpha=n._fadeAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.fillStyle="rgb("+255*n._flashRed+","+255*n._flashGreen+","+255*n._flashBlue+")",s.globalAlpha=n._flashAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.globalAlpha=1),r&&s.restore()},postRender:function(){var t=this.gameContext;t.globalAlpha=1,t.globalCompositeOperation="source-over",this.currentAlpha=1,this.currentBlendMode=0,this.snapshotCallback&&(this.snapshotCallback(s(this.gameCanvas,this.snapshotType,this.snapshotEncoder)),this.snapshotCallback=null)},snapshot:function(t,e,i){this.snapshotCallback=t,this.snapshotType=e,this.snapshotEncoder=i},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e){t.exports=function(t,e,i){var n=this.currentContext,s=i.canvasData;n.drawImage(i.source.image,s.sx,s.sy,s.sWidth,s.sHeight,t,e,s.dWidth,s.dHeight)}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e="image/png"),void 0===i&&(i=.92);var n=t.toDataURL(e,i),s=new Image;return s.src=n,s}},function(t,e){t.exports=function(t,e){var i=this.currentContext,n=t.frame,s=n.canvasData;this.currentBlendMode!==t.blendMode&&(this.currentBlendMode=t.blendMode,i.globalCompositeOperation=this.blendModes[t.blendMode]),this.currentAlpha!==t.alpha&&(this.currentAlpha=t.alpha,i.globalAlpha=t.alpha),this.currentScaleMode!==t.scaleMode&&(this.currentScaleMode=t.scaleMode);var r=n.x,o=n.y,a=1,h=1;t.flipX?(a=-1,r-=s.dWidth-t.displayOriginX):r-=t.displayOriginX,t.flipY?(h=-1,o-=s.dHeight-t.displayOriginY):o-=t.displayOriginY,i.save(),i.translate(t.x-e.scrollX*t.scrollFactorX,t.y-e.scrollY*t.scrollFactorY),i.rotate(t.rotation),i.scale(t.scaleX,t.scaleY),i.scale(a,h),i.drawImage(n.source.image,s.sx,s.sy,s.sWidth,s.sHeight,r,o,s.dWidth,s.dHeight),i.restore()}},function(t,e,i){var n=i(45),s=i(234);t.exports=function(){var t=[],e=s.supportNewBlendModes;return t[n.NORMAL]="source-over",t[n.ADD]="lighter",t[n.MULTIPLY]=e?"multiply":"source-over",t[n.SCREEN]=e?"screen":"source-over",t[n.OVERLAY]=e?"overlay":"source-over",t[n.DARKEN]=e?"darken":"source-over",t[n.LIGHTEN]=e?"lighten":"source-over",t[n.COLOR_DODGE]=e?"color-dodge":"source-over",t[n.COLOR_BURN]=e?"color-burn":"source-over",t[n.HARD_LIGHT]=e?"hard-light":"source-over",t[n.SOFT_LIGHT]=e?"soft-light":"source-over",t[n.DIFFERENCE]=e?"difference":"source-over",t[n.EXCLUSION]=e?"exclusion":"source-over",t[n.HUE]=e?"hue":"source-over",t[n.SATURATION]=e?"saturation":"source-over",t[n.COLOR]=e?"color":"source-over",t[n.LUMINOSITY]=e?"luminosity":"source-over",t}},function(t,e,i){var n=i(0),s=i(22),r=i(125),o=i(42),a=i(507),h=i(508),l=i(511),u=i(237),c=i(238),d=new n({initialize:function(t){var e=this,i={alpha:t.config.transparent,depth:!1,antialias:t.config.antialias,premultipliedAlpha:t.config.transparent,stencil:!0,preserveDrawingBuffer:t.config.preserveDrawingBuffer,failIfMajorPerformanceCaveat:!1,powerPreference:t.config.powerPreference};this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,contextCreation:i,resolution:t.config.resolution,autoResize:t.config.autoResize},this.game=t,this.type=s.WEBGL,this.width=t.config.width,this.height=t.config.height,this.canvas=t.canvas,this.lostContextCallbacks=[],this.restoredContextCallbacks=[],this.blendModes=[],this.nativeTextures=[],this.contextLost=!1,this.pipelines=null,this.snapshotState={callback:null,type:null,encoder:null},this.currentActiveTextureUnit=0,this.currentTextures=new Array(16),this.currentFramebuffer=null,this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=new Uint32Array([0,0,this.width,this.height]),this.currentScissorIdx=0,this.scissorStack=new Uint32Array(4e3),this.canvas.addEventListener("webglcontextlost",function(t){e.contextLost=!0,t.preventDefault();for(var i=0;i=0&&n>=0;if(r[0]===t&&r[1]===e&&r[2]===i&&r[3]===n||this.flush(),r[0]=t,r[1]=e,r[2]=i,r[3]=n,this.currentScissorEnabled=o,!o)return s.enable(s.SCISSOR_TEST),s.scissor(t,s.drawingBufferHeight-e-n,i,n),this;s.disable(s.SCISSOR_TEST)},pushScissor:function(t,e,i,n){var s=this.scissorStack,r=this.currentScissorIdx,o=this.currentScissor;return s[r+0]=o[0],s[r+1]=o[1],s[r+2]=o[2],s[r+3]=o[3],this.currentScissorIdx+=4,this.setScissor(t,e,i,n),this},popScissor:function(){var t=this.scissorStack,e=this.currentScissorIdx-4,i=t[e+0],n=t[e+1],s=t[e+2],r=t[e+3];return this.currentScissorIdx=e,this.setScissor(i,n,s,r),this},setPipeline:function(t){return this.currentPipeline===t&&this.currentPipeline.vertexBuffer===this.currentVertexBuffer&&this.currentPipeline.program===this.currentProgram||(this.flush(),this.currentPipeline=t,this.currentPipeline.bind()),this.currentPipeline.onBind(),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==s.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t&&(this.flush(),e.enable(e.BLEND),e.blendEquation(i.equation),i.func.length>2?e.blendFuncSeparate(i.func[0],i.func[1],i.func[2],i.func[3]):e.blendFunc(i.func[0],i.func[1]),this.currentBlendMode=t),this},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>16&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setTexture2D:function(t,e){var i=this.gl;return t!==this.currentTextures[e]&&(this.flush(),this.currentActiveTextureUnit!==e&&(i.activeTexture(i.TEXTURE0+e),this.currentActiveTextureUnit=e),i.bindTexture(i.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t){var e=this.gl;return t!==this.currentFramebuffer&&(this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),this.currentFramebuffer=t),this},setProgram:function(t){var e=this.gl;return t!==this.currentProgram&&(this.flush(),e.useProgram(t),this.currentProgram=t),this},setVertexBuffer:function(t){var e=this.gl;return t!==this.currentVertexBuffer&&(this.flush(),e.bindBuffer(e.ARRAY_BUFFER,t),this.currentVertexBuffer=t),this},setIndexBuffer:function(t){var e=this.gl;return t!==this.currentIndexBuffer&&(this.flush(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.currentIndexBuffer=t),this},createTextureFromSource:function(t,e,i,n){var o=this.gl,a=o.NEAREST,h=o.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,r(e,i)&&(h=o.REPEAT),n===s.ScaleModes.LINEAR?a=o.LINEAR:(n===s.ScaleModes.NEAREST||this.config.pixelArt)&&(a=o.NEAREST),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,o.RGBA,t):this.createTexture2D(0,a,a,h,h,o.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){var u=this.gl,c=u.createTexture();return l=void 0===l||null===l||l,this.setTexture2D(c,0),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,s),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,n),u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),null===o||void 0===o?u.texImage2D(u.TEXTURE_2D,t,r,a,h,0,r,u.UNSIGNED_BYTE,null):(u.texImage2D(u.TEXTURE_2D,t,r,r,u.UNSIGNED_BYTE,o),a=o.width,h=o.height),this.setTexture2D(null,0),c.isAlphaPremultiplied=l,c.isRenderTexture=!1,c.width=a,c.height=h,this.nativeTextures.push(c),c},createFramebuffer:function(t,e,i,n){var s,r=this.gl,o=r.createFramebuffer();if(this.setFramebuffer(o),n){var a=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,a),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)}if(i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),(s=r.checkFramebufferStatus(r.FRAMEBUFFER))!==r.FRAMEBUFFER_COMPLETE){throw new Error("Framebuffer incomplete. Framebuffer status: "+{36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"}[s])}return o.renderTexture=i,this.setFramebuffer(null),o},createProgram:function(t,e){var i=this.gl,n=i.createProgram(),s=i.createShader(i.VERTEX_SHADER),r=i.createShader(i.FRAGMENT_SHADER);if(i.shaderSource(s,t),i.shaderSource(r,e),i.compileShader(s),i.compileShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS))throw new Error("Failed to compile Vertex Shader:\n"+i.getShaderInfoLog(s));if(!i.getShaderParameter(r,i.COMPILE_STATUS))throw new Error("Failed to compile Fragment Shader:\n"+i.getShaderInfoLog(r));if(i.attachShader(n,s),i.attachShader(n,r),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS))throw new Error("Failed to link program:\n"+i.getProgramInfoLog(n));return n},createVertexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setVertexBuffer(n),i.bufferData(i.ARRAY_BUFFER,t,e),this.setVertexBuffer(null),n},createIndexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setIndexBuffer(n),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t,e),this.setIndexBuffer(null),n},deleteTexture:function(t){return this.gl.deleteTexture(t),this},deleteFramebuffer:function(t){return this.gl.deleteFramebuffer(t),this},deleteProgram:function(t){return this.gl.deleteProgram(t),this},deleteBuffer:function(t){return this.gl.deleteBuffer(t),this},preRenderCamera:function(t){var e=this.config.resolution;if(this.pushScissor(t.x*e,t.y*e,t.width*e,t.height*e),t.backgroundColor.alphaGL>0){var i=t.backgroundColor,n=this.pipelines.FlatTintPipeline;n.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(i.redGL,i.greenGL,i.blueGL,1),i.alphaGL,1,0,0,1,0,0,[1,0,0,1,0,0]),n.flush()}},postRenderCamera:function(t){if(t._fadeAlpha>0||t._flashAlpha>0){var e=this.pipelines.FlatTintPipeline;e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._fadeRed,t._fadeGreen,t._fadeBlue,1),t._fadeAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._flashRed,t._flashGreen,t._flashBlue,1),t._flashAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.flush()}this.popScissor()},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),this.config.clearBeforeRender&&t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT);for(var n in i)i[n].onPreRender()}},render:function(t,e,i,n){if(!this.contextLost){var r=e.list,o=r.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;lthis.vertexCapacity&&this.flush();this.renderer.config.resolution;var x=this.vertexViewF32,b=this.vertexViewU32,w=this.vertexCount*this.vertexComponentCount,T=r+a,S=o+h,A=m[0],C=m[1],M=m[2],E=m[3],_=d*A+f*M,P=d*C+f*E,L=p*A+g*M,k=p*C+g*E,F=v*A+y*M+m[4],O=v*C+y*E+m[5],R=r*_+o*L+F,B=r*P+o*k+O,D=r*_+S*L+F,I=r*P+S*k+O,Y=T*_+S*L+F,z=T*P+S*k+O,X=T*_+o*L+F,N=T*P+o*k+O,V=l.getTintAppendFloatAlphaAndSwap(u,c);x[w+0]=R,x[w+1]=B,b[w+2]=V,x[w+3]=D,x[w+4]=I,b[w+5]=V,x[w+6]=Y,x[w+7]=z,b[w+8]=V,x[w+9]=R,x[w+10]=B,b[w+11]=V,x[w+12]=Y,x[w+13]=z,b[w+14]=V,x[w+15]=X,x[w+16]=N,b[w+17]=V,this.vertexCount+=6},batchFillTriangle:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y,m,x,b){this.renderer.setPipeline(this),this.vertexCount+3>this.vertexCapacity&&this.flush();this.renderer.config.resolution;var w=this.vertexViewF32,T=this.vertexViewU32,S=this.vertexCount*this.vertexComponentCount,A=b[0],C=b[1],M=b[2],E=b[3],_=p*A+g*M,P=p*C+g*E,L=v*A+y*M,k=v*C+y*E,F=m*A+x*M+b[4],O=m*C+x*E+b[5],R=r*_+o*L+F,B=r*P+o*k+O,D=a*_+h*L+F,I=a*P+h*k+O,Y=u*_+c*L+F,z=u*P+c*k+O,X=l.getTintAppendFloatAlphaAndSwap(d,f);w[S+0]=R,w[S+1]=B,T[S+2]=X,w[S+3]=D,w[S+4]=I,T[S+5]=X,w[S+6]=Y,w[S+7]=z,T[S+8]=X,this.vertexCount+=3},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,b){var w=this.tempTriangle;w[0].x=r,w[0].y=o,w[0].width=c,w[0].rgb=d,w[0].alpha=f,w[1].x=a,w[1].y=h,w[1].width=c,w[1].rgb=d,w[1].alpha=f,w[2].x=l,w[2].y=u,w[2].width=c,w[2].rgb=d,w[2].alpha=f,w[3].x=r,w[3].y=o,w[3].width=c,w[3].rgb=d,w[3].alpha=f,this.batchStrokePath(t,e,i,n,s,w,c,d,f,p,g,v,y,m,x,!1,b)},batchFillPath:function(t,e,i,n,s,o,a,h,u,c,d,f,p,g,v){this.renderer.setPipeline(this);this.renderer.config.resolution;for(var y,m,x,b,w,T,S,A,C,M,E,_,P,L,k,F,O,R=o.length,B=this.polygonCache,D=this.vertexViewF32,I=this.vertexViewU32,Y=0,z=v[0],X=v[1],N=v[2],V=v[3],W=u*z+c*N,G=u*X+c*V,U=d*z+f*N,j=d*X+f*V,H=p*z+g*N+v[4],q=p*X+g*V+v[5],K=l.getTintAppendFloatAlphaAndSwap(a,h),J=0;Jthis.vertexCapacity&&this.flush(),Y=this.vertexCount*this.vertexComponentCount,_=(T=B[x+0])*W+(S=B[x+1])*U+H,P=T*G+S*j+q,L=(A=B[b+0])*W+(C=B[b+1])*U+H,k=A*G+C*j+q,F=(M=B[w+0])*W+(E=B[w+1])*U+H,O=M*G+E*j+q,D[Y+0]=_,D[Y+1]=P,I[Y+2]=K,D[Y+3]=L,D[Y+4]=k,I[Y+5]=K,D[Y+6]=F,D[Y+7]=O,I[Y+8]=K,this.vertexCount+=3;B.length=0},batchStrokePath:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y){var m,x;this.renderer.setPipeline(this);for(var b,w,T,S,A=r.length,C=this.polygonCache,M=this.vertexViewF32,E=this.vertexViewU32,_=l.getTintAppendFloatAlphaAndSwap,P=0;P+1this.vertexCapacity&&this.flush(),b=C[L-1]||C[k-1],w=C[L],M[(T=this.vertexCount*this.vertexComponentCount)+0]=b[6],M[T+1]=b[7],E[T+2]=_(b[8],h),M[T+3]=b[0],M[T+4]=b[1],E[T+5]=_(b[2],h),M[T+6]=w[9],M[T+7]=w[10],E[T+8]=_(w[11],h),M[T+9]=b[0],M[T+10]=b[1],E[T+11]=_(b[2],h),M[T+12]=b[6],M[T+13]=b[7],E[T+14]=_(b[8],h),M[T+15]=w[3],M[T+16]=w[4],E[T+17]=_(w[5],h),this.vertexCount+=6;C.length=0},batchLine:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y,m,x,b,w){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();this.renderer.config.resolution;var T=w[0],S=w[1],A=w[2],C=w[3],M=g*T+v*A,E=g*S+v*C,_=y*T+m*A,P=y*S+m*C,L=x*T+b*A+w[4],k=x*S+b*C+w[5],F=this.vertexViewF32,O=this.vertexViewU32,R=a-r,B=h-o,D=Math.sqrt(R*R+B*B),I=u*(h-o)/D,Y=u*(r-a)/D,z=c*(h-o)/D,X=c*(r-a)/D,N=a-z,V=h-X,W=r-I,G=o-Y,U=a+z,j=h+X,H=r+I,q=o+Y,K=N*M+V*_+L,J=N*E+V*P+k,Z=W*M+G*_+L,Q=W*E+G*P+k,$=U*M+j*_+L,tt=U*E+j*P+k,et=H*M+q*_+L,it=H*E+q*P+k,nt=l.getTintAppendFloatAlphaAndSwap,st=nt(d,p),rt=nt(f,p),ot=this.vertexCount*this.vertexComponentCount;return F[ot+0]=K,F[ot+1]=J,O[ot+2]=rt,F[ot+3]=Z,F[ot+4]=Q,O[ot+5]=st,F[ot+6]=$,F[ot+7]=tt,O[ot+8]=rt,F[ot+9]=Z,F[ot+10]=Q,O[ot+11]=st,F[ot+12]=et,F[ot+13]=it,O[ot+14]=st,F[ot+15]=$,F[ot+16]=tt,O[ot+17]=rt,this.vertexCount+=6,[K,J,f,Z,Q,d,$,tt,f,et,it,d]},batchGraphics:function(t,e){if(!(t.commandBuffer.length<=0)){this.renderer.setPipeline(this);var i,n,r=e.scrollX*t.scrollFactorX,o=e.scrollY*t.scrollFactorY,a=t.x-r,h=t.y-o,l=t.scaleX,u=t.scaleY,y=-t.rotation,m=t.commandBuffer,x=1,b=1,w=0,T=0,S=1,A=e.matrix.matrix,C=null,M=0,E=0,_=0,P=0,L=0,k=0,F=0,O=0,R=0,B=null,D=Math.sin,I=Math.cos,Y=D(y),z=I(y),X=z*l,N=-Y*l,V=Y*u,W=z*u,G=a,U=h,j=A[0],H=A[1],q=A[2],K=A[3],J=X*j+N*q,Z=X*H+N*K,Q=V*j+W*q,$=V*H+W*K,tt=G*j+U*q+A[4],et=G*H+U*K+A[5];v.length=0;for(var it=0,nt=m.length;it0){var st=C.points[0],rt=C.points[C.points.length-1];C.points.push(st),C=new d(rt.x,rt.y,rt.width,rt.rgb,rt.alpha),v.push(C)}break;case s.FILL_PATH:for(i=0,n=v.length;i=1)&&(r.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(r.mspointer=!0),navigator.getGamepads&&(r.gamepads=!0),n.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll")),r)},function(t,e,i){var n=i(82),s={audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(n.edge)s.dolby=!0;else if(n.safari&&n.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var i=parseInt(RegExp.$1,10),r=parseInt(RegExp.$2,10);(10===i&&r>=11||i>10)&&(s.dolby=!0)}}catch(t){}return s}()},function(t,e){var i={h264Video:!1,hlsVideo:!1,mp4Video:!1,oggVideo:!1,vp9Video:!1,webmVideo:!1};t.exports=function(){var t=document.createElement("video"),e=!!t.canPlayType;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(i.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.h264Video=!0,i.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(i.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(i.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.hlsVideo=!0))}catch(t){}return i}()},function(t,e){var i={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){var t,e=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],n=document.createElement("div");for(t=0;t0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(s=!0,i=n(t,e))}else s=!0,i=n(t,e);return!s&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},function(t,e){t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},function(t,e){t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},function(t,e,i){var n=i(128),s={};for(var r in n)s[n[r]]=r;t.exports=s},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.altKey=e.altKey,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.location=e.location,t.isDown=!0,t.isUp=!1,t.timeDown=e.timeStamp,t.duration=0,t.repeats++,t._justDown=!0,t._justUp=!1,t}},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.isDown=!1,t.isUp=!0,t.timeUp=e.timeStamp,t.duration=t.timeUp-t.timeDown,t.repeats=0,t._justDown=!1,t._justUp=!0,t}},function(t,e,i){var n=i(2),s=i(253);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=n(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(s(e+"Physics")),i)for(var o in i)o=s(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},function(t,e,i){var n=i(2);t.exports=function(t){var e=t.game.config.defaultPlugins,i=n(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},function(t,e){t.exports={game:"game",anims:"anims",cache:"cache",registry:"registry",sound:"sound",textures:"textures",events:"events",cameras:"cameras",cameras3d:"cameras3d",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e,i){var n=i(52);t.exports=function(t,e,i){if(i.frames||i.textures){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var r,o=Array.isArray(i.textures)?i.textures[0].frames:i.frames,a=0;ag||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,y=f,m=0,x=0,b=0;br&&(m=w-r),T>o&&(x=T-o),t.add(b,e,i+v,s+y,h-m,l-x),(v+=h+p)+h>r&&(v=f,y+=l+p)}return t}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){var s=n(i,"frameWidth",null),r=n(i,"frameHeight",s);if(!s)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o,a=n(i,"startFrame",0),h=n(i,"endFrame",-1),l=n(i,"margin",0),u=n(i,"spacing",0),c=e.cutX,d=e.cutY,f=e.cutWidth,p=e.cutHeight,g=e.realWidth,v=e.realHeight,y=Math.floor((g-l+u)/(s+u)),m=Math.floor((v-l+u)/(r+u)),x=y*m,b=e.x,w=s-b,T=s-(g-f-b),S=e.y,A=r-S,C=r-(v-p-S);(a>x||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var M=l,E=l,_=0,P=e.sourceIndex,L=0;L0||!this.inFocus)&&(this._coolDown--,s=Math.min(s,this._target)),s>this._min&&(s=i[e],s=Math.min(s,this._min)),i[e]=s,this.deltaIndex++,this.deltaIndex>n&&(this.deltaIndex=0);for(var r=0,o=0;othis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var a=r/this._target;this.callback(t,r,a),this.lastTime=t},tick:function(){this.step(window.performance.now())},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running?this.sleep():t&&(this.startTime+=-this.lastTime+(this.lastTime=window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step(window.performance.now())},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e){t.exports=function(t){var e;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(e){document.hidden||"pause"===e.type?t.emit("hidden"):t.emit("visible")},!1),window.onblur=function(){t.emit("blur")},window.onfocus=function(){t.emit("focus")}}},function(t,e,i){var n={DisplayList:i(544),GameObjectCreator:i(13),GameObjectFactory:i(9),UpdateList:i(545),Components:i(11),BitmapText:i(131),Blitter:i(132),DynamicBitmapText:i(133),Graphics:i(134),Group:i(69),Image:i(70),Particles:i(137),PathFollower:i(289),RenderTexture:i(139),Sprite3D:i(81),Sprite:i(37),Text:i(140),TileSprite:i(141),Zone:i(77),Factories:{Blitter:i(628),DynamicBitmapText:i(629),Graphics:i(630),Group:i(631),Image:i(632),Particles:i(633),PathFollower:i(634),RenderTexture:i(635),Sprite3D:i(636),Sprite:i(637),StaticBitmapText:i(638),Text:i(639),TileSprite:i(640),Zone:i(641)},Creators:{Blitter:i(642),DynamicBitmapText:i(643),Graphics:i(644),Group:i(645),Image:i(646),Particles:i(647),RenderTexture:i(648),Sprite3D:i(649),Sprite:i(650),StaticBitmapText:i(651),Text:i(652),TileSprite:i(653),Zone:i(654)}};n.Mesh=i(88),n.Quad=i(143),n.Factories.Mesh=i(658),n.Factories.Quad=i(659),n.Creators.Mesh=i(660),n.Creators.Quad=i(661),n.Light=i(291),i(292),i(662),t.exports=n},function(t,e,i){var n=i(0),s=i(86),r=i(12),o=i(266),a=new n({Extends:s,initialize:function(t){s.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(o.inplace(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},sortGameObjects:function(t){return void 0===t&&(t=this.list),this.scene.sys.depthSort(),t.sort(this.sortIndexHandler.bind(this))},getTopGameObject:function(t){return this.sortGameObjects(t),t[t.length-1]}});r.register("DisplayList",a,"displayList"),t.exports=a},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this._list=[],this._pendingInsertion=[],this._pendingRemoval=[]},boot:function(){var t=this.systems.events;t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t){return-1===this._list.indexOf(t)&&-1===this._pendingInsertion.indexOf(t)&&this._pendingInsertion.push(t),t},preUpdate:function(){var t=this._pendingRemoval.length,e=this._pendingInsertion.length;if(0!==t||0!==e){var i,n;for(i=0;i-1&&this._list.splice(s,1)}this._list=this._list.concat(this._pendingInsertion.splice(0)),this._pendingRemoval.length=0,this._pendingInsertion.length=0}},update:function(t,e){for(var i=0;ia.length&&(f=a.length);for(var p=l,g=u,v={retroFont:!0,font:h,size:i,lineHeight:s,chars:{}},y=0,m=0;m?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",s.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",s.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",s.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",s.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",s.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",s.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",s.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",t.exports=s},function(t,e,i){var n=i(3),s=i(3);n=i(549),s=i(550),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text.length;n.RENDER_MASK!==e.renderFlags||0===r||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchBitmapText(this,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=s.scrollX*e.scrollFactorX,l=s.scrollY*e.scrollFactorY,u=e.fontData.chars,c=e.fontData.lineHeight,d=0,f=0,p=0,g=0,v=null,y=0,m=0,x=0,b=0,w=0,T=0,S=null,A=0,C=t.currentContext,M=e.frame.source.image,E=a.cutX,_=a.cutY,P=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,C.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,C.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),C.save(),C.translate(e.x-h+e.frame.x,e.y-l+e.frame.y),C.rotate(e.rotation),C.translate(-e.displayOriginX,-e.displayOriginY),C.scale(e.scaleX,e.scaleY);for(var L=0;L0&&e.cameraFilter&s._id||this.pipeline.drawBlitter(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=e.getRenderList();t.setBlendMode(e.blendMode);for(var o=t.gameContext,a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY,l=0;l0&&e.cameraFilter&s._id||this.pipeline.batchDynamicBitmapText(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.displayCallback,l=s.scrollX*e.scrollFactorX,u=s.scrollY*e.scrollFactorY,c=e.fontData.chars,d=e.fontData.lineHeight,f=0,p=0,g=0,v=0,y=null,m=0,x=0,b=0,w=0,T=0,S=0,A=null,C=0,M=t.currentContext,E=e.frame.source.image,_=a.cutX,P=a.cutY,L=0,k=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,M.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,M.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),M.save(),M.translate(e.x,e.y),M.rotate(e.rotation),M.translate(-e.displayOriginX,-e.displayOriginY),M.scale(e.scaleX,e.scaleY),e.cropWidth>0&&e.cropHeight>0&&(M.save(),M.beginPath(),M.rect(0,0,e.cropWidth,e.cropHeight),M.clip());for(var F=0;F0&&e.cropHeight>0&&M.restore(),M.restore()}}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(135);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(3),s=i(3);n=i(568),s=i(273),s=i(273),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchGraphics(this,s)}},function(t,e,i){var n=i(3),s=i(3);n=i(570),s=i(571),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t,e,i,n,r){if("object"==typeof t){var o=t;t=s(o,"x",0),e=s(o,"y",0),i=s(o,"power",0),n=s(o,"epsilon",100),r=s(o,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=50);this.x=t,this.y=e,this.active=!0,this._gravity=r,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i=this.x-t.x,n=this.y-t.y,s=i*i+n*n;if(0!==s){var r=Math.sqrt(s);s0&&this.getParticleCount()===this.maxParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,n=i.length,s=0;s0?n.pop():new this.particleClass(this)).fire(e,i),this.particleBringToTop?this.alive.push(r):this.alive.unshift(r),this.emitCallback&&this.emitCallback.call(this.emitCallbackScope,r,this),this.atLimit())break}return r}},preUpdate:function(t,e){var i=(e*=this.timeScale)/1e3;this.trackVisible&&(this.visible=this.follow.visible);for(var n=this.manager.getProcessors(),s=this.alive,r=s.length,o=0;o0){var u=s.splice(s.length-l,l),c=this.deathCallback,d=this.deathCallbackScope;if(c)for(var f=0;f0&&(this._counter-=e,this._counter<=0&&(this.emitParticle(),this._counter=this.frequency-Math.abs(this._counter))))},depthSortCallback:function(t,e){return t.y-e.y},indexSortCallback:function(t,e){return t.index-e.index}});t.exports=x},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=this.source.contains(t.x,t.y);return e&&this.killOnEnter||!e&&!this.killOnEnter}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===n&&(n=!1),void 0===s&&(s=!0),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=n,this.counter=-1,this.seamless=s,this._length=0,this._direction=0,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e,i){var n=i(0),s=i(275),r=i(71),o=i(2),a=i(50),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t=this.propertyValue,e=typeof t;if("number"===e)this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate;else if(Array.isArray(t))this.onEmit=this.randomStaticValueEmit;else if("function"===e)this.emitOnly?this.onEmit=t:this.onUpdate=t;else if("object"===e&&(this.has(t,"random")||this.hasBoth(t,"start","end")||this.hasBoth(t,"min","max"))){this.start=this.has(t,"start")?t.start:t.min,this.end=this.has(t,"end")?t.end:t.max;var i=this.hasBoth(t,"min","max")||this.has(t,"random");if(i){var n=t.random;Array.isArray(n)&&(this.start=n[0],this.end=n[1]),this.onEmit=this.randomRangedValueEmit}if(this.has(t,"steps"))this.steps=t.steps,this.counter=this.start,this.onEmit=this.steppedEmit;else{var s=this.has(t,"ease")?t.ease:"Linear";this.ease=r(s),i||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate}}else"object"===e&&this.hasEither(t,"onEmit","onUpdate")&&(this.has(t,"onEmit")&&(this.onEmit=t.onEmit),this.has(t,"onUpdate")&&(this.onUpdate=t.onUpdate));return this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(276),s=i(277),r=i(278),o=i(279),a=i(280),h=i(281),l=i(282),u=i(283),c=i(284),d=i(285),f=i(286),p=i(287);t.exports={Power0:l,Power1:u.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:l,Quad:u.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:n.Out,Bounce:s.Out,Stepped:p,"Quad.easeIn":u.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":n.In,"Bounce.easeIn":s.In,"Quad.easeOut":u.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":n.Out,"Bounce.easeOut":s.Out,"Quad.easeInOut":u.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":n.InOut,"Bounce.easeInOut":s.InOut}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},function(t,e){t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},function(t,e){t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},function(t,e){t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},function(t,e){t.exports=function(t){return Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},function(t,e){t.exports=function(t){return t*t*t}},function(t,e){t.exports=function(t){return--t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/i)+1}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*.5+1}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},function(t,e){t.exports=function(t){return 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},function(t,e){t.exports=function(t){return t}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return t*(2-t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},function(t,e){t.exports=function(t){return t*t*t*t}},function(t,e){t.exports=function(t){return 1- --t*t*t*t}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},function(t,e){t.exports=function(t){return t*t*t*t*t}},function(t,e){t.exports=function(t){return--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},function(t,e,i){var n=i(0),s=i(35),r=i(41),o=new n({initialize:function(t){this.emitter=t,this.frame=null,this.index=0,this.x=0,this.y=0,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.scrollFactorX=1,this.scrollFactorY=1,this.tint=4294967295,this.color=4294967295,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215,current:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1}}},isAlive:function(){return this.lifeCurrent>0},fire:function(t,e){var i=this.emitter;this.frame=i.getFrame(),i.emitZone&&i.emitZone.getPoint(this),void 0===t?(i.follow&&(this.x+=i.follow.x+i.followOffset.x),this.x+=i.x.onEmit(this,"x")):this.x+=t,void 0===e?(i.follow&&(this.y+=i.follow.y+i.followOffset.y),this.y+=i.y.onEmit(this,"y")):this.y+=e,this.life=i.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0;var n=i.speedX.onEmit(this,"speedX"),o=i.speedY?i.speedY.onEmit(this,"speedY"):n;if(i.radial){var a=s(i.angle.onEmit(this,"angle"));this.velocityX=Math.cos(a)*Math.abs(n),this.velocityY=Math.sin(a)*Math.abs(o)}else if(i.moveTo){var h=i.moveToX.onEmit(this,"moveToX"),l=i.moveToY?i.moveToY.onEmit(this,"moveToY"):h,u=Math.atan2(l-this.y,h-this.x),c=r(this.x,this.y,h,l)/(this.life/1e3);this.velocityX=Math.cos(u)*c,this.velocityY=Math.sin(u)*c}else this.velocityX=n,this.velocityY=o;i.acceleration&&(this.accelerationX=i.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=i.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=i.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=i.maxVelocityY.onEmit(this,"maxVelocityY"),this.delayCurrent=i.delay.onEmit(this,"delay"),this.scaleX=i.scaleX.onEmit(this,"scaleX"),this.scaleY=i.scaleY?i.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=i.rotate.onEmit(this,"rotate"),this.rotation=s(this.angle),this.bounce=i.bounce.onEmit(this,"bounce"),this.alpha=i.alpha.onEmit(this,"alpha"),this.tint=i.tint.onEmit(this,"tint"),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.index=i.alive.length},computeVelocity:function(t,e,i,n){var s=this.velocityX,r=this.velocityY,o=this.accelerationX,a=this.accelerationY,h=this.maxVelocityX,l=this.maxVelocityY;s+=t.gravityX*i,r+=t.gravityY*i,o&&(s+=o*i),a&&(r+=a*i),s>h?s=h:s<-h&&(s=-h),r>l?r=l:r<-l&&(r=-l),this.velocityX=s,this.velocityY=r;for(var u=0;ue.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(this.delayCurrent>0)return this.delayCurrent-=t,!1;var n=this.emitter,r=1-this.lifeCurrent/this.life;return this.lifeT=r,this.computeVelocity(n,t,e,i),this.x+=this.velocityX*e,this.y+=this.velocityY*e,n.bounds&&this.checkBounds(n),n.deathZone&&n.deathZone.willKill(this)?(this.lifeCurrent=0,!0):(this.scaleX=n.scaleX.onUpdate(this,"scaleX",r,this.scaleX),n.scaleY?this.scaleY=n.scaleY.onUpdate(this,"scaleY",r,this.scaleY):this.scaleY=this.scaleX,this.angle=n.rotate.onUpdate(this,"rotate",r,this.angle),this.rotation=s(this.angle),this.alpha=n.alpha.onUpdate(this,"alpha",r,this.alpha),this.tint=n.tint.onUpdate(this,"tint",r,this.tint),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(6),r=new n({initialize:function(t){this.source=t,this._tempVec=new s},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},function(t,e,i){var n=i(3),s=i(3);n=i(613),s=i(614),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){0===e.emitters.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.drawEmitterManager(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.emitters.list;if(!(0===r.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id))for(var o=0;o>24&255)/255;if(!(v<=0)){var y=g.frame,m=.5*y.width,x=.5*y.height,b=y.canvasData,w=-m,T=-x;u.globalAlpha=v,u.save(),u.translate(g.x-d*g.scrollFactorX,g.y-f*g.scrollFactorY),u.rotate(g.rotation),u.scale(g.scaleX,g.scaleY),u.drawImage(y.source.image,b.sx,b.sy,b.sWidth,b.sHeight,w,T,b.dWidth,b.dHeight),u.restore()}}u.globalAlpha=c}}}},function(t,e){t.exports={fill:function(t){return this},clear:function(){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;return t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},draw:function(t,e,i){return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(t,e,i,0,0,t.width,t.height,this.currentMatrix),this.renderer.setFramebuffer(null),this},drawFrame:function(t,e,i,n){return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(t,n.x,n.y,n.width,n.height,t.width,t.height,this.currentMatrix),this.renderer.setFramebuffer(null),this}}},function(t,e,i){var n=i(3),s=i(3);n=i(617),s=i(618),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchTexture(e,e.texture,e.texture.width,e.texture.height,e.x,e.y,e.width,e.height,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,e.texture.width,e.texture.height,4294967295,4294967295,4294967295,4294967295,0,0,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&(e.cameraFilter,s._id)}},function(t,e){t.exports=function(t,e,i){var n=t.canvas,s=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLinesc&&(f=-c),0!==f&&(d+=f>0?f*i.length:f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(3),s=i(3);n=i(621),s=i(622),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text||(e.dirty&&(e.canvasTexture=t.canvasToTexture(e.canvas,e.canvasTexture,!0,e.scaleMode),e.dirty=!1),this.pipeline.batchText(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=e.canvas;r.save(),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.translate(o.width*(e.flipX?1:0),o.height*(e.flipY?1:0)),r.scale(e.flipX?-1:1,e.flipY?-1:1),r.drawImage(o,0,0,o.width,o.height,-e.displayOriginX,-e.displayOriginY,o.width,o.height),r.restore()}}},function(t,e,i){var n=i(0),s=i(10),r=i(4),o=i(624),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new n({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.rtl,this.testString,this._font,this.setStyle(e,!1);var i=r(e,"metrics",!1);this.metrics=i?{ascent:r(i,"ascent",0),descent:r(i,"descent",0),fontSize:r(i,"fontSize",0)}:o(this)},setStyle:function(t,e){void 0===e&&(e=!0),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");for(var i in a)this[i]="wordWrapCallback"===i||"wordWrapCallbackScope"===i?r(t,a[i][0],a[i][1]):s(t,a[i][0],a[i][1]);var n=r(t,"font",null);this._font=null===n?[this.fontStyle,this.fontSize,this.fontFamily].join(" "):n;var o=r(t,"fill",null);return null!==o&&(this.color=o),e&&this.update(!0),this},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" "),this.metrics=o(this)),this.parent.updateText()},setFont:function(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=r(t,"fontFamily","Courier"),this.fontSize=r(t,"fontSize","16px"),this.fontStyle=r(t,"fontStyle","")),this.update(!0)},setFontFamily:function(t){return this.fontFamily=t,this.update(!0)},setFontStyle:function(t){return this.fontStyle=t,this.update(!0)},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.text.width=t),e&&(this.text.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setStroke:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=t,this.strokeThickness=e),this.update(!0)},setShadow:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},function(t,e,i){var n=i(21);t.exports=function(t){var e=n.create(this),i=e.getContext("2d");t.syncFont(e,i);var s=Math.ceil(1.2*i.measureText(t.testString).width),r=s,o=2*r;r=1.4*r|0,e.width=s,e.height=o,i.fillStyle="#f00",i.fillRect(0,0,s,o),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,r);var a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,s,o))return a.ascent=r,a.descent=r+6,a.fontSize=a.ascent+a.descent,n.remove(e),a;var h,l,u=i.getImageData(0,0,s,o).data,c=u.length,d=4*s,f=0,p=!1;for(h=0;hr;h--){for(l=0;l0&&e.cameraFilter&s._id||(e.updateTileTexture(),this.pipeline.batchTileSprite(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext,o=e.frame;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var a=o.x-e.originX*e.width,h=o.y-e.originY*e.height;r.save(),r.translate(a,h),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.fillStyle=e.canvasPattern,r.translate(-this.tilePositionX,-this.tilePositionY),r.fillRect(this.tilePositionX,this.tilePositionY,e.width,e.height),r.restore()}}},function(t,e,i){var n=i(132);i(9).register("blitter",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(133);i(9).register("dynamicBitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(134);i(9).register("graphics",function(t){return this.displayList.add(new n(this.scene,t))})},function(t,e,i){var n=i(69);i(9).register("group",function(t,e){return"object"==typeof t&&void 0===e&&(e=t,t=[]),this.updateList.add(new n(this.scene,t,e))})},function(t,e,i){var n=i(70);i(9).register("image",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(9),s=i(137);n.register("particles",function(t,e,i){var n=new s(this.scene,t,e,i);return this.displayList.add(n),this.updateList.add(n),n})},function(t,e,i){var n=i(9),s=i(289);n.register("follower",function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),this.updateList.add(o),o})},function(t,e,i){var n=i(9),s=i(139);n.register("renderTexture",function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))})},function(t,e,i){var n=i(81);i(9).register("sprite3D",function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o.gameObject),this.updateList.add(o.gameObject),o})},function(t,e,i){var n=i(9),s=i(37);n.register("sprite",function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.displayList.add(r),this.updateList.add(r),r})},function(t,e,i){var n=i(131);i(9).register("bitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(140);i(9).register("text",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(141);i(9).register("tileSprite",function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))})},function(t,e,i){var n=i(77);i(9).register("zone",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(132),s=i(19),r=i(13),o=i(10);r.register("blitter",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new n(this.scene,0,0,e,i);return s(this.scene,r,t),r})},function(t,e,i){var n=i(133),s=i(19),r=i(13),o=i(10);r.register("dynamicBitmapText",function(t){var e=o(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),a=o(t,"align","left"),h=new n(this.scene,0,0,e,i,r,a);return s(this.scene,h,t),h})},function(t,e,i){var n=i(13),s=i(134);n.register("graphics",function(t){return new s(this.scene,t)})},function(t,e,i){var n=i(13),s=i(69);n.register("group",function(t){return new s(this.scene,null,t)})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(70);s.register("image",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=new o(this.scene,0,0,e,i);return n(this.scene,s,t),s})},function(t,e,i){var n=i(13),s=i(10),r=i(2),o=i(137);n.register("particles",function(t){var e=s(t,"key",null),i=s(t,"frame",null),n=r(t,"emitters",null),a=new o(this.scene,e,i,n);return r(t,"add",!1)&&this.displayList.add(a),this.updateList.add(a),a})},function(t,e,i){var n=i(19),s=(i(142),i(13)),r=i(10),o=i(139);s.register("renderTexture",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",32),a=r(t,"height",32),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(19),s=i(142),r=i(13),o=i(10),a=i(81);r.register("sprite3D",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(19),s=i(142),r=i(13),o=i(10),a=i(37);r.register("sprite",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(131),s=i(19),r=i(13),o=i(10),a=i(4);r.register("bitmapText",function(t){var e=a(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),h=new n(this.scene,0,0,e,i,r);return s(this.scene,h,t),h})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(140);s.register("text",function(t){var e=r(t,"text",""),i=r(t,"style",null),s=r(t,"padding",null);null!==s&&(i.padding=s);var a=new o(this.scene,0,0,e,i);return n(this.scene,a,t),a.autoRound=r(t,"autoRound",!0),a.resolution=r(t,"resolution",1),a})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(141);s.register("tileSprite",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",512),a=r(t,"height",512),h=r(t,"key",""),l=r(t,"frame",""),u=new o(this.scene,e,i,s,a,h,l);return n(this.scene,u,t),u})},function(t,e,i){var n=i(13),s=i(10),r=i(77);n.register("zone",function(t){var e=s(t,"x",0),i=s(t,"y",0),n=s(t,"width",1),o=s(t,"height",n);return new r(this.scene,e,i,n,o)})},function(t,e,i){var n=i(3),s=i(3);n=i(656),s=i(657),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchMesh(e,s)}},function(t,e){t.exports=function(){}},function(t,e,i){var n=i(88);i(9).register("mesh",function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))})},function(t,e,i){var n=i(143);i(9).register("quad",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(4),a=i(88);s.register("mesh",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=o(t,"vertices",[]),h=o(t,"colors",[]),l=o(t,"alphas",[]),u=o(t,"uv",[]),c=new a(this.scene,0,0,s,u,h,l,e,i);return n(this.scene,c,t),c})},function(t,e,i){var n=i(19),s=i(13),r=i(10),o=i(143);s.register("quad",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"key",null),a=r(t,"frame",null),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(0),s=i(292),r=i(12),o=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",o,"lights"),t.exports=o},function(t,e,i){var n=i(63);n.Area=i(664),n.Circumference=i(183),n.CircumferencePoint=i(104),n.Clone=i(665),n.Contains=i(32),n.ContainsPoint=i(666),n.ContainsRect=i(667),n.CopyFrom=i(668),n.Equals=i(669),n.GetBounds=i(670),n.GetPoint=i(181),n.GetPoints=i(182),n.Offset=i(671),n.OffsetPoint=i(672),n.Random=i(105),t.exports=n},function(t,e){t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},function(t,e,i){var n=i(63);t.exports=function(t){return new n(t.x,t.y,t.radius)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(41);t.exports=function(t,e){return n(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},function(t,e){t.exports=function(t,e){var i=e.width/2,n=e.height/2,s=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-n),o=i+t.radius,a=n+t.radius;if(s>o||r>a)return!1;if(s<=i||r<=n)return!0;var h=s-i,l=r-n;return h*h+l*l<=t.radius*t.radius}},function(t,e,i){var n=i(8),s=i(295);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},function(t,e){t.exports=function(t,e){var i=t.x1,n=t.y1,s=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,l=e.bottom,u=0;if(i>=o&&i<=h&&n>=a&&n<=l||s>=o&&s<=h&&r>=a&&r<=l)return!0;if(i=o){if((u=n+(r-n)*(o-i)/(s-i))>a&&u<=l)return!0}else if(i>h&&s<=h&&(u=n+(r-n)*(h-i)/(s-i))>=a&&u<=l)return!0;if(n=a){if((u=i+(s-i)*(a-n)/(r-n))>=o&&u<=h)return!0}else if(n>l&&r<=l&&(u=i+(s-i)*(l-n)/(r-n))>=o&&u<=h)return!0;return!1}},function(t,e,i){var n=i(297);t.exports=function(t,e){if(!n(t,e))return!1;var i=Math.min(e.x1,e.x2),s=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=s&&t.y>=r&&t.y<=o}},function(t,e,i){var n=i(89),s=i(33),r=i(144),o=i(298);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||se.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(300);n.Angle=i(54),n.BresenhamPoints=i(191),n.CenterOn=i(684),n.Clone=i(685),n.CopyFrom=i(686),n.Equals=i(687),n.GetMidPoint=i(688),n.GetNormal=i(689),n.GetPoint=i(301),n.GetPoints=i(108),n.Height=i(690),n.Length=i(65),n.NormalAngle=i(302),n.NormalX=i(691),n.NormalY=i(692),n.Offset=i(693),n.PerpSlope=i(694),n.Random=i(110),n.ReflectAngle=i(695),n.Rotate=i(696),n.RotateAroundPoint=i(697),n.RotateAroundXY=i(145),n.SetToAngle=i(698),n.Slope=i(699),n.Width=i(700),t.exports=n},function(t,e){t.exports=function(t,e,i){var n=e-(t.x1+t.x2)/2,s=i-(t.y1+t.y2)/2;return t.x1+=n,t.y1+=s,t.x2+=n,t.y2+=s,t}},function(t,e,i){var n=i(300);t.exports=function(t){return new n(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},function(t,e,i){var n=i(16),s=i(54),r=i(5);t.exports=function(t,e){void 0===e&&(e=new r);var i=s(t)-n.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},function(t,e){t.exports=function(t){return Math.abs(t.y1-t.y2)}},function(t,e,i){var n=i(16),s=i(54);t.exports=function(t){return Math.cos(s(t)-n.TAU)}},function(t,e,i){var n=i(16),s=i(54);t.exports=function(t){return Math.sin(s(t)-n.TAU)}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},function(t,e){t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},function(t,e,i){var n=i(54),s=i(302);t.exports=function(t,e){return 2*s(e)-Math.PI-n(t)}},function(t,e,i){var n=i(145);t.exports=function(t,e){var i=(t.x1+t.x2)/2,s=(t.y1+t.y2)/2;return n(t,i,s,e)}},function(t,e,i){var n=i(145);t.exports=function(t,e,i){return n(t,e.x,e.y,i)}},function(t,e){t.exports=function(t,e,i,n,s){return t.x1=e,t.y1=i,t.x2=e+Math.cos(n)*s,t.y2=i+Math.sin(n)*s,t}},function(t,e){t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},function(t,e){t.exports=function(t){return Math.abs(t.x1-t.x2)}},function(t,e,i){var n=i(5);n.Ceil=i(702),n.Clone=i(703),n.CopyFrom=i(704),n.Equals=i(705),n.Floor=i(706),n.GetCentroid=i(707),n.GetMagnitude=i(303),n.GetMagnitudeSq=i(304),n.GetRectangleFromPoints=i(708),n.Interpolate=i(709),n.Invert=i(710),n.Negative=i(711),n.Project=i(712),n.ProjectUnit=i(713),n.SetMagnitude=i(714),t.exports=n},function(t,e){t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t){return new n(t.x,t.y)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},function(t,e){t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t,e){if(void 0===e&&(e=new n),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var s=0;si&&(i=h.x),h.xr&&(r=h.y),h.yt.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottomn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var n=i(307);t.exports=function(t,e,i){var s=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),n(t,s,r)}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var n=i(5),s=i(35);t.exports=function(t,e,i){void 0===i&&(i=new n),e=s(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._list=s.concat(e.splice(0))}},clear:function(t){var e=t.input;return e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,t.input=null,t},disable:function(t){t.input.enabled=!1},enable:function(t,e,i){return t.input?t.input.enabled=!0:this.setHitArea(t,e,i),this},hitTestPointer:function(t){var e=this.cameras.getCameraBelowPointer(t);return e?(t.camera=e,this.manager.hitTest(t.x,t.y,this._list,e)):[]},processDownEvents:function(t){var e=this._temp;this.emit("pointerdown",t,e);for(var i=0,n=0;n0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var l=[];for(i=0;i1&&(this.sortGameObjects(l),this.topOnly&&l.splice(1)),this._drag[t.id]=l,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&o(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&(t.dragState=3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&(t.dragState=3)),3!==t.dragState){if(4===t.dragState&&t.justMoved){var u=[];for(n=0;n0?(s.emit("dragleave",t,a.target),this.emit("dragleave",t,s,a.target),a.target=u[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target)):(s.emit("dragleave",t,a.target),this.emit("dragleave",t,s,a.target),u[0]?(a.target=u[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target)):a.target=null)}else!a.target&&u[0]&&(a.target=u[0],s.emit("dragenter",t,a.target),this.emit("dragenter",t,s,a.target));var d=t.x-s.input.dragX,f=t.y-s.input.dragY;s.emit("drag",t,d,f),this.emit("drag",t,s,d,f)}}if(5===t.dragState){for(r=this._drag[t.id],i=0;i0}for(r=this._drag[t.id],i=0;i0)for(this.sortGameObjects(s),this.emit("pointerout",t,s),e=0;e0)for(this.sortGameObjects(r),this.emit("pointerover",t,r),e=0;e-1&&this._draggable.splice(s,1)}return this},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);for(var n=0;nn?-1:0},sortHandlerIO:function(t,e){var i=this.displayList.getIndex(t.gameObject),n=this.displayList.getIndex(e.gameObject);return in?-1:0},sortInteractiveObjects:function(t){return t.length<2?t:(this.scene.sys.depthSort(),t.sort(this.sortHandlerIO.bind(this)))},stopPropagation:function(){return this.manager.globalTopOnly&&(this.manager.ignoreEvents=!0),this},update:function(t,e){var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.activePointer,s=n.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(s=!0,this._pollTimer=this.pollRate)),s){this._temp=this.hitTestPointer(n),this.sortGameObjects(this._temp),this.topOnly&&this._temp.length&&this._temp.splice(1);var r=this.processDragEvents(n,t);n.wasTouch||(r+=this.processOverOutEvents(n)),n.justDown&&(r+=this.processDownEvents(n)),n.justUp&&this.processUpEvents(n),n.justMoved&&(r+=this.processMoveEvents(n)),r>0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}},shutdown:function(){this._temp.length=0,this._list.length=0,this._draggable.length=0,this._pendingRemoval.length=0,this._pendingInsertion.length=0;for(var t=0;t<10;t++)this._drag[t]=[],this._over[t]=[];this.removeAllListeners()},destroy:function(){this.shutdown(),this.scene=void 0,this.cameras=void 0,this.manager=void 0,this.events=void 0,this.keyboard=void 0,this.mouse=void 0,this.gamepad=void 0},activePointer:{get:function(){return this.manager.activePointer}},x:{get:function(){return this.manager.activePointer.x}},y:{get:function(){return this.manager.activePointer.y}}});c.register("InputPlugin",v,"input"),t.exports=v},function(t,e,i){t.exports={KeyboardManager:i(244),Key:i(245),KeyCodes:i(128),KeyCombo:i(246),JustDown:i(767),JustUp:i(768),DownDuration:i(769),UpDuration:i(770)}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justDown,t._justDown=!1),e}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justUp,t._justUp=!1),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=50),t.isDown&&t.duration'),n.push(''),n.push(''),n.push(this.xhrLoader.responseText),n.push(""),n.push(""),n.push("");var o=[n.join("\n")],a=this;try{var h=new window.Blob(o,{type:"image/svg+xml;charset=utf-8"})}catch(e){return a.state=s.FILE_ERRORED,void t(a)}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(a.data),a.onComplete(),t(a)},this.data.onerror=function(){r.revokeObjectURL(a.data),a.state=s.FILE_ERRORED,t(a)},r.createObjectURL(this.data,h,"image/svg+xml")}});o.register("html",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0?this.processLoadQueue():0===this.inflight.size&&this.finishedLoading()},finishedLoading:function(){this.state!==s.LOADER_PROCESSING&&(this.progress=1,this.state=s.LOADER_PROCESSING,this.storage.clear(),0===this.queue.size?this.processComplete():this.queue.each(function(t){t.onProcess(this.processUpdate.bind(this))},this))},processUpdate:function(t){if(t.state===s.FILE_ERRORED)return this.failed.set(t),t.linkFile&&this.queue.delete(t.linkFile),this.removeFromQueue(t);t.linkFile?t.state===s.FILE_COMPLETE&&t.linkFile.state===s.FILE_COMPLETE&&(this.storage.set({type:t.linkType,fileA:t,fileB:t.linkFile}),this.queue.delete(t.linkFile),this.removeFromQueue(t)):(this.storage.set(t),this.removeFromQueue(t))},removeFromQueue:function(t){this.queue.delete(t),0===this.queue.size&&this.state===s.LOADER_PROCESSING&&this.processComplete()},processComplete:function(){this.list.clear(),this.inflight.clear(),this.queue.clear(),this.processCallback(),this.state=s.LOADER_COMPLETE,this.emit("complete",this,this.storage.size,this.failed.size)},processCallback:function(){if(0!==this.storage.size){var t,e,i,n=this.scene.sys.cache,s=this.scene.sys.textures,r=this.scene.sys.anims;for(var o in this._multilist){for(var a=[],h=[],u=this._multilist[o],c=0;c0},file:function(t){var e,i=t.key;switch(t.type){case"spritesheet":e=this.spritesheet(i,t.url,t.config,t.xhrSettings);break;case"atlas":e=this.atlas(i,t.textureURL,t.atlasURL,t.textureXhrSettings,t.atlasXhrSettings);break;case"bitmapFont":e=this.bitmapFont(i,t.textureURL,t.xmlURL,t.textureXhrSettings,t.xmlXhrSettings);break;case"multiatlas":e=this.multiatlas(i,t.textureURLs,t.atlasURLs,t.textureXhrSettings,t.atlasXhrSettings);break;case"audioSprite":e=this.audioSprite(i,t.urls,t.json,t.config,t.audioXhrSettings,t.jsonXhrSettings);break;default:e=this[t.type](i,t.url,t.xhrSettings)}return e},shutdown:function(){this.reset(),this.state=s.LOADER_SHUTDOWN},destroy:function(){this.reset(),this.state=s.LOADER_DESTROYED}});u.register("Loader",d,"load"),t.exports=d},function(t,e,i){var n=i(16),s=i(23),r={Angle:i(792),Distance:i(800),Easing:i(803),Fuzzy:i(804),Interpolation:i(810),Pow2:i(813),Snap:i(815),Average:i(819),Bernstein:i(321),Between:i(228),CatmullRom:i(122),CeilTo:i(820),Clamp:i(60),DegToRad:i(35),Difference:i(821),Factorial:i(322),FloatBetween:i(275),FloorTo:i(822),FromPercent:i(64),GetSpeed:i(823),IsEven:i(824),IsEvenStrict:i(825),Linear:i(227),MaxAdd:i(826),MinSub:i(827),Percent:i(828),RadToDeg:i(218),RandomXY:i(829),RandomXYZ:i(206),RandomXYZW:i(207),Rotate:i(323),RotateAround:i(185),RotateAroundDistance:i(112),RoundAwayFromZero:i(324),RoundTo:i(830),SinCosTableGenerator:i(831),SmootherStep:i(192),SmoothStep:i(193),TransformXY:i(250),Within:i(832),Wrap:i(50),Vector2:i(6),Vector3:i(51),Vector4:i(119),Matrix3:i(210),Matrix4:i(118),Quaternion:i(209),RotateVec3:i(208)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Between:i(793),BetweenY:i(794),BetweenPoints:i(795),BetweenPointsY:i(796),Reverse:i(797),RotateTo:i(798),ShortestBetween:i(799),Normalize:i(320),Wrap:i(162),WrapDegrees:i(163)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(i-t,n-e)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},function(t,e,i){var n=i(320);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(16);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e?t:(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:ee-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t1?t[i]-(n(s-i,t[i],t[i],t[i-1],t[i-1])-t[i]):n(s-r,t[r?r-1:0],t[r],t[i0&&0==(t&t-1)}},function(t,e,i){t.exports={Ceil:i(816),Floor:i(817),To:i(818)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.ceil(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.floor(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.round(t/e)))}},function(t,e){t.exports=function(t){for(var e=0,i=0;i1?void 0!==n?(s=(n-t)/(n-i))<0&&(s=0):s=1:s<0&&(s=0),s}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var n=Math.pow(i,-e);return Math.round(t*n)/n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),n*=Math.PI/t;for(var s=[],r=[],o=0;o=0;o--){var a=e[o],h=l(s,r,a.x,a.y);h=0;o--){var a=e[o],h=l(s,r,a.x,a.y);h>i&&(n=a,i=h)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=l(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},moveToObject:function(t,e,i,n){return this.moveTo(t,e.x,e.y,i,n)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(u(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(t,e)},shutdown:function(){this.world.shutdown()},destroy:function(){this.world.destroy()}});a.register("ArcadePhysics",c,"arcadePhysics"),t.exports=c},function(t,e){t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},function(t,e){t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},function(t,e){t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t){return this.body.collideWorldBounds=t,this}}},function(t,e){t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},function(t,e){t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this}}},function(t,e){var i={enableBody:function(t,e,i,n,s){return t&&this.body.reset(e,i),n&&(this.body.gameObject.active=!0),s&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}};t.exports=i},function(t,e){t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},function(t,e){t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},function(t,e){var i={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}};t.exports=i},function(t,e){t.exports={setMass:function(t){return this.body.mass=t,this}}},function(t,e){t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},function(t,e){var i={setVelocity:function(t,e){return this.body.velocity.set(t,e),this},setVelocityX:function(t){return this.body.velocity.x=t,this},setVelocityY:function(t){return this.body.velocity.y=t,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.body.maxVelocity.set(t,e),this}};t.exports=i},function(t,e){t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},function(t,e,i){var n=i(849),s=i(851),r=i(338);t.exports=function(t,e,i,o,a,h){var l=o.left,u=o.top,c=o.right,d=o.bottom,f=i.faceLeft||i.faceRight,p=i.faceTop||i.faceBottom;if(!f&&!p)return!1;var g=0,v=0,y=0,m=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right>i&&(o=t.right-i)>r&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.left=!0:e>0&&(t.blocked.right=!0),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},function(t,e,i){var n=i(852);t.exports=function(t,e,i,s,r){var o=0;return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom>i&&(o=t.bottom-i)>r&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.up=!0:e>0&&(t.blocked.down=!0),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},function(t,e,i){var n=i(333);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.x,a=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=r,e.velocity.x=o-a*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=r,t.velocity.x=a-o*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{r*=.5,t.x-=r,e.x+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),l=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),u=.5*(h+l);h-=u,l-=u,t.velocity.x=u+h*t.bounce.x,e.velocity.x=u+l*e.bounce.x}return!0}},function(t,e,i){var n=i(334);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.y,a=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=r,e.velocity.y=o-a*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=r,t.velocity.y=a-o*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{r*=.5,t.y-=r,e.y+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),l=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),u=.5*(h+l);h-=u,l-=u,t.velocity.y=u+h*t.bounce.y,e.velocity.y=u+l*e.bounce.y}return!0}},function(t,e,i){t.exports={Acceleration:i(961),BodyScale:i(962),BodyType:i(963),Bounce:i(964),CheckAgainst:i(965),Collides:i(966),Debug:i(967),Friction:i(968),Gravity:i(969),Offset:i(970),SetGameObject:i(971),Velocity:i(972)}},function(t,e,i){var n={};t.exports=n;var s=i(94),r=i(38);n.fromVertices=function(t){for(var e={},i=0;i0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}},setFromTileRectangle:function(t){void 0===t&&(t={}),h(t,"isStatic")||(t.isStatic=!0),h(t,"addToWorld")||(t.addToWorld=!0);var e=this.tile.getBounds(),i=e.x+e.width/2,s=e.y+e.height/2,r=n.rectangle(i,s,e.width,e.height,t);return this.setBody(r,t.addToWorld),this},setFromTileCollision:function(t){void 0===t&&(t={}),h(t,"isStatic")||(t.isStatic=!0),h(t,"addToWorld")||(t.addToWorld=!0);for(var e=this.tile.tilemapLayer.scaleX,i=this.tile.tilemapLayer.scaleY,r=this.tile.getLeft(),o=this.tile.getTop(),u=this.tile.getCollisionGroup(),c=a(u,"objects",[]),d=[],f=0;f1&&(t.parts=d,this.setBody(s.create(t),t.addToWorld)),this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(860),r=i(365),o=i(95);n.collisions=function(t,e){for(var i=[],a=e.pairs.table,h=e.metrics,l=0;l1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n={};t.exports=n;var s=i(93),r=i(94);!function(){n.collides=function(e,n,o){var a,h,l,u,c=!1;if(o){var d=e.parent,f=n.parent,p=d.speed*d.speed+d.angularSpeed*d.angularSpeed+f.speed*f.speed+f.angularSpeed*f.angularSpeed;c=o&&o.collided&&p<.2,u=o}else u={collided:!1,bodyA:e,bodyB:n};if(o&&c){var g=u.axisBody,v=g===e?n:e,y=[g.axes[o.axisNumber]];if(l=t(g.vertices,v.vertices,y),u.reused=!0,l.overlap<=0)return u.collided=!1,u}else{if((a=t(e.vertices,n.vertices,e.axes)).overlap<=0)return u.collided=!1,u;if((h=t(n.vertices,e.vertices,n.axes)).overlap<=0)return u.collided=!1,u;a.overlaps?s=a:a=0?o.index-1:u.length-1],l.x=s.x-c.x,l.y=s.y-c.y,h=-r.dot(i,l),a=s,s=u[(o.index+1)%u.length],l.x=s.x-c.x,l.y=s.y-c.y,(n=-r.dot(i,l))r?(s.warn("Plugin.register:",n.toString(e),"was upgraded to",n.toString(t)),n._registry[t.name]=t):i-1},n.isFor=function(t,e){var i=t.for&&n.dependencyParse(t.for);return!t.for||e.name===i.name&&n.versionSatisfies(e.version,i.range)},n.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var i=n.dependencies(t),r=s.topologicalSort(i),o=[],a=0;a0&&!h.silent&&s.info(o.join(" "))}else s.warn("Plugin.use:",n.toString(t),"does not specify any dependencies to install.")},n.dependencies=function(t,e){var i=n.dependencyParse(t),r=i.name;if(!(r in(e=e||{}))){t=n.resolve(t)||t,e[r]=s.map(t.uses||[],function(e){n.isPlugin(e)&&n.register(e);var r=n.dependencyParse(e),o=n.resolve(e);return o&&!n.versionSatisfies(o.version,r.range)?(s.warn("Plugin.dependencies:",n.toString(o),"does not satisfy",n.toString(r),"used by",n.toString(i)+"."),o._warned=!0,t._warned=!0):o||(s.warn("Plugin.dependencies:",n.toString(e),"used by",n.toString(i),"could not be resolved."),t._warned=!0),r.name});for(var o=0;o=s[2];if("^"===i.operator)return s[0]>0?o[0]===s[0]&&r.number>=i.number:s[1]>0?o[1]===s[1]&&o[2]>=s[2]:o[2]===s[2]}return t===e||"*"===t}},function(t,e,i){var n={};t.exports=n;var s=i(151),r=(i(165),i(38));n.create=function(t){var e=s.create(),i={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(e,i,t)}},function(t,e,i){t.exports={SceneManager:i(251),ScenePlugin:i(865),Settings:i(254),Systems:i(129)}},function(t,e,i){var n=i(0),s=i(83),r=i(12),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},start:function(t,e){return void 0===t&&(t=this.key),t!==this.key&&(this.settings.status!==s.RUNNING?(this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t)):(this.manager.stop(this.key),this.manager.start(t,e))),this},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("start",t):this.manager.start(t,e)),this},pause:function(t){return void 0===t&&(t=this.key),this.manager.pause(t),this},resume:function(t){return void 0===t&&(t=this.key),this.manager.resume(t),this},sleep:function(t){return void 0===t&&(t=this.key),this.manager.sleep(t),this},wake:function(t){return void 0===t&&(t=this.key),this.manager.wake(t),this},switch:function(t){return t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("switch",this.key,t):this.manager.switch(this.key,t)),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.stop(t),this},setActive:function(t){return this.settings.active=t,this},setVisible:function(t){return this.settings.visible=t,this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t){return t&&t!==this.key&&this.manager.swapPosition(this.key,t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},shutdown:function(){},destroy:function(){}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={SoundManagerCreator:i(255),BaseSound:i(85),BaseSoundManager:i(84),WebAudioSound:i(261),WebAudioSoundManager:i(260),HTML5AudioSound:i(257),HTML5AudioSoundManager:i(256),NoAudioSound:i(259),NoAudioSoundManager:i(258)}},function(t,e,i){t.exports={List:i(86),Map:i(113),ProcessQueue:i(335),RTree:i(336),Set:i(61)}},function(t,e,i){t.exports={Parsers:i(263),FilterMode:i(869),Frame:i(130),Texture:i(264),TextureManager:i(262),TextureSource:i(265)}},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(96),Parsers:i(900),Formats:i(20),ImageCollection:i(350),ParseToTilemap:i(156),Tile:i(44),Tilemap:i(354),TilemapCreator:i(917),TilemapFactory:i(918),Tileset:i(100),LayerData:i(75),MapData:i(76),ObjectLayer:i(352),DynamicTilemapLayer:i(355),StaticTilemapLayer:i(356)}},function(t,e,i){var n=i(15),s=i(34);t.exports=function(t,e,i,r,o,a,h,l){t<0&&(t=0),e<0&&(e=0),void 0===h&&(h=!0);for(var u=n(t,e,i,r,null,l),c=o-t,d=a-e,f=0;f=0&&p=0&&g-c&&y>-d&&v=0;r--)for(s=n.width-1;s>=0;s--)if((o=n.data[r][s])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;re)){for(var h=t;h<=e;h++)r(h,i,a);for(var l=0;l=t&&c.index<=e&&n(c,i)}o&&s(0,0,a.width,a.height,a)}}},function(t,e,i){var n=i(43),s=i(34),r=i(154);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e){t.exports=function(t,e,i,n){if("number"==typeof t)n.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var s=0,r=t.length;s0){var y=new a(u,v.gid,c,f.length,t.tilewidth,t.tileheight);y.rotation=v.rotation,y.flipX=v.flipped,d.push(y)}else{var m=e?null:new a(u,-1,c,f.length,t.tilewidth,t.tileheight);d.push(m)}++c===l.width&&(f.push(d),c=0,d=[])}u.data=f,i.push(u)}}return i}},function(t,e){t.exports=function(t){for(var e=window.atob(t),i=e.length,n=new Array(i),s=0;s>>0;return n}},function(t,e,i){var n=i(2);t.exports=function(t){for(var e=[],i=0;i-1?new s(a,f,c,u,o.tilesize,o.tilesize):e?null:new s(a,-1,c,u,o.tilesize,o.tilesize),h.push(d)}l.push(h),h=[]}a.data=l,i.push(a)}return i}},function(t,e,i){var n=i(100);t.exports=function(t){for(var e=[],i=[],s=0;s0&&e.cameraFilter&s._id||(e.cull(s),this.pipeline.batchDynamicTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=r.length,a=e.tileset.image.getSourceImage(),h=this.tileset,l=e.x-s.scrollX*e.scrollFactorX,u=e.y-s.scrollY*e.scrollFactorY,c=t.gameContext;c.save(),c.translate(l,u),c.rotate(e.rotation),c.scale(e.scaleX,e.scaleY),c.scale(e.flipX?-1:1,e.flipY?-1:1);for(var d=0;d0&&e.cameraFilter&s._id||(e.upload(s),this.pipeline.drawStaticTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=this.tileset,a=t.gameContext,h=r.length,l=o.image.getSourceImage(),u=e.x-s.scrollX*e.scrollFactorX,c=e.y-s.scrollY*e.scrollFactorY;a.save(),a.translate(u,c),a.rotate(e.rotation),a.scale(e.scaleX,e.scaleY),a.scale(e.flipX?-1:1,e.flipY?-1:1),a.globalAlpha=e.alpha;for(var d=0;d-1&&this._active.splice(s,1),n.destroy()}for(i=0;i=n.delay)){var s=n.elapsed-n.delay;n.elapsed=n.delay,!n.hasDispatched&&n.callback&&(n.hasDispatched=!0,n.callback.apply(n.callbackScope,n.args)),n.repeatCount>0?(n.repeatCount--,n.elapsed=s,n.hasDispatched=!1):this._pendingRemoval.push(n)}}}},shutdown:function(){var t;for(t=0;t=t.pos.x+t.size.x||this.pos.x+this.size.x<=t.pos.x||this.pos.y>=t.pos.y+t.size.y||this.pos.y+this.size.y<=t.pos.y)},resetSize:function(t,e,i,n){return this.pos.x=t,this.pos.y=e,this.size.x=i,this.size.y=n,this},toJSON:function(){return{name:this.name,size:{x:this.size.x,y:this.size.y},pos:{x:this.pos.x,y:this.pos.y},vel:{x:this.vel.x,y:this.vel.y},accel:{x:this.accel.x,y:this.accel.y},friction:{x:this.friction.x,y:this.friction.y},maxVel:{x:this.maxVel.x,y:this.maxVel.y},gravityFactor:this.gravityFactor,bounciness:this.bounciness,minBounceVelocity:this.minBounceVelocity,type:this.type,checkAgainst:this.checkAgainst,collides:this.collides}},fromJSON:function(){},check:function(){},collideWith:function(t,e){this.parent&&this.parent._collideCallback&&this.parent._collideCallback.call(this.parent._callbackScope,this,t,e)},handleMovementTrace:function(){return!0},destroy:function(){this.world.remove(this),this.enabled=!1,this.world=null,this.gameObject=null,this.parent=null}});t.exports=h},function(t,e,i){var n=i(0),s=i(960),r=new n({initialize:function(t,e){void 0===t&&(t=32),this.tilesize=t,this.data=Array.isArray(e)?e:[],this.width=Array.isArray(e)?e[0].length:0,this.height=Array.isArray(e)?e.length:0,this.lastSlope=55,this.tiledef=s},trace:function(t,e,i,n,s,r){var o={collision:{x:!1,y:!1,slope:!1},pos:{x:t+i,y:e+n},tile:{x:0,y:0}};if(!this.data)return o;var a=Math.ceil(Math.max(Math.abs(i),Math.abs(n))/this.tilesize);if(a>1)for(var h=i/a,l=n/a,u=0;u0?r:0,y=n<0?f:0,m=Math.max(Math.floor(i/f),0),x=Math.min(Math.ceil((i+o)/f),g);u=Math.floor((t.pos.x+v)/f);var b=Math.floor((e+v)/f);if((l>0||u===b||b<0||b>=p)&&(b=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,b,c));c++)if(1===(d=this.data[c][u])||d>this.lastSlope||d>1&&this.checkDef(t,d,e,i,a,h,r,o,u,c)){if(d>1&&d<=this.lastSlope&&t.collision.slope)break;t.collision.x=!0,t.tile.x=d,t.pos.x=u*f-v+y,e=t.pos.x,a=0;break}}if(s){var w=s>0?o:0,T=s<0?f:0,S=Math.max(Math.floor(t.pos.x/f),0),A=Math.min(Math.ceil((t.pos.x+r)/f),p);c=Math.floor((t.pos.y+w)/f);var C=Math.floor((i+w)/f);if((l>0||c===C||C<0||C>=g)&&(C=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,C));u++)if(1===(d=this.data[c][u])||d>this.lastSlope||d>1&&this.checkDef(t,d,e,i,a,h,r,o,u,c)){if(d>1&&d<=this.lastSlope&&t.collision.slope)break;t.collision.y=!0,t.tile.y=d,t.pos.y=c*f-w+T;break}}},checkDef:function(t,e,i,n,s,r,o,a,h,l){var u=this.tiledef[e];if(!u)return!1;var c=this.tilesize,d=(h+u[0])*c,f=(l+u[1])*c,p=(u[2]-u[0])*c,g=(u[3]-u[1])*c,v=u[4],y=i+s+(g<0?o:0)-d,m=n+r+(p>0?a:0)-f;if(p*m-g*y>0){if(s*-g+r*p<0)return v;var x=Math.sqrt(p*p+g*g),b=g/x,w=-p/x,T=y*b+m*w,S=b*T,A=w*T;return S*S+A*A>=s*s+r*r?v||p*(m-r)-g*(y-s)<.5:(t.pos.x=i+s-S,t.pos.y=n+r-A,t.collision.slope={x:p,y:g,nx:b,ny:w},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(940),r=i(941),o=i(942),a=new n({initialize:function(t){this.world=t,this.sys=t.scene.sys},body:function(t,e,i,n){return new s(this.world,t,e,i,n)},existing:function(t){var e=t.x-t.frame.centerX,i=t.y-t.frame.centerY,n=t.width,s=t.height;return t.body=this.world.create(e,i,n,s),t.body.parent=t,t.body.gameObject=t,t},image:function(t,e,i,n){var s=new r(this.world,t,e,i,n);return this.sys.displayList.add(s),s},sprite:function(t,e,i,n){var s=new o(this.world,t,e,i,n);return this.sys.displayList.add(s),this.sys.updateList.add(s),s}});t.exports=a},function(t,e,i){var n=i(0),s=i(855),r=new n({Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){this.body=t.create(e,i,n,s),this.body.parent=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=r},function(t,e,i){var n=i(0),s=i(855),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t.scene,e,i,n,s),this.body=t.create(e-this.frame.centerX,i-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=o},function(t,e,i){var n=i(0),s=i(855),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t.scene,e,i,n,s),this.body=t.create(e-this.frame.centerX,i-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=o},function(t,e,i){var n=i(937),s=i(0),r=i(340),o=i(938),a=i(14),h=i(2),l=i(72),u=i(61),c=i(974),d=i(20),f=i(341),p=new s({Extends:a,initialize:function(t,e){a.call(this),this.scene=t,this.bodies=new u,this.gravity=h(e,"gravity",0),this.cellSize=h(e,"cellSize",64),this.collisionMap=new o,this.timeScale=h(e,"timeScale",1),this.maxStep=h(e,"maxStep",.05),this.enabled=!0,this.drawDebug=h(e,"debug",!1),this.debugGraphic;var i=h(e,"maxVelocity",100);if(this.defaults={debugShowBody:h(e,"debugShowBody",!0),debugShowVelocity:h(e,"debugShowVelocity",!0),bodyDebugColor:h(e,"debugBodyColor",16711935),velocityDebugColor:h(e,"debugVelocityColor",65280),maxVelocityX:h(e,"maxVelocityX",i),maxVelocityY:h(e,"maxVelocityY",i),minBounceVelocity:h(e,"minBounceVelocity",40),gravityFactor:h(e,"gravityFactor",1),bounciness:h(e,"bounciness",0)},this.walls={left:null,right:null,top:null,bottom:null},this.delta=0,this._lastId=0,h(e,"setBounds",!1)){var n=e.setBounds;if("boolean"==typeof n)this.setBounds();else{var s=h(n,"x",0),r=h(n,"y",0),l=h(n,"width",t.sys.game.config.width),c=h(n,"height",t.sys.game.config.height),d=h(n,"thickness",64),f=h(n,"left",!0),p=h(n,"right",!0),g=h(n,"top",!0),v=h(n,"bottom",!0);this.setBounds(s,r,l,c,d,f,p,g,v)}}this.drawDebug&&this.createDebugGraphic()},setCollisionMap:function(t,e){if("string"==typeof t){var i=this.scene.cache.tilemap.get(t);if(!i||i.format!==d.WELTMEISTER)return console.warn("The specified key does not correspond to a Weltmeister tilemap: "+t),null;for(var n,s=i.data.layer,r=0;rr.ACTIVE&&c(this,t,e))},setCollidesNever:function(t){for(var e=0;e=0&&h<=1&&l>=0&&l<=1}function s(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function r(t,e,i){return s(t,e,i)>0}function o(t,e,i){return s(t,e,i)>=0}function a(t,e,i){return s(t,e,i)<0}function h(t,e,i){return s(t,e,i)<=0}t.exports={decomp:function(t){var e=function t(e){var i=[],n=[],s=[],r=[];var o=Number.MAX_VALUE;for(var a=0;a0?function t(e,i){if(0===i.length)return[e];if(i instanceof Array&&i.length&&i[0]instanceof Array&&2===i[0].length&&i[0][0]instanceof Array){for(var n=[e],s=0;su)return console.warn("quickDecomp: max level ("+u+") reached."),i;for(var k=0;kA&&(A+=e.length),S=Number.MAX_VALUE,A3&&n>=0;--n)c(f(t,n-1),f(t,n),f(t,n+1),e)&&(t.splice(n%t.length,1),i++);return i},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);r(f(t,e-1),f(t,e),f(t,e+1))||function(t){for(var e=[],i=t.length,n=0;n!==i;n++)e.push(t.pop());for(var n=0;n!==i;n++)t[n]=e[n]}(t)}};var l=[],u=[];function c(t,e,i,n){if(n){var r=l,o=u;r[0]=e[0]-t[0],r[1]=e[1]-t[1],o[0]=i[0]-e[0],o[1]=i[1]-e[1];var a=r[0]*o[0]+r[1]*o[1],h=Math.sqrt(r[0]*r[0]+r[1]*r[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(a/(h*c))g&&(g=m),a.translate(y,{x:.5*x,y:.5*m}),c=y.bounds.max.x+r,s.addBody(u,y),l=y,f+=1}else c+=r}d+=g+o,c=t}return u},n.chain=function(t,e,i,n,a,h){for(var l=t.bodies,u=1;u0)for(l=0;l0&&(d=f[l-1+(h-1)*e],s.addConstraint(t,r.create(o.extend({bodyA:d,bodyB:c},a)))),n&&ld||o<(l=d-l)||o>i-1-l))return 1===c&&a.translate(u,{x:(o+(i%2==1?1:-1))*f,y:0}),h(t+(u?o*f:0)+o*r,n,o,l,u,c)})},n.newtonsCradle=function(t,e,i,n,o){for(var a=s.create({label:"Newtons Cradle"}),l=0;lv.bounds.max.x||b.bounds.max.yv.bounds.max.y)){var w=e(i,b);if(!b.region||w.id!==b.region.id||r){x.broadphaseTests+=1,b.region&&!r||(b.region=w);var T=t(w,b.region);for(d=T.startCol;d<=T.endCol;d++)for(f=T.startRow;f<=T.endRow;f++){p=y[g=a(d,f)];var S=d>=w.startCol&&d<=w.endCol&&f>=w.startRow&&f<=w.endRow,A=d>=b.region.startCol&&d<=b.region.endCol&&f>=b.region.startRow&&f<=b.region.endRow;!S&&A&&A&&p&&u(i,p,b),(b.region===w||S&&!A||r)&&(p||(p=h(y,g)),l(i,p,b))}b.region=w,m=!0}}}m&&(i.pairsList=c(i))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]};var t=function(t,e){var n=Math.min(t.startCol,e.startCol),s=Math.max(t.endCol,e.endCol),r=Math.min(t.startRow,e.startRow),o=Math.max(t.endRow,e.endRow);return i(n,s,r,o)},e=function(t,e){var n=e.bounds,s=Math.floor(n.min.x/t.bucketWidth),r=Math.floor(n.max.x/t.bucketWidth),o=Math.floor(n.min.y/t.bucketHeight),a=Math.floor(n.max.y/t.bucketHeight);return i(s,r,o,a)},i=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},a=function(t,e){return"C"+t+"R"+e},h=function(t,e){return t[e]=[]},l=function(t,e,i){for(var n=0;n0?n.push(i):delete t.pairs[e[s]];return n}}()},function(t,e,i){var n={};t.exports=n;var s=i(365),r=i(38);n.create=function(t){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},n.update=function(t,e,i){var n,r,o,a,h=t.list,l=t.table,u=t.collisionStart,c=t.collisionEnd,d=t.collisionActive;for(u.length=0,c.length=0,d.length=0,a=0;a1e3&&h.push(r);for(r=0;rf.friction*f.frictionStatic*R*i&&(D=k,B=o.clamp(f.friction*F*i,-D,D));var I=r.cross(A,y),Y=r.cross(C,y),z=b/(g.inverseMass+v.inverseMass+g.inverseInertia*I*I+v.inverseInertia*Y*Y);if(O*=z,B*=z,P<0&&P*P>n._restingThresh*i)T.normalImpulse=0;else{var X=T.normalImpulse;T.normalImpulse=Math.min(T.normalImpulse+O,0),O=T.normalImpulse-X}if(L*L>n._restingThreshTangent*i)T.tangentImpulse=0;else{var N=T.tangentImpulse;T.tangentImpulse=o.clamp(T.tangentImpulse+B,-D,D),B=T.tangentImpulse-N}s.x=y.x*O+m.x*B,s.y=y.y*O+m.y*B,g.isStatic||g.isSleeping||(g.positionPrev.x+=s.x*g.inverseMass,g.positionPrev.y+=s.y*g.inverseMass,g.anglePrev+=r.cross(A,s)*g.inverseInertia),v.isStatic||v.isSleeping||(v.positionPrev.x-=s.x*v.inverseMass,v.positionPrev.y-=s.y*v.inverseMass,v.anglePrev-=r.cross(C,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(863),r=i(342),o=i(952),a=i(951),h=i(992),l=i(950),u=i(164),c=i(151),d=i(165),f=i(38),p=i(59);!function(){n.create=function(t,e){e=f.isElement(t)?e:t,t=f.isElement(t)?t:null,e=e||{},(t||e.render)&&f.warn("Engine.create: engine.render is deprecated (see docs)");var i={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:l}},n=f.extend(i,e);return n.world=e.world||s.create(n.world),n.pairs=a.create(),n.broadphase=n.broadphase.controller.create(n.broadphase),n.metrics=n.metrics||{extended:!1},n.metrics=h.create(n.metrics),n},n.update=function(n,s,l){s=s||1e3/60,l=l||1;var f,p=n.world,g=n.timing,v=n.broadphase,y=[];g.timestamp+=s*g.timeScale;var m={timestamp:g.timestamp};u.trigger(n,"beforeUpdate",m);var x=c.allBodies(p),b=c.allConstraints(p);for(h.reset(n.metrics),n.enableSleeping&&r.update(x,g.timeScale),e(x,p.gravity),i(x,s,g.timeScale,l,p.bounds),d.preSolveAll(x),f=0;f0&&u.trigger(n,"collisionStart",{pairs:T.collisionStart}),o.preSolvePosition(T.list),f=0;f0&&u.trigger(n,"collisionActive",{pairs:T.collisionActive}),T.collisionEnd.length>0&&u.trigger(n,"collisionEnd",{pairs:T.collisionEnd}),h.update(n.metrics,n),t(x),u.trigger(n,"afterUpdate",m),n},n.merge=function(t,e){if(f.extend(t,e),e.world){t.world=e.world,n.clear(t);for(var i=c.allBodies(t.world),s=0;s0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionstart",e,i,n)}),c.on(e,"collisionActive",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionactive",e,i,n)}),c.on(e,"collisionEnd",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionend",e,i,n)})},setBounds:function(t,e,i,n,s,r,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===n&&(n=this.scene.sys.game.config.height),void 0===s&&(s=128),void 0===r&&(r=!0),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),this.updateWall(r,"left",t-s,e,s,n),this.updateWall(o,"right",t+i,e,s,n),this.updateWall(a,"top",t,e-s,i,s),this.updateWall(h,"bottom",t,e+n,i,s),this},updateWall:function(t,e,i,n,s,r){var o=this.walls[e];t?(o&&d.remove(this.localWorld,o),i+=s/2,n+=r/2,this.walls[e]=this.create(i,n,s,r,{isStatic:!0,friction:0,frictionStatic:0})):(o&&d.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setZ(Number.MAX_VALUE),this.debugGraphic=t,this.drawDebug=!0,t},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=1),this.localWorld.gravity.x=t,this.localWorld.gravity.y=e,void 0!==i&&(this.localWorld.gravity.scale=i),this},create:function(t,e,i,s,r){var o=n.rectangle(t,e,i,s,r);return d.add(this.localWorld,o),o},add:function(t){return d.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return r.removeBody(this.localWorld,i,e),this},removeConstraint:function(t,e){return r.remove(this.localWorld,t,e),this},convertTilemapLayer:function(t,e){var i=t.layer,n=t.getTilesWithin(0,0,i.width,i.height,{isColliding:!0});return this.convertTiles(n,e),this},convertTiles:function(t,e){if(0===t.length)return this;for(var i=0;i0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e){t.exports=function(t,e){if(t.standing=!1,e.collision.y&&(t.bounciness>0&&Math.abs(t.vel.y)>t.minBounceVelocity?t.vel.y*=-t.bounciness:(t.vel.y>0&&(t.standing=!0),t.vel.y=0)),e.collision.x&&(t.bounciness>0&&Math.abs(t.vel.x)>t.minBounceVelocity?t.vel.x*=-t.bounciness:t.vel.x=0),e.collision.slope){var i=e.collision.slope;if(t.bounciness>0){var n=t.vel.x*i.nx+t.vel.y*i.ny;t.vel.x=(t.vel.x-i.nx*n*2)*t.bounciness,t.vel.y=(t.vel.y-i.ny*n*2)*t.bounciness}else{var s=i.x*i.x+i.y*i.y,r=(t.vel.x*i.x+t.vel.y*i.y)/s;t.vel.x=i.x*r,t.vel.y=i.y*r;var o=Math.atan2(i.x,i.y);o>t.slopeStanding.min&&oi.last.x&&e.last.xi.last.y&&e.last.y0))r=t.collisionMap.trace(e.pos.x,e.pos.y,0,-(e.pos.y+e.size.y-i.pos.y),e.size.x,e.size.y),e.pos.y=r.pos.y,e.bounciness>0&&e.vel.y>e.minBounceVelocity?e.vel.y*=-e.bounciness:(e.standing=!0,e.vel.y=0);else{var l=(e.vel.y-i.vel.y)/2;e.vel.y=-l,i.vel.y=l,s=i.vel.x*t.delta,r=t.collisionMap.trace(e.pos.x,e.pos.y,s,-o/2,e.size.x,e.size.y),e.pos.y=r.pos.y;var u=t.collisionMap.trace(i.pos.x,i.pos.y,0,o/2,i.size.x,i.size.y);i.pos.y=u.pos.y}}},function(t,e,i){t.exports={Factory:i(944),Image:i(947),Matter:i(861),MatterPhysics:i(994),PolyDecomp:i(945),Sprite:i(948),TileBody:i(858),World:i(954)}},function(t,e){t.exports={setBounce:function(t){return this.body.restitution=t,this}}},function(t,e){var i={setCollisionCategory:function(t){return this.body.collisionFilter.category=t,this},setCollisionGroup:function(t){return this.body.collisionFilter.group=t,this},setCollidesWith:function(t){var e=0;if(Array.isArray(t))for(var i=0;i1?1:0;n1;if(!c||t!=c.x||e!=c.y){c&&n?(d=c.x,f=c.y):(d=0,f=0);var s={x:d+t,y:f+e};!n&&c||(c=s),p.push(s),v=d+t,y=f+e}},x=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":v=t.x,y=t.y;break;case"H":v=t.x;break;case"V":y=t.y}m(v,y,t.pathSegType)}};for(t(e),r=e.getTotalLength(),h=[],n=0;n0)for(var a=s+1;ae.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},transformMat3:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},transformMat4:function(t){var e=this.x,i=this.y,n=t.val;return this.x=n[0]*e+n[4]*i+n[12],this.y=n[1]*e+n[5]*i+n[13],this},reset:function(){return this.x=0,this.y=0,this}});n.ZERO=new n,t.exports=n},function(t,e){var i={},n={install:function(t){for(var e in i)t[e]=i[e]},register:function(t,e){i[t]=e},destroy:function(){i={}}};t.exports=n},function(t,e,i){var n=i(0),s=i(33),r=i(107),o=i(185),a=i(108),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(){return{x1:this.x,y1:this.y,x2:this.right,y2:this.y}},getLineB:function(){return{x1:this.right,y1:this.y,x2:this.right,y2:this.bottom}},getLineC:function(){return{x1:this.right,y1:this.bottom,x2:this.x,y2:this.bottom}},getLineD:function(){return{x1:this.x,y1:this.bottom,x2:this.x,y2:this.y}},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.displayList,this.updateList},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList;var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){},destroy:function(){this.scene=null,this.displayList=null,this.updateList=null}});r.register=function(t,e){r.prototype.hasOwnProperty(t)||(r.prototype[t]=e)},s.register("GameObjectFactory",r,"add"),t.exports=r},function(t,e,i){var n=i(16),s=i(4);t.exports=function(t,e,i){var r=s(t,e,null);if(null===r)return i;if(Array.isArray(r))return n.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return n.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return n.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},function(t,e,i){t.exports={Alpha:i(392),Animation:i(366),BlendMode:i(393),ComputedSize:i(394),Depth:i(395),Flip:i(396),GetBounds:i(397),MatrixStack:i(398),Origin:i(399),Pipeline:i(187),ScaleMode:i(400),ScrollFactor:i(401),Size:i(402),Texture:i(403),Tint:i(404),ToJSON:i(405),Transform:i(406),TransformMatrix:i(188),Visible:i(407)}},function(t,e,i){var n=i(0),s={},r=new n({initialize:function(t){this.game=t,t.events.once("boot",this.boot,this)},boot:function(){this.game.events.once("destroy",this.destroy,this)},installGlobal:function(t,e){for(var i=t.game,n=t.scene,s=t.settings.map,r=0;ro.width&&(i=Math.max(o.width-t,0)),e+s>o.height&&(s=Math.max(o.height-e,0));for(var u=[],c=e;c0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},function(t,e,i){var n=i(97),s=i(15);t.exports=function(t,e,i,r,o){for(var a=null,h=null,l=null,u=null,c=s(t,e,i,r,null,o),d=0;d0;e--){var n=Math.floor(i.random()*(e+1)),s=t[e];t[e]=t[n],t[n]=s}return t},i.choose=function(t){return t[Math.floor(i.random()*t.length)]},i.isElement=function(t){return t instanceof HTMLElement},i.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isFunction=function(t){return"function"==typeof t},i.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},i.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},i.clamp=function(t,e,i){return ti?i:t},i.sign=function(t){return t<0?-1:1},i.now=function(){if(window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-i._nowStartTime},i.random=function(e,i){return i=void 0!==i?i:1,(e=void 0!==e?e:0)+t()*(i-e)};var t=function(){return i._seed=(9301*i._seed+49297)%233280,i._seed/233280};i.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.info=function(){console&&i.logLevel>0&&i.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warn=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.nextId=function(){return i._nextId++},i.map=function(t,e){if(t.map)return t.map(e);for(var i=[],n=0;n>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return this.getLeft(t)+this.width/2},getCenterY:function(t){return this.getTop(t)+this.height/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){(void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){(void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight-(this.height-this.baseHeight),this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.tilemapLayer;return t?t.tileset:null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e){t.exports={SKIP_CHECK:-1,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}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z;return this.x=i*o-n*r,this.y=n*s-e*o,this.z=e*r-i*s,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this},transformMat3:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=e*s[0]+i*s[3]+n*s[6],this.y=e*s[1]+i*s[4]+n*s[7],this.z=e*s[2]+i*s[5]+n*s[8],this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=t.val;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=e*s[0]+i*s[4]+n*s[8]+s[12],o=e*s[1]+i*s[5]+n*s[9]+s[13],a=e*s[2]+i*s[6]+n*s[10]+s[14],h=e*s[3]+i*s[7]+n*s[11]+s[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,l=a*i+o*e-s*n,u=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+l*-o-u*-r,this.y=l*a+c*-r+u*-s-h*-o,this.z=u*a+c*-o+h*-r-l*-s,this},project:function(t){var e=this.x,i=this.y,n=this.z,s=t.val,r=s[0],o=s[1],a=s[2],h=s[3],l=s[4],u=s[5],c=s[6],d=s[7],f=s[8],p=s[9],g=s[10],v=s[11],y=s[12],m=s[13],x=s[14],b=1/(e*h+i*d+n*v+s[15]);return this.x=(e*r+i*l+n*f+y)*b,this.y=(e*o+i*u+n*p+m)*b,this.z=(e*a+i*c+n*g+x)*b,this},unproject:function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,o=this.x-i,a=r-this.y-1-n,h=this.z;return this.x=2*o/s-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});t.exports=n},function(t,e,i){var n=i(0),s=i(122),r=i(8),o=i(6),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var n=Math.max(1,Math.round(i/e));return s(this.getSpacedPoints(n),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],n=this.getPoint(0,this._tmpVec2A),s=0;i.push(0);for(var r=1;r<=t;r++)s+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(n),i.push(s),n.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=this.defaultDivisions);for(var e=[],i=0;i<=t;i++){var n=this.getUtoTmapping(i/t,null,t);e.push(this.getPoint(n))}return e},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=t-1e-4,n=t+1e-4;return i<0&&(i=0),n>1&&(n=1),this.getPoint(i,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var n,s=this.getLengths(i),r=0,o=s.length;n=e?Math.min(e,s[o-1]):t*s[o-1];for(var a,h=0,l=o-1;h<=l;)if((a=s[r=Math.floor(h+(l-h)/2)]-n)<0)h=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(s[r=l]===n)return r/(o-1);var u=s[r];return(r+(n-u)/(s[r+1]-u))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},function(t,e){t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},function(t,e){t.exports=function(t,e,i){var n=t.x3-t.x1,s=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,l=n*n+s*s,u=n*r+s*o,c=n*a+s*h,d=r*r+o*o,f=r*a+o*h,p=l*d-u*u,g=0===p?0:1/p,v=(d*c-u*f)*g,y=(l*f-u*c)*g;return v>=0&&y>=0&&v+y<1}},function(t,e){t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},function(t,e,i){var n=i(0),s=i(54),r=i(310),o=i(311),a=i(112),h=new n({initialize:function(t,e,i,n,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this.x3=s,this.y3=r,this},getLineA:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2}},getLineB:function(){return{x1:this.x2,y1:this.y2,x2:this.x3,y2:this.y3}},getLineC:function(){return{x1:this.x3,y1:this.y3,x2:this.x1,y2:this.y1}},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e=0;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=h},function(t,e,i){var n=i(0),s=i(17),r=i(18),o=i(7),a=i(2),h=new n({Extends:r,initialize:function(t,e,i,n){var o="string"==typeof t?t:a(t,"key",""),h={type:"json",extension:a(t,"extension","json"),responseType:"text",key:o,url:a(t,"file",e),path:i,xhrSettings:a(t,"xhr",n)};r.call(this,h),"object"==typeof h.url&&(this.data=h.url,this.state=s.FILE_POPULATED)},onProcess:function(t){this.state=s.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText),this.onComplete(),t(this)}});o.register("json",function(t,e,i){if(Array.isArray(t))for(var n=0;n0&&r.rotateAbout(o.position,i,t.position,o.position)}},n.setVelocity=function(t,e){t.positionPrev.x=t.position.x-e.x,t.positionPrev.y=t.position.y-e.y,t.velocity.x=e.x,t.velocity.y=e.y,t.speed=r.magnitude(t.velocity)},n.setAngularVelocity=function(t,e){t.anglePrev=t.angle-e,t.angularVelocity=e,t.angularSpeed=Math.abs(t.angularVelocity)},n.translate=function(t,e){n.setPosition(t,r.add(t.position,e))},n.rotate=function(t,e,i){if(i){var s=Math.cos(e),r=Math.sin(e),o=t.position.x-i.x,a=t.position.y-i.y;n.setPosition(t,{x:i.x+(o*s-a*r),y:i.y+(o*r+a*s)}),n.setAngle(t,t.angle+e)}else n.setAngle(t,t.angle+e)},n.scale=function(t,i,r,o){o=o||t.position;for(var a=0;a0&&(f.position.x+=t.velocity.x,f.position.y+=t.velocity.y),0!==t.angularVelocity&&(s.rotate(f.vertices,t.angularVelocity,t.position),l.rotate(f.axes,t.angularVelocity),d>0&&r.rotateAbout(f.position,t.angularVelocity,t.position,f.position)),h.update(f.bounds,f.vertices,t.velocity)}},n.applyForce=function(t,e,i){t.force.x+=i.x,t.force.y+=i.y;var n=e.x-t.position.x,s=e.y-t.position.y;t.torque+=n*i.y-s*i.x};var e=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new n;return t.entries.forEach(function(t){e.set(t)}),this.entries.forEach(function(t){e.set(t)}),e},intersect:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)&&e.set(i)}),e},difference:function(t){var e=new n;return this.entries.forEach(function(i){t.contains(i)||e.set(i)}),e},size:{get:function(){return this.entries.length},set:function(t){return this.entries.length=t}}});t.exports=n},function(t,e){t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(0),s=i(32),r=i(182),o=i(183),a=i(106),h=new n({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=h},function(t,e,i){var n=i(61);t.exports=function(t,e,i){return(i-e)*(t=n(t,0,1))}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e,i){(function(e){var i={android:!1,chromeOS:!1,cocoonJS:!1,cocoonJSApp:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){var t=navigator.userAgent;/Windows/.test(t)?i.windows=!0:/Mac OS/.test(t)?i.macOS=!0:/Linux/.test(t)?i.linux=!0:/Android/.test(t)?i.android=!0:/iP[ao]d|iPhone/i.test(t)?(i.iOS=!0,navigator.appVersion.match(/OS (\d+)/),i.iOSVersion=parseInt(RegExp.$1,10)):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?i.kindle=!0:/CrOS/.test(t)&&(i.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(i.android=!1,i.iOS=!1,i.macOS=!1,i.windows=!0,i.windowsPhone=!0);var n=/Silk/.test(t);if((i.windows||i.macOS||i.linux&&!n||i.chromeOS)&&(i.desktop=!0),(i.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(i.desktop=!1),navigator.standalone&&(i.webApp=!0),void 0!==window.cordova&&(i.cordova=!0),void 0!==e&&void 0!==e.versions.node&&(i.node=!0),i.node&&"object"==typeof e.versions&&(i.nodeWebkit=!!e.versions["node-webkit"],i.electron=!!e.versions.electron),navigator.isCocoonJS){i.cocoonJS=!0;try{i.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){i.cocoonJSApp=!1}}return void 0!==window.ejecta&&(i.ejecta=!0),/Crosswalk/.test(t)&&(i.crosswalk=!0),i.iPhone=-1!==t.toLowerCase().indexOf("iphone"),i.iPad=-1!==t.toLowerCase().indexOf("ipad"),i.pixelRatio=window.devicePixelRatio||1,i}()}).call(e,i(507))},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var n=i(169),s=i(0),r=i(2),o=i(4),a=i(275),h=i(62),l=i(37),u=new s({initialize:function(t,e,i){void 0!==i||Array.isArray(e)||"object"!=typeof e||(i=e,e=null),this.scene=t,this.children=new h(e),this.isParent=!0,this.classType=r(i,"classType",l),this.active=r(i,"active",!0),this.maxSize=r(i,"maxSize",-1),this.defaultKey=r(i,"defaultKey",null),this.defaultFrame=r(i,"defaultFrame",null),this.runChildUpdate=r(i,"runChildUpdate",!1),this.createCallback=r(i,"createCallback",null),this.removeCallback=r(i,"removeCallback",null),this.createMultipleCallback=r(i,"createMultipleCallback",null),i&&this.createMultiple(i)},create:function(t,e,i,n,s){if(void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),this.isFull())return null;var r=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(r),r.preUpdate&&this.scene.sys.updateList.add(r),r.visible=s,this.add(r),r},createMultiple:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i=0&&t=0&&e0){this.blockSet=!1;var i=this;if(this.events.emit("changedata",this.parent,t,e,function(e){i.blockSet=!0,i.list[t]=e,i.events.emit("setdata",i.parent,t,e)}),this.blockSet)return this}return this.list[t]=e,this.events.emit("setdata",this.parent,t,e),this},each:function(t,e){for(var i=[this.parent,null,void 0],n=1;n0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}},function(t,e,i){var n=i(0),s=i(1),r=i(37),o=i(6),a=i(120),h=new n({Extends:s,initialize:function(t,e,i,n,h,l){s.call(this,t,"Sprite3D"),this.gameObject=new r(t,0,0,h,l),this.position=new a(e,i,n),this.size=new o(this.gameObject.width,this.gameObject.height),this.scale=new o(1,1),this.adjustScaleX=!0,this.adjustScaleY=!0,this._visible=!0},project:function(t){var e=this.position,i=this.gameObject;t.project(e,i),t.getPointSize(e,this.size,this.scale),this.scale.x<=0||this.scale.y<=0?i.setVisible(!1):(i.visible||i.setVisible(!0),this.adjustScaleX&&(i.scaleX=this.scale.x),this.adjustScaleY&&(i.scaleY=this.scale.y),i.setDepth(-1*i.z))},setVisible:function(t){return this.visible=t,this},visible:{get:function(){return this._visible},set:function(t){this._visible=t,this.gameObject.visible=t}},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},z:{get:function(){return this.position.z},set:function(t){this.position.z=t}}});t.exports=h},function(t,e,i){var n,s=i(67),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0};t.exports=(n=navigator.userAgent,/Edge\/\d+/.test(n)?r.edge=!0:/Chrome\/(\d+)/.test(n)&&!s.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10)):/Firefox\D+(\d+)/.test(n)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(n)&&s.iOS?r.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(n)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Opera/.test(n)?r.opera=!0:/Safari/.test(n)&&!s.windowsPhone?r.safari=!0:/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(n)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(n)&&(r.silk=!0),r)},function(t,e){t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},function(t,e,i){var n=i(0),s=i(14),r=i(3),o=new n({Extends:s,initialize:function(t){s.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,t.events.on("blur",function(){this.pauseOnBlur&&this.onBlur()},this),t.events.on("focus",function(){this.pauseOnBlur&&this.onFocus()},this),t.events.once("destroy",this.destroy,this),this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.locked&&this.unlock()},add:r,addAudioSprite:function(t,e){var i=this.add(t,e);for(var n in i.spritemap=this.game.cache.json.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(n)){var s=i.spritemap[n];i.addMarker({name:n,start:s.start,duration:s.end-s.start,config:e})}return i},play:function(t,e){var i=this.add(t);return i.once("ended",i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var n=this.addAudioSprite(t);return n.once("ended",n.destroy,n),n.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var n=this.sounds[i];n.key===t&&(n.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound(function(t){t.pause()}),this.emit("pauseall",this)},resumeAll:function(){this.forEachActiveSound(function(t){t.resume()}),this.emit("resumeall",this)},stopAll:function(){this.forEachActiveSound(function(t){t.stop()}),this.emit("stopall",this)},unlock:r,onBlur:r,onFocus:r,update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit("unlocked",this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach(function(i){i.update(t,e)})},destroy:function(){this.removeAllListeners(),this.forEachActiveSound(function(t){t.destroy()}),this.sounds.length=0,this.sounds=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach(function(n,s){n.pendingRemove||t.call(e||i,n,s,i.sounds)})},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("rate",this,t)}},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound(function(t){t.setRate()}),this.emit("detune",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(14),r=i(23),o=i(3),a=new n({Extends:s,initialize:function(t,e,i){s.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={delay:0},this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.config=r(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(console.error("addMarker - Marker with name '"+t.name+"' already exists for sound '"+this.key+"'!"),!1):(t=r(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0}},t),this.markers[t.name]=t,!0))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name)&&(this.markers[t.name]?(this.markers[t.name]=r(!0,this.markers[t.name],t),!0):(console.error("updateMarker - Marker with name '"+t.name+"' does not exist for sound '"+this.key+"'!"),!1))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return console.error("Sound marker name has to be a string!"),!1;if(t){if(!this.markers[t])return console.error("No marker with name '"+t+"' found for sound '"+this.key+"'!"),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=r(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!0,!0)},resume:function(){return!(!this.isPaused||this.isPlaying)&&(this.isPlaying=!0,this.isPaused=!1,!0)},stop:function(){return!(!this.isPaused&&!this.isPlaying)&&(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),!0)},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:o,destroy:function(){this.pendingRemove||(this.pendingRemove=!0,this.manager=null,this.key="",this.removeAllListeners(),this.isPlaying=!1,this.isPaused=!1,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)},setRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e}});Object.defineProperty(a.prototype,"rate",{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.setRate(),this.emit("rate",this,t)}}),Object.defineProperty(a.prototype,"detune",{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.setRate(),this.emit("detune",this,t)}}),t.exports=a},function(t,e,i){var n=new(i(0))({initialize:function(t){this.parent=t,this.list=[],this.position=0},add:function(t){return-1===this.getIndex(t)&&this.list.push(t),t},addAt:function(t,e){return void 0===e&&(e=0),0===this.list.length?this.add(t):(e>=0&&e<=this.list.length&&-1===this.getIndex(t)&&this.list.splice(e,0,t),t)},addMultiple:function(t){if(Array.isArray(t))for(var e=0;en?1:0},getByKey:function(t,e){for(var i=0;ithis.list.length)return null;var i=t+Math.floor(Math.random()*e);return this.list[i]},getFirst:function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.list.length);for(var s=i;s=this.list.length)throw new Error("List.moveTo: The supplied index is out of bounds");return this.list.splice(i,1),this.list.splice(e,0,t),t},remove:function(t){var e=this.list.indexOf(t);return-1!==e&&this.list.splice(e,1),t},removeAt:function(t){var e=this.list[t];return e&&this.children.splice(t,1),e},removeBetween:function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.list.length);var i=e-t;if(i>0&&i<=e)return this.list.splice(t,i);if(0===i&&0===this.list.length)return[];throw new Error("List.removeBetween: Range Error, numeric values are outside the acceptable range")},removeAll:function(){for(var t=this.list.length;t--;)this.remove(this.list[t]);return this},bringToTop:function(t){return this.getIndex(t)0&&(this.remove(t),this.addAt(t,0)),t},moveUp:function(t){var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getAt(e-1);i&&this.swap(t,i)}return t},reverse:function(){return this.list.reverse(),this},shuffle:function(){for(var t=this.list.length-1;t>0;t--){var e=Math.floor(Math.random()*(t+1)),i=this.list[t];this.list[t]=this.list[e],this.list[e]=i}return this},replace:function(t,e){var i=this.getIndex(t);if(-1!==i)return this.remove(t),this.addAt(e,i),t},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e){for(var i=0;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=n},function(t,e){t.exports={CREATED:0,INIT:1,DELAY:2,OFFSET_DELAY:3,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING_ADD:20,PAUSED:21,LOOP_DELAY:22,ACTIVE:23,COMPLETE_DELAY:24,PENDING_REMOVE:25,REMOVED:26}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(658),a=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Origin,s.Pipeline,s.ScaleMode,s.Size,s.Texture,s.Transform,s.Visible,s.ScrollFactor,o],initialize:function(t,e,i,n,s,o,a,h,l){if(r.call(this,t,"Mesh"),this.setTexture(h,l),this.setPosition(e,i),this.setSizeToFrame(),this.setOrigin(),this.initPipeline("TextureTintPipeline"),n.length!==s.length)throw new Error("Mesh Vertex count must match UV count");var u,c=n.length/2|0;if(o.length>0&&o.length0&&a.length=0&&f<=1&&p>=0&&p<=1&&(i.x=s+f*(o-s),i.y=r+f*(a-r),!0)}},function(t,e){t.exports=function(t,e,i,n,s){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),{responseType:t,async:e,user:i,password:n,timeout:s,header:void 0,headerValue:void 0,overrideMimeType:void 0}}},function(t,e,i){var n=i(0),s=i(329),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){var n={};t.exports=n;var s=i(93),r=i(38),o=i(60),a=i(95),h=i(94),l=i(948);n.rectangle=function(t,e,i,n,a){a=a||{};var h={label:"Rectangle Body",position:{x:t,y:e},vertices:s.fromPath("L 0 0 L "+i+" 0 L "+i+" "+n+" L 0 "+n)};if(a.chamfer){var l=a.chamfer;h.vertices=s.chamfer(h.vertices,l.radius,l.quality,l.qualityMin,l.qualityMax),delete a.chamfer}return o.create(r.extend({},h,a))},n.trapezoid=function(t,e,i,n,a,h){h=h||{};var l,u=i*(a*=.5),c=u+(1-2*a)*i,d=c+u;l=a<.5?"L 0 0 L "+u+" "+-n+" L "+c+" "+-n+" L "+d+" 0":"L 0 0 L "+c+" "+-n+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:t,y:e},vertices:s.fromPath(l)};if(h.chamfer){var p=h.chamfer;f.vertices=s.chamfer(f.vertices,p.radius,p.quality,p.qualityMin,p.qualityMax),delete h.chamfer}return o.create(r.extend({},f,h))},n.circle=function(t,e,i,s,o){s=s||{};var a={label:"Circle Body",circleRadius:i};o=o||25;var h=Math.ceil(Math.max(10,Math.min(o,i)));return h%2==1&&(h+=1),n.polygon(t,e,h,i,r.extend({},a,s))},n.polygon=function(t,e,i,a,h){if(h=h||{},i<3)return n.circle(t,e,a,h);for(var l=2*Math.PI/i,u="",c=.5*l,d=0;d0&&s.area(A)1?(f=o.create(r.extend({parts:p.slice(0)},n)),o.setPosition(f,{x:t,y:e}),f):p[0]}},function(t,e,i){var n={};t.exports=n;var s=i(94),r=i(38);n.create=function(t,e){for(var i=[],n=0;n0)return!1}return!0},n.scale=function(t,e,i,r){if(1===e&&1===i)return t;var o,a;r=r||n.centre(t);for(var h=0;h=0?h-1:t.length-1],u=t[h],c=t[(h+1)%t.length],d=e[h0&&(r|=2),3===r)return!1;return 0!==r||null},n.hull=function(t){var e,i,n=[],r=[];for((t=t.slice(0)).sort(function(t,e){var i=t.x-e.x;return 0!==i?i:t.y-e.y}),i=0;i=2&&s.cross3(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)}for(i=t.length-1;i>=0;i-=1){for(e=t[i];n.length>=2&&s.cross3(n[n.length-2],n[n.length-1],e)<=0;)n.pop();n.push(e)}return n.pop(),r.pop(),n.concat(r)}},function(t,e){var i={};t.exports=i,i.create=function(t,e){return{x:t||0,y:e||0}},i.clone=function(t){return{x:t.x,y:t.y}},i.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},i.rotate=function(t,e,i){var n=Math.cos(e),s=Math.sin(e);i||(i={});var r=t.x*n-t.y*s;return i.y=t.x*s+t.y*n,i.x=r,i},i.rotateAbout=function(t,e,i,n){var s=Math.cos(e),r=Math.sin(e);n||(n={});var o=i.x+((t.x-i.x)*s-(t.y-i.y)*r);return n.y=i.y+((t.x-i.x)*r+(t.y-i.y)*s),n.x=o,n},i.normalise=function(t){var e=i.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},i.dot=function(t,e){return t.x*e.x+t.y*e.y},i.cross=function(t,e){return t.x*e.y-t.y*e.x},i.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},i.add=function(t,e,i){return i||(i={}),i.x=t.x+e.x,i.y=t.y+e.y,i},i.sub=function(t,e,i){return i||(i={}),i.x=t.x-e.x,i.y=t.y-e.y,i},i.mult=function(t,e){return{x:t.x*e,y:t.y*e}},i.div=function(t,e){return{x:t.x/e,y:t.y/e}},i.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},i.neg=function(t){return{x:-t.x,y:-t.y}},i.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},i._temp=[i.create(),i.create(),i.create(),i.create(),i.create(),i.create()]},function(t,e){var i={};t.exports=i,i.create=function(t){var e={min:{x:0,y:0},max:{x:0,y:0}};return t&&i.update(e,t),e},i.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var n=0;nt.max.x&&(t.max.x=s.x),s.xt.max.y&&(t.max.y=s.y),s.y0?t.max.x+=i.x:t.min.x+=i.x,i.y>0?t.max.y+=i.y:t.min.y+=i.y)},i.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},i.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},i.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},i.shift=function(t,e){var i=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+n}},function(t,e,i){t.exports={CalculateFacesAt:i(151),CalculateFacesWithin:i(34),Copy:i(874),CreateFromTiles:i(875),CullTiles:i(876),Fill:i(877),FilterTiles:i(878),FindByIndex:i(879),FindTile:i(880),ForEachTile:i(881),GetTileAt:i(97),GetTileAtWorldXY:i(882),GetTilesWithin:i(15),GetTilesWithinShape:i(883),GetTilesWithinWorldXY:i(884),HasTileAt:i(346),HasTileAtWorldXY:i(885),IsInLayerBounds:i(74),PutTileAt:i(152),PutTileAtWorldXY:i(886),PutTilesAt:i(887),Randomize:i(888),RemoveTileAt:i(347),RemoveTileAtWorldXY:i(889),RenderDebug:i(890),ReplaceByIndex:i(345),SetCollision:i(891),SetCollisionBetween:i(892),SetCollisionByExclusion:i(893),SetCollisionByProperty:i(894),SetCollisionFromCollisionGroup:i(895),SetTileIndexCallback:i(896),SetTileLocationCallback:i(897),Shuffle:i(898),SwapByIndex:i(899),TileToWorldX:i(98),TileToWorldXY:i(900),TileToWorldY:i(99),WeightedRandomize:i(901),WorldToTileX:i(39),WorldToTileXY:i(902),WorldToTileY:i(40)}},function(t,e,i){var n=i(74);t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),n(t,e,s)){var r=s.data[e][t];return null===r?null:-1===r.index?i?r:null:r}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o,a){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o={}),void 0===a&&(a={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=n,this.tileMargin=s,this.tileSpacing=r,this.tileProperties=o,this.tileData=a,this.image=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&t=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this},bind:function(){var t=this.gl,e=this.vertexBuffer,i=this.attributes,n=this.program,s=this.renderer,r=this.vertexSize;s.setProgram(n),s.setVertexBuffer(e);for(var o=0;o=0?(t.enableVertexAttribArray(h),t.vertexAttribPointer(h,a.size,a.type,a.normalized,r,a.offset)):t.disableVertexAttribArray(h)}return this},onBind:function(){return this},onPreRender:function(){return this},onRender:function(){return this},onPostRender:function(){return this},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t=this.gl,e=this.vertexCount,i=this.topology,n=this.vertexSize;if(0!==e)return t.bufferSubData(t.ARRAY_BUFFER,0,this.bytes.subarray(0,e*n)),t.drawArrays(i,0,e),this.vertexCount=0,this.flushLocked=!1,this;this.flushLocked=!1},destroy:function(){var t=this.gl;return t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),delete this.program,delete this.vertexBuffer,delete this.gl,this},setFloat1:function(t,e){return this.renderer.setFloat1(this.program,t,e),this},setFloat2:function(t,e,i){return this.renderer.setFloat2(this.program,t,e,i),this},setFloat3:function(t,e,i,n){return this.renderer.setFloat3(this.program,t,e,i,n),this},setFloat4:function(t,e,i,n,s){return this.renderer.setFloat4(this.program,t,e,i,n,s),this},setInt1:function(t,e){return this.renderer.setInt1(this.program,t,e),this},setInt2:function(t,e,i){return this.renderer.setInt2(this.program,t,e,i),this},setInt3:function(t,e,i,n){return this.renderer.setInt3(this.program,t,e,i,n),this},setInt4:function(t,e,i,n,s){return this.renderer.setInt4(this.program,t,e,i,n,s),this},setMatrix2:function(t,e,i){return this.renderer.setMatrix2(this.program,t,e,i),this},setMatrix3:function(t,e,i){return this.renderer.setMatrix3(this.program,t,e,i),this},setMatrix4:function(t,e,i){return this.renderer.setMatrix4(this.program,t,e,i),this}});t.exports=r},function(t,e,i){var n=i(53);t.exports=function(t,e){var i=n(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){void 0===e&&(e=new n);var i=2*Math.PI*Math.random(),s=Math.random()+Math.random(),r=s>1?2-s:s,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},function(t,e,i){var n=i(78),s=i(5);t.exports=function(t,e,i){if(void 0===i&&(i=new s),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=n(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},function(t,e,i){var n=i(66),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]),e||(e=n(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,l=t.y2,u=0;u=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(s*a+o*h),e}},function(t,e){t.exports=function(t,e,i,n,s){var r=n+Math.atan2(t.y-i,t.x-e);return t.x=e+s*Math.cos(r),t.y=i+s*Math.sin(r),t}},function(t,e,i){var n=new(i(0))({initialize:function(t){if(this.entries={},this.size=0,Array.isArray(t))for(var e=0;e-y||T>-m||w-y||A>-m||S-y||T>-m||w-y||A>-m||S-v&&A*n+C*r+h>-y&&(A+v)*i+(C+y)*s+a0?this:(this._fadeRed=e,this._fadeGreen=i,this._fadeBlue=n,t<=0&&(t=Number.MIN_VALUE),this._fadeDuration=t,this._fadeAlpha=Number.MIN_VALUE,this)},flash:function(t,e,i,n,s){return!s&&this._flashAlpha>0?this:(void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),this._flashRed=e,this._flashGreen=i,this._flashBlue=n,t<=0&&(t=Number.MIN_VALUE),this._flashDuration=t,this._flashAlpha=1,this)},getWorldPoint:function(t,e,i){void 0===i&&(i=new h);var n=this.matrix.matrix,s=n[0],r=n[1],o=n[2],a=n[3],l=n[4],u=n[5],c=s*a-r*o;if(!c)return i.x=t,i.y=e,i;var d=a*(c=1/c),f=-r*c,p=-o*c,g=s*c,v=(o*u-a*l)*c,y=(r*l-s*u)*c,m=Math.cos(this.rotation),x=Math.sin(this.rotation),b=this.zoom,w=this.scrollX,T=this.scrollY,S=t+(w*m-T*x)*b,A=e+(w*x+T*m)*b;return i.x=S*d+A*p+v,i.y=S*f+A*g+y,i},ignore:function(t){if(t instanceof Array)for(var e=0;eu&&(this.scrollX=u),this.scrollYc&&(this.scrollY=c)}this.roundPixels&&(this.scrollX=Math.round(this.scrollX),this.scrollY=Math.round(this.scrollY)),r.loadIdentity(),r.scale(e,e),r.translate(this.x+o,this.y+a),r.rotate(this.rotation),r.scale(s,s),r.translate(-o,-a),r.translate(this._shakeOffsetX,this._shakeOffsetY)},removeBounds:function(){return this.useBounds=!1,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=s(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=a(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,n){return this._bounds.setTo(t,e,i,n),this.useBounds=!0,this},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t){return this.scene=t,this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setZoom:function(t){return void 0===t&&(t=1),this.zoom=t,this},shake:function(t,e,i){return void 0===e&&(e=.05),i||0===this._shakeOffsetX&&0===this._shakeOffsetY?(this._shakeDuration=t,this._shakeIntensity=e,this._shakeOffsetX=0,this._shakeOffsetY=0,this):this},startFollow:function(t,e){return this._follow=t,void 0!==e&&(this.roundPixels=e),this},stopFollow:function(){return this._follow=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},resetFX:function(){return this._flashAlpha=0,this._fadeAlpha=0,this._shakeOffsetX=0,this._shakeOffsetY=0,this._shakeDuration=0,this},update:function(t,e){if(this._flashAlpha>0&&(this._flashAlpha-=e/this._flashDuration,this._flashAlpha<0&&(this._flashAlpha=0)),this._fadeAlpha>0&&this._fadeAlpha<1&&(this._fadeAlpha+=e/this._fadeDuration,this._fadeAlpha>=1&&(this._fadeAlpha=1)),this._shakeDuration>0){var i=this._shakeIntensity;this._shakeDuration-=e,this._shakeDuration<=0?(this._shakeOffsetX=0,this._shakeOffsetY=0):(this._shakeOffsetX=(Math.random()*i*this.width*2-i*this.width)*this.zoom,this._shakeOffsetY=(Math.random()*i*this.height*2-i*this.height)*this.zoom,this.roundPixels&&(this._shakeOffsetX|=0,this._shakeOffsetY|=0))}},destroy:function(){this._bounds=void 0,this.matrix=void 0,this.culledObjects=[],this.scene=void 0}});t.exports=l},function(t,e,i){var n=i(201),s=i(203),r=i(205),o=i(206);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):n(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var n=i(0),s=i(119),r=i(207),o=i(208),a=i(209),h=i(62),l=i(81),u=i(6),c=i(51),d=i(120),f=new c,p=new d,g=new c,v=new c,y=new s,m=new n({initialize:function(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,this.name="",this.direction=new c(0,0,-1),this.up=new c(0,1,0),this.position=new c,this.pixelScale=128,this.projection=new s,this.view=new s,this.combined=new s,this.invProjectionView=new s,this.near=1,this.far=100,this.ray={origin:new c,direction:new c},this.viewportWidth=0,this.viewportHeight=0,this.billboardMatrixDirty=!0,this.children=new h},setPosition:function(t,e,i){return this.position.set(t,e,i),this.update()},setScene:function(t){return this.scene=t,this},setPixelScale:function(t){return this.pixelScale=t,this.update()},add:function(t){return this.children.set(t),this.updateChildren(),t},remove:function(t){return this.displayList.remove(t.gameObject),this.updateList.remove(t.gameObject),this.children.delete(t),this},clear:function(){for(var t=this.getChildren(),e=0;e0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return Math.sqrt(e*e+i*i+n*n+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0,s=t.w-this.w||0;return e*e+i*i+n*n+s*s},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this},transformQuat:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*n-o*i,l=a*i+o*e-s*n,u=a*n+s*i-r*e,c=-s*e-r*i-o*n;return this.x=h*a+c*-s+l*-o-u*-r,this.y=l*a+c*-r+u*-s-h*-o,this.z=u*a+c*-o+h*-r-l*-s,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});n.prototype.sub=n.prototype.subtract,n.prototype.mul=n.prototype.multiply,n.prototype.div=n.prototype.divide,n.prototype.dist=n.prototype.distance,n.prototype.distSq=n.prototype.distanceSq,n.prototype.len=n.prototype.length,n.prototype.lenSq=n.prototype.lengthSq,t.exports=n},function(t,e){var i,n="";t.exports={disable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!1),t},enable:function(t){return""===n&&(n=i(t)),n&&(t[n]=!0),t},getPrefix:i=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i0&&0==(t&t-1)&&e>0&&0==(e&e-1)}},function(t,e){t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,LINE_FX_TO:12,MOVE_FX_TO:13,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18}},function(t,e){t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221}},function(t,e,i){var n=i(0),s=i(83),r=i(531),o=i(532),a=i(236),h=i(255),l=new n({initialize:function(t,e){this.scene=t,this.game,this.config=e,this.settings=h.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList},init:function(t){this.settings.status=s.INIT,this.game=t,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.installGlobal(this,a.Global),e.installLocal(this,a.CoreScene),e.installLocal(this,o(this)),e.installLocal(this,r(this)),this.events.emit("boot",this),this.settings.isBooted=!0},install:function(t){Array.isArray(t)||(t=[t]),this.plugins.installLocal(this,t)},step:function(t,e){this.events.emit("preupdate",t,e),this.events.emit("update",t,e),this.scene.update.call(this.scene,t,e),this.events.emit("postupdate",t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.cameras.render(t,e),this.events.emit("render",t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(){return this.settings.active&&(this.settings.status=s.PAUSED,this.settings.active=!1,this.events.emit("pause",this)),this},resume:function(){return this.settings.active||(this.settings.status=s.RUNNING,this.settings.active=!0,this.events.emit("resume",this)),this},sleep:function(){return this.settings.status=s.SLEEPING,this.settings.active=!1,this.settings.visible=!1,this.events.emit("sleep",this),this},wake:function(){return this.settings.status=s.RUNNING,this.settings.active=!0,this.settings.visible=!0,this.events.emit("wake",this),this},isSleeping:function(){return this.settings.status===s.SLEEPING},isActive:function(){return this.settings.status===s.RUNNING},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t){return t?this.resume():this.pause()},start:function(t){this.settings.status=s.START,this.settings.data=t,this.settings.active=!0,this.settings.visible=!0,this.events.emit("start",this)},resize:function(t,e){this.events.emit("resize",t,e)},shutdown:function(){this.settings.status=s.SHUTDOWN,this.settings.active=!1,this.settings.visible=!1,this.events.emit("shutdown",this)},destroy:function(){this.settings.status=s.DESTROYED,this.settings.active=!1,this.settings.visible=!1,this.events.emit("destroy",this)}});t.exports=l},function(t,e,i){var n=i(0),s=i(23),r=new n({initialize:function(t,e,i,n,s,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX=n,this.cutY=s,this.cutWidth=r,this.cutHeight=o,this.x=0,this.y=0,this.width=r,this.height=o,this.halfWidth=Math.floor(.5*r),this.halfHeight=Math.floor(.5*o),this.centerX=Math.floor(r/2),this.centerY=Math.floor(o/2),this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.data={cut:{x:n,y:s,w:r,h:o,r:n+r,b:s+o},trim:!1,sourceSize:{w:r,h:o},spriteSourceSize:{x:0,y:0,w:r,h:o},uvs:{x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},radius:.5*Math.sqrt(r*r+o*o),drawImage:{sx:n,sy:s,sWidth:r,sHeight:o,dWidth:r,dHeight:o}},this.updateUVs()},setTrim:function(t,e,i,n,s,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=n,a.w=s,a.h=r,this.x=i,this.y=n,this.width=s,this.height=r,this.halfWidth=.5*s,this.halfHeight=.5*r,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.updateUVs()},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.sWidth=i,s.sHeight=n,s.dWidth=i,s.dHeight=n;var r=this.source.width,o=this.source.height,a=this.data.uvs;return a.x0=t/r,a.y0=e/o,a.x1=t/r,a.y1=(e+n)/o,a.x2=(t+i)/r,a.y2=(e+n)/o,a.x3=(t+i)/r,a.y3=e/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height,i=this.data.uvs;return i.x3=(this.cutX+this.cutHeight)/t,i.y3=(this.cutY+this.cutWidth)/e,i.x2=this.cutX/t,i.y2=(this.cutY+this.cutWidth)/e,i.x1=this.cutX/t,i.y1=this.cutY/e,i.x0=(this.cutX+this.cutHeight)/t,i.y0=this.cutY/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},uvs:{get:function(){return this.data.uvs}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(268),a=i(548),h=i(549),l=i(550),u=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.ScaleMode,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,l],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"BitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds()},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this.text=t.toString()),this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});u.ParseRetroFont=h,u.ParseFromAtlas=a,t.exports=u},function(t,e,i){var n=i(553),s=i(556),r=i(0),o=i(11),a=i(130),h=i(1),l=i(86),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.ScaleMode,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,n],initialize:function(t,e,i,n,s){h.call(this,t,"Blitter"),this.setTexture(n,s),this.setPosition(e,i),this.initPipeline("TextureTintPipeline"),this.children=new l,this.renderList=[],this.dirty=!1},create:function(t,e,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new s(this,t,e,i,n);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,n){for(var s=this.createMultiple(e,i,n),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0}});t.exports=u},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(268),a=i(557),h=new n({Extends:r,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Origin,s.Pipeline,s.Texture,s.Tint,s.Transform,s.Visible,s.ScrollFactor,a],initialize:function(t,e,i,n,s,o){void 0===s&&(s=""),r.call(this,t,"DynamicBitmapText"),this.font=n;var a=this.scene.sys.cache.bitmapFont.get(n);this.fontData=a.data,this.text=Array.isArray(s)?s.join("\n"):s,this.fontSize=o||this.fontData.size,this.setTexture(a.texture,a.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline("TextureTintPipeline"),this._bounds=this.getTextBounds(),this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setFontSize:function(t){return this.fontSize=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this.text=t.toString()),this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this},getTextBounds:function(t){return this._bounds=o(this,t),this._bounds},width:{get:function(){return this.getTextBounds(!1),this._bounds.global.width}},height:{get:function(){return this.getTextBounds(!1),this._bounds.global.height}},toJSON:function(){var t=s.ToJSON(this),e={font:this.font,text:this.text,fontSize:this.fontSize};return t.data=e,t}});t.exports=h},function(t,e,i){var n=i(115),s=i(0),r=i(127),o=i(11),a=i(270),h=i(1),l=i(4),u=i(16),c=i(569),d=new s({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Pipeline,o.Transform,o.Visible,o.ScrollFactor,c],initialize:function(t,e){var i=l(e,"x",0),n=l(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,n),this.initPipeline("FlatTintPipeline"),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.setDefaultStyles(e)},setDefaultStyles:function(t){return l(t,"lineStyle",null)&&(this.defaultStrokeWidth=l(t,"lineStyle.width",1),this.defaultStrokeColor=l(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=l(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),l(t,"fillStyle",null)&&(this.defaultFillColor=l(t,"fillStyle.color",16777215),this.defaultFillAlpha=l(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,u.PI2),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,u.PI2),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,n){return this.commandBuffer.push(r.FILL_RECT,t,e,i,n),this},strokeRect:function(t,e,i,n){var s=this._lineWidth/2,r=t-s,o=t+s;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+n),this.strokePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+n),this.strokePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.beginPath(),this.moveTo(r,e+n),this.lineTo(o+i,e+n),this.strokePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,n,s,o),this},strokeTriangle:function(t,e,i,n,s,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,n,s,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,n){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,n),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},lineFxTo:function(t,e,i,n){return this.commandBuffer.push(r.LINE_FX_TO,t,e,i,n,1),this},moveFxTo:function(t,e,i,n){return this.commandBuffer.push(r.MOVE_FX_TO,t,e,i,n,1),this},strokePoints:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var n,s,r=this.scene.sys;if(void 0===e&&(e=r.game.config.width),void 0===i&&(i=r.game.config.height),d.TargetCamera.setViewport(0,0,e,i),d.TargetCamera.scrollX=this.x,d.TargetCamera.scrollY=this.y,"string"==typeof t)if(r.textures.exists(t)){var o=(n=r.textures.get(t)).getSourceImage();o instanceof HTMLCanvasElement&&(s=o.getContext("2d"))}else s=(n=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d");else t instanceof HTMLCanvasElement&&(s=t.getContext("2d"));return s&&(this.renderCanvas(r.game.renderer,this,0,d.TargetCamera,s),r.game.renderer.gl&&n&&(n.source[0].glTexture=r.game.renderer.canvasToTexture(s.canvas,n.source[0].glTexture,!0,0))),this}});d.TargetCamera=new n(0,0,0,0),t.exports=d},function(t,e,i){var n=i(0),s=i(68),r=i(271),o=i(272),a=i(110),h=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=h},function(t,e,i){var n=i(5);t.exports=function(t,e,i){void 0===i&&(i=new n);var s=t.width/2,r=t.height/2;return i.x=t.x+s*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},function(t,e,i){var n=i(0),s=i(11),r=i(1),o=i(574),a=i(86),h=i(575),l=i(614),u=new n({Extends:r,Mixins:[s.Depth,s.Visible,s.Pipeline,l],initialize:function(t,e,i,n){if(r.call(this,t,"ParticleEmitterManager"),this.blendMode=-1,this.timeScale=1,this.texture=null,this.frame=null,this.frameNames=[],null===i||"object"!=typeof i&&!Array.isArray(i)||(n=i,i=null),this.setTexture(e,i),this.initPipeline("TextureTintPipeline"),this.emitters=new a(this),this.wells=new a(this),n){Array.isArray(n)||(n=[n]);for(var s=0;s0?e.defaultFrame=i[0]:e.defaultFrame=this.defaultFrame,this},addEmitter:function(t){return this.emitters.add(t)},createEmitter:function(t){return this.addEmitter(new h(this,t))},addGravityWell:function(t){return this.wells.add(t)},createGravityWell:function(t){return this.addGravityWell(new o(t))},emitParticle:function(t,e,i){for(var n=this.emitters.list,s=0;sl){if(0===c){for(var g=f;g.length&&(g=g.slice(0,-1),!((p=e.measureText(g).width)<=l)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var v=d.substr(g.length);u[c]=v,h+=g}var y=u[c].length?c:c+1,m=u.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=m+" "+(s[o+1]||""),r=s.length;break}h+=f,l-=p}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var n="",s=t.split(this.splitRegExp),r=0;ro?(h>0&&(n+="\n"),n+=a[h]+" ",o=i-l):(o-=u,n+=a[h]+" ")}r0&&(a+=u.lineSpacing*p),i.rtl?o=d-o:"right"===i.align?o+=u.width-u.lineWidths[p]:"center"===i.align&&(o+=(u.width-u.lineWidths[p])/2),this.autoRound&&(o=Math.round(o),a=Math.round(a)),i.strokeThickness&&(this.style.syncShadow(e,i.shadowStroke),e.strokeText(l[p],o,a)),i.color&&(this.style.syncShadow(e,i.shadowFill),e.fillText(l[p],o,a));return e.restore(),this.dirty=!0,this},getTextMetrics:function(){return this.style.getTextMetrics()},toJSON:function(){var t=o.ToJSON(this),e={autoRound:this.autoRound,text:this.text,style:this.style.toJSON(),resolution:this.resolution,padding:{left:this.padding.left,right:this.padding.right,top:this.padding.top,bottom:this.padding.bottom}};return t.data=e,t},preDestroy:function(){this.style.rtl&&u(this.canvas),s.remove(this.canvas)}});t.exports=f},function(t,e,i){var n=i(19),s=i(0),r=i(11),o=i(1),a=i(291),h=i(628),l=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Origin,r.Pipeline,r.ScaleMode,r.ScrollFactor,r.Size,r.Texture,r.Tint,r.Transform,r.Visible,h],initialize:function(t,e,i,s,r,h,l){var u=t.sys.game.renderer;o.call(this,t,"TileSprite"),this.tilePositionX=0,this.tilePositionY=0,this.dirty=!0,this.tileTexture=null,this.renderer=u,this.setTexture(h,l),this.setPosition(e,i),this.setSize(s,r),this.setOriginFromFrame(),this.initPipeline("TextureTintPipeline"),this.potWidth=a(this.frame.width),this.potHeight=a(this.frame.height),this.canvasPattern=null,this.canvasBuffer=n.create2D(null,this.potWidth,this.potHeight),this.canvasBufferCtx=this.canvasBuffer.getContext("2d"),this.oldFrame=null,this.updateTileTexture(),t.sys.game.renderer.onContextRestored(function(t){var e=t.gl;this.tileTexture=null,this.dirty=!0,this.tileTexture=t.createTexture2D(0,e.LINEAR,e.LINEAR,e.REPEAT,e.REPEAT,e.RGBA,this.canvasBuffer,this.potWidth,this.potHeight)},this)},updateTileTexture:function(){(this.dirty||this.oldFrame!==this.frame)&&(this.oldFrame=this.frame,this.canvasBufferCtx.clearRect(0,0,this.canvasBuffer.width,this.canvasBuffer.height),this.canvasBufferCtx.drawImage(this.frame.source.image,this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight,0,0,this.potWidth,this.potHeight),this.renderer.gl?this.tileTexture=this.renderer.canvasToTexture(this.canvasBuffer,this.tileTexture,null===this.tileTexture,this.scaleMode):this.canvasPattern=this.canvasBufferCtx.createPattern(this.canvasBuffer,"repeat"),this.dirty=!1)},destroy:function(){this.renderer&&this.renderer.deleteTexture(this.tileTexture),n.remove(this.canvasBuffer),this.canvasPattern=null,this.canvasBufferCtx=null,this.canvasBuffer=null,this.renderer=null,this.visible=!1}});t.exports=l},function(t,e,i){var n=i(0),s=i(88),r=new n({Extends:s,initialize:function(t,e,i,n,r){s.call(this,t,e,i,[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,1,1,1,0],[16777215,16777215,16777215,16777215,16777215,16777215],[1,1,1,1,1,1],n,r),this.resetPosition()},topLeftX:{get:function(){return this.x+this.vertices[0]},set:function(t){this.vertices[0]=t-this.x,this.vertices[6]=t-this.x}},topLeftY:{get:function(){return this.y+this.vertices[1]},set:function(t){this.vertices[1]=t-this.y,this.vertices[7]=t-this.y}},topRightX:{get:function(){return this.x+this.vertices[10]},set:function(t){this.vertices[10]=t-this.x}},topRightY:{get:function(){return this.y+this.vertices[11]},set:function(t){this.vertices[11]=t-this.y}},bottomLeftX:{get:function(){return this.x+this.vertices[2]},set:function(t){this.vertices[2]=t-this.x}},bottomLeftY:{get:function(){return this.y+this.vertices[3]},set:function(t){this.vertices[3]=t-this.y}},bottomRightX:{get:function(){return this.x+this.vertices[4]},set:function(t){this.vertices[4]=t-this.x,this.vertices[8]=t-this.x}},bottomRightY:{get:function(){return this.y+this.vertices[5]},set:function(t){this.vertices[5]=t-this.y,this.vertices[9]=t-this.y}},topLeftAlpha:{get:function(){return this.alphas[0]},set:function(t){this.alphas[0]=t,this.alphas[3]=t}},topRightAlpha:{get:function(){return this.alphas[5]},set:function(t){this.alphas[5]=t}},bottomLeftAlpha:{get:function(){return this.alphas[1]},set:function(t){this.alphas[1]=t}},bottomRightAlpha:{get:function(){return this.alphas[2]},set:function(t){this.alphas[2]=t,this.alphas[4]=t}},topLeftColor:{get:function(){return this.colors[0]},set:function(t){this.colors[0]=t,this.colors[3]=t}},topRightColor:{get:function(){return this.colors[5]},set:function(t){this.colors[5]=t}},bottomLeftColor:{get:function(){return this.colors[1]},set:function(t){this.colors[1]=t}},bottomRightColor:{get:function(){return this.colors[2]},set:function(t){this.colors[2]=t,this.colors[4]=t}},setTopLeft:function(t,e){return this.topLeftX=t,this.topLeftY=e,this},setTopRight:function(t,e){return this.topRightX=t,this.topRightY=e,this},setBottomLeft:function(t,e){return this.bottomLeftX=t,this.bottomLeftY=e,this},setBottomRight:function(t,e){return this.bottomRightX=t,this.bottomRightY=e,this},resetPosition:function(){var t=this.x,e=this.y,i=Math.floor(this.width/2),n=Math.floor(this.height/2);return this.setTopLeft(t-i,e-n),this.setTopRight(t+i,e-n),this.setBottomLeft(t-i,e+n),this.setBottomRight(t+i,e+n),this},resetAlpha:function(){var t=this.alphas;return t[0]=1,t[1]=1,t[2]=1,t[3]=1,t[4]=1,t[5]=1,this},resetColors:function(){var t=this.colors;return t[0]=16777215,t[1]=16777215,t[2]=16777215,t[3]=16777215,t[4]=16777215,t[5]=16777215,this},reset:function(){return this.resetPosition(),this.resetAlpha(),this.resetColors()}});t.exports=r},function(t,e){t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=[]);for(var s,r,o,a,h,l,u=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=u*u+c*c,g=u*d+c*f,v=d*d+f*f,y=p*v-g*g,m=0===y?0:1/y,x=t.x1,b=t.y1,w=0;w=0&&r>=0&&s+r<1&&(n.push({x:e[w].x,y:e[w].y}),i)));w++);return n}},function(t,e){t.exports=function(t,e,i,n){var s=Math.cos(n),r=Math.sin(n),o=t.x1-e,a=t.y1-i;return t.x1=o*s-a*r+e,t.y1=o*r+a*s+i,o=t.x2-e,a=t.y2-i,t.x2=o*s-a*r+e,t.y2=o*r+a*s+i,t}},function(t,e){t.exports=function(t,e,i){for(var n=!1,s=-1,r=t.points.length-1;++s0&&(n.totalDuration+=n.t2*n.repeat),n.totalDuration>t&&(t=n.totalDuration)}this.duration=t,this.loopCounter=-1===this.loop?999999999999:this.loop,this.loopCounter>0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){for(var t=this.data,e=this.totalTargets,i=0;i0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&(t.params[1]=this.targets,t.func.apply(t.scope,t.params)),this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},pause:function(){if(this.state!==o.PAUSED)return this.paused=!0,this._pausedState=this.state,this.state=o.PAUSED,this},play:function(t){if(this.state!==o.ACTIVE){this.state!==o.PENDING_REMOVE&&this.state!==o.REMOVED||(this.init(),this.parent.makeActive(this),t=!0);var e=this.callbacks.onStart;this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?(e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.ACTIVE):(this.countdown=this.calculatedOffset,this.state=o.OFFSET_DELAY)):this.paused?(this.paused=!1,this.parent.makeActive(this)):(this.resetTweenData(t),this.state=o.ACTIVE,e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)))}},resetTweenData:function(t){for(var e=this.data,i=0;i0?(n.elapsed=n.delay,n.state=o.DELAY):n.state=o.PENDING_RENDER}},resume:function(){return this.state===o.PAUSED&&(this.paused=!1,this.state=this._pausedState),this},seek:function(t){for(var e=this.data,i=0;i=s.totalDuration?(r=1,o=s.duration):n>s.delay&&n<=s.t1?(r=(n=Math.max(0,n-s.delay))/s.t1,o=s.duration*r):n>s.t1&&ns.repeatDelay&&(r=n/s.t1,o=s.duration*r)),s.progress=r,s.elapsed=o;var a=s.ease(s.progress);s.current=s.start+(s.end-s.start)*a,s.target[s.key]=s.current}},setCallback:function(t,e,i,n){return this.callbacks[t]={func:e,scope:n,params:i},this},complete:function(t){if(void 0===t&&(t=0),t)this.countdown=t,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&(e.params[1]=this.targets,e.func.apply(e.scope,e.params)),this.state=o.PENDING_REMOVE}},stop:function(t){void 0!==t&&this.seek(t),this.state=o.PENDING_REMOVE},update:function(t,e){if(this.state===o.PAUSED)return!1;switch(this.useFrames&&(e=1*this.parent.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var i=!1,n=0;n0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var s=t.callbacks.onRepeat;return s&&(s.params[1]=e.target,s.func.apply(s.scope,s.params)),e.start=e.getStartValue(e.target,e.key,e.start),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},setStateFromStart:function(t,e,i){if(e.repeatCounter>0){e.repeatCounter--,e.elapsed=i,e.progress=i/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY();var n=t.callbacks.onRepeat;return n&&(n.params[1]=e.target,n.func.apply(n.scope,n.params)),e.end=e.getEndValue(e.target,e.key,e.start),e.repeatDelay>0?(e.elapsed=e.repeatDelay-i,e.current=e.start,e.target[e.key]=e.current,o.REPEAT_DELAY):o.PLAYING_FORWARD}return o.COMPLETE},updateTweenData:function(t,e,i){switch(e.state){case o.PLAYING_FORWARD:case o.PLAYING_BACKWARD:if(!e.target){e.state=o.COMPLETE;break}var n=e.elapsed,s=e.duration,r=0;(n+=i)>s&&(r=n-s,n=s);var a,h=e.state===o.PLAYING_FORWARD,l=n/s;a=h?e.ease(l):e.ease(1-l),e.current=e.start+(e.end-e.start)*a,e.target[e.key]=e.current,e.elapsed=n,e.progress=l;var u=t.callbacks.onUpdate;u&&(u.params[1]=e.target,u.func.apply(u.scope,u.params)),1===l&&(h?e.hold>0?(e.elapsed=e.hold-r,e.state=o.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,r):e.state=this.setStateFromStart(t,e,r));break;case o.DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PENDING_RENDER);break;case o.REPEAT_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=o.PLAYING_FORWARD);break;case o.HOLD_DELAY:e.elapsed-=i,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case o.PENDING_RENDER:e.target?(e.start=e.getStartValue(e.target,e.key,e.target[e.key]),e.end=e.getEndValue(e.target,e.key,e.start),e.current=e.start,e.target[e.key]=e.start,e.state=o.PLAYING_FORWARD):e.state=o.COMPLETE}return e.state!==o.COMPLETE}});a.TYPES=["onComplete","onLoop","onRepeat","onStart","onUpdate","onYoyo"],r.register("tween",function(t){return this.scene.sys.tweens.add(t)}),s.register("tween",function(t){return this.scene.sys.tweens.create(t)}),t.exports=a},function(t,e){t.exports=function(t,e,i,n,s,r,o,a,h,l,u,c,d){return{target:t,key:e,getEndValue:i,getStartValue:n,ease:s,duration:0,totalDuration:0,delay:0,yoyo:a,hold:0,repeat:0,repeatDelay:0,flipX:c,flipY:d,progress:0,elapsed:0,repeatCounter:0,start:0,current:0,end:0,t1:0,t2:0,gen:{delay:r,duration:o,hold:h,repeat:l,repeatDelay:u},state:0}}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-Math.PI,Math.PI)}},function(t,e,i){var n=i(50);t.exports=function(t){return n(t,-180,180)}},function(t,e,i){var n=i(0),s=i(516),r=i(164),o=new n({Extends:r,initialize:function(t){t.fragShader=s.replace("%LIGHT_COUNT%",10..toString()),r.call(this,t)},onBind:function(){r.prototype.onBind.call(this);var t=this.renderer,e=this.program;return this.mvpUpdate(),t.setInt1(e,"uNormSampler",1),t.setFloat2(e,"uResolution",this.width,this.height),this},onRender:function(t,e){var i=t.lights;if(i.culledLights.length=0,i.lights.length<=0||!i.active)return this;var n,s=this.renderer,r=this.program,o=t.lights.cull(e),a=Math.min(o.length,10),h=e.matrix,l={x:0,y:0},u=s.height;for(n=0;n<10;++n)s.setFloat1(r,"uLights["+n+"].radius",0);if(a<=0)return this;for(s.setFloat4(r,"uCamera",e.x,e.y,e.rotation,e.zoom),s.setFloat3(r,"uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),n=0;n0?(n.textures[e-1]&&n.textures[e-1]!==t&&this.pushBatch(),i[i.length-1].textures[e-1]=t):(null!==n.texture&&n.texture!==t&&this.pushBatch(),i[i.length-1].texture=t),this},pushBatch:function(){var t={first:this.vertexCount,texture:null,textures:[]};this.batches.push(t)},flush:function(){if(this.flushLocked)return this;this.flushLocked=!0;var t,e,i,n=this.gl,s=this.renderer,r=this.vertexCount,o=this.topology,a=this.vertexSize,h=this.batches,l=0,u=null;if(0===h.length||0===r)return this.flushLocked=!1,this;n.bufferSubData(n.ARRAY_BUFFER,0,this.bytes.subarray(0,r*a));for(var c=0;c0){for(e=0;e0){for(e=0;e0&&(s.setTexture2D(u.texture,0),n.drawArrays(o,u.first,l)),this.vertexCount=0,h.length=0,this.pushBatch(),this.flushLocked=!1,this},onBind:function(){return h.prototype.onBind.call(this),this.mvpUpdate(),0===this.batches.length&&this.pushBatch(),this},resize:function(t,e,i){return h.prototype.resize.call(this,t,e,i),this.projOrtho(0,this.width,this.height,0,-1e3,1e3),this},drawStaticTilemapLayer:function(t){if(t.vertexCount>0){var e=this.vertexBuffer,i=this.gl,n=this.renderer,s=t.tileset.image.get();n.currentPipeline&&n.currentPipeline.vertexCount>0&&n.flush(),this.vertexBuffer=t.vertexBuffer,n.setPipeline(this),n.setTexture2D(s.source.glTexture,0),i.drawArrays(this.topology,0,t.vertexCount),this.vertexBuffer=e}this.viewIdentity(),this.modelIdentity()},drawEmitterManager:function(t,e){this.renderer.setPipeline(this);var i=this.renderer.config.roundPixels,n=t.emitters.list,s=n.length,r=this.vertexViewF32,o=this.vertexViewU32,a=this.renderer,h=this.maxQuads,l=e.scrollX,u=e.scrollY,c=e.matrix.matrix,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=Math.sin,x=Math.cos,b=this.vertexComponentCount,w=this.vertexCapacity,T=t.defaultFrame.source.glTexture;this.setTexture2D(T,0);for(var S=0;S=w&&(this.flush(),this.setTexture2D(T,0));for(var k=0;k<_;++k){for(var F=Math.min(M,h),O=0;O=w&&(this.flush(),this.setTexture2D(T,0))}}}this.setTexture2D(T,0)},drawBlitter:function(t,e){this.renderer.setPipeline(this);for(var i=this.renderer.config.roundPixels,n=a.getTintAppendFloatAlpha,s=this.vertexViewF32,r=this.vertexViewU32,o=t.getRenderList(),h=o.length,l=e.matrix.matrix,u=l[0],c=l[1],d=l[2],f=l[3],p=l[4],g=l[5],v=e.scrollX*t.scrollFactorX,y=e.scrollY*t.scrollFactorY,m=Math.ceil(h/this.maxQuads),x=0,b=t.x-v,w=t.y-y,T=0;T=this.vertexCapacity&&this.flush()}x+=S,h-=S,this.vertexCount>=this.vertexCapacity&&this.flush()}},batchSprite:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n=this.renderer.config.roundPixels,s=a.getTintAppendFloatAlpha,r=this.vertexViewF32,o=this.vertexViewU32,h=e.matrix.matrix,l=t.frame,u=l.texture.source[l.sourceIndex].glTexture,c=!!u.isRenderTexture,d=t.flipX,f=t.flipY^c,p=l.uvs,g=l.width*(d?-1:1),v=l.height*(f?-1:1),y=-t.displayOriginX+l.x+l.width*(d?1:0),m=-t.displayOriginY+l.y+l.height*(f?1:0),x=(n?0|y:y)+g,b=(n?0|m:m)+v,w=t.x-e.scrollX*t.scrollFactorX,T=t.y-e.scrollY*t.scrollFactorY,S=t.scaleX,A=t.scaleY,C=-t.rotation,M=t._alphaTL,_=t._alphaTR,E=t._alphaBL,P=t._alphaBR,L=t._tintTL,k=t._tintTR,F=t._tintBL,O=t._tintBR,R=Math.sin(C),B=Math.cos(C),I=B*S,D=-R*S,z=R*A,Y=B*A,X=w,N=T,V=h[0],W=h[1],G=h[2],U=h[3],j=I*V+D*G,H=I*W+D*U,q=z*V+Y*G,K=z*W+Y*U,J=X*V+N*G+h[4],Z=X*W+N*U+h[5],Q=y*j+m*q+J,$=y*H+m*K+Z,tt=y*j+b*q+J,et=y*H+b*K+Z,it=x*j+b*q+J,nt=x*H+b*K+Z,st=x*j+m*q+J,rt=x*H+m*K+Z,ot=s(L,M),at=s(k,_),ht=s(F,E),lt=s(O,P);n&&(Q|=0,$|=0,tt|=0,et|=0,it|=0,nt|=0,st|=0,rt|=0),this.setTexture2D(u,0),r[(i=this.vertexCount*this.vertexComponentCount)+0]=Q,r[i+1]=$,r[i+2]=p.x0,r[i+3]=p.y0,o[i+4]=ot,r[i+5]=tt,r[i+6]=et,r[i+7]=p.x1,r[i+8]=p.y1,o[i+9]=ht,r[i+10]=it,r[i+11]=nt,r[i+12]=p.x2,r[i+13]=p.y2,o[i+14]=lt,r[i+15]=Q,r[i+16]=$,r[i+17]=p.x0,r[i+18]=p.y0,o[i+19]=ot,r[i+20]=it,r[i+21]=nt,r[i+22]=p.x2,r[i+23]=p.y2,o[i+24]=lt,r[i+25]=st,r[i+26]=rt,r[i+27]=p.x3,r[i+28]=p.y3,o[i+29]=at,this.vertexCount+=6},batchMesh:function(t,e){var i=t.vertices,n=i.length,s=n/2|0;this.renderer.setPipeline(this),this.vertexCount+s>this.vertexCapacity&&this.flush();var r=this.renderer.config.roundPixels,o=a.getTintAppendFloatAlpha,h=t.uv,l=t.colors,u=t.alphas,c=this.vertexViewF32,d=this.vertexViewU32,f=e.matrix.matrix,p=t.frame,g=t.texture.source[p.sourceIndex].glTexture,v=t.x-e.scrollX*t.scrollFactorX,y=t.y-e.scrollY*t.scrollFactorY,m=t.scaleX,x=t.scaleY,b=-t.rotation,w=Math.sin(b),T=Math.cos(b),S=T*m,A=-w*m,C=w*x,M=T*x,_=v,E=y,P=f[0],L=f[1],k=f[2],F=f[3],O=S*P+A*k,R=S*L+A*F,B=C*P+M*k,I=C*L+M*F,D=_*P+E*k+f[4],z=_*L+E*F+f[5],Y=0;this.setTexture2D(g,0),Y=this.vertexCount*this.vertexComponentCount;for(var X=0,N=0;Xthis.vertexCapacity&&this.flush();var i,n,s,r,o,h,l,u,c=this.renderer.config.roundPixels,d=t.text,f=d.length,p=a.getTintAppendFloatAlpha,g=this.vertexViewF32,v=this.vertexViewU32,y=e.matrix.matrix,m=e.width+50,x=e.height+50,b=t.frame,w=t.texture.source[b.sourceIndex],T=e.scrollX*t.scrollFactorX,S=e.scrollY*t.scrollFactorY,A=t.fontData,C=A.lineHeight,M=t.fontSize/A.size,_=A.chars,E=t.alpha,P=p(t._tintTL,E),L=p(t._tintTR,E),k=p(t._tintBL,E),F=p(t._tintBR,E),O=t.x,R=t.y,B=b.cutX,I=b.cutY,D=w.width,z=w.height,Y=w.glTexture,X=0,N=0,V=0,W=0,G=null,U=0,j=0,H=0,q=0,K=0,J=0,Z=0,Q=0,$=0,tt=0,et=0,it=0,nt=null,st=0,rt=O-T+b.x,ot=R-S+b.y,at=-t.rotation,ht=t.scaleX,lt=t.scaleY,ut=Math.sin(at),ct=Math.cos(at),dt=ct*ht,ft=-ut*ht,pt=ut*lt,gt=ct*lt,vt=rt,yt=ot,mt=y[0],xt=y[1],bt=y[2],wt=y[3],Tt=dt*mt+ft*bt,St=dt*xt+ft*wt,At=pt*mt+gt*bt,Ct=pt*xt+gt*wt,Mt=vt*mt+yt*bt+y[4],_t=vt*xt+yt*wt+y[5],Et=0;this.setTexture2D(Y,0);for(var Pt=0;Ptm||n<-50||n>x)&&(s<-50||s>m||r<-50||r>x)&&(o<-50||o>m||h<-50||h>x)&&(l<-50||l>m||u<-50||u>x)||(this.vertexCount+6>this.vertexCapacity&&this.flush(),c&&(i|=0,n|=0,s|=0,r|=0,o|=0,h|=0,l|=0,u|=0),g[(Et=this.vertexCount*this.vertexComponentCount)+0]=i,g[Et+1]=n,g[Et+2]=$,g[Et+3]=et,v[Et+4]=P,g[Et+5]=s,g[Et+6]=r,g[Et+7]=$,g[Et+8]=it,v[Et+9]=k,g[Et+10]=o,g[Et+11]=h,g[Et+12]=tt,g[Et+13]=it,v[Et+14]=F,g[Et+15]=i,g[Et+16]=n,g[Et+17]=$,g[Et+18]=et,v[Et+19]=P,g[Et+20]=o,g[Et+21]=h,g[Et+22]=tt,g[Et+23]=it,v[Et+24]=F,g[Et+25]=l,g[Et+26]=u,g[Et+27]=tt,g[Et+28]=et,v[Et+29]=L,this.vertexCount+=6))}}else X=0,V=0,N+=C,nt=null},batchDynamicBitmapText:function(t,e){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var i,n,s,r,o,h,l,u,c,d,f,p,g,v,y=this.renderer.config.roundPixels,m=t.displayCallback,x=t.text,b=x.length,w=a.getTintAppendFloatAlpha,T=this.vertexViewF32,S=this.vertexViewU32,A=this.renderer,C=e.matrix.matrix,M=t.frame,_=t.texture.source[M.sourceIndex],E=e.scrollX*t.scrollFactorX,P=e.scrollY*t.scrollFactorY,L=t.scrollX,k=t.scrollY,F=t.fontData,O=F.lineHeight,R=t.fontSize/F.size,B=F.chars,I=t.alpha,D=w(t._tintTL,I),z=w(t._tintTR,I),Y=w(t._tintBL,I),X=w(t._tintBR,I),N=t.x,V=t.y,W=M.cutX,G=M.cutY,U=_.width,j=_.height,H=_.glTexture,q=0,K=0,J=0,Z=0,Q=null,$=0,tt=0,et=0,it=0,nt=0,st=0,rt=0,ot=0,at=0,ht=0,lt=0,ut=0,ct=null,dt=0,ft=N+M.x,pt=V+M.y,gt=-t.rotation,vt=t.scaleX,yt=t.scaleY,mt=Math.sin(gt),xt=Math.cos(gt),bt=xt*vt,wt=-mt*vt,Tt=mt*yt,St=xt*yt,At=ft,Ct=pt,Mt=C[0],_t=C[1],Et=C[2],Pt=C[3],Lt=bt*Mt+wt*Et,kt=bt*_t+wt*Pt,Ft=Tt*Mt+St*Et,Ot=Tt*_t+St*Pt,Rt=At*Mt+Ct*Et+C[4],Bt=At*_t+Ct*Pt+C[5],It=t.cropWidth>0||t.cropHeight>0,Dt=0;this.setTexture2D(H,0),It&&A.pushScissor(t.x,t.y,t.cropWidth*t.scaleX,t.cropHeight*t.scaleY);for(var zt=0;ztthis.vertexCapacity&&this.flush(),y&&(i|=0,n|=0,s|=0,r|=0,o|=0,h|=0,l|=0,u|=0),T[(Dt=this.vertexCount*this.vertexComponentCount)+0]=i,T[Dt+1]=n,T[Dt+2]=at,T[Dt+3]=lt,S[Dt+4]=D,T[Dt+5]=s,T[Dt+6]=r,T[Dt+7]=at,T[Dt+8]=ut,S[Dt+9]=Y,T[Dt+10]=o,T[Dt+11]=h,T[Dt+12]=ht,T[Dt+13]=ut,S[Dt+14]=X,T[Dt+15]=i,T[Dt+16]=n,T[Dt+17]=at,T[Dt+18]=lt,S[Dt+19]=D,T[Dt+20]=o,T[Dt+21]=h,T[Dt+22]=ht,T[Dt+23]=ut,S[Dt+24]=X,T[Dt+25]=l,T[Dt+26]=u,T[Dt+27]=ht,T[Dt+28]=lt,S[Dt+29]=z,this.vertexCount+=6}}}else q=0,J=0,K+=O,ct=null;It&&A.popScissor()},batchText:function(t,e){var i=a.getTintAppendFloatAlpha;this.batchTexture(t,t.canvasTexture,t.canvasTexture.width,t.canvasTexture.height,t.x,t.y,t.canvasTexture.width,t.canvasTexture.height,t.scaleX,t.scaleY,t.rotation,t.flipX,t.flipY,t.scrollFactorX,t.scrollFactorY,t.displayOriginX,t.displayOriginY,0,0,t.canvasTexture.width,t.canvasTexture.height,i(t._tintTL,t._alphaTL),i(t._tintTR,t._alphaTR),i(t._tintBL,t._alphaBL),i(t._tintBR,t._alphaBR),0,0,e)},batchDynamicTilemapLayer:function(t,e){for(var i=t.culledTiles,n=i.length,s=t.tileset.image.get().source.glTexture,r=t.tileset,o=t.scrollFactorX,h=t.scrollFactorY,l=t.alpha,u=t.x,c=t.y,d=t.scaleX,f=t.scaleY,p=a.getTintAppendFloatAlpha,g=0;gthis.vertexCapacity&&this.flush(),d^=e.isRenderTexture?1:0,u=-u;var E,P=this.renderer.config.roundPixels,L=this.vertexViewF32,k=this.vertexViewU32,F=_.matrix.matrix,O=o*(c?1:0)-g,R=a*(d?1:0)-v,B=O+o*(c?-1:1),I=R+a*(d?-1:1),D=s-_.scrollX*f,z=r-_.scrollY*p,Y=Math.sin(u),X=Math.cos(u),N=X*h,V=-Y*h,W=Y*l,G=X*l,U=D,j=z,H=F[0],q=F[1],K=F[2],J=F[3],Z=N*H+V*K,Q=N*q+V*J,$=W*H+G*K,tt=W*q+G*J,et=U*H+j*K+F[4],it=U*q+j*J+F[5],nt=O*Z+R*$+et,st=O*Q+R*tt+it,rt=O*Z+I*$+et,ot=O*Q+I*tt+it,at=B*Z+I*$+et,ht=B*Q+I*tt+it,lt=B*Z+R*$+et,ut=B*Q+R*tt+it,ct=y/i+C,dt=m/n+M,ft=(y+x)/i+C,pt=(m+b)/n+M;this.setTexture2D(e,0),P&&(nt|=0,st|=0,rt|=0,ot|=0,at|=0,ht|=0,lt|=0,ut|=0),L[(E=this.vertexCount*this.vertexComponentCount)+0]=nt,L[E+1]=st,L[E+2]=ct,L[E+3]=dt,k[E+4]=w,L[E+5]=rt,L[E+6]=ot,L[E+7]=ct,L[E+8]=pt,k[E+9]=T,L[E+10]=at,L[E+11]=ht,L[E+12]=ft,L[E+13]=pt,k[E+14]=S,L[E+15]=nt,L[E+16]=st,L[E+17]=ct,L[E+18]=dt,k[E+19]=w,L[E+20]=at,L[E+21]=ht,L[E+22]=ft,L[E+23]=pt,k[E+24]=S,L[E+25]=lt,L[E+26]=ut,L[E+27]=ft,L[E+28]=dt,k[E+29]=A,this.vertexCount+=6},drawTexture:function(t,e,i,n,s,r,o,h,l,u){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var c,d=this.renderer.config.roundPixels,f=this.vertexViewF32,p=this.vertexViewU32,g=e,v=i,y=g+h,m=v+l,x=u[0],b=u[1],w=u[2],T=u[3],S=u[4],A=u[5],C=g*x+v*w+S,M=g*b+v*T+A,_=g*x+m*w+S,E=g*b+m*T+A,P=y*x+m*w+S,L=y*b+m*T+A,k=y*x+v*w+S,F=y*b+v*T+A,O=t.width,R=t.height,B=r/O,I=o/R,D=(r+h)/O,z=(o+l)/R;n=a.getTintAppendFloatAlpha(n,s),this.setTexture2D(t,0),d&&(C|=0,M|=0,_|=0,E|=0,P|=0,L|=0,k|=0,F|=0),f[(c=this.vertexCount*this.vertexComponentCount)+0]=C,f[c+1]=M,f[c+2]=B,f[c+3]=I,p[c+4]=n,f[c+5]=_,f[c+6]=E,f[c+7]=B,f[c+8]=z,p[c+9]=n,f[c+10]=P,f[c+11]=L,f[c+12]=D,f[c+13]=z,p[c+14]=n,f[c+15]=C,f[c+16]=M,f[c+17]=B,f[c+18]=I,p[c+19]=n,f[c+20]=P,f[c+21]=L,f[c+22]=D,f[c+23]=z,p[c+24]=n,f[c+25]=k,f[c+26]=F,f[c+27]=D,f[c+28]=I,p[c+29]=n,this.vertexCount+=6,this.flush()},batchGraphics:function(){}});t.exports=l},function(t,e,i){var n={};t.exports=n;var s=i(38);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var o={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===e.length&&e.stiffness>.1?(o.type="pin",o.anchors=!1):e.stiffness<.9&&(o.type="spring"),e.render=l.extend(o,e.render),e},n.preSolveAll=function(t){for(var e=0;e0&&(c.position.x+=l.x,c.position.y+=l.y),0!==l.angle&&(s.rotate(c.vertices,l.angle,i.position),h.rotate(c.axes,l.angle),u>0&&r.rotateAbout(c.position,l.angle,i.position,c.position)),a.update(c.bounds,c.vertices,i.velocity)}l.angle*=n._warming,l.x*=n._warming,l.y*=n._warming}}}},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){t.exports=function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0}},function(t,e,i){t.exports={Angle:i(387),Call:i(388),GetFirst:i(389),GridAlign:i(390),IncAlpha:i(408),IncX:i(409),IncXY:i(410),IncY:i(411),PlaceOnCircle:i(412),PlaceOnEllipse:i(413),PlaceOnLine:i(414),PlaceOnRectangle:i(415),PlaceOnTriangle:i(416),PlayAnimation:i(417),RandomCircle:i(418),RandomEllipse:i(419),RandomLine:i(420),RandomRectangle:i(421),RandomTriangle:i(422),Rotate:i(423),RotateAround:i(424),RotateAroundDistance:i(425),ScaleX:i(426),ScaleXY:i(427),ScaleY:i(428),SetAlpha:i(429),SetBlendMode:i(430),SetDepth:i(431),SetHitArea:i(432),SetOrigin:i(433),SetRotation:i(434),SetScale:i(435),SetScaleX:i(436),SetScaleY:i(437),SetTint:i(438),SetVisible:i(439),SetX:i(440),SetXY:i(441),SetY:i(442),ShiftPosition:i(443),Shuffle:i(444),SmootherStep:i(445),SmoothStep:i(446),Spread:i(447),ToggleVisible:i(448)}},function(t,e,i){var n=i(171),s=[];s[n.BOTTOM_CENTER]=i(172),s[n.BOTTOM_LEFT]=i(173),s[n.BOTTOM_RIGHT]=i(174),s[n.CENTER]=i(175),s[n.LEFT_CENTER]=i(177),s[n.RIGHT_CENTER]=i(178),s[n.TOP_CENTER]=i(179),s[n.TOP_LEFT]=i(180),s[n.TOP_RIGHT]=i(181);t.exports=function(t,e,i,n,r){return s[i](t,e,n,r)}},function(t,e){t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},function(t,e,i){var n=i(24),s=i(46),r=i(25),o=i(47);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(26),r=i(25),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(24),s=i(28),r=i(25),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(176),s=i(46),r=i(49);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),n(t,s(e)+i,r(e)+o),t}},function(t,e,i){var n=i(47),s=i(48);t.exports=function(t,e,i){return n(t,e),s(t,i)}},function(t,e,i){var n=i(49),s=i(26),r=i(48),o=i(27);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)+a),t}},function(t,e,i){var n=i(49),s=i(28),r=i(48),o=i(29);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)+a),t}},function(t,e,i){var n=i(46),s=i(30),r=i(47),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(26),s=i(30),r=i(27),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)-a),t}},function(t,e,i){var n=i(28),s=i(30),r=i(29),o=i(31);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)-a),t}},function(t,e,i){var n=i(105),s=i(65),r=i(16),o=i(5);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=s(e,0,r.PI2);return n(t,a,i)}},function(t,e,i){var n=i(184),s=i(105),r=i(65),o=i(16);t.exports=function(t,e,i,a){void 0===a&&(a=[]),e||(e=n(t)/i);for(var h=0;h=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;n-h&&(c-=h,n+=l),f0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var n=this.frames.slice(0,t),s=this.frames.slice(t);this.frames=n.concat(i,s)}this.updateFrameSequence()}return this},checkFrame:function(t){return t0){o.isLast=!0,o.nextFrame=l[0],l[0].prevFrame=o;var v=1/(l.length-1);for(a=0;a=this.frames.length&&(e=0),t.currentAnim!==this&&(t.currentAnim=this,t._timeScale=1,t.frameRate=this.frameRate,t.duration=this.duration,t.msPerFrame=this.msPerFrame,t.skipMissedFrames=this.skipMissedFrames,t._delay=this.delay,t._repeat=this.repeat,t._repeatDelay=this.repeatDelay,t._yoyo=this.yoyo,t._callbackArgs[1]=this,t._updateParams=t._callbackArgs.concat(this.onUpdateParams)),t.updateFrame(this.frames[e])},nextFrame:function(t){var e=t.currentFrame;e.isLast?this.yoyo?(t.forward=!1,t.updateFrame(e.prevFrame),this.getNextTick(t)):t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.nextFrame),this.getNextTick(t))},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.repeatCounter>0?this.repeatAnimation(t):this.completeAnimation(t):(t.updateFrame(e.prevFrame),this.getNextTick(t))},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){t._repeatDelay>0&&!1===t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=1e3*t._repeatDelay):(t.repeatCounter--,t.forward=!0,t.updateFrame(t.currentFrame.nextFrame),this.getNextTick(t),t.pendingRepeat=!1,this.onRepeat&&this.onRepeat.apply(this.callbackScope,t._callbackArgs.concat(this.onRepeatParams)))},setFrame:function(t){t.forward?this.nextFrame(t):this.previousFrame(t)},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showOnStart:this.showOnStart,hideOnComplete:this.hideOnComplete};return this.frames.forEach(function(e){t.frames.push(e.toJSON())}),t},updateFrameSequence:function(){for(var t=this.frames.length,e=1/(t-1),i=0;i1&&(n.prevFrame=this.frames[i-1],n.nextFrame=this.frames[i+1])}return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){}});t.exports=o},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.onUpdate=null},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0,this.onUpdate=void 0}});t.exports=n},function(t,e,i){var n=i(195),s=i(0),r=i(114),o=i(14),a=i(4),h=i(198),l=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.paused=!1,this.name="AnimationManager",t.events.once("boot",this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once("destroy",this.destroy,this)},add:function(t,e){if(!this.anims.has(t))return e.key=t,this.anims.set(t,e),this.emit("add",t,e),this;console.warn("Animation with key",t,"already exists")},create:function(t){var e=t.key;if(e&&!this.anims.has(e)){var i=new n(this,e,t);return this.anims.set(e,i),this.emit("add",e,i),i}console.warn("Invalid Animation Key, or Key already in use: "+e)},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var n=0;n=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(0),s=i(114),r=i(14),o=new n({initialize:function(){this.entries=new s,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit("add",this,t,e),this},has:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit("remove",this,t,e.data)),this},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=o},function(t,e,i){var n=i(199),s=new(i(0))({initialize:function(t){this.game=t,this.binary=new n,this.bitmapFont=new n,this.json=new n,this.physics=new n,this.shader=new n,this.audio=new n,this.text=new n,this.obj=new n,this.tilemap=new n,this.xml=new n,this.custom={},this.game.events.once("destroy",this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new n),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","text","obj","tilemap","xml"],e=0;e16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(36);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var n=i(36);t.exports=function(t){var e=new n,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var s=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(s,r,o,255*a)}return e}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,n=2*Math.random()-1,s=Math.sqrt(1-n*n)*e;return t.x=Math.cos(i)*s,t.y=Math.sin(i)*s,t.z=n*e,t}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},function(t,e,i){var n=i(51),s=i(119),r=i(210),o=new s,a=new r,h=new n;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},function(t,e,i){var n=i(0),s=i(51),r=i(211),o=new Int8Array([1,2,0]),a=new Float32Array([0,0,0]),h=new s(1,0,0),l=new s(0,1,0),u=new s,c=new r,d=new n({initialize:function(t,e,i,n){"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},set:function(t,e,i,n){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},normalize:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s,this.w=n*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,n=this.y,s=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=s+e*(t.z-s),this.w=r+e*(t.w-r),this},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(u.copy(h).cross(t).length()<1e-6&&u.copy(l).cross(t),u.normalize(),this.setAxisAngle(u,Math.PI)):i>.999999?(this.x=0,this.y=0,this.z=0,this.w=1,this):(u.copy(t).cross(e),this.x=u.x,this.y=u.y,this.z=u.z,this.w=1+i,this.normalize())},setAxes:function(t,e,i){var n=c.val;return n[0]=e.x,n[3]=e.y,n[6]=e.z,n[1]=i.x,n[4]=i.y,n[7]=i.z,n[2]=-t.x,n[5]=-t.y,n[8]=-t.z,this.fromMat3(c).normalize()},identity:function(){return this.x=0,this.y=0,this.z=0,this.w=1,this},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=Math.cos(e),this},multiply:function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.x=e*h+s*r+i*a-n*o,this.y=i*h+s*o+n*r-e*a,this.z=n*h+s*a+e*o-i*r,this.w=s*h-e*r-i*o-n*a,this},slerp:function(t,e){var i=this.x,n=this.y,s=this.z,r=this.w,o=t.x,a=t.y,h=t.z,l=t.w,u=i*o+n*a+s*h+r*l;u<0&&(u=-u,o=-o,a=-a,h=-h,l=-l);var c=1-e,d=e;if(1-u>1e-6){var f=Math.acos(u),p=Math.sin(f);c=Math.sin((1-e)*f)/p,d=Math.sin(e*f)/p}return this.x=c*i+d*o,this.y=c*n+d*a,this.z=c*s+d*h,this.w=c*r+d*l,this},invert:function(){var t=this.x,e=this.y,i=this.z,n=this.w,s=t*t+e*e+i*i+n*n,r=s?1/s:0;return this.x=-t*r,this.y=-e*r,this.z=-i*r,this.w=n*r,this},conjugate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+s*r,this.y=i*o+n*r,this.z=n*o-i*r,this.w=s*o-e*r,this},rotateY:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o-n*r,this.y=i*o+s*r,this.z=n*o+e*r,this.w=s*o-i*r,this},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,n=this.z,s=this.w,r=Math.sin(t),o=Math.cos(t);return this.x=e*o+i*r,this.y=i*o-e*r,this.z=n*o+s*r,this.w=s*o-n*r,this},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(Math.abs(1-t*t-e*e-i*i)),this},fromMat3:function(t){var e,i=t.val,n=i[0]+i[4]+i[8];if(n>0)e=Math.sqrt(n+1),this.w=.5*e,e=.5/e,this.x=(i[7]-i[5])*e,this.y=(i[2]-i[6])*e,this.z=(i[3]-i[1])*e;else{var s=0;i[4]>i[0]&&(s=1),i[8]>i[3*s+s]&&(s=2);var r=o[s],h=o[r];e=Math.sqrt(i[3*s+s]-i[3*r+r]-i[3*h+h]+1),a[s]=.5*e,e=.5/e,a[r]=(i[3*r+s]+i[3*s+r])*e,a[h]=(i[3*h+s]+i[3*s+h])*e,this.x=a[0],this.y=a[1],this.z=a[2],this.w=(i[3*h+r]-i[3*r+h])*e}return this}});t.exports=d},function(t,e,i){var n=new(i(0))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new n(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],n=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=n,this},invert:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*r-o*h,c=-l*s+o*a,d=h*s-r*a,f=e*u+i*c+n*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*i+n*h)*f,t[2]=(o*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*a)*f,t[5]=(-o*e+n*s)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*s)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return t[0]=r*l-o*h,t[1]=n*h-i*l,t[2]=i*o-n*r,t[3]=o*a-s*l,t[4]=e*l-n*a,t[5]=n*s-e*o,t[6]=s*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*s,this},determinant:function(){var t=this.val,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*(l*r-o*h)+i*(-l*s+o*a)+n*(h*s-r*a)},multiply:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=t.val,d=c[0],f=c[1],p=c[2],g=c[3],v=c[4],y=c[5],m=c[6],x=c[7],b=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*n+f*o+p*l,e[2]=d*s+f*a+p*u,e[3]=g*i+v*r+y*h,e[4]=g*n+v*o+y*l,e[5]=g*s+v*a+y*u,e[6]=m*i+x*r+b*h,e[7]=m*n+x*o+b*l,e[8]=m*s+x*a+b*u,this},translate:function(t){var e=this.val,i=t.x,n=t.y;return e[6]=i*e[0]+n*e[3]+e[6],e[7]=i*e[1]+n*e[4]+e[7],e[8]=i*e[2]+n*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),l=Math.cos(t);return e[0]=l*i+h*r,e[1]=l*n+h*o,e[2]=l*s+h*a,e[3]=l*r-h*i,e[4]=l*o-h*n,e[5]=l*a-h*s,this},scale:function(t){var e=this.val,i=t.x,n=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=n*e[3],e[4]=n*e[4],e[5]=n*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,o=i+i,a=n+n,h=e*r,l=e*o,u=e*a,c=i*o,d=i*a,f=n*a,p=s*r,g=s*o,v=s*a,y=this.val;return y[0]=1-(c+f),y[3]=l+v,y[6]=u-g,y[1]=l-v,y[4]=1-(h+f),y[7]=d+p,y[2]=u+g,y[5]=d-p,y[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],h=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],v=e[13],y=e[14],m=e[15],x=n*h-s*a,b=n*l-r*a,w=n*u-o*a,T=s*l-r*h,S=s*u-o*h,A=r*u-o*l,C=c*v-d*g,M=c*y-f*g,_=c*m-p*g,E=d*y-f*v,P=d*m-p*v,L=f*m-p*y,k=x*L-b*P+w*E+T*_-S*M+A*C;return k?(k=1/k,i[0]=(h*L-l*P+u*E)*k,i[1]=(l*_-a*L-u*M)*k,i[2]=(a*P-h*_+u*C)*k,i[3]=(r*P-s*L-o*E)*k,i[4]=(n*L-r*_+o*M)*k,i[5]=(s*_-n*P-o*C)*k,i[6]=(v*A-y*S+m*T)*k,i[7]=(y*w-g*A-m*b)*k,i[8]=(g*S-v*w+m*x)*k,this):null}});t.exports=n},function(t,e,i){var n=i(118),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),n.call(this,t),this.viewportWidth=e,this.viewportHeight=i,this._zoom=1,this.near=0,this.update()},setToOrtho:function(t,e,i){void 0===e&&(e=this.viewportWidth),void 0===i&&(i=this.viewportHeight);var n=this.zoom;return this.up.set(0,t?-1:1,0),this.direction.set(0,0,t?1:-1),this.position.set(n*e/2,n*i/2,0),this.viewportWidth=e,this.viewportHeight=i,this.update()},update:function(){var t=this.viewportWidth,e=this.viewportHeight,i=Math.abs(this.near),n=Math.abs(this.far),s=this.zoom;return 0===t||0===e?this:(this.projection.ortho(s*-t/2,s*t/2,s*-e/2,s*e/2,i,n),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this)},zoom:{get:function(){return this._zoom},set:function(t){this._zoom=t,this.update()}}});t.exports=o},function(t,e,i){var n=i(118),s=i(0),r=new(i(51)),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e=80),void 0===i&&(i=0),void 0===s&&(s=0),n.call(this,t),this.viewportWidth=i,this.viewportHeight=s,this.fieldOfView=e*Math.PI/180,this.update()},setFOV:function(t){return this.fieldOfView=t*Math.PI/180,this},update:function(){var t=this.viewportWidth/this.viewportHeight;return this.projection.perspective(this.fieldOfView,t,Math.abs(this.near),Math.abs(this.far)),r.copy(this.position).add(this.direction),this.view.lookAt(this.position,r,this.up),this.combined.copy(this.projection).multiply(this.view),this.invProjectionView.copy(this.combined).invert(),this.billboardMatrixDirty=!0,this.updateChildren(),this}});t.exports=o},function(t,e,i){var n=i(215),s=i(19),r=i(4);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",n),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),l=r(t,"resizeCanvas",!0),u=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=s.create2D(this,f,p),l=!1,u=!1),l&&(i.width=f,i.height=p);var g=i.getContext("2d");u&&g.clearRect(0,0,f,p),c&&c(i,g);for(var v=0;vi;)n-=i;ni.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(n(a,h.x,l.x,u.x,c.x),n(a,h.y,l.y,u.y,c.y))},toJSON:function(){for(var t=[],e=0;e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}}).call(e,i(497)(t))},function(t,e,i){var n=i(117);t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var s=Math.floor(6*t),r=6*t-s,o=Math.floor(i*(1-e)*255),a=Math.floor(i*(1-r*e)*255),h=Math.floor(i*(1-(1-r)*e)*255),l={r:i=Math.floor(i*=255),g:i,b:i,color:0},u=s%6;return 0===u?(l.g=h,l.b=o):1===u?(l.r=a,l.b=o):2===u?(l.r=o,l.b=h):3===u?(l.r=o,l.g=a):4===u?(l.r=h,l.g=o):5===u&&(l.g=o,l.b=a),l.color=n(l.r,l.g,l.b),l}},function(t,e,i){var n=i(230);t.exports=function(t,e){var i=t.length-1,s=i*e,r=Math.floor(s);return e<0?n(t[0],t[1],s):e>1?n(t[i],t[i-1],i-s):n(t[r],t[r+1>i?i:r+1],s-r)}},function(t,e){t.exports=function(t,e,i){return(e-t)*i+t}},function(t,e){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},function(t,e,i){var n=i(67);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?n.cordova&&!n.cocoonJS?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},function(t,e){t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},function(t,e){t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},function(t,e,i){var n=i(0),s=i(3),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0;var t=this;this.step=function e(i){t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.requestAnimationFrame(e)},this.stepTimeout=function e(){var i=Date.now(),n=Math.max(16+t.lastTime-i,0);t.lastTime=t.tick,t.tick=i,t.callback(i),t.timeOutID=window.setTimeout(e,n)}},start:function(t,e){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e){t.exports={Global:["anims","cache","registry","sound","textures"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["CameraManager3D","Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},function(t,e,i){var n,s,r,o=i(19),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create(t,6,1).getContext("2d");if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,a,h,l,u,f,g,v=e&&e.length,y=v?e[0]*i:t.length,m=s(t,0,y,i,!0),x=[];if(!m)return x;if(v&&(m=function(t,e,i,n){var o,a,h,l,u,f=[];for(o=0,a=e.length;o80*i){n=h=t[0],a=l=t[1];for(var b=i;bh&&(h=u),f>l&&(l=f);g=Math.max(h-n,l-a)}return o(m,x,i,n,a,g),x}function s(t,e,i,n,s){var r,o;if(s===C(t,e,i,n)>0)for(r=e;r=e;r-=n)o=T(r,t[r],t[r+1],o);return o&&m(o,o.next)&&(S(o),o=o.next),o}function r(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!m(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(S(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,s,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0!==a&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(o>1)}(s)}(t,n,s,c);for(var p,g,v=t;t.prev!==t.next;)if(p=t.prev,g=t.next,c?h(t,n,s,c):a(t))e.push(p.i/i),e.push(t.i/i),e.push(g.i/i),S(t),t=g.next,v=g.next;else if((t=g)===v){d?1===d?o(t=l(t,e,i),e,i,n,s,c,2):2===d&&u(t,e,i,n,s,c):o(r(t),e,i,n,s,c,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(y(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&y(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function h(t,e,i,n){var s=t.prev,r=t,o=t.next;if(y(s,r,o)>=0)return!1;for(var a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(a,h,e,i,n),d=f(l,u,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&g(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function l(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!m(s,r)&&x(s,n,n.next,r)&&b(s,r)&&b(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),S(n),S(n.next),n=t=r),n=n.next}while(n!==t);return n}function u(t,e,i,n,s,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&v(h,l)){var u=w(h,l);return h=r(h,h.next),u=r(u,u.next),o(h,e,i,n,s,a),void o(u,e,i,n,s,a)}l=l.next}h=h.next}while(h!==t)}function c(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&a>o){if(o=a,a===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=u&&s!==n.x&&g(ri.x)&&b(n,t)&&(i=n,d=h),n=n.next;return i}(t,e)){var i=w(e,t);r(i,i.next)}}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&x(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&b(t,e)&&b(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function y(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function m(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,i,n){return!!(m(t,e)&&m(i,n)||m(t,n)&&m(i,e))||y(t,e,i)>0!=y(t,e,n)>0&&y(i,n,t)>0!=y(i,n,e)>0}function b(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function w(t,e){var i=new A(t.i,t.x,t.y),n=new A(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function T(t,e,i,n){var s=new A(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function S(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},function(t,e){var i={modelMatrixDirty:!1,viewMatrixDirty:!1,projectionMatrixDirty:!1,modelMatrix:null,viewMatrix:null,projectionMatrix:null,mvpInit:function(){return this.modelMatrixDirty=!0,this.viewMatrixDirty=!0,this.projectionMatrixDirty=!0,this.modelMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},mvpUpdate:function(){var t=this.program;return this.modelMatrixDirty&&(this.renderer.setMatrix4(t,"uModelMatrix",!1,this.modelMatrix),this.modelMatrixDirty=!1),this.viewMatrixDirty&&(this.renderer.setMatrix4(t,"uViewMatrix",!1,this.viewMatrix),this.viewMatrixDirty=!1),this.projectionMatrixDirty&&(this.renderer.setMatrix4(t,"uProjectionMatrix",!1,this.projectionMatrix),this.projectionMatrixDirty=!1),this},modelIdentity:function(){var t=this.modelMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.modelMatrixDirty=!0,this},modelScale:function(t,e,i){var n=this.modelMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.modelMatrixDirty=!0,this},modelTranslate:function(t,e,i){var n=this.modelMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.modelMatrixDirty=!0,this},modelRotateX:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],l=e[9],u=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+l*i,e[6]=o*n+u*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=l*n-r*i,e[10]=u*n-o*i,e[11]=c*n-a*i,this.modelMatrixDirty=!0,this},modelRotateY:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],l=e[9],u=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-l*i,e[2]=o*n-u*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+l*n,e[10]=o*i+u*n,e[11]=a*i+c*n,this.modelMatrixDirty=!0,this},modelRotateZ:function(t){var e=this.modelMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5],u=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+l*i,e[2]=o*n+u*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=l*n-r*i,e[6]=u*n-o*i,e[7]=c*n-a*i,this.modelMatrixDirty=!0,this},viewIdentity:function(){var t=this.viewMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.viewMatrixDirty=!0,this},viewScale:function(t,e,i){var n=this.viewMatrix;return n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*t,n[3]=n[3]*t,n[4]=n[4]*e,n[5]=n[5]*e,n[6]=n[6]*e,n[7]=n[7]*e,n[8]=n[8]*i,n[9]=n[9]*i,n[10]=n[10]*i,n[11]=n[11]*i,this.viewMatrixDirty=!0,this},viewTranslate:function(t,e,i){var n=this.viewMatrix;return n[12]=n[0]*t+n[4]*e+n[8]*i+n[12],n[13]=n[1]*t+n[5]*e+n[9]*i+n[13],n[14]=n[2]*t+n[6]*e+n[10]*i+n[14],n[15]=n[3]*t+n[7]*e+n[11]*i+n[15],this.viewMatrixDirty=!0,this},viewRotateX:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[4],r=e[5],o=e[6],a=e[7],h=e[8],l=e[9],u=e[10],c=e[11];return e[4]=s*n+h*i,e[5]=r*n+l*i,e[6]=o*n+u*i,e[7]=a*n+c*i,e[8]=h*n-s*i,e[9]=l*n-r*i,e[10]=u*n-o*i,e[11]=c*n-a*i,this.viewMatrixDirty=!0,this},viewRotateY:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[8],l=e[9],u=e[10],c=e[11];return e[0]=s*n-h*i,e[1]=r*n-l*i,e[2]=o*n-u*i,e[3]=a*n-c*i,e[8]=s*i+h*n,e[9]=r*i+l*n,e[10]=o*i+u*n,e[11]=a*i+c*n,this.viewMatrixDirty=!0,this},viewRotateZ:function(t){var e=this.viewMatrix,i=Math.sin(t),n=Math.cos(t),s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5],u=e[6],c=e[7];return e[0]=s*n+h*i,e[1]=r*n+l*i,e[2]=o*n+u*i,e[3]=a*n+c*i,e[4]=h*n-s*i,e[5]=l*n-r*i,e[6]=u*n-o*i,e[7]=c*n-a*i,this.viewMatrixDirty=!0,this},viewLoad2D:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=0,e[4]=t[2],e[5]=t[3],e[6]=0,e[7]=0,e[8]=t[4],e[9]=t[5],e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this.viewMatrixDirty=!0,this},viewLoad:function(t){var e=this.viewMatrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this.viewMatrixDirty=!0,this},projIdentity:function(){var t=this.projectionMatrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this.projectionMatrixDirty=!0,this},projOrtho:function(t,e,i,n,s,r){var o=this.projectionMatrix,a=1/(t-e),h=1/(i-n),l=1/(s-r);return o[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*h,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*l,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*h,o[14]=(r+s)*l,o[15]=1,this.projectionMatrixDirty=!0,this},projPersp:function(t,e,i,n){var s=this.projectionMatrix,r=1/Math.tan(t/2),o=1/(i-n);return s[0]=r/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*n*i*o,s[15]=0,this.projectionMatrixDirty=!0,this}};t.exports=i},function(t,e,i){var n=i(0),s=i(14),r=i(241),o=i(245),a=i(248),h=i(249),l=i(8),u=i(250),c=i(251),d=new n({initialize:function(t,e){this.game=t,this.canvas,this.config=e,this.enabled=!0,this.events=new s,this.queue=[],this.keyboard=new o(this),this.mouse=new a(this),this.touch=new u(this),this.gamepad=new r(this),this.activePointer=new h(this,0),this.scale={x:1,y:1},this.globalTopOnly=!0,this.ignoreEvents=!1,this.bounds=new l,this._tempPoint={x:0,y:0},this._tempHitTest=[],t.events.once("boot",this.boot,this)},boot:function(){this.canvas=this.game.canvas,this.updateBounds(),this.keyboard.boot(),this.mouse.boot(),this.touch.boot(),this.gamepad.boot(),this.game.events.once("destroy",this.destroy,this)},updateBounds:function(){var t=this.bounds,e=this.canvas.getBoundingClientRect();t.x=e.left+window.pageXOffset-document.documentElement.clientLeft,t.y=e.top+window.pageYOffset-document.documentElement.clientTop,t.width=e.width,t.height=e.height},resize:function(){this.updateBounds();var t=this.game.config.width,e=this.game.config.height,i=this.bounds.width,n=this.bounds.height;this.scale.x=t/i,this.scale.y=e/n},update:function(t){this.keyboard.update(),this.gamepad.update(),this.ignoreEvents=!1;var e=this.queue.length,i=this.activePointer;if(i.reset(),this.enabled&&0!==e){this.updateBounds(),this.scale.x=this.game.config.width/this.bounds.width,this.scale.y=this.game.config.height/this.bounds.height;for(var n=this.queue.splice(0,e),s=0;s=n.x&&e>=n.y&&t<=n.x+o&&e<=n.y+a))return s;n.getWorldPoint(t,e,r);for(var h=n.cull(i),l={x:0,y:0},u=0;u0?1:-1)}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=0,this.pressed=!1},update:function(t){this.value=t.value,this.value>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit("down",this.pad,this,this.value,t)):this.pressed&&(this.pressed=!1,this.events.emit("up",this.pad,this,this.value,t))}});t.exports=n},function(t,e,i){var n=i(0),s=i(14),r=i(246),o=i(128),a=i(247),h=i(528),l=i(529),u=i(530),c=new n({Extends:s,initialize:function(t){s.call(this),this.manager=t,this.enabled=!1,this.target,this.keys=[],this.combos=[],this.captures=[],this.queue=[],this.handler},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.enabled&&this.startListeners()},startListeners:function(){var t=this.queue,e=this.captures,i=function(i){i.defaultPrevented||(t.push(i),e[i.keyCode]&&i.preventDefault())};this.handler=i,this.target.addEventListener("keydown",i,!1),this.target.addEventListener("keyup",i,!1)},stopListeners:function(){this.target.removeEventListener("keydown",this.handler),this.target.removeEventListener("keyup",this.handler)},createCursorKeys:function(){return this.addKeys({up:o.UP,down:o.DOWN,left:o.LEFT,right:o.RIGHT,space:o.SPACE,shift:o.SHIFT})},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},addKey:function(t){var e=this.keys;return e[t]||(e[t]=new r(t),this.captures[t]=!0),e[t]},removeKey:function(t){this.keys[t]&&(this.keys[t]=void 0,this.captures[t]=!1)},addKeyCapture:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e-1&&(this.keys[n]=void 0,this.scenes.splice(i,1),this._start.indexOf(n)>-1&&(i=this._start.indexOf(n),this._start.splice(i,1)),e.sys.destroy())}return this},bootScene:function(t){var e;t.init&&t.init.call(t,t.sys.settings.data),t.sys.load&&(e=t.sys.load).reset(),e&&t.preload?(t.preload.call(t),0===e.list.size?this.create(t):(t.sys.settings.status=s.LOADING,e.once("complete",this.loadComplete,this),e.start())):this.create(t)},loadComplete:function(t){var e=t.scene;this.create(e)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this._processing=1;for(var i=this.scenes.length-1;i>=0;i--){var n=this.scenes[i].sys;n.settings.status===s.RUNNING&&n.step(t,e)}},resize:function(t,e){for(var i=0;i0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this._processing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,n=this.getScene(t),s=this.getAt(i);this.scenes[e]=s,this.scenes[i]=n}}return this},moveUp:function(t){if(this._processing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(en&&-1!==i&&-1!==n){var s=this.getAt(n);this.scenes.splice(n,1),this.scenes.splice(i,0,s)}}return this},moveBelow:function(t,e){if(t===e)return this;if(this._processing)this._queue.push({op:"moveBelow",keyA:t,keyB:e});else{var i=this.getIndex(t),n=this.getIndex(e);if(i=0;t--){this.scenes[t].sys.destroy()}this.scenes=[],this._pending=[],this._start=[],this._queue=[],this.game=null}});t.exports=l},function(t,e,i){var n=i(0),s=i(129),r=new n({initialize:function(t){this.sys=new s(this,t)},update:function(){}});t.exports=r},function(t,e){t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},function(t,e,i){var n=i(83),s=i(4),r=i(533),o={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:n.PENDING,key:s(t,"key",""),active:s(t,"active",!1),visible:s(t,"visible",!0),isBooted:!1,data:{},files:s(t,"files",!1),cameras:s(t,"cameras",null),map:s(t,"map",r),physics:s(t,"physics",{}),loader:s(t,"loader",{}),plugins:s(t,"plugins",!1)}}};t.exports=o},function(t,e,i){var n=i(257),s=i(259),r=i(261),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e&&e.noAudio||!i.webAudio&&!i.audioData?new s(t):!i.webAudio||e&&e.disableWebAudio?new n(t):new r(t)}};t.exports=o},function(t,e,i){var n=i(84),s=i(0),r=i(258),o=new s({Extends:n,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,n.call(this,t)},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=!1,i=function(){e=!0},n=function(){if(t.game.cache.audio.entries.size)if(e)e=!1;else{document.body.removeEventListener("touchmove",i),document.body.removeEventListener("touchend",n);var s=[];t.game.cache.audio.entries.each(function(t,e){for(var i=0;i0)&&(!!s.prototype.pause.call(this)&&(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit("pause",this),!0)))},resume:function(){return!this.manager.isLocked(this,"resume")&&(!(this.startTime>0)&&(!!s.prototype.resume.call(this)&&(!!this.pickAndPlayAudioTag()&&(this.emit("resume",this),!0))))},stop:function(){return!this.manager.isLocked(this,"stop")&&(!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit("stop",this),!0))},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s=n)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit("ended",this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},setMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},setVolume:function(){this.audio&&(this.audio.volume=this.currentConfig.volume*this.manager.volume)},setRate:function(){s.prototype.setRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)}});Object.defineProperty(r.prototype,"mute",{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.setMute(),this.emit("mute",this,t))}}),Object.defineProperty(r.prototype,"volume",{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.setVolume(),this.emit("volume",this,t))}}),Object.defineProperty(r.prototype,"rate",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"rate").get.call(this)},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,"rate",t)||Object.getOwnPropertyDescriptor(s.prototype,"rate").set.call(this,t)}}),Object.defineProperty(r.prototype,"detune",{get:function(){return Object.getOwnPropertyDescriptor(s.prototype,"detune").get.call(this)},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,"detune",t)||Object.getOwnPropertyDescriptor(s.prototype,"detune").set.call(this,t)}}),Object.defineProperty(r.prototype,"seek",{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit("seek",this,t))}}),Object.defineProperty(r.prototype,"loop",{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit("loop",this,t))}}),t.exports=r},function(t,e,i){var n=i(84),s=i(0),r=i(14),o=i(260),a=i(3),h=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return n.prototype.remove.call(this,t)},removeByKey:function(t){return n.prototype.removeByKey.call(this,t)},pauseAll:a,resumeAll:a,stopAll:a,update:a,destroy:function(){n.prototype.destroy.call(this)},forEachActiveSound:function(t,e){n.prototype.forEachActiveSound.call(this,t,e)}});t.exports=h},function(t,e,i){var n=i(85),s=i(0),r=i(14),o=i(23),a=new s({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!1},updateMarker:function(t){return!1},removeMarker:function(t){return null},play:function(t,e){return!1},pause:function(){return!1},resume:function(){return!1},stop:function(){return!1},destroy:function(){this.manager.remove(this),n.prototype.destroy.call(this)}});t.exports=a},function(t,e,i){var n=i(84),s=i(0),r=i(262),o=new s({Extends:n,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&"ontouchstart"in window,n.call(this,t)},createAudioContext:function(t){var e=t.config.audio;return e&&e.context?(e.context.resume(),e.context):new AudioContext},add:function(t,e){var i=new r(this,t,e);return this.sounds.push(i),i},unlock:function(){var t=this,e=function(){t.context.resume().then(function(){document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),t.unlocked=!0})};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("touchend",e,!1)},onBlur:function(){this.context.suspend()},onFocus:function(){this.context.resume()},destroy:function(){this.destination=null,this.masterVolumeNode.disconnect(),this.masterVolumeNode=null,this.masterMuteNode.disconnect(),this.masterMuteNode=null,this.game.config.audio&&this.game.config.audio.context?this.context.suspend():this.context.close(),this.context=null,n.prototype.destroy.call(this)},mute:{get:function(){return 0===this.masterMuteNode.gain.value},set:function(t){this.masterMuteNode.gain.setValueAtTime(t?0:1,0),this.emit("mute",this,t)}},volume:{get:function(){return this.masterVolumeNode.gain.value},set:function(t){this.masterVolumeNode.gain.setValueAtTime(t,0),this.emit("volume",this,t)}}});t.exports=o},function(t,e,i){var n=i(0),s=i(85),r=new n({Extends:s,initialize:function(t,e,i){void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),this.audioBuffer?(this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)):console.error("No audio loaded in cache with key: '"+e+"'!")},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit("play",this),!0)},pause:function(){return!(this.manager.context.currentTime=0&&t<=o.width&&e>=0&&e<=o.height){t+=s.cutX,e+=s.cutY;var a=this._tempContext;a.clearRect(0,0,1,1),a.drawImage(o,t,e,1,1,0,0,1,1);var h=a.getImageData(0,0,1,1);return new r(h.data[0],h.data[1],h.data[2],h.data[3])}}return null},setTexture:function(t,e,i){return this.list[e]&&(t.texture=this.list[e],t.frame=t.texture.get(i)),t},each:function(t,e){for(var i=[null],n=1;nl&&(r=l),o>l&&(o=l),a=s,h=r;;)if(ay&&(s=y),r>m&&(r=m);var S=y+g-s,A=m+v-r;o0&&e.cameraFilter&r._id)){var h=r.scrollX*e.scrollFactorX,l=r.scrollY*e.scrollFactorY,u=e.x,c=e.y,d=e.scaleX,f=e.scaleY,p=e.rotation,g=e.commandBuffer,v=o||t.currentContext,y=1,m=1,x=0,b=0,w=1,T=0,S=0,A=0;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,v.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,v.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),v.save(),v.translate(u-h,c-l),v.rotate(p),v.scale(d,f),v.fillStyle="#fff",v.globalAlpha=e.alpha;for(var C=0,M=g.length;C>>16,S=(65280&x)>>>8,A=255&x,v.strokeStyle="rgba("+T+","+S+","+A+","+y+")",v.lineWidth=w,C+=3;break;case n.FILL_STYLE:b=g[C+1],m=g[C+2],T=(16711680&b)>>>16,S=(65280&b)>>>8,A=255&b,v.fillStyle="rgba("+T+","+S+","+A+","+m+")",C+=2;break;case n.BEGIN_PATH:v.beginPath();break;case n.CLOSE_PATH:v.closePath();break;case n.FILL_PATH:a||v.fill();break;case n.STROKE_PATH:a||v.stroke();break;case n.FILL_RECT:a?v.rect(g[C+1],g[C+2],g[C+3],g[C+4]):v.fillRect(g[C+1],g[C+2],g[C+3],g[C+4]),C+=4;break;case n.FILL_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.fill(),C+=6;break;case n.STROKE_TRIANGLE:v.beginPath(),v.moveTo(g[C+1],g[C+2]),v.lineTo(g[C+3],g[C+4]),v.lineTo(g[C+5],g[C+6]),v.closePath(),a||v.stroke(),C+=6;break;case n.LINE_TO:v.lineTo(g[C+1],g[C+2]),C+=2;break;case n.MOVE_TO:v.moveTo(g[C+1],g[C+2]),C+=2;break;case n.LINE_FX_TO:v.lineTo(g[C+1],g[C+2]),C+=5;break;case n.MOVE_FX_TO:v.moveTo(g[C+1],g[C+2]),C+=5;break;case n.SAVE:v.save();break;case n.RESTORE:v.restore();break;case n.TRANSLATE:v.translate(g[C+1],g[C+2]),C+=2;break;case n.SCALE:v.scale(g[C+1],g[C+2]),C+=2;break;case n.ROTATE:v.rotate(g[C+1]),C+=1}v.restore()}}},function(t,e,i){var n=i(4),s=i(80),r=function(t,e,i){for(var n=[],s=0;s0?s.delayedPlay(d,r,o):s.load(r)}return t}},function(t,e,i){var n=i(0),s=i(41),r=new n({initialize:function(t,e,i,n,s,r,o){this.x=t,this.y=e,this.radius=i,this.r=n,this.g=s,this.b=r,this.intensity=o,this.scrollFactorX=1,this.scrollFactorY=1},set:function(t,e,i,n,s,r,o){return this.x=t,this.y=e,this.radius=i,this.r=n,this.g=s,this.b=r,this.intensity=o,this.scrollFactorX=1,this.scrollFactorY=1,this},setScrollFactor:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this},setColor:function(t){var e=s.getFloatsFromUintRGB(t);return this.r=e[0],this.g=e[1],this.b=e[2],this},setIntensity:function(t){return this.intensity=t,this},setPosition:function(t,e){return this.x=t,this.y=e,this},setRadius:function(t){return this.radius=t,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(293),r=i(163),o=i(41),a=new n({initialize:function(){this.lightPool=[],this.lights=[],this.culledLights=[],this.ambientColor={r:.1,g:.1,b:.1},this.active=!1},enable:function(){return this.active=!0,this},disable:function(){return this.active=!1,this},cull:function(t){var e=this.lights,i=this.culledLights,n=e.length,s=t.x+t.width/2,o=t.y+t.height/2,a=(t.width+t.height)/2,h={x:0,y:0},l=t.matrix,u=this.systems.game.config.height;i.length=0;for(var c=0;c0?(h=this.lightPool.pop()).set(t,e,i,a[0],a[1],a[2],r):h=new s(t,e,i,a[0],a[1],a[2],r),this.lights.push(h),h},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&(this.lightPool.push(t),this.lights.splice(e,1)),this},shutdown:function(){for(;this.lights.length>0;)this.lightPool.push(this.lights.pop());this.ambientColor={r:.1,g:.1,b:.1},this.culledLights.length=0,this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=a},function(t,e,i){t.exports={Circle:i(666),Ellipse:i(270),Intersects:i(296),Line:i(686),Point:i(704),Polygon:i(718),Rectangle:i(308),Triangle:i(747)}},function(t,e,i){t.exports={CircleToCircle:i(676),CircleToRectangle:i(677),GetRectangleIntersection:i(678),LineToCircle:i(298),LineToLine:i(89),LineToRectangle:i(679),PointToLine:i(299),PointToLineSegment:i(680),RectangleToRectangle:i(297),RectangleToTriangle:i(681),RectangleToValues:i(682),TriangleToCircle:i(683),TriangleToLine:i(684),TriangleToTriangle:i(685)}},function(t,e){t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},function(t,e,i){var n=i(32),s=new(i(5));t.exports=function(t,e,i){if(void 0===i&&(i=s),n(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(n(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,l=r*r+o*o,u=r,c=o;if(l>0){var d=(a*r+h*o)/l;u*=d,c*=d}return i.x=t.x1+u,i.y=t.y1+c,u*u+c*c<=l&&u*r+c*o>=0&&n(e,i.x,i.y)}},function(t,e){t.exports=function(t,e){return(t.x-e.x1)*(e.y2-e.y1)==(e.x2-e.x1)*(t.y-e.y1)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},function(t,e,i){var n=i(0),s=i(303),r=i(109),o=i(111),a=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n},getPoint:function(t,e){return s(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return o(this,t)},setTo:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x1=t,this.y1=e,this.x2=i,this.y2=n,this},getPointA:function(){return{x:this.x1,y:this.y1}},getPointB:function(){return{x:this.x2,y:this.y2}},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=a},function(t,e,i){var n=i(5);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},function(t,e,i){var n=i(16),s=i(50),r=i(55);t.exports=function(t){var e=r(t)-n.TAU;return s(e,-Math.PI,Math.PI)}},function(t,e){t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},function(t,e){t.exports=function(t){return t.x*t.x+t.y*t.y}},function(t,e,i){var n=i(0),s=i(145),r=new n({initialize:function(t){this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return s(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],!Array.isArray(t))return this;for(var e,i=Number.MAX_VALUE,n=0;n=1)return i.x=r.x1,i.y=r.y1,i;var h=s(r),l=s(o),u=s(a),c=(h+l+u)*e,d=0;return ch+l?(d=(c-=h+l)/u,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/l,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},function(t,e,i){var n=i(66),s=i(5);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=n(o),u=n(a),c=n(h),d=l+u+c;e||(e=d/i);for(var f=0;fl+u?(g=(p-=l+u)/c,v.x=h.x1+(h.x2-h.x1)*g,v.y=h.y1+(h.y2-h.y1)*g):(g=(p-=l)/u,v.x=a.x1+(a.x2-a.x1)*g,v.y=a.y1+(a.y2-a.y1)*g),r.push(v)}return r}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},function(t,e,i){var n=i(5);function s(t,e,i,n){var s=t-i,r=e-n,o=s*s+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new n);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,l=t.y3,u=s(h,l,o,a),c=s(i,r,h,l),d=s(o,a,i,r),f=u+c+d;return e.x=(i*u+o*c+h*d)/f,e.y=(r*u+a*c+l*d)/f,e}},function(t,e){t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragX:0,dragY:0}}},function(t,e,i){var n=i(149);t.exports=function(t,e){var i=n(e,t.xhrSettings),s=new XMLHttpRequest;return s.open("GET",t.src,i.async,i.user,i.password),s.responseType=t.xhrSettings.responseType,s.timeout=i.timeout,i.header&&i.headerValue&&s.setRequestHeader(i.header,i.headerValue),i.overrideMimeType&&s.overrideMimeType(i.overrideMimeType),s.onload=t.onLoad.bind(t),s.onerror=t.onError.bind(t),s.onprogress=t.onProgress.bind(t),s.send(),s}},function(t,e,i){var n=i(0),s=i(22),r=i(18),o=i(7),a=i(2),h=i(318),l=new n({Extends:r,initialize:function(t,e,i,n,s){this.context=s;var o={type:"audio",extension:a(e,"type",""),responseType:"arraybuffer",key:t,url:a(e,"uri",e),path:i,xhrSettings:n};r.call(this,o)},onProcess:function(t){this.state=s.FILE_PROCESSING;var e=this;this.context.decodeAudioData(this.xhrLoader.response,function(i){e.data=i,e.onComplete(),t(e)},function(i){console.error("Error with decoding audio data for '"+this.key+"':",i.message),e.state=s.FILE_ERRORED,t(e)}),this.context=null}});l.create=function(t,e,i,n,s){var r=t.systems.game,o=r.config.audio,a=r.device.audio;if(o&&o.noAudio||!a.webAudio&&!a.audioData)return null;var u=l.findAudioURL(r,i);return u?!a.webAudio||o&&o.disableWebAudio?new h(e,u,t.path,n,r.sound.locked):new l(e,u,t.path,s,r.sound.context):null},o.register("audio",function(t,e,i,n){var s=l.create(this,t,e,i,n);return s&&this.addFile(s),this}),l.findAudioURL=function(t,e){e.constructor!==Array&&(e=[e]);for(var i=0;i=0?t:t+2*Math.PI}},function(t,e,i){var n=i(324);t.exports=function(t,e){return n(t)/n(e)/n(t-e)}},function(t,e){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},function(t,e){t.exports=function(t,e){var i=t.x,n=t.y;return t.x=i*Math.cos(e)-n*Math.sin(e),t.y=i*Math.sin(e)+n*Math.cos(e),t}},function(t,e){t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},function(t,e,i){var n=i(328),s=i(91),r=i(0),o=i(59),a=i(330),h=i(331),l=new r({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,n,s){return this.world.addCollider(t,e,i,n,s)},overlap:function(t,e,i,n,s){return this.world.addOverlap(t,e,i,n,s)},existing:function(t,e){var i=e?o.STATIC_BODY:o.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},image:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticSprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.STATIC_BODY),r},sprite:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,o.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new a(this.world,this.world.scene,t,e))}});t.exports=l},function(t,e,i){var n=i(0),s=i(329),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s)}});t.exports=o},function(t,e,i){t.exports={Acceleration:i(838),Angular:i(839),Bounce:i(840),Debug:i(841),Drag:i(842),Enable:i(843),Friction:i(844),Gravity:i(845),Immovable:i(846),Mass:i(847),Size:i(848),Velocity:i(849)}},function(t,e,i){var n=i(91),s=i(0),r=i(59),o=i(2),a=i(69),h=new s({Extends:a,initialize:function(t,e,i,s){void 0!==s||Array.isArray(i)||"object"!=typeof i?void 0===s&&(s={}):(s=i,i=null),this.world=t,s.createCallback=this.createCallback,s.removeCallback=this.removeCallback,s.classType=o(s,"classType",n),this.physicsType=r.DYNAMIC_BODY,this.defaults={setCollideWorldBounds:o(s,"collideWorldBounds",!1),setAccelerationX:o(s,"accelerationX",0),setAccelerationY:o(s,"accelerationY",0),setBounceX:o(s,"bounceX",0),setBounceY:o(s,"bounceY",0),setDragX:o(s,"dragX",0),setDragY:o(s,"dragY",0),setGravityX:o(s,"gravityX",0),setGravityY:o(s,"gravityY",0),setFrictionX:o(s,"frictionX",0),setFrictionY:o(s,"frictionY",0),setVelocityX:o(s,"velocityX",0),setVelocityY:o(s,"velocityY",0),setAngularVelocity:o(s,"angularVelocity",0),setAngularAcceleration:o(s,"angularAcceleration",0),setAngularDrag:o(s,"angularDrag",0),setMass:o(s,"mass",1),setImmovable:o(s,"immovable",!1)},a.call(this,e,i,s)},createCallback:function(t){t.body||this.world.enableBody(t,r.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallback:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var n=this.getChildren(),s=0;s0){var l=this.tree,u=this.staticTree;for(o=(r=s.entries).length,t=0;t0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},separate:function(t,e,i,n,s){if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return!1;if(i&&!1===i.call(n,t.gameObject,e.gameObject))return!1;if(t.isCircle&&e.isCircle)return this.separateCircle(t,e,s);if(t.isCircle!==e.isCircle){var r=t.isCircle?e:t,o=t.isCircle?t:e,a={x:r.x,y:r.y,right:r.right,bottom:r.bottom},h=o.center;if((h.ya.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var l=!1,u=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)l.right&&(a=h(d.x,d.y,l.right,l.y)-d.radius):d.y>l.bottom&&(d.xl.right&&(a=h(d.x,d.y,l.right,l.bottom)-d.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-h(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap||e.onOverlap)&&this.emit("overlap",t.gameObject,e.gameObject,t,e),0!==a;var f=t.velocity.x,p=t.velocity.y,g=t.mass,v=e.velocity.x,y=e.velocity.y,m=e.mass,x=f*Math.cos(o)+p*Math.sin(o),b=f*Math.sin(o)-p*Math.cos(o),w=v*Math.cos(o)+y*Math.sin(o),T=v*Math.sin(o)-y*Math.cos(o),S=((g-m)*x+2*m*w)/(g+m),A=(2*g*x+(m-g)*w)/(g+m);return t.immovable||(t.velocity.x=(S*Math.cos(o)-b*Math.sin(o))*t.bounce.x,t.velocity.y=(b*Math.cos(o)+S*Math.sin(o))*t.bounce.y,f=t.velocity.x,p=t.velocity.y),e.immovable||(e.velocity.x=(A*Math.cos(o)-T*Math.sin(o))*e.bounce.x,e.velocity.y=(T*Math.cos(o)+A*Math.sin(o))*e.bounce.y,v=e.velocity.x,y=e.velocity.y),Math.abs(o)0&&!t.immovable&&v>f?t.velocity.x*=-1:v<0&&!e.immovable&&f0&&!t.immovable&&y>p?t.velocity.y*=-1:y<0&&!e.immovable&&pMath.PI/2&&(f<0&&!t.immovable&&v0&&!e.immovable&&f>v?e.velocity.x*=-1:p<0&&!t.immovable&&y0&&!e.immovable&&f>y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.delta-a*Math.cos(o),t.y+=t.velocity.y*this.delta-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.delta+a*Math.cos(o),e.y+=e.velocity.y*this.delta+a*Math.sin(o)),(t.onCollide||e.onCollide)&&this.emit("collide",t.gameObject,e.gameObject,t,e),!0},intersects:function(t,e){return t!==e&&(t.isCircle?e.isCircle?h(t.center.x,t.center.y,e.center.x,e.center.y)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):e.isCircle?this.circleBodyIntersects(e,t):!(t.right<=e.position.x)&&(!(t.bottom<=e.position.y)&&(!(t.position.x>=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=s(t.center.x,e.left,e.right),n=s(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t=t.isParent&&void 0===t.physicsType?t.children.entries:t,e=e.isParent&&void 0===e.physicsType?e.children.entries:e;var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;o0},collideHandler:function(t,e,i,n,s,r){if(void 0===e&&t.isParent)return this.collideGroupVsGroup(t,t,i,n,s,r);if(!t||!e)return!1;if(t.body){if(e.body)return this.collideSpriteVsSprite(t,e,i,n,s,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,n,s,r)}else if(t.isParent){if(e.body)return this.collideSpriteVsGroup(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,n,s,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,n,s,r)}else if(t.isTilemap){if(e.body)return this.collideSpriteVsTilemapLayer(e,t,i,n,s,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,n,s,r)}},collideSpriteVsSprite:function(t,e,i,n,s,r){return!(!t.body||!e.body)&&(this.separate(t.body,e.body,n,s,r)&&(i&&i.call(s,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,n,s,r){var o=t.body;if(0!==e.length&&o){var h=this.treeMinMax;h.minX=o.left,h.minY=o.top,h.maxX=o.right,h.maxY=o.bottom;var l=e.physicsType===a.DYNAMIC_BODY?this.tree.search(h):this.staticTree.search(h);if(0!==l.length)for(var u=e.getChildren(),c=0;cc.baseTileWidth){var d=(c.tileWidth-c.baseTileWidth)*e.scaleX;a-=d,l+=d}c.tileHeight>c.baseTileHeight&&(u+=(c.tileHeight-c.baseTileHeight)*e.scaleY);var f,g=e.getTilesWithinWorldXY(a,h,l,u);if(0===g.length)return!1;for(var v={left:0,right:0,top:0,bottom:0},m=0;m0&&(this.facing=r.FACING_RIGHT),this._dy<0?this.facing=r.FACING_UP:this._dy>0&&(this.facing=r.FACING_DOWN),this.moves&&(0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.gameObject.x+=this._dx,this.gameObject.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.world.bounds,i=this.world.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n=this.gameObject;if(this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&n.getCenter){var s=n.displayWidth/2,r=n.displayHeight/2;this.offset.set(s-this.halfWidth,r-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i.setPosition(t,e),i.getTopLeft(this.position),this.prev.copy(this.position),this.rotation=i.angle,this.preRotation=i.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):a(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,n=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor),this.isCircle?t.strokeCircle(i,n,this.radius):t.strokeRect(e.x,e.y,this.width,this.height)),this.debugShowVelocity&&(t.lineStyle(1,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,n,i+this.velocity.x/2,n+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t){return this.collideWorldBounds=t,this},setVelocity:function(t,e){return this.velocity.set(t,e),this},setVelocityX:function(t){return this.velocity.x=t,this},setVelocityY:function(t){return this.velocity.y=t,this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return this.immovable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=l},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=n,this.collideCallback=s,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=n},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(s=t.right-e.x)>r&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()r&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?s=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=s,e.overlapX=s,s}},function(t,e){t.exports=function(t,e,i,n){var s=0,r=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(s=t.bottom-e.y)>r&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()r&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?s=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=s,e.overlapY=s,s}},function(t,e,i){var n=new(i(0))({initialize:function(){this._pending=[],this._active=[],this._destroy=[],this._toProcess=0},add:function(t){return this._pending.push(t),this._toProcess++,this},remove:function(t){return this._destroy.push(t),this._toProcess++,this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,n=this._active;for(t=0;t=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,s,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=s||(o=e+Math.ceil((i-e)/s/2)*s,n(t,o,e,i,r),a.push(e,o,o,i))}s.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!p(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),a=g(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var n,s,r,o,h,l,u,d,f,p,g,v,y,m;for(l=u=1/0,n=e;n<=i-e;n++)s=a(t,0,n,this.toBBox),r=a(t,n,i,this.toBBox),f=s,p=r,void 0,void 0,void 0,void 0,g=Math.max(f.minX,p.minX),v=Math.max(f.minY,p.minY),y=Math.min(f.maxX,p.maxX),m=Math.min(f.maxY,p.maxY),o=Math.max(0,y-g)*Math.max(0,m-v),h=c(s)+c(r),o=e;s--)r=t.children[s],h(u,t.leaf?o(r):r),c+=d(u);return c},_adjustParentBBoxes:function(t,e,i){for(var n=i;n>=0;n--)h(e[n],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},t.exports=s},function(t,e){var i=function(t,e,r,o,a){for(r=r||0,o=o||t.length-1,a=a||s;o>r;){if(o-r>600){var h=o-r+1,l=e-r+1,u=Math.log(h),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(h-c)/h)*(l-h/2<0?-1:1),f=Math.max(r,Math.floor(e-l*c/h+d)),p=Math.min(o,Math.floor(e+(h-l)*c/h+d));i(t,e,f,p,a)}var g=t[e],v=r,y=o;for(n(t,r,e),a(t[o],g)>0&&n(t,r,o);v0;)y--}0===a(t[r],g)?n(t,r,y):n(t,++y,o),y<=e&&(r=y+1),e<=y&&(o=y-1)}};function n(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function s(t,e){return te?1:0}t.exports=i},function(t,e){t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},function(t,e,i){var n=i(32),s=i(0),r=i(59),o=i(33),a=i(6),h=new s({initialize:function(t,e){this.world=t,this.gameObject=e,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new a,this.position=new a(e.x-e.displayOriginX,e.y-e.displayOriginY),this.width=e.displayWidth,this.height=e.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new a(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=a.ZERO,this.allowGravity=!1,this.gravity=a.ZERO,this.bounce=a.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=r.STATIC_BODY},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setSize:function(t,e,i,n){return void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),this.offset.set(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n(this,t,e):o(this,t,e)},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position;this.debugShowBody&&(t.lineStyle(1,this.debugBodyColor,1),t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=h},function(t,e){t.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8}},function(t,e){t.exports={NONE:0,A:1,B:2,BOTH:3}},function(t,e,i){var n={};t.exports=n;var s=i(165);n._motionWakeThreshold=.18,n._motionSleepThreshold=.08,n._minBias=.9,n.update=function(t,e){for(var i=e*e*e,s=0;s0&&r.motion=r.sleepThreshold&&n.set(r,!0)):r.sleepCounter>0&&(r.sleepCounter-=1)}else n.set(r,!1)}},n.afterCollisions=function(t,e){for(var i=e*e*e,s=0;sn._motionWakeThreshold*i&&n.set(l,!1)}}}},n.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||s.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&s.trigger(t,"sleepEnd"))}},function(t,e,i){var n=i(15);t.exports=function(t,e,i,s,r,o,a){for(var h=n(i,s,r,o,null,a),l=0;l-1}return!1}},function(t,e,i){var n=i(44),s=i(74),r=i(151);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!1),void 0===o&&(o=!0),!s(t,e,a))return null;var h=a.data[e][t];return null===h?null:(a.data[e][t]=i?null:new n(a,-1,t,e,h.width,h.height),o&&h&&h.collides&&r(t,e,a),h)}},function(t,e,i){var n=i(21),s=i(154),r=i(349),o=i(350),a=i(355);t.exports=function(t,e,i,h,l,u){var c;switch(e){case n.ARRAY_2D:c=s(t,i,h,l,u);break;case n.CSV:c=r(t,i,h,l,u);break;case n.TILED_JSON:c=o(t,i,u);break;case n.WELTMEISTER:c=a(t,i,u);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},function(t,e,i){var n=i(21),s=i(154);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map(function(t){return t.split(",")}),h=s(t,a,i,r,o);return h.format=n.CSV,h}},function(t,e,i){var n=i(21),s=i(76),r=i(904),o=i(906),a=i(907),h=i(909),l=i(910),u=i(911);t.exports=function(t,e,i){if("orthogonal"!==e.orientation)return console.warn("Only orthogonal map types are supported in this version of Phaser"),null;var c=new s({width:e.width,height:e.height,name:t,tileWidth:e.tilewidth,tileHeight:e.tileheight,orientation:e.orientation,format:n.TILED_JSON,version:e.version,properties:e.properties});c.layers=r(e,i),c.images=o(e);var d=a(e);return c.tilesets=d.tilesets,c.imageCollections=d.imageCollections,c.objects=h(e),c.tiles=l(c),u(c),c}},function(t,e){t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),n=Boolean(536870912&t);t&=536870911;var s=0,r=!1;return e&&i&&n?(s=Math.PI/2,r=!0):e&&i&&!n?(s=Math.PI,r=!1):e&&!i&&n?(s=Math.PI/2,r=!1):!e||i||n?!e&&i&&n?(s=3*Math.PI/2,r=!1):e||!i||n?e||i||!n?e||i||n||(s=0,r=!1):(s=3*Math.PI/2,r=!0):(s=Math.PI,r=!0):(s=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:n,rotation:s,flipped:r}}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&ta&&(a=e.layer[l].width),e.layer[l].height>h&&(h=e.layer[l].height);var u=new s({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:n.WELTMEISTER});return u.layers=r(e,i),u.tilesets=o(e),u}},function(t,e,i){var n=i(0),s=i(35),r=i(357),o=i(23),a=i(21),h=i(75),l=i(325),u=i(358),c=i(44),d=i(96),f=i(100),p=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0},addTilesetImage:function(t,e,i,n,s,r,o){if(void 0===t)return null;if(null==e&&(e=t),!this.scene.sys.textures.exists(e))return console.warn('Invalid image key given for tileset: "'+e+'"'),null;var h=this.scene.sys.textures.get(e),l=this.getTilesetIndex(t);if(null===l&&this.format===a.TILED_JSON)return console.warn('No data found in the JSON tilemap from Tiled matching the tileset name: "'+t+'"'),null;if(this.tilesets[l])return this.tilesets[l].setTileSize(i,n),this.tilesets[l].setSpacing(s,r),this.tilesets[l].setImage(h),this.tilesets[l];void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0);var u=new f(t,o,i,n,s,r);return u.setImage(h),this.tilesets.push(u),u},convertLayerToStatic:function(t){if(null===(t=this.getLayer(t)))return null;var e=t.tilemapLayer;if(!(e&&e instanceof r))return null;var i=new u(e.scene,e.tilemap,e.layerIndex,e.tileset,e.x,e.y);return this.scene.sys.displayList.add(i),e.destroy(),i},copy:function(t,e,i,n,s,r,o,a){return a=this.getLayer(a),this._isStaticCall(a,"copy")?this:(null!==a&&d.Copy(t,e,i,n,s,r,o,a),this)},createBlankDynamicLayer:function(t,e,i,n,s,o,a,l){if(void 0===a&&(a=e.tileWidth),void 0===l&&(l=e.tileHeight),void 0===s&&(s=this.width),void 0===o&&(o=this.height),void 0===i&&(i=0),void 0===n&&(n=0),null!==this.getLayerIndex(t))return console.warn("Cannot create blank layer: layer with matching name already exists "+t),null;for(var u,d=new h({name:t,tileWidth:a,tileHeight:l,width:s,height:o}),f=0;f0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},function(t,e,i){var n=i(926);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substr(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===n.indexOf(e)&&"_"!==e.substr(0,1)&&i.push({key:e,value:t[e]});return i}},function(t,e,i){var n=i(4);t.exports=function(t){var e=n(t,"tweens",null);return null===e?[]:("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e]),e)}},function(t,e,i){var n=i(158),s=i(10),r=i(73),o=i(71),a=i(101),h=i(4),l=i(157),u=i(159),c=i(160);t.exports=function(t,e,i){void 0===i&&(i=n);var d=h(e,"from",0),f=h(e,"to",1),p=[{value:d}],g=a(e,"delay",i.delay),v=a(e,"duration",i.duration),y=h(e,"easeParams",i.easeParams),m=o(h(e,"ease",i.ease),y),x=a(e,"hold",i.hold),b=a(e,"repeat",i.repeat),w=a(e,"repeatDelay",i.repeatDelay),T=r(e,"yoyo",i.yoyo),S=[],A=l("value",f),C=c(p[0],"value",A.getEnd,A.getStart,m,g,v,T,x,b,w,!1,!1);C.start=d,C.current=d,C.to=f,S.push(C);var M=new u(t,S,p);M.offset=s(e,"offset",null),M.completeDelay=s(e,"completeDelay",0),M.loop=Math.round(s(e,"loop",0)),M.loopDelay=Math.round(s(e,"loopDelay",0)),M.paused=r(e,"paused",!1),M.useFrames=r(e,"useFrames",!1);for(var _=h(e,"callbackScope",M),E=[M,null],P=u.TYPES,L=0;L0?Math.floor(v/p.length):h(e,"duration",g.duration),g.delay=h(e,"delay",g.delay),g.easeParams=c(e,"easeParams",g.easeParams),g.ease=a(c(e,"ease",g.ease),g.easeParams),g.hold=h(e,"hold",g.hold),g.repeat=h(e,"repeat",g.repeat),g.repeatDelay=h(e,"repeatDelay",g.repeatDelay),g.yoyo=o(e,"yoyo",g.yoyo),g.flipX=o(e,"flipX",g.flipX),g.flipY=o(e,"flipY",g.flipY);for(var y=0;y0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=o.PAUSED,!1)},resetTweens:function(t){for(var e=0;e0){this.elapsed=0,this.progress=0,this.loopCounter--;var t=this.callbacks.onLoop;t&&t.func.apply(t.scope,t.params),this.emit("loop",this,this.loopCounter),this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=o.LOOP_DELAY):this.state=o.ACTIVE}else if(this.completeDelay>0)this.countdown=this.completeDelay,this.state=o.COMPLETE_DELAY;else{var e=this.callbacks.onComplete;e&&e.func.apply(e.scope,e.params),this.emit("complete",this),this.state=o.PENDING_REMOVE}},update:function(t,e){if(this.state!==o.PAUSED){var i=e;switch(this.useFrames&&(e=1*this.manager.timeScale),e*=this.timeScale,this.elapsed+=e,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=e,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case o.ACTIVE:for(var n=this.totalData,s=0;s=t.length)){for(var i=t.length-1,n=t[e],s=e;s=this.nextTick&&this.currentAnim.setFrame(this))},updateFrame:function(t){var e=this.parent;if(this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,this.isPlaying){t.setAlpha&&(e.alpha=t.alpha);var i=this.currentAnim;i.onUpdate&&i.onUpdate.apply(i.callbackScope,this._updateParams),t.onUpdate&&t.onUpdate(e,t)}},yoyo:function(t){return void 0===t?this._yoyo:(this._yoyo=t,this)},destroy:function(){}});t.exports=n},function(t,e,i){var n=i(368),s=i(369),r=i(0),o=i(22),a=i(370),h=i(371),l=i(63),u=i(121),c=new r({initialize:function(t){this.game=t,this.type=o.CANVAS,this.drawCount=0,this.width=t.config.width,this.height=t.config.height,this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,resolution:t.config.resolution,autoResize:t.config.autoResize,roundPixels:t.config.roundPixels},this.scaleMode=t.config.pixelArt?l.NEAREST:l.LINEAR,this.gameCanvas=t.canvas,this.gameContext=this.gameCanvas.getContext("2d"),this.currentContext=this.gameContext,this.drawImage=a(this.config.roundPixels),this.blitImage=n(this.config.roundPixels),this.blendModes=h(),this.currentAlpha=1,this.currentBlendMode=0,this.currentScaleMode=0,this.snapshotCallback=null,this.snapshotType=null,this.snapshotEncoder=null,this.init()},init:function(){this.resize(this.width,this.height)},resize:function(t,e){var i=this.config.resolution;this.width=t*i,this.height=e*i,this.gameCanvas.width=this.width,this.gameCanvas.height=this.height,this.config.autoResize&&(this.gameCanvas.style.width=this.width/i+"px",this.gameCanvas.style.height=this.height/i+"px"),this.scaleMode===l.NEAREST&&u.disable(this.gameContext)},onContextLost:function(){},onContextRestored:function(){},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(t){return this.currentBlendMode!==t&&(this.currentContext.globalCompositeOperation=t,this.currentBlendMode=t),this.currentBlendMode},setAlpha:function(t){return this.currentAlpha!==t&&(this.currentContext.globalAlpha=t,this.currentAlpha=t),this.currentAlpha},preRender:function(){var t=this.gameContext,e=this.config,i=this.width,n=this.height;e.clearBeforeRender&&t.clearRect(0,0,i,n),e.transparent||(t.fillStyle=e.backgroundColor.rgba,t.fillRect(0,0,i,n)),this.drawCount=0},render:function(t,e,i,n){var s=t.sys.context,r=0!==n.x||0!==n.y||n.width!==s.canvas.width||n.height!==s.canvas.height,o=e.list,a=this.config.resolution;this.currentContext=s,n.transparent||(s.fillStyle=n.backgroundColor.rgba,s.fillRect(n.x,n.y,n.width,n.height)),1!==this.currentAlpha&&(s.globalAlpha=1,this.currentAlpha=1),0!==this.currentBlendMode&&(s.globalCompositeOperation="source-over",this.currentBlendMode=0),this.currentScaleMode=0,this.drawCount+=o.length,r&&(s.save(),s.beginPath(),s.rect(n.x*a,n.y*a,n.width*a,n.height*a),s.clip());var h=n.matrix.matrix;s.setTransform(h[0],h[1],h[2],h[3],h[4],h[5]);for(var l=0;l0||n._flashAlpha>0)&&(s.globalCompositeOperation="source-over",s.fillStyle="rgb("+255*n._fadeRed+","+255*n._fadeGreen+","+255*n._fadeBlue+")",s.globalAlpha=n._fadeAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.fillStyle="rgb("+255*n._flashRed+","+255*n._flashGreen+","+255*n._flashBlue+")",s.globalAlpha=n._flashAlpha,s.fillRect(n.x,n.y,n.width,n.height),s.globalAlpha=1),r&&s.restore()},postRender:function(){var t=this.gameContext;t.globalAlpha=1,t.globalCompositeOperation="source-over",this.currentAlpha=1,this.currentBlendMode=0,this.snapshotCallback&&(this.snapshotCallback(s(this.gameCanvas,this.snapshotType,this.snapshotEncoder)),this.snapshotCallback=null)},snapshot:function(t,e,i){this.snapshotCallback=t,this.snapshotType=e,this.snapshotEncoder=i},destroy:function(){this.gameCanvas=null,this.gameContext=null,this.game=null}});t.exports=c},function(t,e){var i=!1,n=function(t,e,n){var s=this.currentContext,r=n.canvasData;i&&(t|=0,e|=0),s.drawImage(n.source.image,r.sx,r.sy,r.sWidth,r.sHeight,t,e,r.dWidth,r.dHeight)};t.exports=function(t){return i=t,n}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e="image/png"),void 0===i&&(i=.92);var n=t.toDataURL(e,i),s=new Image;return s.src=n,s}},function(t,e){var i=!1,n=function(t,e){var n=this.currentContext,s=t.frame,r=s.canvasData;this.currentBlendMode!==t.blendMode&&(this.currentBlendMode=t.blendMode,n.globalCompositeOperation=this.blendModes[t.blendMode]),this.currentAlpha!==t.alpha&&(this.currentAlpha=t.alpha,n.globalAlpha=t.alpha),this.currentScaleMode!==t.scaleMode&&(this.currentScaleMode=t.scaleMode);var o=s.x,a=s.y,h=1,l=1;t.flipX?(h=-1,o-=r.dWidth-t.displayOriginX):o-=t.displayOriginX,t.flipY?(l=-1,a-=r.dHeight-t.displayOriginY):a-=t.displayOriginY;var u=t.x-e.scrollX*t.scrollFactorX,c=t.y-e.scrollY*t.scrollFactorY;i&&(u|=0,c|=0,o|=0,a|=0),n.save(),n.translate(u,c),n.rotate(t.rotation),n.scale(t.scaleX,t.scaleY),n.scale(h,l),n.drawImage(s.source.image,r.sx,r.sy,r.sWidth,r.sHeight,o,a,r.dWidth,r.dHeight),n.restore()};t.exports=function(t){return i=t,n}},function(t,e,i){var n=i(45),s=i(237);t.exports=function(){var t=[],e=s.supportNewBlendModes;return t[n.NORMAL]="source-over",t[n.ADD]="lighter",t[n.MULTIPLY]=e?"multiply":"source-over",t[n.SCREEN]=e?"screen":"source-over",t[n.OVERLAY]=e?"overlay":"source-over",t[n.DARKEN]=e?"darken":"source-over",t[n.LIGHTEN]=e?"lighten":"source-over",t[n.COLOR_DODGE]=e?"color-dodge":"source-over",t[n.COLOR_BURN]=e?"color-burn":"source-over",t[n.HARD_LIGHT]=e?"hard-light":"source-over",t[n.SOFT_LIGHT]=e?"soft-light":"source-over",t[n.DIFFERENCE]=e?"difference":"source-over",t[n.EXCLUSION]=e?"exclusion":"source-over",t[n.HUE]=e?"hue":"source-over",t[n.SATURATION]=e?"saturation":"source-over",t[n.COLOR]=e?"color":"source-over",t[n.LUMINOSITY]=e?"luminosity":"source-over",t}},function(t,e,i){var n=i(0),s=i(22),r=i(126),o=i(41),a=i(373),h=i(374),l=i(375),u=i(163),c=i(164),d=new n({initialize:function(t){var e=this,i={alpha:t.config.transparent,depth:!1,antialias:t.config.antialias,premultipliedAlpha:t.config.transparent,stencil:!0,preserveDrawingBuffer:t.config.preserveDrawingBuffer,failIfMajorPerformanceCaveat:!1,powerPreference:t.config.powerPreference};this.config={clearBeforeRender:t.config.clearBeforeRender,pixelArt:t.config.pixelArt,backgroundColor:t.config.backgroundColor,contextCreation:i,resolution:t.config.resolution,autoResize:t.config.autoResize,roundPixels:t.config.roundPixels},this.game=t,this.type=s.WEBGL,this.width=t.config.width,this.height=t.config.height,this.canvas=t.canvas,this.lostContextCallbacks=[],this.restoredContextCallbacks=[],this.blendModes=[],this.nativeTextures=[],this.contextLost=!1,this.pipelines=null,this.snapshotState={callback:null,type:null,encoder:null},this.currentActiveTextureUnit=0,this.currentTextures=new Array(16),this.currentFramebuffer=null,this.currentPipeline=null,this.currentProgram=null,this.currentVertexBuffer=null,this.currentIndexBuffer=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=new Uint32Array([0,0,this.width,this.height]),this.currentScissorIdx=0,this.scissorStack=new Uint32Array(4e3),this.canvas.addEventListener("webglcontextlost",function(t){e.contextLost=!0,t.preventDefault();for(var i=0;i=0&&n>=0;if(r[0]===t&&r[1]===e&&r[2]===i&&r[3]===n||this.flush(),r[0]=t,r[1]=e,r[2]=i,r[3]=n,this.currentScissorEnabled=o,!o)return s.enable(s.SCISSOR_TEST),s.scissor(t,s.drawingBufferHeight-e-n,i,n),this;s.disable(s.SCISSOR_TEST)},pushScissor:function(t,e,i,n){var s=this.scissorStack,r=this.currentScissorIdx,o=this.currentScissor;return s[r+0]=o[0],s[r+1]=o[1],s[r+2]=o[2],s[r+3]=o[3],this.currentScissorIdx+=4,this.setScissor(t,e,i,n),this},popScissor:function(){var t=this.scissorStack,e=this.currentScissorIdx-4,i=t[e+0],n=t[e+1],s=t[e+2],r=t[e+3];return this.currentScissorIdx=e,this.setScissor(i,n,s,r),this},setPipeline:function(t){return this.currentPipeline===t&&this.currentPipeline.vertexBuffer===this.currentVertexBuffer&&this.currentPipeline.program===this.currentProgram||(this.flush(),this.currentPipeline=t,this.currentPipeline.bind()),this.currentPipeline.onBind(),this.currentPipeline},setBlendMode:function(t){var e=this.gl,i=this.blendModes[t];return t!==s.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t&&(this.flush(),e.enable(e.BLEND),e.blendEquation(i.equation),i.func.length>2?e.blendFuncSeparate(i.func[0],i.func[1],i.func[2],i.func[3]):e.blendFunc(i.func[0],i.func[1]),this.currentBlendMode=t),this},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>16&&this.blendModes[t]&&this.blendModes.splice(t,1),this},setTexture2D:function(t,e){var i=this.gl;return t!==this.currentTextures[e]&&(this.flush(),this.currentActiveTextureUnit!==e&&(i.activeTexture(i.TEXTURE0+e),this.currentActiveTextureUnit=e),i.bindTexture(i.TEXTURE_2D,t),this.currentTextures[e]=t),this},setFramebuffer:function(t){var e=this.gl;return t!==this.currentFramebuffer&&(this.flush(),e.bindFramebuffer(e.FRAMEBUFFER,t),this.currentFramebuffer=t),this},setProgram:function(t){var e=this.gl;return t!==this.currentProgram&&(this.flush(),e.useProgram(t),this.currentProgram=t),this},setVertexBuffer:function(t){var e=this.gl;return t!==this.currentVertexBuffer&&(this.flush(),e.bindBuffer(e.ARRAY_BUFFER,t),this.currentVertexBuffer=t),this},setIndexBuffer:function(t){var e=this.gl;return t!==this.currentIndexBuffer&&(this.flush(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.currentIndexBuffer=t),this},createTextureFromSource:function(t,e,i,n){var o=this.gl,a=o.NEAREST,h=o.CLAMP_TO_EDGE;return e=t?t.width:e,i=t?t.height:i,r(e,i)&&(h=o.REPEAT),n===s.ScaleModes.LINEAR?a=o.LINEAR:(n===s.ScaleModes.NEAREST||this.config.pixelArt)&&(a=o.NEAREST),t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,a,a,h,h,o.RGBA,t):this.createTexture2D(0,a,a,h,h,o.RGBA,null,e,i)},createTexture2D:function(t,e,i,n,s,r,o,a,h,l){var u=this.gl,c=u.createTexture();return l=null==l||l,this.setTexture2D(c,0),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,s),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,n),u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),null==o?u.texImage2D(u.TEXTURE_2D,t,r,a,h,0,r,u.UNSIGNED_BYTE,null):(u.texImage2D(u.TEXTURE_2D,t,r,r,u.UNSIGNED_BYTE,o),a=o.width,h=o.height),this.setTexture2D(null,0),c.isAlphaPremultiplied=l,c.isRenderTexture=!1,c.width=a,c.height=h,this.nativeTextures.push(c),c},createFramebuffer:function(t,e,i,n){var s,r=this.gl,o=r.createFramebuffer();if(this.setFramebuffer(o),n){var a=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,a),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)}if(i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),(s=r.checkFramebufferStatus(r.FRAMEBUFFER))!==r.FRAMEBUFFER_COMPLETE){throw new Error("Framebuffer incomplete. Framebuffer status: "+{36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"}[s])}return o.renderTexture=i,this.setFramebuffer(null),o},createProgram:function(t,e){var i=this.gl,n=i.createProgram(),s=i.createShader(i.VERTEX_SHADER),r=i.createShader(i.FRAGMENT_SHADER);if(i.shaderSource(s,t),i.shaderSource(r,e),i.compileShader(s),i.compileShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS))throw new Error("Failed to compile Vertex Shader:\n"+i.getShaderInfoLog(s));if(!i.getShaderParameter(r,i.COMPILE_STATUS))throw new Error("Failed to compile Fragment Shader:\n"+i.getShaderInfoLog(r));if(i.attachShader(n,s),i.attachShader(n,r),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS))throw new Error("Failed to link program:\n"+i.getProgramInfoLog(n));return n},createVertexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setVertexBuffer(n),i.bufferData(i.ARRAY_BUFFER,t,e),this.setVertexBuffer(null),n},createIndexBuffer:function(t,e){var i=this.gl,n=i.createBuffer();return this.setIndexBuffer(n),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t,e),this.setIndexBuffer(null),n},deleteTexture:function(t){return this.gl.deleteTexture(t),this},deleteFramebuffer:function(t){return this.gl.deleteFramebuffer(t),this},deleteProgram:function(t){return this.gl.deleteProgram(t),this},deleteBuffer:function(t){return this.gl.deleteBuffer(t),this},preRenderCamera:function(t){var e=this.config.resolution;if(this.pushScissor(t.x*e,t.y*e,t.width*e,t.height*e),t.backgroundColor.alphaGL>0){var i=t.backgroundColor,n=this.pipelines.FlatTintPipeline;n.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(i.redGL,i.greenGL,i.blueGL,1),i.alphaGL,1,0,0,1,0,0,[1,0,0,1,0,0]),n.flush()}},postRenderCamera:function(t){if(t._fadeAlpha>0||t._flashAlpha>0){var e=this.pipelines.FlatTintPipeline;e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._fadeRed,t._fadeGreen,t._fadeBlue,1),t._fadeAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.batchFillRect(0,0,1,1,0,t.x,t.y,t.width,t.height,o.getTintFromFloats(t._flashRed,t._flashGreen,t._flashBlue,1),t._flashAlpha,1,0,0,1,0,0,[1,0,0,1,0,0]),e.flush()}this.popScissor()},preRender:function(){if(!this.contextLost){var t=this.gl,e=this.config.backgroundColor,i=this.pipelines;for(var n in t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),this.config.clearBeforeRender&&t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT),i)i[n].onPreRender()}},render:function(t,e,i,n){if(!this.contextLost){var r=e.list,o=r.length,a=this.pipelines;for(var h in a)a[h].onRender(t,n);this.preRenderCamera(n);for(var l=0;lthis.vertexCapacity&&this.flush();var x=this.vertexViewF32,b=this.vertexViewU32,w=this.vertexCount*this.vertexComponentCount,T=r+a,S=o+h,A=m[0],C=m[1],M=m[2],_=m[3],E=d*A+f*M,P=d*C+f*_,L=p*A+g*M,k=p*C+g*_,F=v*A+y*M+m[4],O=v*C+y*_+m[5],R=r*E+o*L+F,B=r*P+o*k+O,I=r*E+S*L+F,D=r*P+S*k+O,z=T*E+S*L+F,Y=T*P+S*k+O,X=T*E+o*L+F,N=T*P+o*k+O,V=l.getTintAppendFloatAlphaAndSwap(u,c);x[w+0]=R,x[w+1]=B,b[w+2]=V,x[w+3]=I,x[w+4]=D,b[w+5]=V,x[w+6]=z,x[w+7]=Y,b[w+8]=V,x[w+9]=R,x[w+10]=B,b[w+11]=V,x[w+12]=z,x[w+13]=Y,b[w+14]=V,x[w+15]=X,x[w+16]=N,b[w+17]=V,this.vertexCount+=6},batchFillTriangle:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y,m,x,b){this.renderer.setPipeline(this),this.vertexCount+3>this.vertexCapacity&&this.flush();var w=this.vertexViewF32,T=this.vertexViewU32,S=this.vertexCount*this.vertexComponentCount,A=b[0],C=b[1],M=b[2],_=b[3],E=p*A+g*M,P=p*C+g*_,L=v*A+y*M,k=v*C+y*_,F=m*A+x*M+b[4],O=m*C+x*_+b[5],R=r*E+o*L+F,B=r*P+o*k+O,I=a*E+h*L+F,D=a*P+h*k+O,z=u*E+c*L+F,Y=u*P+c*k+O,X=l.getTintAppendFloatAlphaAndSwap(d,f);w[S+0]=R,w[S+1]=B,T[S+2]=X,w[S+3]=I,w[S+4]=D,T[S+5]=X,w[S+6]=z,w[S+7]=Y,T[S+8]=X,this.vertexCount+=3},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,y,m,x,b){var w=this.tempTriangle;w[0].x=r,w[0].y=o,w[0].width=c,w[0].rgb=d,w[0].alpha=f,w[1].x=a,w[1].y=h,w[1].width=c,w[1].rgb=d,w[1].alpha=f,w[2].x=l,w[2].y=u,w[2].width=c,w[2].rgb=d,w[2].alpha=f,w[3].x=r,w[3].y=o,w[3].width=c,w[3].rgb=d,w[3].alpha=f,this.batchStrokePath(t,e,i,n,s,w,c,d,f,p,g,v,y,m,x,!1,b)},batchFillPath:function(t,e,i,n,s,o,a,h,u,c,d,f,p,g,v){this.renderer.setPipeline(this);for(var y,m,x,b,w,T,S,A,C,M,_,E,P,L,k,F,O,R=o.length,B=this.polygonCache,I=this.vertexViewF32,D=this.vertexViewU32,z=0,Y=v[0],X=v[1],N=v[2],V=v[3],W=u*Y+c*N,G=u*X+c*V,U=d*Y+f*N,j=d*X+f*V,H=p*Y+g*N+v[4],q=p*X+g*V+v[5],K=l.getTintAppendFloatAlphaAndSwap(a,h),J=0;Jthis.vertexCapacity&&this.flush(),z=this.vertexCount*this.vertexComponentCount,E=(T=B[x+0])*W+(S=B[x+1])*U+H,P=T*G+S*j+q,L=(A=B[b+0])*W+(C=B[b+1])*U+H,k=A*G+C*j+q,F=(M=B[w+0])*W+(_=B[w+1])*U+H,O=M*G+_*j+q,I[z+0]=E,I[z+1]=P,D[z+2]=K,I[z+3]=L,I[z+4]=k,D[z+5]=K,I[z+6]=F,I[z+7]=O,D[z+8]=K,this.vertexCount+=3;B.length=0},batchStrokePath:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y){var m,x;this.renderer.setPipeline(this);for(var b,w,T,S,A=r.length,C=this.polygonCache,M=this.vertexViewF32,_=this.vertexViewU32,E=l.getTintAppendFloatAlphaAndSwap,P=0;P+1this.vertexCapacity&&this.flush(),b=C[L-1]||C[k-1],w=C[L],M[(T=this.vertexCount*this.vertexComponentCount)+0]=b[6],M[T+1]=b[7],_[T+2]=E(b[8],h),M[T+3]=b[0],M[T+4]=b[1],_[T+5]=E(b[2],h),M[T+6]=w[9],M[T+7]=w[10],_[T+8]=E(w[11],h),M[T+9]=b[0],M[T+10]=b[1],_[T+11]=E(b[2],h),M[T+12]=b[6],M[T+13]=b[7],_[T+14]=E(b[8],h),M[T+15]=w[3],M[T+16]=w[4],_[T+17]=E(w[5],h),this.vertexCount+=6;C.length=0},batchLine:function(t,e,i,n,s,r,o,a,h,u,c,d,f,p,g,v,y,m,x,b,w){this.renderer.setPipeline(this),this.vertexCount+6>this.vertexCapacity&&this.flush();var T=w[0],S=w[1],A=w[2],C=w[3],M=g*T+v*A,_=g*S+v*C,E=y*T+m*A,P=y*S+m*C,L=x*T+b*A+w[4],k=x*S+b*C+w[5],F=this.vertexViewF32,O=this.vertexViewU32,R=a-r,B=h-o,I=Math.sqrt(R*R+B*B),D=u*(h-o)/I,z=u*(r-a)/I,Y=c*(h-o)/I,X=c*(r-a)/I,N=a-Y,V=h-X,W=r-D,G=o-z,U=a+Y,j=h+X,H=r+D,q=o+z,K=N*M+V*E+L,J=N*_+V*P+k,Z=W*M+G*E+L,Q=W*_+G*P+k,$=U*M+j*E+L,tt=U*_+j*P+k,et=H*M+q*E+L,it=H*_+q*P+k,nt=l.getTintAppendFloatAlphaAndSwap,st=nt(d,p),rt=nt(f,p),ot=this.vertexCount*this.vertexComponentCount;return F[ot+0]=K,F[ot+1]=J,O[ot+2]=rt,F[ot+3]=Z,F[ot+4]=Q,O[ot+5]=st,F[ot+6]=$,F[ot+7]=tt,O[ot+8]=rt,F[ot+9]=Z,F[ot+10]=Q,O[ot+11]=st,F[ot+12]=et,F[ot+13]=it,O[ot+14]=st,F[ot+15]=$,F[ot+16]=tt,O[ot+17]=rt,this.vertexCount+=6,[K,J,f,Z,Q,d,$,tt,f,et,it,d]},batchGraphics:function(t,e){if(!(t.commandBuffer.length<=0)){this.renderer.setPipeline(this);var i,n,r=e.scrollX*t.scrollFactorX,o=e.scrollY*t.scrollFactorY,a=t.x-r,h=t.y-o,l=t.scaleX,u=t.scaleY,y=-t.rotation,m=t.commandBuffer,x=1,b=1,w=0,T=0,S=1,A=e.matrix.matrix,C=null,M=0,_=0,E=0,P=0,L=0,k=0,F=0,O=0,R=0,B=0,I=null,D=Math.sin,z=Math.cos,Y=2*Math.PI,X=D(y),N=z(y),V=N*l,W=-X*l,G=X*u,U=N*u,j=a,H=h,q=A[0],K=A[1],J=A[2],Z=A[3],Q=V*q+W*J,$=V*K+W*Z,tt=G*q+U*J,et=G*K+U*Z,it=j*q+H*J+A[4],nt=j*K+H*Z+A[5];v.length=0;for(var st=0,rt=m.length;st0&&(R=R%Y-Y):R>Y?R=Y:R<0&&(R=Y+R%Y);M<1;)_=L+z(P=R*M+O)*F,E=k+D(P)*F,C.points.push(new c(_,E,S,w,x)),M+=.01;_=L+z(P=R+O)*F,E=k+D(P)*F,C.points.push(new c(_,E,S,w,x)),st+=6;break;case s.LINE_STYLE:S=m[st+1],w=m[st+2],x=m[st+3],st+=3;break;case s.FILL_STYLE:T=m[st+1],b=m[st+2],st+=2;break;case s.BEGIN_PATH:v.length=0,C=null;break;case s.CLOSE_PATH:C&&C.points.length&&C.points.push(C.points[0]);break;case s.FILL_PATH:for(i=0,n=v.length;i>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return this.n=i,2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e=0&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=s},function(t,e){t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}}},function(t,e){var i={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.scene.sys.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}};t.exports=i},function(t,e){t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},function(t,e,i){var n=i(8),s=i(186),r=i(6),o={getCenter:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,t},getTopLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getTopRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomLeft:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBottomRight:function(t){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,0!==this.rotation&&s(t,this.x,this.y,this.rotation),t},getBounds:function(t){void 0===t&&(t=new n),this.getTopLeft(t);var e=t.x,i=t.y;this.getTopRight(t);var s=t.x,r=t.y;this.getBottomLeft(t);var o=t.x,a=t.y;this.getBottomRight(t);var h=t.x,l=t.y;return t.x=Math.min(e,s,o,h),t.y=Math.min(i,r,a,l),t.width=Math.max(e,s,o,h)-t.x,t.height=Math.max(i,r,a,l)-t.y,t}};t.exports=o},function(t,e){var i={matrixStack:null,currentMatrix:null,currentMatrixIndex:0,initMatrixStack:function(){return this.matrixStack=new Float32Array(6e3),this.currentMatrix=new Float32Array([1,0,0,1,0,0]),this.currentMatrixIndex=0,this},save:function(){if(this.currentMatrixIndex>=this.matrixStack.length)return this;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return this.currentMatrixIndex+=6,t[i+0]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=e[3],t[i+4]=e[4],t[i+5]=e[5],this},restore:function(){if(this.currentMatrixIndex<=0)return this;this.currentMatrixIndex-=6;var t=this.matrixStack,e=this.currentMatrix,i=this.currentMatrixIndex;return e[0]=t[i+0],e[1]=t[i+1],e[2]=t[i+2],e[3]=t[i+3],e[4]=t[i+4],e[5]=t[i+5],this},loadIdentity:function(){return this.setTransform(1,0,0,1,0,0),this},transform:function(t,e,i,n,s,r){var o=this.currentMatrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=a*t+l*e,o[1]=h*t+u*e,o[2]=a*i+l*n,o[3]=h*i+u*n,o[4]=a*s+l*r+c,o[5]=h*s+u*r+d,this},setTransform:function(t,e,i,n,s,r){var o=this.currentMatrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o[4]=s,o[5]=r,this},translate:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3],a=i[4],h=i[5];return i[4]=n*t+r*e+a,i[5]=s*t+o*e+h,this},scale:function(t,e){var i=this.currentMatrix,n=i[0],s=i[1],r=i[2],o=i[3];return i[0]=n*t,i[1]=s*t,i[2]=r*e,i[3]=o*e,this},rotate:function(t){var e=this.currentMatrix,i=e[0],n=e[1],s=e[2],r=e[3],o=Math.sin(t),a=Math.cos(t);return e[0]=i*a+s*o,e[1]=n*a+r*o,e[2]=i*-o+s*a,e[3]=n*-o+r*a,this}};t.exports=i},function(t,e){var i={_originComponent:!0,originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=Math.round(this.originX*this.width),this._displayOriginY=Math.round(this.originY*this.height),this}};t.exports=i},function(t,e,i){var n=i(63),s={_scaleMode:n.DEFAULT,scaleMode:{get:function(){return this._scaleMode},set:function(t){t!==n.LINEAR&&t!==n.NEAREST||(this._scaleMode=t)}},setScaleMode:function(t){return this.scaleMode=t,this}};t.exports=s},function(t,e){var i={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}};t.exports=i},function(t,e){var i={_sizeComponent:!0,width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.frame.realWidth},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return this.scaleY*this.frame.realHeight},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){return void 0===t&&(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=i},function(t,e){var i={texture:null,frame:null,setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){return this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&this.setSizeToFrame(),this._originComponent&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this}};t.exports=i},function(t,e){var i=function(t){return(t>>16)+(65280&t)+((255&t)<<16)},n={_tintTL:16777215,_tintTR:16777215,_tintBL:16777215,_tintBR:16777215,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,n,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,n=t,s=t),this._tintTL=i(t),this._tintTR=i(e),this._tintBL=i(n),this._tintBR=i(s),this},tintTopLeft:{get:function(){return this._tintTL},set:function(t){this._tintTL=i(t)}},tintTopRight:{get:function(){return this._tintTR},set:function(t){this._tintTR=i(t)}},tintBottomLeft:{get:function(){return this._tintBL},set:function(t){this._tintBL=i(t)}},tintBottomRight:{get:function(){return this._tintBR},set:function(t){this._tintBR=i(t)}},tint:{set:function(t){this.setTint(t,t,t,t)}}};t.exports=n},function(t,e){t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,scaleMode:t.scaleMode,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},function(t,e,i){var n=i(16),s=i(161),r=i(162),o={_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4}},angle:{get:function(){return r(this._rotation*n.RAD_TO_DEG)},set:function(t){this.rotation=r(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=s(t)}},setPosition:function(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this}};t.exports=o},function(t,e){var i={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}};t.exports=i},function(t,e){t.exports=function(t,e){for(var i=0;i0?s(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a1)if(0===s){var d=t.length-1;for(o=t[d].x,a=t[d].y,h=d-1;h>=0;h--)l=(c=t[h]).x,u=c.y,c.x=o,c.y=a,o=l,a=u;t[d].x=e,t[d].y=i}else{for(o=t[0].x,a=t[0].y,h=1;h0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.1&&(e.zoom=.1))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(115),CameraManager:i(456)}},function(t,e,i){var n=i(115),s=i(0),r=i(2),o=i(12),a=i(33),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.currentCameraId=1,this.cameras=[],this.cameraPool=[],t.sys.settings.cameras?this.fromJSON(t.sys.settings.cameras):this.add(),this.main=this.cameras[0],this.baseScale=1},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i,s,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===s&&(s=this.scene.sys.game.config.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=null;return this.cameraPool.length>0?(a=this.cameraPool.pop()).setViewport(t,e,i,s):a=new n(t,e,i,s),a.setName(o),a.setScene(this.scene),this.cameras.push(a),r&&(this.main=a),a._id=this.currentCameraId,this.currentCameraId=this.currentCameraId<<1,a},addExisting:function(t){var e=this.cameras.indexOf(t),i=this.cameraPool.indexOf(t);return e<0&&i>=0?(this.cameras.push(t),this.cameraPool.slice(i,1),t):null},fromJSON:function(t){Array.isArray(t)||(t=[t]);for(var e=this.scene.sys.game.config.width,i=this.scene.sys.game.config.height,n=0;n=0;i--){var n=e[i];if(n.inputEnabled&&a(n,t.x,t.y))return n}},remove:function(t){var e=this.cameras.indexOf(t);e>=0&&this.cameras.length>1&&(this.cameraPool.push(this.cameras[e]),this.cameras.splice(e,1),this.main===t&&(this.main=this.cameras[0]))},render:function(t,e,i){for(var n=this.cameras,s=this.baseScale,r=0,o=n.length;r0;)this.cameraPool.push(this.cameras.pop());return this.main=this.add(),this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(212),r=i(213),o=i(12),a=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.cameras=[],t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t,e,i){return this.addPerspectiveCamera(t,e,i)},addOrthographicCamera:function(t,e){var i=this.scene.sys.game.config;void 0===t&&(t=i.width),void 0===e&&(e=i.height);var n=new s(this.scene,t,e);return this.cameras.push(n),n},addPerspectiveCamera:function(t,e,i){var n=this.scene.sys.game.config;void 0===t&&(t=80),void 0===e&&(e=n.width),void 0===i&&(i=n.height);var s=new r(this.scene,t,e,i);return this.cameras.push(s),s},getCamera:function(t){return this.cameras.forEach(function(e){if(e.name===t)return e}),null},removeCamera:function(t){var e=this.cameras.indexOf(t);-1!==e&&this.cameras.splice(e,1)},removeAll:function(){for(;this.cameras.length>0;){this.cameras.pop().destroy()}return this.main},update:function(t,e){for(var i=0,n=this.cameras.length;i0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),n=this.getCurveLengths(),s=0;s=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},getRandomPoint:function(t){return void 0===t&&(t=new d),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new d),t.copy(this.startPoint)},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},function(t,e,i){var n=i(36),s=i(227);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,l=2*i-h;r=s(l,h,t+1/3),o=s(l,h,t),a=s(l,h,t-1/3)}return(new n).setGLTo(r,o,a,1)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){var n=i(228);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n(s/359,t,e));return i}},function(t,e,i){var n=i(229),s=function(t,e,i,s,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var l=h/a;return{r:n(t,s,l),g:n(e,r,l),b:n(i,o,l)}};t.exports={RGBWithRGB:s,ColorWithRGB:function(t,e,i,n,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),s(t.r,t.g,t.b,e,i,n,r,o)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),s(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(231),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e){t.exports=function(t,e,i){t/=255,e/=255,i/=255;var n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n,o=0;return s!==n&&(s===t?o=(e-i)/r+(e1)for(var i=1;i=1)&&(r.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(r.mspointer=!0),navigator.getGamepads&&(r.gamepads=!0),n.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll")),r)},function(t,e,i){var n=i(82),s={audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(n.edge)s.dolby=!0;else if(n.safari&&n.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var i=parseInt(RegExp.$1,10),r=parseInt(RegExp.$2,10);(10===i&&r>=11||i>10)&&(s.dolby=!0)}}catch(t){}return s}()},function(t,e){var i={h264Video:!1,hlsVideo:!1,mp4Video:!1,oggVideo:!1,vp9Video:!1,webmVideo:!1};t.exports=function(){var t=document.createElement("video"),e=!!t.canPlayType;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(i.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.h264Video=!0,i.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(i.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(i.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(i.hlsVideo=!0))}catch(t){}return i}()},function(t,e){var i={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){var t,e=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],n=document.createElement("div");for(t=0;t0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(s=!0,i=n(t,e))}else s=!0,i=n(t,e);return!s&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},function(t,e){t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},function(t,e){t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},function(t,e,i){var n=i(128),s={};for(var r in n)s[n[r]]=r;t.exports=s},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.altKey=e.altKey,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.location=e.location,!1===t.isDown&&(t.isDown=!0,t.isUp=!1,t.timeDown=e.timeStamp,t.duration=0),t.repeats++,t._justDown=!0,t._justUp=!1,t}},function(t,e){t.exports=function(t,e){if(t.originalEvent=e,t.preventDefault&&e.preventDefault(),t.enabled)return t.isDown=!1,t.isUp=!0,t.timeUp=e.timeStamp,t.duration=t.timeUp-t.timeDown,t.repeats=0,t._justDown=!1,t._justUp=!0,t}},function(t,e,i){var n=i(2),s=i(254);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=n(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(s(e+"Physics")),i)for(var o in i)o=s(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},function(t,e,i){var n=i(2);t.exports=function(t){var e=t.game.config.defaultPlugins,i=n(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},function(t,e){t.exports={game:"game",anims:"anims",cache:"cache",registry:"registry",sound:"sound",textures:"textures",events:"events",cameras:"cameras",cameras3d:"cameras3d",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e){t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},function(t,e,i){var n=i(53);t.exports=function(t,e,i){if(i.frames||i.textures){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var r,o=Array.isArray(i.textures)?i.textures[e].frames:i.frames,a=0;ag||c<-g)&&(c=0),c<0&&(c=g+c),-1!==d&&(g=c+(d+1));for(var v=f,y=f,m=0,x=0,b=0;br&&(m=w-r),T>o&&(x=T-o),t.add(b,e,i+v,s+y,h-m,l-x),(v+=h+p)+h>r&&(v=f,y+=l+p)}return t}},function(t,e,i){var n=i(2);t.exports=function(t,e,i){var s=n(i,"frameWidth",null),r=n(i,"frameHeight",s);if(!s)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o,a=n(i,"startFrame",0),h=n(i,"endFrame",-1),l=n(i,"margin",0),u=n(i,"spacing",0),c=e.cutX,d=e.cutY,f=e.cutWidth,p=e.cutHeight,g=e.realWidth,v=e.realHeight,y=Math.floor((g-l+u)/(s+u)),m=Math.floor((v-l+u)/(r+u)),x=y*m,b=e.x,w=s-b,T=s-(g-f-b),S=e.y,A=r-S,C=r-(v-p-S);(a>x||a<-x)&&(a=0),a<0&&(a=x+a),-1!==h&&(x=a+(h+1));for(var M=l,_=l,E=0,P=e.sourceIndex,L=0;L0||!this.inFocus)&&(this._coolDown--,s=Math.min(s,this._target)),s>this._min&&(s=i[e],s=Math.min(s,this._min)),i[e]=s,this.deltaIndex++,this.deltaIndex>n&&(this.deltaIndex=0);for(var r=0,o=0;othis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var a=r/this._target;this.callback(t,r,a),this.lastTime=t},tick:function(){this.step(window.performance.now())},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running?this.sleep():t&&(this.startTime+=-this.lastTime+(this.lastTime=window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step(window.performance.now())},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e){t.exports=function(t){var e;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(e){document.hidden||"pause"===e.type?t.emit("hidden"):t.emit("visible")},!1),window.onblur=function(){t.emit("blur")},window.onfocus=function(){t.emit("focus")}}},function(t,e,i){var n={DisplayList:i(546),GameObjectCreator:i(13),GameObjectFactory:i(9),UpdateList:i(547),Components:i(11),BitmapText:i(131),Blitter:i(132),DynamicBitmapText:i(133),Graphics:i(134),Group:i(69),Image:i(70),Particles:i(137),PathFollower:i(290),RenderTexture:i(139),Sprite3D:i(81),Sprite:i(37),Text:i(140),TileSprite:i(141),Zone:i(77),Factories:{Blitter:i(631),DynamicBitmapText:i(632),Graphics:i(633),Group:i(634),Image:i(635),Particles:i(636),PathFollower:i(637),RenderTexture:i(638),Sprite3D:i(639),Sprite:i(640),StaticBitmapText:i(641),Text:i(642),TileSprite:i(643),Zone:i(644)},Creators:{Blitter:i(645),DynamicBitmapText:i(646),Graphics:i(647),Group:i(648),Image:i(649),Particles:i(650),RenderTexture:i(651),Sprite3D:i(652),Sprite:i(653),StaticBitmapText:i(654),Text:i(655),TileSprite:i(656),Zone:i(657)}};n.Mesh=i(88),n.Quad=i(142),n.Factories.Mesh=i(661),n.Factories.Quad=i(662),n.Creators.Mesh=i(663),n.Creators.Quad=i(664),n.Light=i(293),i(294),i(665),t.exports=n},function(t,e,i){var n=i(0),s=i(86),r=i(12),o=i(267),a=new n({Extends:s,initialize:function(t){s.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(o.inplace(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},sortGameObjects:function(t){return void 0===t&&(t=this.list),this.scene.sys.depthSort(),t.sort(this.sortIndexHandler.bind(this))},getTopGameObject:function(t){return this.sortGameObjects(t),t[t.length-1]}});r.register("DisplayList",a,"displayList"),t.exports=a},function(t,e,i){var n=i(0),s=i(12),r=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this._list=[],this._pendingInsertion=[],this._pendingRemoval=[]},boot:function(){var t=this.systems.events;t.on("preupdate",this.preUpdate,this),t.on("update",this.update,this),t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},add:function(t){return-1===this._list.indexOf(t)&&-1===this._pendingInsertion.indexOf(t)&&this._pendingInsertion.push(t),t},preUpdate:function(){var t=this._pendingRemoval.length,e=this._pendingInsertion.length;if(0!==t||0!==e){var i,n;for(i=0;i-1&&this._list.splice(s,1)}this._list=this._list.concat(this._pendingInsertion.splice(0)),this._pendingRemoval.length=0,this._pendingInsertion.length=0}},update:function(t,e){for(var i=0;ia.length&&(f=a.length);for(var p=l,g=u,v={retroFont:!0,font:h,size:i,lineHeight:s,chars:{}},y=0,m=0;m?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",s.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",s.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",s.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",s.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",s.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",s.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",s.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",t.exports=s},function(t,e,i){var n=i(3),s=i(3);n=i(551),s=i(552),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text.length;n.RENDER_MASK!==e.renderFlags||0===r||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchBitmapText(this,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.fontData.chars,l=e.fontData.lineHeight,u=0,c=0,d=0,f=0,p=null,g=0,v=0,y=0,m=0,x=0,b=0,w=null,T=0,S=t.currentContext,A=e.frame.source.image,C=a.cutX,M=a.cutY,_=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,S.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,S.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var E=t.config.roundPixels,P=e.x-s.scrollX*e.scrollFactorX+e.frame.x,L=e.y-s.scrollY*e.scrollFactorY+e.frame.y;E&&(P|=0,L|=0),S.save(),S.translate(P,L),S.rotate(e.rotation),S.translate(-e.displayOriginX,-e.displayOriginY),S.scale(e.scaleX,e.scaleY);for(var k=0;k0&&e.cameraFilter&s._id||this.pipeline.drawBlitter(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=e.getRenderList();t.setBlendMode(e.blendMode);for(var o=t.gameContext,a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY,l=0;l0&&e.cameraFilter&s._id||this.pipeline.batchDynamicBitmapText(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.text,o=r.length;if(!(n.RENDER_MASK!==e.renderFlags||0===o||e.cameraFilter>0&&e.cameraFilter&s._id)){var a=e.frame,h=e.displayCallback,l=s.scrollX*e.scrollFactorX,u=s.scrollY*e.scrollFactorY,c=e.fontData.chars,d=e.fontData.lineHeight,f=0,p=0,g=0,v=0,y=null,m=0,x=0,b=0,w=0,T=0,S=0,A=null,C=0,M=t.currentContext,_=e.frame.source.image,E=a.cutX,P=a.cutY,L=0,k=e.fontSize/e.fontData.size;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,M.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,M.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode),M.save(),M.translate(e.x,e.y),M.rotate(e.rotation),M.translate(-e.displayOriginX,-e.displayOriginY),M.scale(e.scaleX,e.scaleY),e.cropWidth>0&&e.cropHeight>0&&(M.save(),M.beginPath(),M.rect(0,0,e.cropWidth,e.cropHeight),M.clip());for(var F=t.config.roundPixels,O=0;O0&&e.cropHeight>0&&M.restore(),M.restore()}}},function(t,e){t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},function(t,e,i){var n=i(135);t.exports=function(t){return new n(t.x,t.y,t.width,t.height)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(68);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(3),s=i(3);n=i(570),s=i(274),s=i(274),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchGraphics(this,s)}},function(t,e,i){var n=i(3),s=i(3);n=i(572),s=i(573),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchSprite(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||t.drawImage(e,s)}},function(t,e,i){var n=i(0),s=i(2),r=new n({initialize:function(t,e,i,n,r){if("object"==typeof t){var o=t;t=s(o,"x",0),e=s(o,"y",0),i=s(o,"power",0),n=s(o,"epsilon",100),r=s(o,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=50);this.x=t,this.y=e,this.active=!0,this._gravity=r,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i=this.x-t.x,n=this.y-t.y,s=i*i+n*n;if(0!==s){var r=Math.sqrt(s);s0&&this.getParticleCount()===this.maxParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,n=i.length,s=0;s0?n.pop():new this.particleClass(this)).fire(e,i),this.particleBringToTop?this.alive.push(r):this.alive.unshift(r),this.emitCallback&&this.emitCallback.call(this.emitCallbackScope,r,this),this.atLimit())break}return r}},preUpdate:function(t,e){var i=(e*=this.timeScale)/1e3;this.trackVisible&&(this.visible=this.follow.visible);for(var n=this.manager.getProcessors(),s=this.alive,r=s.length,o=0;o0){var u=s.splice(s.length-l,l),c=this.deathCallback,d=this.deathCallbackScope;if(c)for(var f=0;f0&&(this._counter-=e,this._counter<=0&&(this.emitParticle(),this._counter=this.frequency-Math.abs(this._counter))))},depthSortCallback:function(t,e){return t.y-e.y},indexSortCallback:function(t,e){return t.index-e.index}});t.exports=x},function(t,e,i){var n=new(i(0))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=this.source.contains(t.x,t.y);return e&&this.killOnEnter||!e&&!this.killOnEnter}});t.exports=n},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===n&&(n=!1),void 0===s&&(s=!0),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=n,this.counter=-1,this.seamless=s,this._length=0,this._direction=0,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e,i){var n=i(0),s=i(276),r=i(71),o=i(2),a=i(50),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t=this.propertyValue,e=typeof t;if("number"===e)this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate;else if(Array.isArray(t))this.onEmit=this.randomStaticValueEmit;else if("function"===e)this.emitOnly?this.onEmit=t:this.onUpdate=t;else if("object"===e&&(this.has(t,"random")||this.hasBoth(t,"start","end")||this.hasBoth(t,"min","max"))){this.start=this.has(t,"start")?t.start:t.min,this.end=this.has(t,"end")?t.end:t.max;var i=this.hasBoth(t,"min","max")||this.has(t,"random");if(i){var n=t.random;Array.isArray(n)&&(this.start=n[0],this.end=n[1]),this.onEmit=this.randomRangedValueEmit}if(this.has(t,"steps"))this.steps=t.steps,this.counter=this.start,this.onEmit=this.steppedEmit;else{var s=this.has(t,"ease")?t.ease:"Linear";this.ease=r(s),i||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate}}else"object"===e&&this.hasEither(t,"onEmit","onUpdate")&&(this.has(t,"onEmit")&&(this.onEmit=t.onEmit),this.has(t,"onUpdate")&&(this.onUpdate=t.onUpdate));return this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(277),s=i(278),r=i(279),o=i(280),a=i(281),h=i(282),l=i(283),u=i(284),c=i(285),d=i(286),f=i(287),p=i(288);t.exports={Power0:l,Power1:u.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:l,Quad:u.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:n.Out,Bounce:s.Out,Stepped:p,"Quad.easeIn":u.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":n.In,"Bounce.easeIn":s.In,"Quad.easeOut":u.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":n.Out,"Bounce.easeOut":s.Out,"Quad.easeInOut":u.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":n.InOut,"Bounce.easeInOut":s.InOut}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},function(t,e){t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},function(t,e){t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},function(t,e){t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},function(t,e){t.exports=function(t){return 1-Math.sqrt(1-t*t)}},function(t,e){t.exports=function(t){return Math.sqrt(1- --t*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},function(t,e){t.exports=function(t){return t*t*t}},function(t,e){t.exports=function(t){return--t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/i)+1}},function(t,e){t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var n=i/4;return e<1?e=1:n=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/i)*.5+1}},function(t,e){t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},function(t,e){t.exports=function(t){return 1-Math.pow(2,-10*t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},function(t,e){t.exports=function(t){return t}},function(t,e){t.exports=function(t){return t*t}},function(t,e){t.exports=function(t){return t*(2-t)}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},function(t,e){t.exports=function(t){return t*t*t*t}},function(t,e){t.exports=function(t){return 1- --t*t*t*t}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},function(t,e){t.exports=function(t){return t*t*t*t*t}},function(t,e){t.exports=function(t){return--t*t*t*t*t+1}},function(t,e){t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},function(t,e){t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},function(t,e,i){var n=i(0),s=i(35),r=i(42),o=new n({initialize:function(t){this.emitter=t,this.frame=null,this.index=0,this.x=0,this.y=0,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.scrollFactorX=1,this.scrollFactorY=1,this.tint=4294967295,this.color=4294967295,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215,current:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1}}},isAlive:function(){return this.lifeCurrent>0},fire:function(t,e){var i=this.emitter;this.frame=i.getFrame(),i.emitZone&&i.emitZone.getPoint(this),void 0===t?(i.follow&&(this.x+=i.follow.x+i.followOffset.x),this.x+=i.x.onEmit(this,"x")):this.x+=t,void 0===e?(i.follow&&(this.y+=i.follow.y+i.followOffset.y),this.y+=i.y.onEmit(this,"y")):this.y+=e,this.life=i.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0;var n=i.speedX.onEmit(this,"speedX"),o=i.speedY?i.speedY.onEmit(this,"speedY"):n;if(i.radial){var a=s(i.angle.onEmit(this,"angle"));this.velocityX=Math.cos(a)*Math.abs(n),this.velocityY=Math.sin(a)*Math.abs(o)}else if(i.moveTo){var h=i.moveToX.onEmit(this,"moveToX"),l=i.moveToY?i.moveToY.onEmit(this,"moveToY"):h,u=Math.atan2(l-this.y,h-this.x),c=r(this.x,this.y,h,l)/(this.life/1e3);this.velocityX=Math.cos(u)*c,this.velocityY=Math.sin(u)*c}else this.velocityX=n,this.velocityY=o;i.acceleration&&(this.accelerationX=i.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=i.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=i.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=i.maxVelocityY.onEmit(this,"maxVelocityY"),this.delayCurrent=i.delay.onEmit(this,"delay"),this.scaleX=i.scaleX.onEmit(this,"scaleX"),this.scaleY=i.scaleY?i.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=i.rotate.onEmit(this,"rotate"),this.rotation=s(this.angle),this.bounce=i.bounce.onEmit(this,"bounce"),this.alpha=i.alpha.onEmit(this,"alpha"),this.tint=i.tint.onEmit(this,"tint"),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.index=i.alive.length},computeVelocity:function(t,e,i,n){var s=this.velocityX,r=this.velocityY,o=this.accelerationX,a=this.accelerationY,h=this.maxVelocityX,l=this.maxVelocityY;s+=t.gravityX*i,r+=t.gravityY*i,o&&(s+=o*i),a&&(r+=a*i),s>h?s=h:s<-h&&(s=-h),r>l?r=l:r<-l&&(r=-l),this.velocityX=s,this.velocityY=r;for(var u=0;ue.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(this.delayCurrent>0)return this.delayCurrent-=t,!1;var n=this.emitter,r=1-this.lifeCurrent/this.life;return this.lifeT=r,this.computeVelocity(n,t,e,i),this.x+=this.velocityX*e,this.y+=this.velocityY*e,n.bounds&&this.checkBounds(n),n.deathZone&&n.deathZone.willKill(this)?(this.lifeCurrent=0,!0):(this.scaleX=n.scaleX.onUpdate(this,"scaleX",r,this.scaleX),n.scaleY?this.scaleY=n.scaleY.onUpdate(this,"scaleY",r,this.scaleY):this.scaleY=this.scaleX,this.angle=n.rotate.onUpdate(this,"rotate",r,this.angle),this.rotation=s(this.angle),this.alpha=n.alpha.onUpdate(this,"alpha",r,this.alpha),this.tint=n.tint.onUpdate(this,"tint",r,this.tint),this.color=16777215&this.tint|(255*this.alpha|0)<<24,this.lifeCurrent-=t,this.lifeCurrent<=0)}});t.exports=o},function(t,e,i){var n=i(0),s=i(6),r=new n({initialize:function(t){this.source=t,this._tempVec=new s},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},function(t,e,i){var n=i(3),s=i(3);n=i(615),s=i(616),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){0===e.emitters.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.drawEmitterManager(e,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){var r=e.emitters.list;if(!(0===r.length||n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id))for(var o=0;o>24&255)/255;if(!(y<=0)){var m=v.frame,x=.5*m.width,b=.5*m.height,w=m.canvasData,T=-x,S=-b,A=v.x-d*v.scrollFactorX,C=v.y-f*v.scrollFactorY;p&&(A|=0,C|=0),u.globalAlpha=y,u.save(),u.translate(A,C),u.rotate(v.rotation),u.scale(v.scaleX,v.scaleY),u.drawImage(m.source.image,w.sx,w.sy,w.sWidth,w.sHeight,T,S,w.dWidth,w.dHeight),u.restore()}}u.globalAlpha=c}}}},function(t,e,i){var n=i(3),s=i(3);n=i(618),s=i(619),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchTexture(e,e.texture,e.texture.width,e.texture.height,e.x,e.y,e.width,e.height,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,e.texture.width,e.texture.height,4294967295,4294967295,4294967295,4294967295,0,0,s)}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=0,a=0,h=1,l=1;e.flipX?(h=-1,o-=e.canvas.width-e.displayOriginX):o-=e.displayOriginX,e.flipY?(l=-1,a-=e.canvas.height-e.displayOriginY):a-=e.displayOriginY,r.save(),r.translate(e.x-s.scrollX*e.scrollFactorX,e.y-s.scrollY*e.scrollFactorY),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.scale(h,l),r.drawImage(e.canvas,o,a),r.restore()}}},function(t,e){t.exports={fill:function(t){var e=255&(t>>16|0),i=255&(t>>8|0),n=255&(0|t);return this.context.fillStyle="rgb("+e+","+i+","+n+")",this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this},clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this},draw:function(t,e,i,n){var s=this.currentMatrix;return this.context.globalAlpha=this.globalAlpha,this.context.setTransform(s[0],s[1],s[2],s[3],s[4],s[5]),this.context.drawImage(t.source[e.sourceIndex].image,e.x,e.y,e.width,e.height,i,n,e.width,e.height),this}}},function(t,e){t.exports={fill:function(t){var e=255&(t>>16|0),i=255&(t>>8|0),n=255&(0|t);this.renderer.setFramebuffer(this.framebuffer);var s=this.gl;return s.clearColor(e/255,i/255,n/255,1),s.clear(s.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},clear:function(){this.renderer.setFramebuffer(this.framebuffer);var t=this.gl;return t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.renderer.setFramebuffer(null),this},draw:function(t,e,i,n){var s=t.source[e.sourceIndex].glTexture,r=(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16);return this.renderer.setFramebuffer(this.framebuffer),this.renderer.pipelines.TextureTintPipeline.drawTexture(s,i,n,r,this.globalAlpha,e.x,e.y,e.width,e.height,this.currentMatrix),this.renderer.setFramebuffer(null),this}}},function(t,e){t.exports=function(t,e,i){var n=t.canvas,s=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLinesc&&(f=-c),0!==f&&(d+=f>0?f*i.length:f*(i.length-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},function(t,e,i){var n=i(3),s=i(3);n=i(624),s=i(625),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text||(e.dirty&&(e.canvasTexture=t.canvasToTexture(e.canvas,e.canvasTexture,!0,e.scaleMode),e.dirty=!1),this.pipeline.batchText(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||""===e.text)){var r=t.currentContext;t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var o=e.canvas;r.save();var a=e.x-s.scrollX*e.scrollFactorX,h=e.y-s.scrollY*e.scrollFactorY;t.config.roundPixels&&(a|=0,h|=0),r.translate(a,h),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY),r.translate(o.width*(e.flipX?1:0),o.height*(e.flipY?1:0)),r.scale(e.flipX?-1:1,e.flipY?-1:1),r.drawImage(o,0,0,o.width,o.height,-e.displayOriginX,-e.displayOriginY,o.width,o.height),r.restore()}}},function(t,e,i){var n=i(0),s=i(10),r=i(4),o=i(627),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new n({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.rtl,this.testString,this._font,this.setStyle(e,!1);var i=r(e,"metrics",!1);this.metrics=i?{ascent:r(i,"ascent",0),descent:r(i,"descent",0),fontSize:r(i,"fontSize",0)}:o(this)},setStyle:function(t,e){for(var i in void 0===e&&(e=!0),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),a)this[i]="wordWrapCallback"===i||"wordWrapCallbackScope"===i?r(t,a[i][0],a[i][1]):s(t,a[i][0],a[i][1]);var n=r(t,"font",null);this._font=null===n?[this.fontStyle,this.fontSize,this.fontFamily].join(" "):n;var o=r(t,"fill",null);return null!==o&&(this.color=o),e&&this.update(!0),this},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" "),this.metrics=o(this)),this.parent.updateText()},setFont:function(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=r(t,"fontFamily","Courier"),this.fontSize=r(t,"fontSize","16px"),this.fontStyle=r(t,"fontStyle","")),this.update(!0)},setFontFamily:function(t){return this.fontFamily=t,this.update(!0)},setFontStyle:function(t){return this.fontStyle=t,this.update(!0)},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.text.width=t),e&&(this.text.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setStroke:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=t,this.strokeThickness=e),this.update(!0)},setShadow:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},function(t,e,i){var n=i(19);t.exports=function(t){var e=n.create(this),i=e.getContext("2d");t.syncFont(e,i);var s=Math.ceil(1.2*i.measureText(t.testString).width),r=s,o=2*r;r=1.4*r|0,e.width=s,e.height=o,i.fillStyle="#f00",i.fillRect(0,0,s,o),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,r);var a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,s,o))return a.ascent=r,a.descent=r+6,a.fontSize=a.ascent+a.descent,n.remove(e),a;var h,l,u=i.getImageData(0,0,s,o).data,c=u.length,d=4*s,f=0,p=!1;for(h=0;hr;h--){for(l=0;l0&&e.cameraFilter&s._id||(e.updateTileTexture(),this.pipeline.batchTileSprite(this,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){var r=t.currentContext,o=e.frame;e.updateTileTexture(),t.currentBlendMode!==e.blendMode&&(t.currentBlendMode=e.blendMode,r.globalCompositeOperation=t.blendModes[e.blendMode]),t.currentAlpha!==e.alpha&&(t.currentAlpha=e.alpha,r.globalAlpha=e.alpha),t.currentScaleMode!==e.scaleMode&&(t.currentScaleMode=e.scaleMode);var a=o.x-e.originX*e.width,h=o.y-e.originY*e.height,l=e.x-s.scrollX*e.scrollFactorX,u=e.y-s.scrollY*e.scrollFactorY;t.config.roundPixels&&(a|=0,h|=0,l|=0,u|=0),r.save(),r.translate(a,h),r.translate(l,u),r.fillStyle=e.canvasPattern,r.translate(-this.tilePositionX,-this.tilePositionY),r.fillRect(this.tilePositionX,this.tilePositionY,e.width,e.height),r.restore()}}},function(t,e,i){var n=i(132);i(9).register("blitter",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(133);i(9).register("dynamicBitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(134);i(9).register("graphics",function(t){return this.displayList.add(new n(this.scene,t))})},function(t,e,i){var n=i(69);i(9).register("group",function(t,e){return"object"==typeof t&&void 0===e&&(e=t,t=[]),this.updateList.add(new n(this.scene,t,e))})},function(t,e,i){var n=i(70);i(9).register("image",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(9),s=i(137);n.register("particles",function(t,e,i){var n=new s(this.scene,t,e,i);return this.displayList.add(n),this.updateList.add(n),n})},function(t,e,i){var n=i(9),s=i(290);n.register("follower",function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),this.updateList.add(o),o})},function(t,e,i){var n=i(9),s=i(139);n.register("renderTexture",function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))})},function(t,e,i){var n=i(81);i(9).register("sprite3D",function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o.gameObject),this.updateList.add(o.gameObject),o})},function(t,e,i){var n=i(9),s=i(37);n.register("sprite",function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.displayList.add(r),this.updateList.add(r),r})},function(t,e,i){var n=i(131);i(9).register("bitmapText",function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))})},function(t,e,i){var n=i(140);i(9).register("text",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(141);i(9).register("tileSprite",function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))})},function(t,e,i){var n=i(77);i(9).register("zone",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(132),s=i(20),r=i(13),o=i(10);r.register("blitter",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new n(this.scene,0,0,e,i);return s(this.scene,r,t),r})},function(t,e,i){var n=i(133),s=i(20),r=i(13),o=i(10);r.register("dynamicBitmapText",function(t){var e=o(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),a=o(t,"align","left"),h=new n(this.scene,0,0,e,i,r,a);return s(this.scene,h,t),h})},function(t,e,i){var n=i(13),s=i(134);n.register("graphics",function(t){return new s(this.scene,t)})},function(t,e,i){var n=i(13),s=i(69);n.register("group",function(t){return new s(this.scene,null,t)})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(70);s.register("image",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=new o(this.scene,0,0,e,i);return n(this.scene,s,t),s})},function(t,e,i){var n=i(13),s=i(10),r=i(2),o=i(137);n.register("particles",function(t){var e=s(t,"key",null),i=s(t,"frame",null),n=r(t,"emitters",null),a=new o(this.scene,e,i,n);return r(t,"add",!1)&&this.displayList.add(a),this.updateList.add(a),a})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(139);s.register("renderTexture",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",32),a=r(t,"height",32),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(20),s=i(292),r=i(13),o=i(10),a=i(81);r.register("sprite3D",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(20),s=i(292),r=i(13),o=i(10),a=i(37);r.register("sprite",function(t){var e=o(t,"key",null),i=o(t,"frame",null),r=new a(this.scene,0,0,e,i);return n(this.scene,r,t),s(r,t),r})},function(t,e,i){var n=i(131),s=i(20),r=i(13),o=i(10),a=i(4);r.register("bitmapText",function(t){var e=a(t,"font",""),i=o(t,"text",""),r=o(t,"size",!1),h=new n(this.scene,0,0,e,i,r);return s(this.scene,h,t),h})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(140);s.register("text",function(t){var e=r(t,"text",""),i=r(t,"style",null),s=r(t,"padding",null);null!==s&&(i.padding=s);var a=new o(this.scene,0,0,e,i);return n(this.scene,a,t),a.autoRound=r(t,"autoRound",!0),a.resolution=r(t,"resolution",1),a})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(141);s.register("tileSprite",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"width",512),a=r(t,"height",512),h=r(t,"key",""),l=r(t,"frame",""),u=new o(this.scene,e,i,s,a,h,l);return n(this.scene,u,t),u})},function(t,e,i){var n=i(13),s=i(10),r=i(77);n.register("zone",function(t){var e=s(t,"x",0),i=s(t,"y",0),n=s(t,"width",1),o=s(t,"height",n);return new r(this.scene,e,i,n,o)})},function(t,e,i){var n=i(3),s=i(3);n=i(659),s=i(660),t.exports={renderWebGL:n,renderCanvas:s}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id||this.pipeline.batchMesh(e,s)}},function(t,e){t.exports=function(){}},function(t,e,i){var n=i(88);i(9).register("mesh",function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))})},function(t,e,i){var n=i(142);i(9).register("quad",function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(4),a=i(88);s.register("mesh",function(t){var e=r(t,"key",null),i=r(t,"frame",null),s=o(t,"vertices",[]),h=o(t,"colors",[]),l=o(t,"alphas",[]),u=o(t,"uv",[]),c=new a(this.scene,0,0,s,u,h,l,e,i);return n(this.scene,c,t),c})},function(t,e,i){var n=i(20),s=i(13),r=i(10),o=i(142);s.register("quad",function(t){var e=r(t,"x",0),i=r(t,"y",0),s=r(t,"key",null),a=r(t,"frame",null),h=new o(this.scene,e,i,s,a);return n(this.scene,h,t),h})},function(t,e,i){var n=i(0),s=i(294),r=i(12),o=new n({Extends:s,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),s.call(this)},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",o,"lights"),t.exports=o},function(t,e,i){var n=i(64);n.Area=i(667),n.Circumference=i(184),n.CircumferencePoint=i(105),n.Clone=i(668),n.Contains=i(32),n.ContainsPoint=i(669),n.ContainsRect=i(670),n.CopyFrom=i(671),n.Equals=i(672),n.GetBounds=i(673),n.GetPoint=i(182),n.GetPoints=i(183),n.Offset=i(674),n.OffsetPoint=i(675),n.Random=i(106),t.exports=n},function(t,e){t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},function(t,e,i){var n=i(64);t.exports=function(t){return new n(t.x,t.y,t.radius)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)}},function(t,e,i){var n=i(32);t.exports=function(t,e){return n(t,e.x,e.y)&&n(t,e.right,e.y)&&n(t,e.x,e.bottom)&&n(t,e.right,e.bottom)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},function(t,e,i){var n=i(8);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},function(t,e){t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},function(t,e){t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},function(t,e,i){var n=i(42);t.exports=function(t,e){return n(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},function(t,e){t.exports=function(t,e){var i=e.width/2,n=e.height/2,s=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-n),o=i+t.radius,a=n+t.radius;if(s>o||r>a)return!1;if(s<=i||r<=n)return!0;var h=s-i,l=r-n;return h*h+l*l<=t.radius*t.radius}},function(t,e,i){var n=i(8),s=i(297);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},function(t,e){t.exports=function(t,e){var i=t.x1,n=t.y1,s=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,l=e.bottom,u=0;if(i>=o&&i<=h&&n>=a&&n<=l||s>=o&&s<=h&&r>=a&&r<=l)return!0;if(i=o){if((u=n+(r-n)*(o-i)/(s-i))>a&&u<=l)return!0}else if(i>h&&s<=h&&(u=n+(r-n)*(h-i)/(s-i))>=a&&u<=l)return!0;if(n=a){if((u=i+(s-i)*(a-n)/(r-n))>=o&&u<=h)return!0}else if(n>l&&r<=l&&(u=i+(s-i)*(l-n)/(r-n))>=o&&u<=h)return!0;return!1}},function(t,e,i){var n=i(299);t.exports=function(t,e){if(!n(t,e))return!1;var i=Math.min(e.x1,e.x2),s=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=s&&t.y>=r&&t.y<=o}},function(t,e,i){var n=i(89),s=i(33),r=i(143),o=i(300);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||se.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottom0||(c=s(e),(d=n(t,c,!0)).length>0)}},function(t,e,i){var n=i(302);n.Angle=i(55),n.BresenhamPoints=i(192),n.CenterOn=i(687),n.Clone=i(688),n.CopyFrom=i(689),n.Equals=i(690),n.GetMidPoint=i(691),n.GetNormal=i(692),n.GetPoint=i(303),n.GetPoints=i(109),n.Height=i(693),n.Length=i(66),n.NormalAngle=i(304),n.NormalX=i(694),n.NormalY=i(695),n.Offset=i(696),n.PerpSlope=i(697),n.Random=i(111),n.ReflectAngle=i(698),n.Rotate=i(699),n.RotateAroundPoint=i(700),n.RotateAroundXY=i(144),n.SetToAngle=i(701),n.Slope=i(702),n.Width=i(703),t.exports=n},function(t,e){t.exports=function(t,e,i){var n=e-(t.x1+t.x2)/2,s=i-(t.y1+t.y2)/2;return t.x1+=n,t.y1+=s,t.x2+=n,t.y2+=s,t}},function(t,e,i){var n=i(302);t.exports=function(t){return new n(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},function(t,e){t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},function(t,e,i){var n=i(16),s=i(55),r=i(5);t.exports=function(t,e){void 0===e&&(e=new r);var i=s(t)-n.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},function(t,e){t.exports=function(t){return Math.abs(t.y1-t.y2)}},function(t,e,i){var n=i(16),s=i(55);t.exports=function(t){return Math.cos(s(t)-n.TAU)}},function(t,e,i){var n=i(16),s=i(55);t.exports=function(t){return Math.sin(s(t)-n.TAU)}},function(t,e){t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},function(t,e){t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},function(t,e,i){var n=i(55),s=i(304);t.exports=function(t,e){return 2*s(e)-Math.PI-n(t)}},function(t,e,i){var n=i(144);t.exports=function(t,e){var i=(t.x1+t.x2)/2,s=(t.y1+t.y2)/2;return n(t,i,s,e)}},function(t,e,i){var n=i(144);t.exports=function(t,e,i){return n(t,e.x,e.y,i)}},function(t,e){t.exports=function(t,e,i,n,s){return t.x1=e,t.y1=i,t.x2=e+Math.cos(n)*s,t.y2=i+Math.sin(n)*s,t}},function(t,e){t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},function(t,e){t.exports=function(t){return Math.abs(t.x1-t.x2)}},function(t,e,i){var n=i(5);n.Ceil=i(705),n.Clone=i(706),n.CopyFrom=i(707),n.Equals=i(708),n.Floor=i(709),n.GetCentroid=i(710),n.GetMagnitude=i(305),n.GetMagnitudeSq=i(306),n.GetRectangleFromPoints=i(711),n.Interpolate=i(712),n.Invert=i(713),n.Negative=i(714),n.Project=i(715),n.ProjectUnit=i(716),n.SetMagnitude=i(717),t.exports=n},function(t,e){t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t){return new n(t.x,t.y)}},function(t,e){t.exports=function(t,e){return e.setTo(t.x,t.y)}},function(t,e){t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},function(t,e){t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},function(t,e,i){var n=i(5);t.exports=function(t,e){if(void 0===e&&(e=new n),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var s=0;si&&(i=h.x),h.xr&&(r=h.y),h.yt.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottomn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(5);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var n=i(309);t.exports=function(t,e,i){var s=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),n(t,s,r)}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var n=i(5),s=i(35);t.exports=function(t,e,i){void 0===i&&(i=new n),e=s(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r)-1&&(s.splice(a,1),this.clear(o))}t.length=0,this._list=s.concat(e.splice(0))}},clear:function(t){var e=t.input;e.gameObject=void 0,e.target=void 0,e.hitArea=void 0,e.hitAreaCallback=void 0,e.callbackContext=void 0,t.input=null;var i=this._draggable.indexOf(t);return i>-1&&this._draggable.splice(i,1),(i=this._drag[0].indexOf(t))>-1&&this._drag[0].splice(i,1),(i=this._over[0].indexOf(t))>-1&&this._over[0].splice(i,1),t},disable:function(t){t.input.enabled=!1},enable:function(t,e,i,n){return void 0===n&&(n=!1),t.input?t.input.enabled=!0:this.setHitArea(t,e,i),t.input.dropZone=n,this},hitTestPointer:function(t){var e=this.cameras.getCameraBelowPointer(t);if(e){t.camera=e;for(var i=this.manager.hitTest(t.x,t.y,this._list,e),n=0;n0?t.dragState=1:t.dragState>0&&!t.primaryDown&&t.justUp&&(t.dragState=5),1===t.dragState){var h=[];for(i=0;i1&&(this.sortGameObjects(h),this.topOnly&&h.splice(1)),this._drag[t.id]=h,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?t.dragState=3:t.dragState=2}if(2===t.dragState&&(this.dragDistanceThreshold>0&&o(t.x,t.y,t.downX,t.downY)>=this.dragDistanceThreshold&&(t.dragState=3),this.dragTimeThreshold>0&&e>=t.downTime+this.dragTimeThreshold&&(t.dragState=3)),3===t.dragState){for(s=this._drag[t.id],i=0;i0?(n.emit("dragleave",t,r.target),this.emit("dragleave",t,n,r.target),r.target=l[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target)):(n.emit("dragleave",t,r.target),this.emit("dragleave",t,n,r.target),l[0]?(r.target=l[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target)):r.target=null)}else!r.target&&l[0]&&(r.target=l[0],n.emit("dragenter",t,r.target),this.emit("dragenter",t,n,r.target));var c=t.x-n.input.dragX,d=t.y-n.input.dragY;n.emit("drag",t,c,d),this.emit("drag",t,n,c,d)}}if(5===t.dragState){for(s=this._drag[t.id],i=0;i0},processMoveEvents:function(t){var e=this._temp;this.emit("pointermove",t,e);for(var i=0,n=0;n0)for(this.sortGameObjects(s),this.emit("pointerout",t,s),e=0;e0)for(this.sortGameObjects(r),this.emit("pointerover",t,r),e=0;e-1&&this._draggable.splice(s,1)}return this},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);for(var n=0;nn?-1:0},sortHandlerIO:function(t,e){var i=this.displayList.getIndex(t.gameObject),n=this.displayList.getIndex(e.gameObject);return in?-1:0},sortInteractiveObjects:function(t){return t.length<2?t:(this.scene.sys.depthSort(),t.sort(this.sortHandlerIO.bind(this)))},stopPropagation:function(){return this.manager.globalTopOnly&&(this.manager.ignoreEvents=!0),this},update:function(t,e){var i=this.manager;if(!i.globalTopOnly||!i.ignoreEvents){var n=i.activePointer,s=n.dirty||0===this.pollRate;if(this.pollRate>-1&&(this._pollTimer-=e,this._pollTimer<0&&(s=!0,this._pollTimer=this.pollRate)),s){this._tempZones=[],this._temp=this.hitTestPointer(n),this.sortGameObjects(this._temp),this.sortGameObjects(this._tempZones),this.topOnly&&(this._temp.length&&this._temp.splice(1),this._tempZones.length&&this._tempZones.splice(1));var r=this.processDragEvents(n,t);n.wasTouch||(r+=this.processOverOutEvents(n)),n.justDown&&(r+=this.processDownEvents(n)),n.justUp&&(r+=this.processUpEvents(n)),n.justMoved&&(r+=this.processMoveEvents(n)),r>0&&i.globalTopOnly&&(i.ignoreEvents=!0)}}},shutdown:function(){this._temp.length=0,this._list.length=0,this._draggable.length=0,this._pendingRemoval.length=0,this._pendingInsertion.length=0;for(var t=0;t<10;t++)this._drag[t]=[],this._over[t]=[];this.removeAllListeners()},destroy:function(){this.shutdown(),this.scene=void 0,this.cameras=void 0,this.manager=void 0,this.events=void 0,this.keyboard=void 0,this.mouse=void 0,this.gamepad=void 0},activePointer:{get:function(){return this.manager.activePointer}},x:{get:function(){return this.manager.activePointer.x}},y:{get:function(){return this.manager.activePointer.y}}});c.register("InputPlugin",v,"input"),t.exports=v},function(t,e,i){t.exports={KeyboardManager:i(245),Key:i(246),KeyCodes:i(128),KeyCombo:i(247),JustDown:i(770),JustUp:i(771),DownDuration:i(772),UpDuration:i(773)}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justDown,t._justDown=!1),e}},function(t,e){t.exports=function(t){var e=!1;return t.isDown&&(e=t._justUp,t._justUp=!1),e}},function(t,e){t.exports=function(t,e){return void 0===e&&(e=50),t.isDown&&t.duration'),n.push(''),n.push(''),n.push(this.xhrLoader.responseText),n.push(""),n.push(""),n.push("");var o=[n.join("\n")],a=this;try{var h=new window.Blob(o,{type:"image/svg+xml;charset=utf-8"})}catch(e){return a.state=s.FILE_ERRORED,void t(a)}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(a.data),a.onComplete(),t(a)},this.data.onerror=function(){r.revokeObjectURL(a.data),a.state=s.FILE_ERRORED,t(a)},r.createObjectURL(this.data,h,"image/svg+xml")}});o.register("html",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r0?this.processLoadQueue():0===this.inflight.size&&this.finishedLoading()},finishedLoading:function(){this.state!==s.LOADER_PROCESSING&&(this.progress=1,this.state=s.LOADER_PROCESSING,this.storage.clear(),0===this.queue.size?this.processComplete():this.queue.each(function(t){t.onProcess(this.processUpdate.bind(this))},this))},processUpdate:function(t){if(t.state===s.FILE_ERRORED)return this.failed.set(t),t.linkFile&&this.queue.delete(t.linkFile),this.removeFromQueue(t);t.linkFile?t.state===s.FILE_COMPLETE&&t.linkFile.state===s.FILE_COMPLETE&&(this.storage.set({type:t.linkType,fileA:t,fileB:t.linkFile}),this.queue.delete(t.linkFile),this.removeFromQueue(t)):(this.storage.set(t),this.removeFromQueue(t))},removeFromQueue:function(t){this.queue.delete(t),0===this.queue.size&&this.state===s.LOADER_PROCESSING&&this.processComplete()},processComplete:function(){this.list.clear(),this.inflight.clear(),this.queue.clear(),this.processCallback(),this.state=s.LOADER_COMPLETE,this.emit("complete",this,this.storage.size,this.failed.size)},processCallback:function(){if(0!==this.storage.size){var t,e,i,n=this.scene.sys.cache,s=this.scene.sys.textures,r=this.scene.sys.anims;for(var o in this._multilist){for(var a=[],h=[],u=this._multilist[o],c=0;c0},file:function(t){var e,i=t.key;switch(t.type){case"spritesheet":e=this.spritesheet(i,t.url,t.config,t.xhrSettings);break;case"atlas":e=this.atlas(i,t.textureURL,t.atlasURL,t.textureXhrSettings,t.atlasXhrSettings);break;case"bitmapFont":e=this.bitmapFont(i,t.textureURL,t.xmlURL,t.textureXhrSettings,t.xmlXhrSettings);break;case"multiatlas":e=this.multiatlas(i,t.textureURLs,t.atlasURLs,t.textureXhrSettings,t.atlasXhrSettings);break;case"audioSprite":e=this.audioSprite(i,t.urls,t.json,t.config,t.audioXhrSettings,t.jsonXhrSettings);break;default:e=this[t.type](i,t.url,t.xhrSettings)}return e},shutdown:function(){this.reset(),this.state=s.LOADER_SHUTDOWN},destroy:function(){this.reset(),this.state=s.LOADER_DESTROYED}});u.register("Loader",d,"load"),t.exports=d},function(t,e,i){var n=i(16),s=i(23),r={Angle:i(795),Distance:i(803),Easing:i(806),Fuzzy:i(807),Interpolation:i(813),Pow2:i(816),Snap:i(818),Average:i(822),Bernstein:i(323),Between:i(231),CatmullRom:i(123),CeilTo:i(823),Clamp:i(61),DegToRad:i(35),Difference:i(824),Factorial:i(324),FloatBetween:i(276),FloorTo:i(825),FromPercent:i(65),GetSpeed:i(826),IsEven:i(827),IsEvenStrict:i(828),Linear:i(230),MaxAdd:i(829),MinSub:i(830),Percent:i(831),RadToDeg:i(219),RandomXY:i(832),RandomXYZ:i(207),RandomXYZW:i(208),Rotate:i(325),RotateAround:i(186),RotateAroundDistance:i(113),RoundAwayFromZero:i(326),RoundTo:i(833),SinCosTableGenerator:i(834),SmootherStep:i(193),SmoothStep:i(194),TransformXY:i(251),Within:i(835),Wrap:i(50),Vector2:i(6),Vector3:i(51),Vector4:i(120),Matrix3:i(211),Matrix4:i(119),Quaternion:i(210),RotateVec3:i(209)};r=s(!1,r,n),t.exports=r},function(t,e,i){t.exports={Between:i(796),BetweenY:i(797),BetweenPoints:i(798),BetweenPointsY:i(799),Reverse:i(800),RotateTo:i(801),ShortestBetween:i(802),Normalize:i(322),Wrap:i(161),WrapDegrees:i(162)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(i-t,n-e)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},function(t,e,i){var n=i(322);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(16);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e?t:(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:ee-i}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t1?t[i]-(n(s-i,t[i],t[i],t[i-1],t[i-1])-t[i]):n(s-r,t[r?r-1:0],t[r],t[i0&&0==(t&t-1)}},function(t,e,i){t.exports={Ceil:i(819),Floor:i(820),To:i(821)}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.ceil(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.floor(t/e)))}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=0),0===e?t:(t-=i,i+(t=e*Math.round(t/e)))}},function(t,e){t.exports=function(t){for(var e=0,i=0;i1?void 0!==n?(s=(n-t)/(n-i))<0&&(s=0):s=1:s<0&&(s=0),s}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var n=Math.pow(i,-e);return Math.round(t*n)/n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),n*=Math.PI/t;for(var s=[],r=[],o=0;o=0;o--){var a=e[o],h=l(s,r,a.x,a.y);h=0;o--){var a=e[o],h=l(s,r,a.x,a.y);h>i&&(n=a,i=h)}return n},moveTo:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=l(t.x,t.y,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},moveToObject:function(t,e,i,n){return this.moveTo(t,e.x,e.y,i,n)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(u(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),i.setToPolar(t,e)},shutdown:function(){this.world.shutdown()},destroy:function(){this.world.destroy()}});a.register("ArcadePhysics",c,"arcadePhysics"),t.exports=c},function(t,e){t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},function(t,e){t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},function(t,e){t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t){return this.body.collideWorldBounds=t,this}}},function(t,e){t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},function(t,e){t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this}}},function(t,e){var i={enableBody:function(t,e,i,n,s){return t&&this.body.reset(e,i),n&&(this.body.gameObject.active=!0),s&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}};t.exports=i},function(t,e){t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},function(t,e){t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},function(t,e){var i={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}};t.exports=i},function(t,e){t.exports={setMass:function(t){return this.body.mass=t,this}}},function(t,e){t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},function(t,e){var i={setVelocity:function(t,e){return this.body.velocity.set(t,e),this},setVelocityX:function(t){return this.body.velocity.x=t,this},setVelocityY:function(t){return this.body.velocity.y=t,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.body.maxVelocity.set(t,e),this}};t.exports=i},function(t,e){t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},function(t,e,i){var n=i(852),s=i(854),r=i(340);t.exports=function(t,e,i,o,a,h){var l=o.left,u=o.top,c=o.right,d=o.bottom,f=i.faceLeft||i.faceRight,p=i.faceTop||i.faceBottom;if(!f&&!p)return!1;var g=0,v=0,y=0,m=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right>i&&(o=t.right-i)>r&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.left=!0:e>0&&(t.blocked.right=!0),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},function(t,e,i){var n=i(855);t.exports=function(t,e,i,s,r){var o=0;return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom>i&&(o=t.bottom-i)>r&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:n(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?t.blocked.up=!0:e>0&&(t.blocked.down=!0),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},function(t,e,i){var n=i(335);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.x,a=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=r,e.velocity.x=o-a*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=r,t.velocity.x=a-o*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{r*=.5,t.x-=r,e.x+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),l=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),u=.5*(h+l);h-=u,l-=u,t.velocity.x=u+h*t.bounce.x,e.velocity.x=u+l*e.bounce.x}return!0}},function(t,e,i){var n=i(336);t.exports=function(t,e,i,s){var r=n(t,e,i,s);if(i||0===r||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==r||t.embedded&&e.embedded;var o=t.velocity.y,a=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=r,e.velocity.y=o-a*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=r,t.velocity.y=a-o*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{r*=.5,t.y-=r,e.y+=r;var h=Math.sqrt(a*a*e.mass/t.mass)*(a>0?1:-1),l=Math.sqrt(o*o*t.mass/e.mass)*(o>0?1:-1),u=.5*(h+l);h-=u,l-=u,t.velocity.y=u+h*t.bounce.y,e.velocity.y=u+l*e.bounce.y}return!0}},function(t,e,i){t.exports={Acceleration:i(964),BodyScale:i(965),BodyType:i(966),Bounce:i(967),CheckAgainst:i(968),Collides:i(969),Debug:i(970),Friction:i(971),Gravity:i(972),Offset:i(973),SetGameObject:i(974),Velocity:i(975)}},function(t,e,i){var n={};t.exports=n;var s=i(94),r=i(38);n.fromVertices=function(t){for(var e={},i=0;i0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}},setFromTileRectangle:function(t){void 0===t&&(t={}),h(t,"isStatic")||(t.isStatic=!0),h(t,"addToWorld")||(t.addToWorld=!0);var e=this.tile.getBounds(),i=e.x+e.width/2,s=e.y+e.height/2,r=n.rectangle(i,s,e.width,e.height,t);return this.setBody(r,t.addToWorld),this},setFromTileCollision:function(t){void 0===t&&(t={}),h(t,"isStatic")||(t.isStatic=!0),h(t,"addToWorld")||(t.addToWorld=!0);for(var e=this.tile.tilemapLayer.scaleX,i=this.tile.tilemapLayer.scaleY,r=this.tile.getLeft(),o=this.tile.getTop(),u=this.tile.getCollisionGroup(),c=a(u,"objects",[]),d=[],f=0;f1&&(t.parts=d,this.setBody(s.create(t),t.addToWorld)),this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0}});t.exports=u},function(t,e,i){var n={};t.exports=n;var s=i(863),r=i(376),o=i(95);n.collisions=function(t,e){for(var i=[],a=e.pairs.table,h=e.metrics,l=0;l1?1:0;d1?1:0;p0:0!=(t.mask&e.category)&&0!=(e.mask&t.category)}},function(t,e,i){var n={};t.exports=n;var s=i(93),r=i(94);!function(){n.collides=function(e,n,o){var a,h,l,u,c=!1;if(o){var d=e.parent,f=n.parent,p=d.speed*d.speed+d.angularSpeed*d.angularSpeed+f.speed*f.speed+f.angularSpeed*f.angularSpeed;c=o&&o.collided&&p<.2,u=o}else u={collided:!1,bodyA:e,bodyB:n};if(o&&c){var g=u.axisBody,v=g===e?n:e,y=[g.axes[o.axisNumber]];if(l=t(g.vertices,v.vertices,y),u.reused=!0,l.overlap<=0)return u.collided=!1,u}else{if((a=t(e.vertices,n.vertices,e.axes)).overlap<=0)return u.collided=!1,u;if((h=t(n.vertices,e.vertices,n.axes)).overlap<=0)return u.collided=!1,u;a.overlaps?s=a:a=0?o.index-1:u.length-1],l.x=s.x-c.x,l.y=s.y-c.y,h=-r.dot(i,l),a=s,s=u[(o.index+1)%u.length],l.x=s.x-c.x,l.y=s.y-c.y,(n=-r.dot(i,l))r?(s.warn("Plugin.register:",n.toString(e),"was upgraded to",n.toString(t)),n._registry[t.name]=t):i-1},n.isFor=function(t,e){var i=t.for&&n.dependencyParse(t.for);return!t.for||e.name===i.name&&n.versionSatisfies(e.version,i.range)},n.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var i=n.dependencies(t),r=s.topologicalSort(i),o=[],a=0;a0&&!h.silent&&s.info(o.join(" "))}else s.warn("Plugin.use:",n.toString(t),"does not specify any dependencies to install.")},n.dependencies=function(t,e){var i=n.dependencyParse(t),r=i.name;if(!(r in(e=e||{}))){t=n.resolve(t)||t,e[r]=s.map(t.uses||[],function(e){n.isPlugin(e)&&n.register(e);var r=n.dependencyParse(e),o=n.resolve(e);return o&&!n.versionSatisfies(o.version,r.range)?(s.warn("Plugin.dependencies:",n.toString(o),"does not satisfy",n.toString(r),"used by",n.toString(i)+"."),o._warned=!0,t._warned=!0):o||(s.warn("Plugin.dependencies:",n.toString(e),"used by",n.toString(i),"could not be resolved."),t._warned=!0),r.name});for(var o=0;o=s[2];if("^"===i.operator)return s[0]>0?o[0]===s[0]&&r.number>=i.number:s[1]>0?o[1]===s[1]&&o[2]>=s[2]:o[2]===s[2]}return t===e||"*"===t}},function(t,e,i){var n={};t.exports=n;var s=i(150),r=(i(166),i(38));n.create=function(t){var e=s.create(),i={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(e,i,t)}},function(t,e,i){t.exports={SceneManager:i(252),ScenePlugin:i(868),Settings:i(255),Systems:i(129)}},function(t,e,i){var n=i(0),s=i(83),r=i(12),o=new n({initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once("boot",this.boot,this),this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene},boot:function(){var t=this.systems.events;t.on("shutdown",this.shutdown,this),t.on("destroy",this.destroy,this)},start:function(t,e){return void 0===t&&(t=this.key),t!==this.key&&(this.settings.status!==s.RUNNING?(this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t)):(this.manager.stop(this.key),this.manager.start(t,e))),this},add:function(t,e,i){return this.manager.add(t,e,i),this},launch:function(t,e){return t&&t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("start",t,e):this.manager.start(t,e)),this},pause:function(t){return void 0===t&&(t=this.key),this.manager.pause(t),this},resume:function(t){return void 0===t&&(t=this.key),this.manager.resume(t),this},sleep:function(t){return void 0===t&&(t=this.key),this.manager.sleep(t),this},wake:function(t){return void 0===t&&(t=this.key),this.manager.wake(t),this},switch:function(t){return t!==this.key&&(this.settings.status!==s.RUNNING?this.manager.queueOp("switch",this.key,t):this.manager.switch(this.key,t)),this},stop:function(t){return void 0===t&&(t=this.key),this.manager.stop(t),this},setActive:function(t){return this.settings.active=t,this},setVisible:function(t){return this.settings.visible=t,this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},shutdown:function(){},destroy:function(){}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={SoundManagerCreator:i(256),BaseSound:i(85),BaseSoundManager:i(84),WebAudioSound:i(262),WebAudioSoundManager:i(261),HTML5AudioSound:i(258),HTML5AudioSoundManager:i(257),NoAudioSound:i(260),NoAudioSoundManager:i(259)}},function(t,e,i){t.exports={List:i(86),Map:i(114),ProcessQueue:i(337),RTree:i(338),Set:i(62)}},function(t,e,i){t.exports={Parsers:i(264),FilterMode:i(872),Frame:i(130),Texture:i(265),TextureManager:i(263),TextureSource:i(266)}},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(96),Parsers:i(903),Formats:i(21),ImageCollection:i(352),ParseToTilemap:i(155),Tile:i(44),Tilemap:i(356),TilemapCreator:i(920),TilemapFactory:i(921),Tileset:i(100),LayerData:i(75),MapData:i(76),ObjectLayer:i(354),DynamicTilemapLayer:i(357),StaticTilemapLayer:i(358)}},function(t,e,i){var n=i(15),s=i(34);t.exports=function(t,e,i,r,o,a,h,l){t<0&&(t=0),e<0&&(e=0),void 0===h&&(h=!0);for(var u=n(t,e,i,r,null,l),c=o-t,d=a-e,f=0;f=0&&p=0&&g-c&&y>-d&&v=0;r--)for(s=n.width-1;s>=0;s--)if((o=n.data[r][s])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;re)){for(var h=t;h<=e;h++)r(h,i,a);for(var l=0;l=t&&c.index<=e&&n(c,i)}o&&s(0,0,a.width,a.height,a)}}},function(t,e,i){var n=i(43),s=i(34),r=i(153);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a0&&n(a,t)}}e&&s(0,0,i.width,i.height,i)}},function(t,e){t.exports=function(t,e,i,n){if("number"==typeof t)n.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var s=0,r=t.length;s0){var y=new a(u,v.gid,c,f.length,t.tilewidth,t.tileheight);y.rotation=v.rotation,y.flipX=v.flipped,d.push(y)}else{var m=e?null:new a(u,-1,c,f.length,t.tilewidth,t.tileheight);d.push(m)}++c===l.width&&(f.push(d),c=0,d=[])}u.data=f,i.push(u)}}return i}},function(t,e){t.exports=function(t){for(var e=window.atob(t),i=e.length,n=new Array(i),s=0;s>>0;return n}},function(t,e,i){var n=i(2);t.exports=function(t){for(var e=[],i=0;i-1?new s(a,f,c,u,o.tilesize,o.tilesize):e?null:new s(a,-1,c,u,o.tilesize,o.tilesize),h.push(d)}l.push(h),h=[]}a.data=l,i.push(a)}return i}},function(t,e,i){var n=i(100);t.exports=function(t){for(var e=[],i=[],s=0;s0&&e.cameraFilter&s._id||(e.cull(s),this.pipeline.batchDynamicTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=r.length,a=e.tileset.image.getSourceImage(),h=this.tileset,l=e.x-s.scrollX*e.scrollFactorX,u=e.y-s.scrollY*e.scrollFactorY,c=t.gameContext;c.save(),c.translate(l,u),c.rotate(e.rotation),c.scale(e.scaleX,e.scaleY),c.scale(e.flipX?-1:1,e.flipY?-1:1);for(var d=0;d0&&e.cameraFilter&s._id||(e.upload(s),this.pipeline.drawStaticTilemapLayer(e,s))}},function(t,e,i){var n=i(1);t.exports=function(t,e,i,s){if(!(n.RENDER_MASK!==e.renderFlags||e.cameraFilter>0&&e.cameraFilter&s._id)){e.cull(s);var r=e.culledTiles,o=this.tileset,a=t.gameContext,h=r.length,l=o.image.getSourceImage(),u=e.x-s.scrollX*e.scrollFactorX,c=e.y-s.scrollY*e.scrollFactorY;a.save(),a.translate(u,c),a.rotate(e.rotation),a.scale(e.scaleX,e.scaleY),a.scale(e.flipX?-1:1,e.flipY?-1:1),a.globalAlpha=e.alpha;for(var d=0;d-1&&this._active.splice(s,1),n.destroy()}for(i=0;i=n.delay)){var s=n.elapsed-n.delay;n.elapsed=n.delay,!n.hasDispatched&&n.callback&&(n.hasDispatched=!0,n.callback.apply(n.callbackScope,n.args)),n.repeatCount>0?(n.repeatCount--,n.elapsed=s,n.hasDispatched=!1):this._pendingRemoval.push(n)}}}},shutdown:function(){var t;for(t=0;t=t.pos.x+t.size.x||this.pos.x+this.size.x<=t.pos.x||this.pos.y>=t.pos.y+t.size.y||this.pos.y+this.size.y<=t.pos.y)},resetSize:function(t,e,i,n){return this.pos.x=t,this.pos.y=e,this.size.x=i,this.size.y=n,this},toJSON:function(){return{name:this.name,size:{x:this.size.x,y:this.size.y},pos:{x:this.pos.x,y:this.pos.y},vel:{x:this.vel.x,y:this.vel.y},accel:{x:this.accel.x,y:this.accel.y},friction:{x:this.friction.x,y:this.friction.y},maxVel:{x:this.maxVel.x,y:this.maxVel.y},gravityFactor:this.gravityFactor,bounciness:this.bounciness,minBounceVelocity:this.minBounceVelocity,type:this.type,checkAgainst:this.checkAgainst,collides:this.collides}},fromJSON:function(){},check:function(){},collideWith:function(t,e){this.parent&&this.parent._collideCallback&&this.parent._collideCallback.call(this.parent._callbackScope,this,t,e)},handleMovementTrace:function(){return!0},destroy:function(){this.world.remove(this),this.enabled=!1,this.world=null,this.gameObject=null,this.parent=null}});t.exports=h},function(t,e,i){var n=i(0),s=i(963),r=new n({initialize:function(t,e){void 0===t&&(t=32),this.tilesize=t,this.data=Array.isArray(e)?e:[],this.width=Array.isArray(e)?e[0].length:0,this.height=Array.isArray(e)?e.length:0,this.lastSlope=55,this.tiledef=s},trace:function(t,e,i,n,s,r){var o={collision:{x:!1,y:!1,slope:!1},pos:{x:t+i,y:e+n},tile:{x:0,y:0}};if(!this.data)return o;var a=Math.ceil(Math.max(Math.abs(i),Math.abs(n))/this.tilesize);if(a>1)for(var h=i/a,l=n/a,u=0;u0?r:0,y=n<0?f:0,m=Math.max(Math.floor(i/f),0),x=Math.min(Math.ceil((i+o)/f),g);u=Math.floor((t.pos.x+v)/f);var b=Math.floor((e+v)/f);if((l>0||u===b||b<0||b>=p)&&(b=-1),u>=0&&u1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,b,c));c++)if(1===(d=this.data[c][u])||d>this.lastSlope||d>1&&this.checkDef(t,d,e,i,a,h,r,o,u,c)){if(d>1&&d<=this.lastSlope&&t.collision.slope)break;t.collision.x=!0,t.tile.x=d,t.pos.x=u*f-v+y,e=t.pos.x,a=0;break}}if(s){var w=s>0?o:0,T=s<0?f:0,S=Math.max(Math.floor(t.pos.x/f),0),A=Math.min(Math.ceil((t.pos.x+r)/f),p);c=Math.floor((t.pos.y+w)/f);var C=Math.floor((i+w)/f);if((l>0||c===C||C<0||C>=g)&&(C=-1),c>=0&&c1&&d<=this.lastSlope&&this.checkDef(t,d,e,i,a,h,r,o,u,C));u++)if(1===(d=this.data[c][u])||d>this.lastSlope||d>1&&this.checkDef(t,d,e,i,a,h,r,o,u,c)){if(d>1&&d<=this.lastSlope&&t.collision.slope)break;t.collision.y=!0,t.tile.y=d,t.pos.y=c*f-w+T;break}}},checkDef:function(t,e,i,n,s,r,o,a,h,l){var u=this.tiledef[e];if(!u)return!1;var c=this.tilesize,d=(h+u[0])*c,f=(l+u[1])*c,p=(u[2]-u[0])*c,g=(u[3]-u[1])*c,v=u[4],y=i+s+(g<0?o:0)-d,m=n+r+(p>0?a:0)-f;if(p*m-g*y>0){if(s*-g+r*p<0)return v;var x=Math.sqrt(p*p+g*g),b=g/x,w=-p/x,T=y*b+m*w,S=b*T,A=w*T;return S*S+A*A>=s*s+r*r?v||p*(m-r)-g*(y-s)<.5:(t.pos.x=i+s-S,t.pos.y=n+r-A,t.collision.slope={x:p,y:g,nx:b,ny:w},!0)}return!1}});t.exports=r},function(t,e,i){var n=i(0),s=i(943),r=i(944),o=i(945),a=new n({initialize:function(t){this.world=t,this.sys=t.scene.sys},body:function(t,e,i,n){return new s(this.world,t,e,i,n)},existing:function(t){var e=t.x-t.frame.centerX,i=t.y-t.frame.centerY,n=t.width,s=t.height;return t.body=this.world.create(e,i,n,s),t.body.parent=t,t.body.gameObject=t,t},image:function(t,e,i,n){var s=new r(this.world,t,e,i,n);return this.sys.displayList.add(s),s},sprite:function(t,e,i,n){var s=new o(this.world,t,e,i,n);return this.sys.displayList.add(s),this.sys.updateList.add(s),s}});t.exports=a},function(t,e,i){var n=i(0),s=i(858),r=new n({Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){this.body=t.create(e,i,n,s),this.body.parent=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=r},function(t,e,i){var n=i(0),s=i(858),r=i(70),o=new n({Extends:r,Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t.scene,e,i,n,s),this.body=t.create(e-this.frame.centerX,i-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=o},function(t,e,i){var n=i(0),s=i(858),r=i(37),o=new n({Extends:r,Mixins:[s.Acceleration,s.BodyScale,s.BodyType,s.Bounce,s.CheckAgainst,s.Collides,s.Debug,s.Friction,s.Gravity,s.Offset,s.SetGameObject,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t.scene,e,i,n,s),this.body=t.create(e-this.frame.centerX,i-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});t.exports=o},function(t,e,i){var n=i(940),s=i(0),r=i(342),o=i(941),a=i(14),h=i(2),l=i(72),u=i(62),c=i(977),d=i(21),f=i(343),p=new s({Extends:a,initialize:function(t,e){a.call(this),this.scene=t,this.bodies=new u,this.gravity=h(e,"gravity",0),this.cellSize=h(e,"cellSize",64),this.collisionMap=new o,this.timeScale=h(e,"timeScale",1),this.maxStep=h(e,"maxStep",.05),this.enabled=!0,this.drawDebug=h(e,"debug",!1),this.debugGraphic;var i=h(e,"maxVelocity",100);if(this.defaults={debugShowBody:h(e,"debugShowBody",!0),debugShowVelocity:h(e,"debugShowVelocity",!0),bodyDebugColor:h(e,"debugBodyColor",16711935),velocityDebugColor:h(e,"debugVelocityColor",65280),maxVelocityX:h(e,"maxVelocityX",i),maxVelocityY:h(e,"maxVelocityY",i),minBounceVelocity:h(e,"minBounceVelocity",40),gravityFactor:h(e,"gravityFactor",1),bounciness:h(e,"bounciness",0)},this.walls={left:null,right:null,top:null,bottom:null},this.delta=0,this._lastId=0,h(e,"setBounds",!1)){var n=e.setBounds;if("boolean"==typeof n)this.setBounds();else{var s=h(n,"x",0),r=h(n,"y",0),l=h(n,"width",t.sys.game.config.width),c=h(n,"height",t.sys.game.config.height),d=h(n,"thickness",64),f=h(n,"left",!0),p=h(n,"right",!0),g=h(n,"top",!0),v=h(n,"bottom",!0);this.setBounds(s,r,l,c,d,f,p,g,v)}}this.drawDebug&&this.createDebugGraphic()},setCollisionMap:function(t,e){if("string"==typeof t){var i=this.scene.cache.tilemap.get(t);if(!i||i.format!==d.WELTMEISTER)return console.warn("The specified key does not correspond to a Weltmeister tilemap: "+t),null;for(var n,s=i.data.layer,r=0;rr.ACTIVE&&c(this,t,e))},setCollidesNever:function(t){for(var e=0;e=0&&h<=1&&l>=0&&l<=1}function s(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function r(t,e,i){return s(t,e,i)>0}function o(t,e,i){return s(t,e,i)>=0}function a(t,e,i){return s(t,e,i)<0}function h(t,e,i){return s(t,e,i)<=0}t.exports={decomp:function(t){var e=function t(e){var i=[],n=[],s=[],r=[];var o=Number.MAX_VALUE;for(var a=0;a0?function t(e,i){if(0===i.length)return[e];if(i instanceof Array&&i.length&&i[0]instanceof Array&&2===i[0].length&&i[0][0]instanceof Array){for(var n=[e],s=0;su)return console.warn("quickDecomp: max level ("+u+") reached."),i;for(var k=0;kA&&(A+=e.length),S=Number.MAX_VALUE,A3&&n>=0;--n)c(f(t,n-1),f(t,n),f(t,n+1),e)&&(t.splice(n%t.length,1),i++);return i},makeCCW:function(t){for(var e=0,i=t,n=1;ni[e][0])&&(e=n);r(f(t,e-1),f(t,e),f(t,e+1))||function(t){for(var e=[],i=t.length,n=0;n!==i;n++)e.push(t.pop());for(var n=0;n!==i;n++)t[n]=e[n]}(t)}};var l=[],u=[];function c(t,e,i,n){if(n){var r=l,o=u;r[0]=e[0]-t[0],r[1]=e[1]-t[1],o[0]=i[0]-e[0],o[1]=i[1]-e[1];var a=r[0]*o[0]+r[1]*o[1],h=Math.sqrt(r[0]*r[0]+r[1]*r[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(a/(h*c))g&&(g=m),a.translate(y,{x:.5*x,y:.5*m}),c=y.bounds.max.x+r,s.addBody(u,y),l=y,f+=1}else c+=r}d+=g+o,c=t}return u},n.chain=function(t,e,i,n,a,h){for(var l=t.bodies,u=1;u0)for(l=0;l0&&(d=f[l-1+(h-1)*e],s.addConstraint(t,r.create(o.extend({bodyA:d,bodyB:c},a)))),n&&ld||o<(l=d-l)||o>i-1-l))return 1===c&&a.translate(u,{x:(o+(i%2==1?1:-1))*f,y:0}),h(t+(u?o*f:0)+o*r,n,o,l,u,c)})},n.newtonsCradle=function(t,e,i,n,o){for(var a=s.create({label:"Newtons Cradle"}),l=0;lv.bounds.max.x||b.bounds.max.yv.bounds.max.y)){var w=e(i,b);if(!b.region||w.id!==b.region.id||r){x.broadphaseTests+=1,b.region&&!r||(b.region=w);var T=t(w,b.region);for(d=T.startCol;d<=T.endCol;d++)for(f=T.startRow;f<=T.endRow;f++){p=y[g=a(d,f)];var S=d>=w.startCol&&d<=w.endCol&&f>=w.startRow&&f<=w.endRow,A=d>=b.region.startCol&&d<=b.region.endCol&&f>=b.region.startRow&&f<=b.region.endRow;!S&&A&&A&&p&&u(i,p,b),(b.region===w||S&&!A||r)&&(p||(p=h(y,g)),l(i,p,b))}b.region=w,m=!0}}}m&&(i.pairsList=c(i))},n.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]};var t=function(t,e){var n=Math.min(t.startCol,e.startCol),s=Math.max(t.endCol,e.endCol),r=Math.min(t.startRow,e.startRow),o=Math.max(t.endRow,e.endRow);return i(n,s,r,o)},e=function(t,e){var n=e.bounds,s=Math.floor(n.min.x/t.bucketWidth),r=Math.floor(n.max.x/t.bucketWidth),o=Math.floor(n.min.y/t.bucketHeight),a=Math.floor(n.max.y/t.bucketHeight);return i(s,r,o,a)},i=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},a=function(t,e){return"C"+t+"R"+e},h=function(t,e){return t[e]=[]},l=function(t,e,i){for(var n=0;n0?n.push(i):delete t.pairs[e[s]];return n}}()},function(t,e,i){var n={};t.exports=n;var s=i(376),r=i(38);n.create=function(t){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},n.update=function(t,e,i){var n,r,o,a,h=t.list,l=t.table,u=t.collisionStart,c=t.collisionEnd,d=t.collisionActive;for(u.length=0,c.length=0,d.length=0,a=0;a1e3&&h.push(r);for(r=0;rf.friction*f.frictionStatic*R*i&&(I=k,B=o.clamp(f.friction*F*i,-I,I));var D=r.cross(A,y),z=r.cross(C,y),Y=b/(g.inverseMass+v.inverseMass+g.inverseInertia*D*D+v.inverseInertia*z*z);if(O*=Y,B*=Y,P<0&&P*P>n._restingThresh*i)T.normalImpulse=0;else{var X=T.normalImpulse;T.normalImpulse=Math.min(T.normalImpulse+O,0),O=T.normalImpulse-X}if(L*L>n._restingThreshTangent*i)T.tangentImpulse=0;else{var N=T.tangentImpulse;T.tangentImpulse=o.clamp(T.tangentImpulse+B,-I,I),B=T.tangentImpulse-N}s.x=y.x*O+m.x*B,s.y=y.y*O+m.y*B,g.isStatic||g.isSleeping||(g.positionPrev.x+=s.x*g.inverseMass,g.positionPrev.y+=s.y*g.inverseMass,g.anglePrev+=r.cross(A,s)*g.inverseInertia),v.isStatic||v.isSleeping||(v.positionPrev.x-=s.x*v.inverseMass,v.positionPrev.y-=s.y*v.inverseMass,v.anglePrev-=r.cross(C,s)*v.inverseInertia)}}}}},function(t,e,i){var n={};t.exports=n;var s=i(866),r=i(344),o=i(955),a=i(954),h=i(995),l=i(953),u=i(165),c=i(150),d=i(166),f=i(38),p=i(60);!function(){n.create=function(t,e){e=(e=f.isElement(t)?e:t)||{},((t=f.isElement(t)?t:null)||e.render)&&f.warn("Engine.create: engine.render is deprecated (see docs)");var i={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:l}},n=f.extend(i,e);return n.world=e.world||s.create(n.world),n.pairs=a.create(),n.broadphase=n.broadphase.controller.create(n.broadphase),n.metrics=n.metrics||{extended:!1},n.metrics=h.create(n.metrics),n},n.update=function(n,s,l){s=s||1e3/60,l=l||1;var f,p=n.world,g=n.timing,v=n.broadphase,y=[];g.timestamp+=s*g.timeScale;var m={timestamp:g.timestamp};u.trigger(n,"beforeUpdate",m);var x=c.allBodies(p),b=c.allConstraints(p);for(h.reset(n.metrics),n.enableSleeping&&r.update(x,g.timeScale),e(x,p.gravity),i(x,s,g.timeScale,l,p.bounds),d.preSolveAll(x),f=0;f0&&u.trigger(n,"collisionStart",{pairs:T.collisionStart}),o.preSolvePosition(T.list),f=0;f0&&u.trigger(n,"collisionActive",{pairs:T.collisionActive}),T.collisionEnd.length>0&&u.trigger(n,"collisionEnd",{pairs:T.collisionEnd}),h.update(n.metrics,n),t(x),u.trigger(n,"afterUpdate",m),n},n.merge=function(t,e){if(f.extend(t,e),e.world){t.world=e.world,n.clear(t);for(var i=c.allBodies(t.world),s=0;s0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionstart",e,i,n)}),c.on(e,"collisionActive",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionactive",e,i,n)}),c.on(e,"collisionEnd",function(e){var i,n,s=e.pairs;s.length>0&&(i=s[0].bodyA,n=s[0].bodyB),t.emit("collisionend",e,i,n)})},setBounds:function(t,e,i,n,s,r,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.game.config.width),void 0===n&&(n=this.scene.sys.game.config.height),void 0===s&&(s=128),void 0===r&&(r=!0),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),this.updateWall(r,"left",t-s,e,s,n),this.updateWall(o,"right",t+i,e,s,n),this.updateWall(a,"top",t,e-s,i,s),this.updateWall(h,"bottom",t,e+n,i,s),this},updateWall:function(t,e,i,n,s,r){var o=this.walls[e];t?(o&&d.remove(this.localWorld,o),i+=s/2,n+=r/2,this.walls[e]=this.create(i,n,s,r,{isStatic:!0,friction:0,frictionStatic:0})):(o&&d.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setZ(Number.MAX_VALUE),this.debugGraphic=t,this.drawDebug=!0,t},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=1),this.localWorld.gravity.x=t,this.localWorld.gravity.y=e,void 0!==i&&(this.localWorld.gravity.scale=i),this},create:function(t,e,i,s,r){var o=n.rectangle(t,e,i,s,r);return d.add(this.localWorld,o),o},add:function(t){return d.add(this.localWorld,t),this},remove:function(t,e){var i=t.body?t.body:t;return r.removeBody(this.localWorld,i,e),this},removeConstraint:function(t,e){return r.remove(this.localWorld,t,e),this},convertTilemapLayer:function(t,e){var i=t.layer,n=t.getTilesWithin(0,0,i.width,i.height,{isColliding:!0});return this.convertTiles(n,e),this},convertTiles:function(t,e){if(0===t.length)return this;for(var i=0;i0?e-o:e+o<0?e+o:0}return n(e,-r,r)}},function(t,e){t.exports=function(t,e){if(t.standing=!1,e.collision.y&&(t.bounciness>0&&Math.abs(t.vel.y)>t.minBounceVelocity?t.vel.y*=-t.bounciness:(t.vel.y>0&&(t.standing=!0),t.vel.y=0)),e.collision.x&&(t.bounciness>0&&Math.abs(t.vel.x)>t.minBounceVelocity?t.vel.x*=-t.bounciness:t.vel.x=0),e.collision.slope){var i=e.collision.slope;if(t.bounciness>0){var n=t.vel.x*i.nx+t.vel.y*i.ny;t.vel.x=(t.vel.x-i.nx*n*2)*t.bounciness,t.vel.y=(t.vel.y-i.ny*n*2)*t.bounciness}else{var s=i.x*i.x+i.y*i.y,r=(t.vel.x*i.x+t.vel.y*i.y)/s;t.vel.x=i.x*r,t.vel.y=i.y*r;var o=Math.atan2(i.x,i.y);o>t.slopeStanding.min&&oi.last.x&&e.last.xi.last.y&&e.last.y0))r=t.collisionMap.trace(e.pos.x,e.pos.y,0,-(e.pos.y+e.size.y-i.pos.y),e.size.x,e.size.y),e.pos.y=r.pos.y,e.bounciness>0&&e.vel.y>e.minBounceVelocity?e.vel.y*=-e.bounciness:(e.standing=!0,e.vel.y=0);else{var l=(e.vel.y-i.vel.y)/2;e.vel.y=-l,i.vel.y=l,s=i.vel.x*t.delta,r=t.collisionMap.trace(e.pos.x,e.pos.y,s,-o/2,e.size.x,e.size.y),e.pos.y=r.pos.y;var u=t.collisionMap.trace(i.pos.x,i.pos.y,0,o/2,i.size.x,i.size.y);i.pos.y=u.pos.y}}},function(t,e,i){t.exports={Factory:i(947),Image:i(950),Matter:i(864),MatterPhysics:i(997),PolyDecomp:i(948),Sprite:i(951),TileBody:i(861),World:i(957)}},function(t,e){t.exports={setBounce:function(t){return this.body.restitution=t,this}}},function(t,e){var i={setCollisionCategory:function(t){return this.body.collisionFilter.category=t,this},setCollisionGroup:function(t){return this.body.collisionFilter.group=t,this},setCollidesWith:function(t){var e=0;if(Array.isArray(t))for(var i=0;i1?1:0;n1;if(!c||t!=c.x||e!=c.y){c&&n?(d=c.x,f=c.y):(d=0,f=0);var s={x:d+t,y:f+e};!n&&c||(c=s),p.push(s),v=d+t,y=f+e}},x=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":v=t.x,y=t.y;break;case"H":v=t.x;break;case"V":y=t.y}m(v,y,t.pathSegType)}};for(t(e),r=e.getTotalLength(),h=[],n=0;n0)for(var a=s+1;ae.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y